2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
Copyright @ 1999-2006, The Institute for Genomic Research (TIGR). |
2 |
26 Feb 07 |
jari |
All rights reserved. |
2 |
26 Feb 07 |
jari |
4 |
*/ |
2 |
26 Feb 07 |
jari |
5 |
/* |
2 |
26 Feb 07 |
jari |
* Created on Apr 6, 2005 |
2 |
26 Feb 07 |
jari |
7 |
*/ |
2 |
26 Feb 07 |
jari |
8 |
package org.tigr.microarray.mev.cluster.gui.impl.lem; |
2 |
26 Feb 07 |
jari |
9 |
|
2 |
26 Feb 07 |
jari |
10 |
import java.awt.Color; |
2 |
26 Feb 07 |
jari |
11 |
import java.awt.Dimension; |
2 |
26 Feb 07 |
jari |
12 |
import java.awt.Frame; |
2 |
26 Feb 07 |
jari |
13 |
import java.awt.GridBagConstraints; |
2 |
26 Feb 07 |
jari |
14 |
import java.awt.GridBagLayout; |
2 |
26 Feb 07 |
jari |
15 |
import java.awt.Insets; |
2 |
26 Feb 07 |
jari |
16 |
import java.awt.Toolkit; |
2 |
26 Feb 07 |
jari |
17 |
import java.awt.event.ActionEvent; |
2 |
26 Feb 07 |
jari |
18 |
import java.awt.event.ItemEvent; |
2 |
26 Feb 07 |
jari |
19 |
import java.awt.event.ItemListener; |
2 |
26 Feb 07 |
jari |
20 |
import java.awt.event.WindowEvent; |
2 |
26 Feb 07 |
jari |
21 |
|
2 |
26 Feb 07 |
jari |
22 |
import javax.swing.JCheckBox; |
2 |
26 Feb 07 |
jari |
23 |
import javax.swing.JComboBox; |
2 |
26 Feb 07 |
jari |
24 |
import javax.swing.JLabel; |
2 |
26 Feb 07 |
jari |
25 |
import javax.swing.JOptionPane; |
2 |
26 Feb 07 |
jari |
26 |
import javax.swing.JPanel; |
2 |
26 Feb 07 |
jari |
27 |
import javax.swing.JSeparator; |
2 |
26 Feb 07 |
jari |
28 |
|
2 |
26 Feb 07 |
jari |
29 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.AlgorithmDialog; |
2 |
26 Feb 07 |
jari |
30 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.DialogListener; |
2 |
26 Feb 07 |
jari |
31 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.ParameterPanel; |
2 |
26 Feb 07 |
jari |
32 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.dialogHelpUtil.HelpWindow; |
2 |
26 Feb 07 |
jari |
33 |
|
2 |
26 Feb 07 |
jari |
34 |
/** |
2 |
26 Feb 07 |
jari |
* @author braisted |
2 |
26 Feb 07 |
jari |
36 |
* |
2 |
26 Feb 07 |
jari |
* LEMInitDialog collects parameters for the LEM algorithm. |
2 |
26 Feb 07 |
jari |
38 |
*/ |
2 |
26 Feb 07 |
jari |
39 |
public class LEMInitDialog extends AlgorithmDialog { |
2 |
26 Feb 07 |
jari |
40 |
|
2 |
26 Feb 07 |
jari |
41 |
private int result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
42 |
|
2 |
26 Feb 07 |
jari |
43 |
private JCheckBox fileInput; |
2 |
26 Feb 07 |
jari |
44 |
private JCheckBox multipleChr; |
2 |
26 Feb 07 |
jari |
45 |
|
2 |
26 Feb 07 |
jari |
46 |
private JComboBox locusBox; |
2 |
26 Feb 07 |
jari |
47 |
private JComboBox startBox; |
2 |
26 Feb 07 |
jari |
48 |
private JComboBox endBox; |
2 |
26 Feb 07 |
jari |
49 |
private JComboBox chrBox; |
2 |
26 Feb 07 |
jari |
50 |
private JLabel chrLabel; |
2 |
26 Feb 07 |
jari |
51 |
private JLabel startLabel; |
2 |
26 Feb 07 |
jari |
52 |
private JLabel endLabel; |
2 |
26 Feb 07 |
jari |
53 |
|
2 |
26 Feb 07 |
jari |
54 |
private JLabel coorInfoLabel; |
2 |
26 Feb 07 |
jari |
55 |
|
2 |
26 Feb 07 |
jari |
56 |
/** |
2 |
26 Feb 07 |
jari |
* Constructor |
2 |
26 Feb 07 |
jari |
* @param parent parent component |
2 |
26 Feb 07 |
jari |
* @param fieldNames annotation field names |
2 |
26 Feb 07 |
jari |
60 |
*/ |
2 |
26 Feb 07 |
jari |
61 |
public LEMInitDialog(Frame parent, String [] fieldNames) { |
2 |
26 Feb 07 |
jari |
62 |
super(parent, "Linear Expression Map", true); |
2 |
26 Feb 07 |
jari |
63 |
EventListener listener = new EventListener(); |
2 |
26 Feb 07 |
jari |
64 |
|
2 |
26 Feb 07 |
jari |
//Identifier selection |
2 |
26 Feb 07 |
jari |
66 |
JLabel locusLabel = new JLabel("Select Locus Identifier Field"); |
2 |
26 Feb 07 |
jari |
67 |
locusBox = new JComboBox(fieldNames); |
2 |
26 Feb 07 |
jari |
68 |
|
2 |
26 Feb 07 |
jari |
69 |
ParameterPanel geneIDPanel = new ParameterPanel("Locus Identifier Selection"); |
2 |
26 Feb 07 |
jari |
70 |
geneIDPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
71 |
geneIDPanel.add(locusLabel, new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10,0,15,0),0,0)); |
2 |
26 Feb 07 |
jari |
//geneIDPanel.add(locusLabel, new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0)); |
2 |
26 Feb 07 |
jari |
73 |
geneIDPanel.add(locusBox, new GridBagConstraints(1,0,1,1,0,0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10,15,15,0),0,0)); |
2 |
26 Feb 07 |
jari |
74 |
|
2 |
26 Feb 07 |
jari |
75 |
|
2 |
26 Feb 07 |
jari |
//coordinate data input |
2 |
26 Feb 07 |
jari |
77 |
fileInput = new JCheckBox("Use Coordinate File", false); |
2 |
26 Feb 07 |
jari |
78 |
fileInput.setOpaque(false); |
2 |
26 Feb 07 |
jari |
79 |
fileInput.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
80 |
fileInput.setHorizontalAlignment(JCheckBox.CENTER); |
2 |
26 Feb 07 |
jari |
81 |
fileInput.setActionCommand("use-coord-file-command"); |
2 |
26 Feb 07 |
jari |
82 |
fileInput.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
83 |
JLabel fileInputLabel = new JLabel("<html><body>(Hit the \"i\" button (lower left corner) for <b>File Format Information</b>)</body></html>)"); |
2 |
26 Feb 07 |
jari |
84 |
fileInputLabel.setHorizontalAlignment(JLabel.CENTER); |
2 |
26 Feb 07 |
jari |
85 |
|
2 |
26 Feb 07 |
jari |
86 |
String text = "<html>Coordinate information can be supplied via a file input or<br>" |
2 |
26 Feb 07 |
jari |
87 |
+"via information in the annotation loaded into MeV. If using a coordinates<br>" |
2 |
26 Feb 07 |
jari |
88 |
+"file please refer to the help page by hitting the information button (lower left).<br>" |
2 |
26 Feb 07 |
jari |
89 |
+"If using coordinate information in the MeV annoation please indicate the appropriate<br>" |
2 |
26 Feb 07 |
jari |
90 |
+"annotation fields for coordinate parameters.<html>"; |
2 |
26 Feb 07 |
jari |
91 |
|
2 |
26 Feb 07 |
jari |
92 |
JLabel textLabel = new JLabel(text); |
2 |
26 Feb 07 |
jari |
93 |
|
2 |
26 Feb 07 |
jari |
94 |
multipleChr = new JCheckBox("Multiple Chromosomes or Plasmids", false); |
2 |
26 Feb 07 |
jari |
95 |
multipleChr.setOpaque(false); |
2 |
26 Feb 07 |
jari |
96 |
multipleChr.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
97 |
multipleChr.setHorizontalAlignment(JCheckBox.CENTER); |
2 |
26 Feb 07 |
jari |
98 |
multipleChr.setActionCommand("multiple-chr-command"); |
2 |
26 Feb 07 |
jari |
99 |
multipleChr.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
100 |
|
2 |
26 Feb 07 |
jari |
101 |
chrLabel = new JLabel("Select Chromosome ID Field"); |
2 |
26 Feb 07 |
jari |
102 |
chrLabel.setEnabled(false); |
2 |
26 Feb 07 |
jari |
103 |
chrLabel.setHorizontalAlignment(JLabel.CENTER); |
2 |
26 Feb 07 |
jari |
104 |
|
2 |
26 Feb 07 |
jari |
105 |
chrBox = new JComboBox(fieldNames); |
2 |
26 Feb 07 |
jari |
106 |
chrBox.setEnabled(false); |
2 |
26 Feb 07 |
jari |
107 |
|
2 |
26 Feb 07 |
jari |
108 |
startLabel = new JLabel("Select Start Coordinate (5' End) Field"); |
2 |
26 Feb 07 |
jari |
109 |
startBox = new JComboBox(fieldNames); |
2 |
26 Feb 07 |
jari |
110 |
|
2 |
26 Feb 07 |
jari |
111 |
endLabel = new JLabel("Select End Coordinate (3' End) Field"); |
2 |
26 Feb 07 |
jari |
112 |
endBox = new JComboBox(fieldNames); |
2 |
26 Feb 07 |
jari |
113 |
|
2 |
26 Feb 07 |
jari |
114 |
ParameterPanel coordPanel = new ParameterPanel("Coordinate Data Selections"); |
2 |
26 Feb 07 |
jari |
115 |
coordPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
116 |
|
2 |
26 Feb 07 |
jari |
117 |
coordPanel.add(fileInput, new GridBagConstraints(0,0,2,1,1,1,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10,0,5,0),0,0)); |
2 |
26 Feb 07 |
jari |
118 |
coordPanel.add(fileInputLabel, new GridBagConstraints(0,1,2,1,1,1,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,10,0),0,0)); |
2 |
26 Feb 07 |
jari |
119 |
JSeparator sep = new JSeparator(JSeparator.HORIZONTAL); |
2 |
26 Feb 07 |
jari |
120 |
sep.setPreferredSize(new Dimension(300,2)); |
2 |
26 Feb 07 |
jari |
121 |
sep.setSize(100,2); |
2 |
26 Feb 07 |
jari |
122 |
coordPanel.add(sep, new GridBagConstraints(0,2,2,1,0,0,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0,0,0,0),0,0)); |
2 |
26 Feb 07 |
jari |
123 |
|
2 |
26 Feb 07 |
jari |
//coordPanel.add(textLabel, new GridBagConstraints(0,3,2,1,0,0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0)); |
2 |
26 Feb 07 |
jari |
125 |
|
2 |
26 Feb 07 |
jari |
126 |
coordPanel.add(multipleChr, new GridBagConstraints(0,3,2,1,1,1,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10,0,10,0),0,0)); |
2 |
26 Feb 07 |
jari |
127 |
|
2 |
26 Feb 07 |
jari |
128 |
coordPanel.add(chrLabel, new GridBagConstraints(0,4,1,1,1,0,GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(0,40,15,0),0,0)); |
2 |
26 Feb 07 |
jari |
129 |
coordPanel.add(chrBox, new GridBagConstraints(1,4,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0,0,15,40),0,0)); |
2 |
26 Feb 07 |
jari |
130 |
|
2 |
26 Feb 07 |
jari |
131 |
JSeparator sep1 = new JSeparator(JSeparator.HORIZONTAL); |
2 |
26 Feb 07 |
jari |
132 |
sep1.setPreferredSize(new Dimension(300,2)); |
2 |
26 Feb 07 |
jari |
133 |
sep1.setSize(100,2); |
2 |
26 Feb 07 |
jari |
134 |
coordPanel.add(sep1, new GridBagConstraints(0,5,2,1,0,0,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0,0,0,0),0,0)); |
2 |
26 Feb 07 |
jari |
135 |
|
2 |
26 Feb 07 |
jari |
136 |
|
2 |
26 Feb 07 |
jari |
137 |
coordPanel.add(startLabel, new GridBagConstraints(0,6,1,1,1,0,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(20,40,0,10),0,0)); |
2 |
26 Feb 07 |
jari |
138 |
coordPanel.add(startBox, new GridBagConstraints(1,6,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(20,0,0,40),0,0)); |
2 |
26 Feb 07 |
jari |
139 |
|
2 |
26 Feb 07 |
jari |
140 |
coordPanel.add(endLabel, new GridBagConstraints(0,7,1,1,1,0,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10,40,25,10),0,0)); |
2 |
26 Feb 07 |
jari |
141 |
coordPanel.add(endBox, new GridBagConstraints(1,7,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(10,0,25,40),0,0)); |
2 |
26 Feb 07 |
jari |
142 |
|
2 |
26 Feb 07 |
jari |
143 |
JPanel mainPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
144 |
mainPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
145 |
mainPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
146 |
|
2 |
26 Feb 07 |
jari |
147 |
mainPanel.add(geneIDPanel, new GridBagConstraints(0,0,1,1,1,1,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0)); |
2 |
26 Feb 07 |
jari |
148 |
mainPanel.add(coordPanel, new GridBagConstraints(0,1,1,1,1,1,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0)); |
2 |
26 Feb 07 |
jari |
149 |
|
2 |
26 Feb 07 |
jari |
150 |
addContent(mainPanel); |
2 |
26 Feb 07 |
jari |
151 |
setActionListeners(listener); |
2 |
26 Feb 07 |
jari |
152 |
|
2 |
26 Feb 07 |
jari |
153 |
pack(); |
2 |
26 Feb 07 |
jari |
154 |
} |
2 |
26 Feb 07 |
jari |
155 |
|
2 |
26 Feb 07 |
jari |
/** Shows the dialog. |
2 |
26 Feb 07 |
jari |
* @return */ |
2 |
26 Feb 07 |
jari |
158 |
public int showModal() { |
2 |
26 Feb 07 |
jari |
159 |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
2 |
26 Feb 07 |
jari |
160 |
setLocation((screenSize.width - getSize().width)/2, (screenSize.height - getSize().height)/2); |
2 |
26 Feb 07 |
jari |
161 |
show(); |
2 |
26 Feb 07 |
jari |
162 |
return result; |
2 |
26 Feb 07 |
jari |
163 |
} |
2 |
26 Feb 07 |
jari |
164 |
|
2 |
26 Feb 07 |
jari |
165 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the locus field name |
2 |
26 Feb 07 |
jari |
167 |
*/ |
2 |
26 Feb 07 |
jari |
168 |
public String getLocusField() { |
2 |
26 Feb 07 |
jari |
169 |
return (String)(this.locusBox.getSelectedItem()); |
2 |
26 Feb 07 |
jari |
170 |
} |
2 |
26 Feb 07 |
jari |
171 |
|
2 |
26 Feb 07 |
jari |
172 |
/** |
2 |
26 Feb 07 |
jari |
* Return if a coord. file should be used |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
175 |
*/ |
2 |
26 Feb 07 |
jari |
176 |
public boolean useFileInput() { |
2 |
26 Feb 07 |
jari |
177 |
return this.fileInput.isSelected(); |
2 |
26 Feb 07 |
jari |
178 |
} |
2 |
26 Feb 07 |
jari |
179 |
|
2 |
26 Feb 07 |
jari |
180 |
/** |
2 |
26 Feb 07 |
jari |
* Returns true if there are multiple chr. or plasmids |
2 |
26 Feb 07 |
jari |
* @return true for multiple chromosomes |
2 |
26 Feb 07 |
jari |
183 |
*/ |
2 |
26 Feb 07 |
jari |
184 |
public boolean hasMultipleChr() { |
2 |
26 Feb 07 |
jari |
185 |
return this.multipleChr.isSelected(); |
2 |
26 Feb 07 |
jari |
186 |
} |
2 |
26 Feb 07 |
jari |
187 |
|
2 |
26 Feb 07 |
jari |
188 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the chr field name |
2 |
26 Feb 07 |
jari |
* @return chr field name |
2 |
26 Feb 07 |
jari |
191 |
*/ |
2 |
26 Feb 07 |
jari |
192 |
public String getChrIDField() { |
2 |
26 Feb 07 |
jari |
193 |
return (String)(this.chrBox.getSelectedItem()); |
2 |
26 Feb 07 |
jari |
194 |
} |
2 |
26 Feb 07 |
jari |
195 |
|
2 |
26 Feb 07 |
jari |
196 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the start coord field name |
2 |
26 Feb 07 |
jari |
* @return coord start field name |
2 |
26 Feb 07 |
jari |
199 |
*/ |
2 |
26 Feb 07 |
jari |
200 |
public String getStartField() { |
2 |
26 Feb 07 |
jari |
201 |
return (String)(this.startBox.getSelectedItem()); |
2 |
26 Feb 07 |
jari |
202 |
} |
2 |
26 Feb 07 |
jari |
203 |
|
2 |
26 Feb 07 |
jari |
204 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the end coord field name |
2 |
26 Feb 07 |
jari |
* @return coord end field name |
2 |
26 Feb 07 |
jari |
207 |
*/ |
2 |
26 Feb 07 |
jari |
208 |
public String getEndField() { |
2 |
26 Feb 07 |
jari |
209 |
return (String)(this.endBox.getSelectedItem()); |
2 |
26 Feb 07 |
jari |
210 |
} |
2 |
26 Feb 07 |
jari |
211 |
|
2 |
26 Feb 07 |
jari |
212 |
/** |
2 |
26 Feb 07 |
jari |
* Updates the dialog for file input selection |
2 |
26 Feb 07 |
jari |
214 |
*/ |
2 |
26 Feb 07 |
jari |
215 |
private void fireUseFileInputState() { |
2 |
26 Feb 07 |
jari |
216 |
boolean enable = !this.fileInput.isSelected(); |
2 |
26 Feb 07 |
jari |
217 |
if(enable && this.multipleChr.isSelected()) { |
2 |
26 Feb 07 |
jari |
218 |
this.chrLabel.setEnabled(true); |
2 |
26 Feb 07 |
jari |
219 |
this.chrBox.setEnabled(true); |
2 |
26 Feb 07 |
jari |
220 |
} else if(!enable) { |
2 |
26 Feb 07 |
jari |
221 |
this.chrLabel.setEnabled(false); |
2 |
26 Feb 07 |
jari |
222 |
this.chrBox.setEnabled(false); |
2 |
26 Feb 07 |
jari |
223 |
} |
2 |
26 Feb 07 |
jari |
224 |
this.startLabel.setEnabled(enable); |
2 |
26 Feb 07 |
jari |
225 |
this.startBox.setEnabled(enable); |
2 |
26 Feb 07 |
jari |
226 |
this.endLabel.setEnabled(enable); |
2 |
26 Feb 07 |
jari |
227 |
this.endBox.setEnabled(enable); |
2 |
26 Feb 07 |
jari |
228 |
} |
2 |
26 Feb 07 |
jari |
229 |
|
2 |
26 Feb 07 |
jari |
230 |
/** |
2 |
26 Feb 07 |
jari |
* Updates the dialog for multiple chr selection |
2 |
26 Feb 07 |
jari |
232 |
*/ |
2 |
26 Feb 07 |
jari |
233 |
private void fireMultipleChrState() { |
2 |
26 Feb 07 |
jari |
234 |
boolean enable = this.multipleChr.isSelected(); |
2 |
26 Feb 07 |
jari |
235 |
if(this.fileInput.isSelected()) { |
2 |
26 Feb 07 |
jari |
236 |
this.chrLabel.setEnabled(false); |
2 |
26 Feb 07 |
jari |
237 |
this.chrBox.setEnabled(false); |
2 |
26 Feb 07 |
jari |
238 |
} else { |
2 |
26 Feb 07 |
jari |
239 |
this.chrLabel.setEnabled(enable); |
2 |
26 Feb 07 |
jari |
240 |
this.chrBox.setEnabled(enable); |
2 |
26 Feb 07 |
jari |
241 |
} |
2 |
26 Feb 07 |
jari |
242 |
} |
2 |
26 Feb 07 |
jari |
243 |
|
2 |
26 Feb 07 |
jari |
244 |
/** |
2 |
26 Feb 07 |
jari |
* Resets the dialog controls |
2 |
26 Feb 07 |
jari |
246 |
*/ |
2 |
26 Feb 07 |
jari |
247 |
private void resetControls() { |
2 |
26 Feb 07 |
jari |
248 |
this.locusBox.setSelectedIndex(0); |
2 |
26 Feb 07 |
jari |
249 |
this.fileInput.setSelected(false); |
2 |
26 Feb 07 |
jari |
250 |
fireUseFileInputState(); |
2 |
26 Feb 07 |
jari |
251 |
this.chrBox.setSelectedIndex(0); |
2 |
26 Feb 07 |
jari |
252 |
this.multipleChr.setSelected(false); |
2 |
26 Feb 07 |
jari |
253 |
fireMultipleChrState(); |
2 |
26 Feb 07 |
jari |
254 |
this.startBox.setSelectedIndex(0); |
2 |
26 Feb 07 |
jari |
255 |
this.endBox.setSelectedIndex(0); |
2 |
26 Feb 07 |
jari |
256 |
} |
2 |
26 Feb 07 |
jari |
257 |
|
2 |
26 Feb 07 |
jari |
258 |
/** |
2 |
26 Feb 07 |
jari |
* The class to listen to the dialog and check boxes items events. |
2 |
26 Feb 07 |
jari |
260 |
*/ |
2 |
26 Feb 07 |
jari |
261 |
private class EventListener extends DialogListener implements ItemListener { |
2 |
26 Feb 07 |
jari |
262 |
|
2 |
26 Feb 07 |
jari |
263 |
/** |
2 |
26 Feb 07 |
jari |
* handles action events |
2 |
26 Feb 07 |
jari |
265 |
*/ |
2 |
26 Feb 07 |
jari |
266 |
public void actionPerformed(ActionEvent e) { |
2 |
26 Feb 07 |
jari |
267 |
String command = e.getActionCommand(); |
2 |
26 Feb 07 |
jari |
268 |
if(command.equals("ok-command")) { |
2 |
26 Feb 07 |
jari |
269 |
result = JOptionPane.OK_OPTION; |
2 |
26 Feb 07 |
jari |
270 |
dispose(); |
2 |
26 Feb 07 |
jari |
271 |
} else if (command.equals("cancel-command")) { |
2 |
26 Feb 07 |
jari |
272 |
result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
273 |
dispose(); |
2 |
26 Feb 07 |
jari |
274 |
} else if (command.equals("reset-command")) { |
2 |
26 Feb 07 |
jari |
275 |
resetControls(); |
2 |
26 Feb 07 |
jari |
276 |
} else if(command.equals("use-coord-file-command")) { |
2 |
26 Feb 07 |
jari |
277 |
fireUseFileInputState(); |
2 |
26 Feb 07 |
jari |
278 |
} else if (command.equals("multiple-chr-command")) { |
2 |
26 Feb 07 |
jari |
279 |
fireMultipleChrState(); |
2 |
26 Feb 07 |
jari |
280 |
} else if (command.equals("info-command")) { |
2 |
26 Feb 07 |
jari |
281 |
HelpWindow hw = new HelpWindow(LEMInitDialog.this, "LEM Initialization Dialog"); |
2 |
26 Feb 07 |
jari |
282 |
result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
283 |
if(hw.getWindowContent()){ |
2 |
26 Feb 07 |
jari |
284 |
hw.setSize(600,600); |
2 |
26 Feb 07 |
jari |
285 |
hw.setLocation(); |
2 |
26 Feb 07 |
jari |
286 |
hw.show(); |
2 |
26 Feb 07 |
jari |
287 |
} |
2 |
26 Feb 07 |
jari |
288 |
else { |
2 |
26 Feb 07 |
jari |
289 |
hw.setVisible(false); |
2 |
26 Feb 07 |
jari |
290 |
hw.dispose(); |
2 |
26 Feb 07 |
jari |
291 |
} |
2 |
26 Feb 07 |
jari |
292 |
} |
2 |
26 Feb 07 |
jari |
293 |
} |
2 |
26 Feb 07 |
jari |
294 |
|
2 |
26 Feb 07 |
jari |
295 |
public void itemStateChanged(ItemEvent e) { |
2 |
26 Feb 07 |
jari |
//okButton.setEnabled(genes_box.isSelected() || cluster_box.isSelected()); |
2 |
26 Feb 07 |
jari |
297 |
} |
2 |
26 Feb 07 |
jari |
298 |
|
2 |
26 Feb 07 |
jari |
299 |
public void windowClosing(WindowEvent e) { |
2 |
26 Feb 07 |
jari |
300 |
result = JOptionPane.CLOSED_OPTION; |
2 |
26 Feb 07 |
jari |
301 |
dispose(); |
2 |
26 Feb 07 |
jari |
302 |
} |
2 |
26 Feb 07 |
jari |
303 |
} |
2 |
26 Feb 07 |
jari |
304 |
|
2 |
26 Feb 07 |
jari |
/* test launch */ |
2 |
26 Feb 07 |
jari |
306 |
public static void main(String [] args) { |
2 |
26 Feb 07 |
jari |
307 |
String [] fields = {"Locus", "Chr#", "Start", "End"}; |
2 |
26 Feb 07 |
jari |
308 |
|
2 |
26 Feb 07 |
jari |
309 |
LEMInitDialog dialog = new LEMInitDialog(new Frame(), fields); |
2 |
26 Feb 07 |
jari |
310 |
dialog.showModal(); |
2 |
26 Feb 07 |
jari |
311 |
|
2 |
26 Feb 07 |
jari |
312 |
} |
2 |
26 Feb 07 |
jari |
313 |
} |