2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
Copyright @ 1999-2004, 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 |
* ScriptAlgorithmInitDialog.java |
2 |
26 Feb 07 |
jari |
7 |
* |
2 |
26 Feb 07 |
jari |
* Created on March 4, 2004, 10:56 AM |
2 |
26 Feb 07 |
jari |
9 |
*/ |
2 |
26 Feb 07 |
jari |
10 |
|
2 |
26 Feb 07 |
jari |
11 |
package org.tigr.microarray.mev.script.scriptGUI; |
2 |
26 Feb 07 |
jari |
12 |
|
2 |
26 Feb 07 |
jari |
13 |
import java.awt.Color; |
2 |
26 Feb 07 |
jari |
14 |
import java.awt.Dimension; |
2 |
26 Feb 07 |
jari |
15 |
import java.awt.Graphics; |
2 |
26 Feb 07 |
jari |
16 |
import java.awt.GridBagConstraints; |
2 |
26 Feb 07 |
jari |
17 |
import java.awt.GridBagLayout; |
2 |
26 Feb 07 |
jari |
18 |
import java.awt.Insets; |
2 |
26 Feb 07 |
jari |
19 |
import java.awt.Point; |
2 |
26 Feb 07 |
jari |
20 |
import java.awt.Toolkit; |
2 |
26 Feb 07 |
jari |
21 |
import java.awt.event.ActionEvent; |
2 |
26 Feb 07 |
jari |
22 |
import java.awt.event.ActionListener; |
2 |
26 Feb 07 |
jari |
23 |
import java.awt.event.WindowEvent; |
2 |
26 Feb 07 |
jari |
24 |
import java.util.Hashtable; |
2 |
26 Feb 07 |
jari |
25 |
|
2 |
26 Feb 07 |
jari |
26 |
import javax.swing.Action; |
2 |
26 Feb 07 |
jari |
27 |
import javax.swing.BorderFactory; |
2 |
26 Feb 07 |
jari |
28 |
import javax.swing.ButtonGroup; |
2 |
26 Feb 07 |
jari |
29 |
import javax.swing.Icon; |
2 |
26 Feb 07 |
jari |
30 |
import javax.swing.JButton; |
2 |
26 Feb 07 |
jari |
31 |
import javax.swing.JCheckBox; |
2 |
26 Feb 07 |
jari |
32 |
import javax.swing.JFrame; |
2 |
26 Feb 07 |
jari |
33 |
import javax.swing.JLabel; |
2 |
26 Feb 07 |
jari |
34 |
import javax.swing.JOptionPane; |
2 |
26 Feb 07 |
jari |
35 |
import javax.swing.JPanel; |
2 |
26 Feb 07 |
jari |
36 |
import javax.swing.JRadioButton; |
2 |
26 Feb 07 |
jari |
37 |
import javax.swing.JTabbedPane; |
2 |
26 Feb 07 |
jari |
38 |
import javax.swing.JTextField; |
2 |
26 Feb 07 |
jari |
39 |
import javax.swing.border.BevelBorder; |
2 |
26 Feb 07 |
jari |
40 |
|
2 |
26 Feb 07 |
jari |
41 |
import org.tigr.microarray.mev.action.ActionManager; |
2 |
26 Feb 07 |
jari |
42 |
import org.tigr.microarray.mev.cluster.gui.IClusterGUI; |
2 |
26 Feb 07 |
jari |
43 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.AlgorithmDialog; |
2 |
26 Feb 07 |
jari |
44 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.DialogListener; |
2 |
26 Feb 07 |
jari |
45 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.ParameterPanel; |
2 |
26 Feb 07 |
jari |
46 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.dialogHelpUtil.HelpWindow; |
2 |
26 Feb 07 |
jari |
47 |
import org.tigr.microarray.mev.script.util.ScriptConstants; |
2 |
26 Feb 07 |
jari |
48 |
|
2 |
26 Feb 07 |
jari |
/** The ScriptAlgorithmInitDialog permits algorithm selection during script construction. |
2 |
26 Feb 07 |
jari |
* Three broad scripting algorithm categories exist: analyis (clustering, stat, and classification), |
2 |
26 Feb 07 |
jari |
* adjustment algorithms (filters, tranformations), and cluster selections algorithms. |
2 |
26 Feb 07 |
jari |
* @author braisted |
2 |
26 Feb 07 |
jari |
53 |
*/ |
2 |
26 Feb 07 |
jari |
54 |
public class ScriptAlgorithmInitDialog extends AlgorithmDialog { |
2 |
26 Feb 07 |
jari |
55 |
|
2 |
26 Feb 07 |
jari |
/** result |
2 |
26 Feb 07 |
jari |
57 |
*/ |
2 |
26 Feb 07 |
jari |
58 |
private int result; |
2 |
26 Feb 07 |
jari |
/** algorithm index |
2 |
26 Feb 07 |
jari |
60 |
*/ |
2 |
26 Feb 07 |
jari |
61 |
private int algorithmIndex = -1; |
2 |
26 Feb 07 |
jari |
/** algorithm type |
2 |
26 Feb 07 |
jari |
63 |
*/ |
2 |
26 Feb 07 |
jari |
64 |
private String algorithmType; |
2 |
26 Feb 07 |
jari |
/** current selected algorithm name |
2 |
26 Feb 07 |
jari |
66 |
*/ |
2 |
26 Feb 07 |
jari |
67 |
private String currentAlgorithmName; |
2 |
26 Feb 07 |
jari |
/** main panel for components |
2 |
26 Feb 07 |
jari |
69 |
*/ |
2 |
26 Feb 07 |
jari |
70 |
private JPanel mainPanel; |
2 |
26 Feb 07 |
jari |
/** action manager to accumulate available mev algorithms for presentation |
2 |
26 Feb 07 |
jari |
72 |
*/ |
2 |
26 Feb 07 |
jari |
73 |
private ActionManager actionManager; |
2 |
26 Feb 07 |
jari |
/** previews the selections |
2 |
26 Feb 07 |
jari |
75 |
*/ |
2 |
26 Feb 07 |
jari |
76 |
private PreviewPanel previewPanel; |
2 |
26 Feb 07 |
jari |
/** analysis algorithm selection controls |
2 |
26 Feb 07 |
jari |
78 |
*/ |
2 |
26 Feb 07 |
jari |
79 |
private AlgorithmSelectionPanel algSelPanel; |
2 |
26 Feb 07 |
jari |
/** adjustment algorithm controls |
2 |
26 Feb 07 |
jari |
81 |
*/ |
2 |
26 Feb 07 |
jari |
82 |
private AdjustmentSelectionPanel adjSelPanel; |
2 |
26 Feb 07 |
jari |
/** cluster selection parameter controls |
2 |
26 Feb 07 |
jari |
84 |
*/ |
2 |
26 Feb 07 |
jari |
85 |
private ClusterSelectionPanel clusterSelectionPanel; |
2 |
26 Feb 07 |
jari |
86 |
|
2 |
26 Feb 07 |
jari |
87 |
/* |
2 |
26 Feb 07 |
jari |
* CLASS DEVELOPMENT NOTES |
2 |
26 Feb 07 |
jari |
89 |
* |
2 |
26 Feb 07 |
jari |
* The main panel will hold all content except super class elements. |
2 |
26 Feb 07 |
jari |
* Three tabbed panes will correspond to three algorithm types, |
2 |
26 Feb 07 |
jari |
* <cluster | data adjustment | normalization | cluster selection> |
2 |
26 Feb 07 |
jari |
* Cluster selection applys to multicluster result only. |
2 |
26 Feb 07 |
jari |
* Other type can apply to any result. |
2 |
26 Feb 07 |
jari |
95 |
* |
2 |
26 Feb 07 |
jari |
* Internal classes handle representation of algorithm types. |
2 |
26 Feb 07 |
jari |
* Selection type and specific information is displayed in top preview panel. |
2 |
26 Feb 07 |
jari |
98 |
* |
2 |
26 Feb 07 |
jari |
* The main return values will be a type string and associated parameters |
2 |
26 Feb 07 |
jari |
* in the case of cluster selection criteria. |
2 |
26 Feb 07 |
jari |
101 |
*/ |
2 |
26 Feb 07 |
jari |
102 |
|
2 |
26 Feb 07 |
jari |
103 |
|
2 |
26 Feb 07 |
jari |
/** Creates a new instance of ScriptAlgorithmInitDialog |
2 |
26 Feb 07 |
jari |
* @param manager ActionManager to provide available algorithms |
2 |
26 Feb 07 |
jari |
* @param nodeType Node type, data node type can restrict algorithm selection. |
2 |
26 Feb 07 |
jari |
* @param isAffyData Indicates if loaded data is for Affymetrix(TM) data, need more filter controls. |
2 |
26 Feb 07 |
jari |
108 |
*/ |
2 |
26 Feb 07 |
jari |
109 |
public ScriptAlgorithmInitDialog(ActionManager manager, String nodeType, boolean isAffyData) { |
2 |
26 Feb 07 |
jari |
110 |
super(new JFrame(), "Script Algorithm Initialization Dialog", true); |
2 |
26 Feb 07 |
jari |
111 |
this.actionManager = manager; |
2 |
26 Feb 07 |
jari |
112 |
algorithmType = ScriptConstants.ALGORITHM_TYPE_CLUSTER;;//default |
2 |
26 Feb 07 |
jari |
113 |
result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
114 |
|
2 |
26 Feb 07 |
jari |
115 |
mainPanel = new JPanel(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
116 |
mainPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
117 |
|
2 |
26 Feb 07 |
jari |
118 |
previewPanel = new PreviewPanel(); |
2 |
26 Feb 07 |
jari |
119 |
algSelPanel = new AlgorithmSelectionPanel(actionManager); |
2 |
26 Feb 07 |
jari |
120 |
adjSelPanel = new AdjustmentSelectionPanel(isAffyData); |
2 |
26 Feb 07 |
jari |
121 |
clusterSelectionPanel = new ClusterSelectionPanel(); |
2 |
26 Feb 07 |
jari |
122 |
|
2 |
26 Feb 07 |
jari |
123 |
JTabbedPane tabbedPane = new JTabbedPane(); |
2 |
26 Feb 07 |
jari |
124 |
tabbedPane.addTab("Analysis Algorithms", algSelPanel); |
2 |
26 Feb 07 |
jari |
125 |
tabbedPane.addTab("Adjustment Algorithms", adjSelPanel); |
2 |
26 Feb 07 |
jari |
126 |
tabbedPane.addTab("Cluster Selection Algorithms", clusterSelectionPanel); |
2 |
26 Feb 07 |
jari |
127 |
|
2 |
26 Feb 07 |
jari |
128 |
if(nodeType.equals(ScriptConstants.OUTPUT_DATA_CLASS_GENE_MULTICLUSTER_OUTPUT) |
2 |
26 Feb 07 |
jari |
129 |
|| nodeType.equals(ScriptConstants.OUTPUT_DATA_CLASS_EXPERIMENT_MULTICLUSTER_OUTPUT) |
2 |
26 Feb 07 |
jari |
130 |
|| nodeType.equals(ScriptConstants.OUTPUT_DATA_CLASS_MULTICLUSTER_OUTPUT)) { |
2 |
26 Feb 07 |
jari |
131 |
tabbedPane.setEnabledAt(0, false); |
2 |
26 Feb 07 |
jari |
132 |
tabbedPane.setEnabledAt(1, false); |
2 |
26 Feb 07 |
jari |
133 |
tabbedPane.setSelectedIndex(2); |
2 |
26 Feb 07 |
jari |
134 |
} else { |
2 |
26 Feb 07 |
jari |
135 |
tabbedPane.setEnabledAt(2, false); |
2 |
26 Feb 07 |
jari |
136 |
} |
2 |
26 Feb 07 |
jari |
137 |
|
2 |
26 Feb 07 |
jari |
138 |
mainPanel.add(previewPanel, new GridBagConstraints(0,0,1,1,1,0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0), 0,0)); |
2 |
26 Feb 07 |
jari |
139 |
mainPanel.add(tabbedPane, new GridBagConstraints(0,1,1,2,1,0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0), 0,0)); |
2 |
26 Feb 07 |
jari |
140 |
|
2 |
26 Feb 07 |
jari |
141 |
Listener listener = new Listener(); |
2 |
26 Feb 07 |
jari |
142 |
addWindowListener(listener); |
2 |
26 Feb 07 |
jari |
143 |
addContent(mainPanel); |
2 |
26 Feb 07 |
jari |
144 |
setActionListeners(listener); |
2 |
26 Feb 07 |
jari |
145 |
pack(); |
2 |
26 Feb 07 |
jari |
146 |
if(!isAffyData) |
2 |
26 Feb 07 |
jari |
147 |
setSize(new Dimension(510, 587)); |
2 |
26 Feb 07 |
jari |
148 |
else |
2 |
26 Feb 07 |
jari |
149 |
setSize(new Dimension(510, 665)); |
2 |
26 Feb 07 |
jari |
150 |
} |
2 |
26 Feb 07 |
jari |
151 |
|
2 |
26 Feb 07 |
jari |
152 |
/** |
2 |
26 Feb 07 |
jari |
* Shows the dialog. |
2 |
26 Feb 07 |
jari |
154 |
*/ |
2 |
26 Feb 07 |
jari |
155 |
public int showModal() { |
2 |
26 Feb 07 |
jari |
156 |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
2 |
26 Feb 07 |
jari |
157 |
setLocation((screenSize.width - getSize().width)/2, (screenSize.height - getSize().height)/2); |
2 |
26 Feb 07 |
jari |
158 |
show(); |
2 |
26 Feb 07 |
jari |
159 |
return result; |
2 |
26 Feb 07 |
jari |
160 |
} |
2 |
26 Feb 07 |
jari |
161 |
|
2 |
26 Feb 07 |
jari |
/** Resets the controls |
2 |
26 Feb 07 |
jari |
163 |
*/ |
2 |
26 Feb 07 |
jari |
164 |
public void onReset() { |
2 |
26 Feb 07 |
jari |
165 |
this.previewPanel.reset(); |
2 |
26 Feb 07 |
jari |
166 |
this.algSelPanel.reset(); |
2 |
26 Feb 07 |
jari |
167 |
this.adjSelPanel.reset(); |
2 |
26 Feb 07 |
jari |
168 |
this.clusterSelectionPanel.reset(); |
2 |
26 Feb 07 |
jari |
169 |
this.algorithmIndex = -1; |
2 |
26 Feb 07 |
jari |
170 |
this.algorithmType = ""; |
2 |
26 Feb 07 |
jari |
171 |
this.currentAlgorithmName = ""; |
2 |
26 Feb 07 |
jari |
172 |
} |
2 |
26 Feb 07 |
jari |
173 |
|
2 |
26 Feb 07 |
jari |
174 |
|
2 |
26 Feb 07 |
jari |
/** returns the algorithm class |
2 |
26 Feb 07 |
jari |
176 |
*/ |
2 |
26 Feb 07 |
jari |
177 |
public String getAlgorithmType() { |
2 |
26 Feb 07 |
jari |
178 |
return algorithmType; |
2 |
26 Feb 07 |
jari |
179 |
} |
2 |
26 Feb 07 |
jari |
180 |
|
2 |
26 Feb 07 |
jari |
/** returns algorithm name |
2 |
26 Feb 07 |
jari |
182 |
*/ |
2 |
26 Feb 07 |
jari |
183 |
public String getAlgorithmName() { |
2 |
26 Feb 07 |
jari |
184 |
return currentAlgorithmName; |
2 |
26 Feb 07 |
jari |
185 |
} |
2 |
26 Feb 07 |
jari |
186 |
|
2 |
26 Feb 07 |
jari |
/** returns the algorthms index |
2 |
26 Feb 07 |
jari |
188 |
*/ |
2 |
26 Feb 07 |
jari |
189 |
public int getAlgorithmIndex() { |
2 |
26 Feb 07 |
jari |
190 |
int index; |
2 |
26 Feb 07 |
jari |
191 |
if(currentAlgorithmName != null) { |
2 |
26 Feb 07 |
jari |
192 |
String number = (String)(algSelPanel.indexHash.get(currentAlgorithmName)); |
2 |
26 Feb 07 |
jari |
193 |
if(number != null) { |
2 |
26 Feb 07 |
jari |
194 |
return Integer.parseInt(number); |
2 |
26 Feb 07 |
jari |
195 |
} |
2 |
26 Feb 07 |
jari |
196 |
} |
2 |
26 Feb 07 |
jari |
197 |
|
2 |
26 Feb 07 |
jari |
198 |
return -1; |
2 |
26 Feb 07 |
jari |
199 |
|
2 |
26 Feb 07 |
jari |
200 |
} |
2 |
26 Feb 07 |
jari |
201 |
|
2 |
26 Feb 07 |
jari |
202 |
|
2 |
26 Feb 07 |
jari |
203 |
|
2 |
26 Feb 07 |
jari |
204 |
|
2 |
26 Feb 07 |
jari |
205 |
/* |
2 |
26 Feb 07 |
jari |
206 |
* |
2 |
26 Feb 07 |
jari |
* Internal Classes |
2 |
26 Feb 07 |
jari |
208 |
* |
2 |
26 Feb 07 |
jari |
209 |
*/ |
2 |
26 Feb 07 |
jari |
210 |
|
2 |
26 Feb 07 |
jari |
211 |
|
2 |
26 Feb 07 |
jari |
/* Preview Panel simply reports the current selections and key information |
2 |
26 Feb 07 |
jari |
* such as algorithm category and algorithm name. |
2 |
26 Feb 07 |
jari |
214 |
*/ |
2 |
26 Feb 07 |
jari |
215 |
|
2 |
26 Feb 07 |
jari |
/** Previews the algorithm selection |
2 |
26 Feb 07 |
jari |
217 |
*/ |
2 |
26 Feb 07 |
jari |
218 |
private class PreviewPanel extends ParameterPanel { |
2 |
26 Feb 07 |
jari |
219 |
|
2 |
26 Feb 07 |
jari |
220 |
JTextField categoryValueField; |
2 |
26 Feb 07 |
jari |
221 |
JTextField algValueField; |
2 |
26 Feb 07 |
jari |
222 |
|
2 |
26 Feb 07 |
jari |
223 |
public PreviewPanel() { |
2 |
26 Feb 07 |
jari |
224 |
super("Selection Preview"); |
2 |
26 Feb 07 |
jari |
225 |
super.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
226 |
JLabel categoryLabel = new JLabel("Algorithm Category: "); |
2 |
26 Feb 07 |
jari |
227 |
categoryValueField = new JTextField("Not Selected", 25); |
2 |
26 Feb 07 |
jari |
228 |
categoryValueField.setEditable(false); |
2 |
26 Feb 07 |
jari |
229 |
|
2 |
26 Feb 07 |
jari |
230 |
JLabel algNameLabel = new JLabel("Algorithm: "); |
2 |
26 Feb 07 |
jari |
231 |
algValueField = new JTextField("Not Selected", 25); |
2 |
26 Feb 07 |
jari |
232 |
algValueField.setEditable(false); |
2 |
26 Feb 07 |
jari |
233 |
|
2 |
26 Feb 07 |
jari |
234 |
add(categoryLabel, new GridBagConstraints(0,0,1,1,1,1,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,20,0,0), 0,0)); |
2 |
26 Feb 07 |
jari |
235 |
add(categoryValueField, new GridBagConstraints(1,0,1,1,0,1,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,10,0,0), 0,0)); |
2 |
26 Feb 07 |
jari |
236 |
add(algNameLabel, new GridBagConstraints(0,1,1,1,1,1,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10,20,5,0), 0,0)); |
2 |
26 Feb 07 |
jari |
237 |
add(algValueField, new GridBagConstraints(1,1,1,1,0,1,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10,10,5,0), 0,0)); |
2 |
26 Feb 07 |
jari |
238 |
} |
2 |
26 Feb 07 |
jari |
239 |
|
2 |
26 Feb 07 |
jari |
240 |
public void reset() { |
2 |
26 Feb 07 |
jari |
241 |
algValueField.setText("Not Selected"); |
2 |
26 Feb 07 |
jari |
242 |
categoryValueField.setText("Not Selected"); |
2 |
26 Feb 07 |
jari |
243 |
} |
2 |
26 Feb 07 |
jari |
244 |
|
2 |
26 Feb 07 |
jari |
245 |
public void setValues(String cat, String name) { |
2 |
26 Feb 07 |
jari |
246 |
algValueField.setText(name); |
2 |
26 Feb 07 |
jari |
247 |
categoryValueField.setText(cat); |
2 |
26 Feb 07 |
jari |
248 |
} |
2 |
26 Feb 07 |
jari |
249 |
} |
2 |
26 Feb 07 |
jari |
250 |
|
2 |
26 Feb 07 |
jari |
/* AlgorithmSelectinoPanel displays all clustering, stat and classification |
2 |
26 Feb 07 |
jari |
* algorithms by retrieving them from the action manager. |
2 |
26 Feb 07 |
jari |
* The buttons presented have a simple listener to report the algorithm name. |
2 |
26 Feb 07 |
jari |
254 |
* |
2 |
26 Feb 07 |
jari |
* Button arrangemet is to match rows and columns in number with prefference to |
2 |
26 Feb 07 |
jari |
* extra rows if needed. |
2 |
26 Feb 07 |
jari |
257 |
*/ |
2 |
26 Feb 07 |
jari |
258 |
|
2 |
26 Feb 07 |
jari |
/** Supports analysis algorithm selection. |
2 |
26 Feb 07 |
jari |
260 |
*/ |
2 |
26 Feb 07 |
jari |
261 |
private class AlgorithmSelectionPanel extends ParameterPanel { |
2 |
26 Feb 07 |
jari |
262 |
|
2 |
26 Feb 07 |
jari |
263 |
ButtonPanel buttonPanel; |
2 |
26 Feb 07 |
jari |
264 |
ButtonListener listener; |
2 |
26 Feb 07 |
jari |
265 |
Hashtable descriptions; |
2 |
26 Feb 07 |
jari |
//Hashtable locations; |
2 |
26 Feb 07 |
jari |
267 |
Hashtable indexHash; |
2 |
26 Feb 07 |
jari |
268 |
|
2 |
26 Feb 07 |
jari |
269 |
AlgorithmSelectionPanel(ActionManager actionManager) { |
2 |
26 Feb 07 |
jari |
270 |
super("Algorithm Selection"); |
2 |
26 Feb 07 |
jari |
271 |
setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
272 |
setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
273 |
listener = new ButtonListener(); |
2 |
26 Feb 07 |
jari |
274 |
buttonPanel = new ButtonPanel(); |
2 |
26 Feb 07 |
jari |
275 |
buttonPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
276 |
buttonPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
277 |
descriptions = new Hashtable(); |
2 |
26 Feb 07 |
jari |
278 |
indexHash = new Hashtable(); |
2 |
26 Feb 07 |
jari |
// locations = new Hashtable(); |
2 |
26 Feb 07 |
jari |
280 |
addAlgorithmButtons(actionManager); |
2 |
26 Feb 07 |
jari |
281 |
add(buttonPanel, 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 |
282 |
} |
2 |
26 Feb 07 |
jari |
283 |
|
2 |
26 Feb 07 |
jari |
284 |
|
2 |
26 Feb 07 |
jari |
285 |
private void addAlgorithmButtons(ActionManager manager) { |
2 |
26 Feb 07 |
jari |
286 |
int algCnt = 0, x, y; |
2 |
26 Feb 07 |
jari |
287 |
Action action; |
2 |
26 Feb 07 |
jari |
288 |
|
2 |
26 Feb 07 |
jari |
289 |
while ((action = manager.getAction(ActionManager.ANALYSIS_ACTION+String.valueOf(algCnt)))!=null) |
2 |
26 Feb 07 |
jari |
290 |
algCnt++; |
2 |
26 Feb 07 |
jari |
291 |
|
2 |
26 Feb 07 |
jari |
292 |
x = 1; |
2 |
26 Feb 07 |
jari |
293 |
y = algCnt; |
2 |
26 Feb 07 |
jari |
294 |
|
2 |
26 Feb 07 |
jari |
295 |
while(true){ |
2 |
26 Feb 07 |
jari |
296 |
x++; |
2 |
26 Feb 07 |
jari |
297 |
y = (int)Math.floor(algCnt/x); |
2 |
26 Feb 07 |
jari |
298 |
y += x*y < algCnt ? 1 : 0; |
2 |
26 Feb 07 |
jari |
299 |
if(y<=x) |
2 |
26 Feb 07 |
jari |
300 |
break; |
2 |
26 Feb 07 |
jari |
301 |
} |
2 |
26 Feb 07 |
jari |
302 |
|
2 |
26 Feb 07 |
jari |
303 |
algCnt = 0; |
2 |
26 Feb 07 |
jari |
304 |
JButton button; |
2 |
26 Feb 07 |
jari |
305 |
GridBagConstraints gbc = new GridBagConstraints(); |
2 |
26 Feb 07 |
jari |
306 |
gbc.insets = new Insets(4,4,4,4); |
2 |
26 Feb 07 |
jari |
307 |
int cnt = 0; |
2 |
26 Feb 07 |
jari |
308 |
for(int i = 0; i < x; i++){ |
2 |
26 Feb 07 |
jari |
309 |
for(int j = 0; j < y; j++){ |
2 |
26 Feb 07 |
jari |
310 |
action = manager.getAction(ActionManager.ANALYSIS_ACTION+String.valueOf(cnt)); |
2 |
26 Feb 07 |
jari |
311 |
if(action != null) { |
2 |
26 Feb 07 |
jari |
312 |
button = new JButton(); |
2 |
26 Feb 07 |
jari |
313 |
button.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
314 |
button.setActionCommand((String)action.getValue(Action.NAME)); |
2 |
26 Feb 07 |
jari |
315 |
button.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
316 |
button.setIcon((Icon)action.getValue(ActionManager.LARGE_ICON)); |
2 |
26 Feb 07 |
jari |
317 |
button.setText(""); |
2 |
26 Feb 07 |
jari |
318 |
button.setToolTipText((String)action.getValue(Action.SHORT_DESCRIPTION)); |
2 |
26 Feb 07 |
jari |
319 |
button.setPreferredSize(new Dimension(45,45)); |
2 |
26 Feb 07 |
jari |
320 |
button.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); |
2 |
26 Feb 07 |
jari |
321 |
gbc.gridx = j; |
2 |
26 Feb 07 |
jari |
322 |
gbc.gridy = i; |
2 |
26 Feb 07 |
jari |
323 |
buttonPanel.add(button, gbc); |
2 |
26 Feb 07 |
jari |
324 |
descriptions.put(action.getValue(Action.NAME), action.getValue(Action.SHORT_DESCRIPTION)); |
2 |
26 Feb 07 |
jari |
325 |
indexHash.put(action.getValue(Action.NAME), String.valueOf(cnt)); |
2 |
26 Feb 07 |
jari |
326 |
try { |
2 |
26 Feb 07 |
jari |
327 |
Class clazz = Class.forName(((String)action.getValue(ActionManager.PARAMETER))); |
2 |
26 Feb 07 |
jari |
328 |
IClusterGUI gui = (IClusterGUI)clazz.newInstance(); |
2 |
26 Feb 07 |
jari |
329 |
button.setEnabled(gui instanceof IScriptGUI); |
2 |
26 Feb 07 |
jari |
330 |
} catch (Exception e ) { } |
2 |
26 Feb 07 |
jari |
// locations.put(button, new Point(button.getLocation())); |
2 |
26 Feb 07 |
jari |
332 |
} |
2 |
26 Feb 07 |
jari |
333 |
cnt++; |
2 |
26 Feb 07 |
jari |
334 |
} |
2 |
26 Feb 07 |
jari |
335 |
} |
2 |
26 Feb 07 |
jari |
336 |
} |
2 |
26 Feb 07 |
jari |
337 |
|
2 |
26 Feb 07 |
jari |
338 |
public void reset() { |
2 |
26 Feb 07 |
jari |
339 |
buttonPanel.setSelected(false); |
2 |
26 Feb 07 |
jari |
340 |
buttonPanel.repaint(); |
2 |
26 Feb 07 |
jari |
341 |
} |
2 |
26 Feb 07 |
jari |
342 |
|
2 |
26 Feb 07 |
jari |
343 |
/** |
2 |
26 Feb 07 |
jari |
344 |
*/ |
2 |
26 Feb 07 |
jari |
345 |
private class ButtonPanel extends JPanel { |
2 |
26 Feb 07 |
jari |
346 |
boolean isSelected; |
2 |
26 Feb 07 |
jari |
347 |
Point selectedSector; |
2 |
26 Feb 07 |
jari |
348 |
JButton selectedButton; |
2 |
26 Feb 07 |
jari |
349 |
|
2 |
26 Feb 07 |
jari |
350 |
public ButtonPanel() { |
2 |
26 Feb 07 |
jari |
351 |
super(); |
2 |
26 Feb 07 |
jari |
352 |
isSelected = false; |
2 |
26 Feb 07 |
jari |
353 |
} |
2 |
26 Feb 07 |
jari |
354 |
|
2 |
26 Feb 07 |
jari |
355 |
public void setSelection(JButton button) { |
2 |
26 Feb 07 |
jari |
356 |
isSelected = true; |
2 |
26 Feb 07 |
jari |
357 |
selectedButton = button; |
2 |
26 Feb 07 |
jari |
358 |
repaint(); |
2 |
26 Feb 07 |
jari |
359 |
} |
2 |
26 Feb 07 |
jari |
360 |
|
2 |
26 Feb 07 |
jari |
361 |
public void setSelected(boolean value) { |
2 |
26 Feb 07 |
jari |
362 |
isSelected = value; |
2 |
26 Feb 07 |
jari |
363 |
} |
2 |
26 Feb 07 |
jari |
364 |
|
2 |
26 Feb 07 |
jari |
365 |
public void paint(Graphics g) { |
2 |
26 Feb 07 |
jari |
366 |
super.paint(g); |
2 |
26 Feb 07 |
jari |
367 |
if(isSelected && selectedButton != null) { |
2 |
26 Feb 07 |
jari |
368 |
selectedSector = selectedButton.getLocation(); |
2 |
26 Feb 07 |
jari |
369 |
g.setColor(Color.blue); |
2 |
26 Feb 07 |
jari |
370 |
g.drawRect(selectedSector.x-5, selectedSector.y-5, 54, 54); |
2 |
26 Feb 07 |
jari |
371 |
g.drawRect(selectedSector.x-4, selectedSector.y-4, 52, 52); |
2 |
26 Feb 07 |
jari |
372 |
} |
2 |
26 Feb 07 |
jari |
373 |
} |
2 |
26 Feb 07 |
jari |
374 |
} |
2 |
26 Feb 07 |
jari |
375 |
|
2 |
26 Feb 07 |
jari |
// Sets current algorithm |
2 |
26 Feb 07 |
jari |
377 |
private class ButtonListener implements ActionListener { |
2 |
26 Feb 07 |
jari |
378 |
public void actionPerformed(ActionEvent ae) { |
2 |
26 Feb 07 |
jari |
379 |
String algorithmName = ae.getActionCommand(); |
2 |
26 Feb 07 |
jari |
380 |
currentAlgorithmName = algorithmName; |
2 |
26 Feb 07 |
jari |
381 |
Object button = ae.getSource(); |
2 |
26 Feb 07 |
jari |
382 |
|
2 |
26 Feb 07 |
jari |
383 |
if(button != null && button instanceof JButton) { |
2 |
26 Feb 07 |
jari |
384 |
buttonPanel.setSelection((JButton)button); |
2 |
26 Feb 07 |
jari |
385 |
algorithmType = ScriptConstants.ALGORITHM_TYPE_CLUSTER; |
2 |
26 Feb 07 |
jari |
386 |
previewPanel.setValues("Analysis Algorithm", algorithmName+": "+((String)descriptions.get(algorithmName))); |
2 |
26 Feb 07 |
jari |
387 |
} |
2 |
26 Feb 07 |
jari |
388 |
} |
2 |
26 Feb 07 |
jari |
389 |
} |
2 |
26 Feb 07 |
jari |
390 |
|
2 |
26 Feb 07 |
jari |
391 |
} |
2 |
26 Feb 07 |
jari |
392 |
|
2 |
26 Feb 07 |
jari |
393 |
|
2 |
26 Feb 07 |
jari |
394 |
|
2 |
26 Feb 07 |
jari |
395 |
|
2 |
26 Feb 07 |
jari |
/** Support selection of adjustment algorithm |
2 |
26 Feb 07 |
jari |
397 |
*/ |
2 |
26 Feb 07 |
jari |
398 |
private class AdjustmentSelectionPanel extends ParameterPanel { |
2 |
26 Feb 07 |
jari |
//Filters (affymetrics as well detection filter and ....) |
2 |
26 Feb 07 |
jari |
//Gene Based transformations |
2 |
26 Feb 07 |
jari |
//NormSpots /RMS /SD MeanCenter DigSpots |
2 |
26 Feb 07 |
jari |
//Experiments (as above) |
2 |
26 Feb 07 |
jari |
//intensity adjustments |
2 |
26 Feb 07 |
jari |
404 |
|
2 |
26 Feb 07 |
jari |
405 |
ButtonGroup bg; |
2 |
26 Feb 07 |
jari |
406 |
JCheckBox noneBox; |
2 |
26 Feb 07 |
jari |
407 |
|
2 |
26 Feb 07 |
jari |
408 |
public AdjustmentSelectionPanel(boolean isAffyData) { |
2 |
26 Feb 07 |
jari |
409 |
super("Adjustment Selection"); |
2 |
26 Feb 07 |
jari |
410 |
setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
411 |
AdjustmentBoxListener listener = new AdjustmentBoxListener(); |
2 |
26 Feb 07 |
jari |
412 |
|
2 |
26 Feb 07 |
jari |
413 |
bg = new ButtonGroup(); |
2 |
26 Feb 07 |
jari |
414 |
noneBox = new JCheckBox("none", true); //used for reset() method |
2 |
26 Feb 07 |
jari |
415 |
bg.add(noneBox); |
2 |
26 Feb 07 |
jari |
416 |
|
2 |
26 Feb 07 |
jari |
//Filter Panel |
2 |
26 Feb 07 |
jari |
418 |
ParameterPanel filterPanel = new ParameterPanel("Gene/Row Filters"); |
2 |
26 Feb 07 |
jari |
419 |
filterPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
420 |
JCheckBox percBox = createCheckBox("Percentage Cutoff", "Requires x% valid expression values to retain a gene", listener); |
2 |
26 Feb 07 |
jari |
421 |
JCheckBox lowerBox = createCheckBox("Lower Cutoffs", "Cy3 and Cy5 must have a minium value \n to retain gene. (see info page)", listener); |
2 |
26 Feb 07 |
jari |
422 |
filterPanel.add(percBox, new GridBagConstraints(0,0,1,1,0,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(5,0,10,25), 0,0)); |
2 |
26 Feb 07 |
jari |
423 |
filterPanel.add(lowerBox, new GridBagConstraints(1,0,1,1,0,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(5,25,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
424 |
|
2 |
26 Feb 07 |
jari |
//Gene Panel |
2 |
26 Feb 07 |
jari |
426 |
ParameterPanel genePanel = new ParameterPanel("Gene/Row Based Adjustments"); |
2 |
26 Feb 07 |
jari |
427 |
genePanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
428 |
|
2 |
26 Feb 07 |
jari |
429 |
JCheckBox gNormBox = createCheckBox("Normalize Genes/Rows","Adjust Vector ||v||=1", listener); |
2 |
26 Feb 07 |
jari |
430 |
JCheckBox gRMSBox = createCheckBox("Divide Genes/Rows by RMS","Divide values by spot's RMS", listener); |
2 |
26 Feb 07 |
jari |
431 |
JCheckBox gSDBox = createCheckBox("Divide Genes/Rows by SD","Divide values by spot's SD", listener); |
2 |
26 Feb 07 |
jari |
432 |
JCheckBox gMCBox = createCheckBox("Mean Center Genes/Rows","Divide values by spot's Mean", listener); |
2 |
26 Feb 07 |
jari |
433 |
JCheckBox gMedCBox = createCheckBox("Median Center Genes/Rows","Divide values by spot's Median", listener); |
2 |
26 Feb 07 |
jari |
434 |
JCheckBox gDigBox = createCheckBox("Digital Genes/Rows","Bins spot's values into log2(#Spots) int value bins ", listener); |
2 |
26 Feb 07 |
jari |
435 |
|
2 |
26 Feb 07 |
jari |
436 |
genePanel.add(gNormBox, new GridBagConstraints(0,0,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(5,10,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
437 |
genePanel.add(gRMSBox, new GridBagConstraints(0,1,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,10,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
438 |
genePanel.add(gSDBox, new GridBagConstraints(0,2,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,10,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
439 |
genePanel.add(gMCBox, new GridBagConstraints(0,3,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,10,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
440 |
genePanel.add(gMedCBox, new GridBagConstraints(0,4,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,10,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
441 |
genePanel.add(gDigBox, new GridBagConstraints(0,5,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,10,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
442 |
|
2 |
26 Feb 07 |
jari |
//Experiment Panel |
2 |
26 Feb 07 |
jari |
444 |
ParameterPanel expPanel = new ParameterPanel("Sample/Column Based Adjustments"); |
2 |
26 Feb 07 |
jari |
445 |
expPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
446 |
|
2 |
26 Feb 07 |
jari |
447 |
JCheckBox eNormBox = createCheckBox("Normalize Samples/Columns","Adjust Vector ||v||=1", listener); |
2 |
26 Feb 07 |
jari |
448 |
JCheckBox eRMSBox = createCheckBox("Divide Samples/Columns by RMS","Divide values by sample's RMS", listener); |
2 |
26 Feb 07 |
jari |
449 |
JCheckBox eSDBox = createCheckBox("Divide Samples/Columns by SD","Divide values by sample's SD", listener); |
2 |
26 Feb 07 |
jari |
450 |
JCheckBox eMCBox = createCheckBox("Mean Center Samples/Columns","Divide values by sample's Mean", listener); |
2 |
26 Feb 07 |
jari |
451 |
JCheckBox eMedCBox = createCheckBox("Median Center Samples/Columns","Divide values by sample's Median", listener); |
2 |
26 Feb 07 |
jari |
452 |
JCheckBox eDigBox = createCheckBox("Digital Samples/Columns","Bins values into log2(#Exps) int value bins ", listener); |
2 |
26 Feb 07 |
jari |
453 |
|
2 |
26 Feb 07 |
jari |
454 |
expPanel.add(eNormBox, new GridBagConstraints(0,0,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(5,10,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
455 |
expPanel.add(eRMSBox, new GridBagConstraints(0,1,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,10,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
456 |
expPanel.add(eSDBox, new GridBagConstraints(0,2,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,10,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
457 |
expPanel.add(eMCBox, new GridBagConstraints(0,3,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,10,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
458 |
expPanel.add(eMedCBox, new GridBagConstraints(0,4,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,10,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
459 |
expPanel.add(eDigBox, new GridBagConstraints(0,5,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,10,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
460 |
|
2 |
26 Feb 07 |
jari |
//Policy Panel ** This is a global policy not an adjustment |
2 |
26 Feb 07 |
jari |
//ParameterPanel polPanel = new ParameterPanel("Experiment Based Adjustments"); |
2 |
26 Feb 07 |
jari |
//polPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
464 |
|
2 |
26 Feb 07 |
jari |
//Log Transformations |
2 |
26 Feb 07 |
jari |
// Do we want or need these, applies log two transformation to FloatMatrix which is in log 2 |
2 |
26 Feb 07 |
jari |
467 |
|
2 |
26 Feb 07 |
jari |
468 |
add(filterPanel, new GridBagConstraints(0,0,2,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,0,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
469 |
add(genePanel, new GridBagConstraints(0,1,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,0,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
470 |
add(expPanel, new GridBagConstraints(1,1,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,0,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
471 |
if(isAffyData) { |
2 |
26 Feb 07 |
jari |
//affy based Detection and Fold filters |
2 |
26 Feb 07 |
jari |
473 |
ParameterPanel affyPanel = new ParameterPanel("Affimetrix Filtering Options"); |
2 |
26 Feb 07 |
jari |
474 |
affyPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
475 |
JCheckBox affyDetectionBox = createCheckBox("Detection Filter", "Filters by detection flag.",listener); |
2 |
26 Feb 07 |
jari |
476 |
JCheckBox affyFoldBox = createCheckBox("Fold Filter", "Filters by fold change.",listener); |
2 |
26 Feb 07 |
jari |
477 |
affyPanel.add(affyDetectionBox, new GridBagConstraints(0,0,1,1,0,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(5,0,10,25), 0,0)); |
2 |
26 Feb 07 |
jari |
478 |
affyPanel.add(affyFoldBox, new GridBagConstraints(1,0,1,1,0,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(5,25,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
479 |
|
2 |
26 Feb 07 |
jari |
480 |
add(affyPanel, new GridBagConstraints(0,2,2,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,0,10,0), 0,0)); |
2 |
26 Feb 07 |
jari |
481 |
} |
2 |
26 Feb 07 |
jari |
482 |
} |
2 |
26 Feb 07 |
jari |
483 |
|
2 |
26 Feb 07 |
jari |
484 |
|
2 |
26 Feb 07 |
jari |
485 |
private JCheckBox createCheckBox(String label, String toolTip, ActionListener listener) { |
2 |
26 Feb 07 |
jari |
486 |
JCheckBox box = new JCheckBox(label); |
2 |
26 Feb 07 |
jari |
487 |
box.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
488 |
box.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
489 |
box.setActionCommand(label); |
2 |
26 Feb 07 |
jari |
490 |
box.setToolTipText(toolTip); |
2 |
26 Feb 07 |
jari |
491 |
box.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
492 |
bg.add(box); |
2 |
26 Feb 07 |
jari |
493 |
return box; |
2 |
26 Feb 07 |
jari |
494 |
} |
2 |
26 Feb 07 |
jari |
495 |
|
2 |
26 Feb 07 |
jari |
496 |
public void reset() { |
2 |
26 Feb 07 |
jari |
497 |
noneBox.setSelected(true); |
2 |
26 Feb 07 |
jari |
498 |
} |
2 |
26 Feb 07 |
jari |
499 |
|
2 |
26 Feb 07 |
jari |
// Sets current algorithm |
2 |
26 Feb 07 |
jari |
501 |
private class AdjustmentBoxListener implements ActionListener { |
2 |
26 Feb 07 |
jari |
502 |
public void actionPerformed(ActionEvent ae) { |
2 |
26 Feb 07 |
jari |
503 |
String algorithmName = ae.getActionCommand(); |
2 |
26 Feb 07 |
jari |
504 |
currentAlgorithmName = algorithmName; |
2 |
26 Feb 07 |
jari |
505 |
previewPanel.setValues("Adjustment Algorithm", algorithmName); |
2 |
26 Feb 07 |
jari |
506 |
algorithmType = ScriptConstants.ALGORITHM_TYPE_ADJUSTMENT; |
2 |
26 Feb 07 |
jari |
507 |
} |
2 |
26 Feb 07 |
jari |
508 |
} |
2 |
26 Feb 07 |
jari |
509 |
|
2 |
26 Feb 07 |
jari |
510 |
} |
2 |
26 Feb 07 |
jari |
511 |
|
2 |
26 Feb 07 |
jari |
512 |
private class NormalizationSelectionPanel extends JPanel { |
2 |
26 Feb 07 |
jari |
513 |
// |
2 |
26 Feb 07 |
jari |
514 |
|
2 |
26 Feb 07 |
jari |
515 |
} |
2 |
26 Feb 07 |
jari |
516 |
|
2 |
26 Feb 07 |
jari |
/** Supports selection of cluster selection algorithms |
2 |
26 Feb 07 |
jari |
518 |
*/ |
2 |
26 Feb 07 |
jari |
519 |
private class ClusterSelectionPanel extends JPanel { |
2 |
26 Feb 07 |
jari |
520 |
JRadioButton diversityButton; |
2 |
26 Feb 07 |
jari |
521 |
JRadioButton centroidEntropyButton; |
2 |
26 Feb 07 |
jari |
522 |
JRadioButton noButton; |
2 |
26 Feb 07 |
jari |
523 |
|
2 |
26 Feb 07 |
jari |
524 |
public ClusterSelectionPanel() { |
2 |
26 Feb 07 |
jari |
525 |
super(); |
2 |
26 Feb 07 |
jari |
526 |
setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
527 |
ButtonListener listener = new ButtonListener(); |
2 |
26 Feb 07 |
jari |
528 |
|
2 |
26 Feb 07 |
jari |
529 |
ParameterPanel panel = new ParameterPanel(); |
2 |
26 Feb 07 |
jari |
530 |
panel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
531 |
|
2 |
26 Feb 07 |
jari |
532 |
diversityButton = new JRadioButton("Diversity Ranking Cluster Selection", false); |
2 |
26 Feb 07 |
jari |
533 |
diversityButton.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
534 |
diversityButton.setOpaque(false); |
2 |
26 Feb 07 |
jari |
535 |
diversityButton.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
536 |
|
2 |
26 Feb 07 |
jari |
537 |
centroidEntropyButton = new JRadioButton("Centroid Variance or Entropy Cluster Selection", false); |
2 |
26 Feb 07 |
jari |
538 |
centroidEntropyButton.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
539 |
centroidEntropyButton.setOpaque(false); |
2 |
26 Feb 07 |
jari |
540 |
centroidEntropyButton.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
541 |
|
2 |
26 Feb 07 |
jari |
542 |
noButton = new JRadioButton("hidden", true); |
2 |
26 Feb 07 |
jari |
543 |
ButtonGroup bg = new ButtonGroup(); |
2 |
26 Feb 07 |
jari |
544 |
bg.add(diversityButton); |
2 |
26 Feb 07 |
jari |
545 |
bg.add(centroidEntropyButton); |
2 |
26 Feb 07 |
jari |
546 |
bg.add(noButton); |
2 |
26 Feb 07 |
jari |
547 |
|
2 |
26 Feb 07 |
jari |
548 |
panel.add(centroidEntropyButton, new GridBagConstraints(0,0,1,1,0,0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,20,0), 0,0)); |
2 |
26 Feb 07 |
jari |
549 |
panel.add(diversityButton, new GridBagConstraints(0,1,1,1,0,0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(20,0,0,0), 0,0)); |
2 |
26 Feb 07 |
jari |
550 |
|
2 |
26 Feb 07 |
jari |
551 |
add(panel, 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 |
552 |
} |
2 |
26 Feb 07 |
jari |
553 |
|
2 |
26 Feb 07 |
jari |
554 |
public void reset() { |
2 |
26 Feb 07 |
jari |
555 |
noButton.setSelected(true); |
2 |
26 Feb 07 |
jari |
556 |
} |
2 |
26 Feb 07 |
jari |
557 |
|
2 |
26 Feb 07 |
jari |
// Sets current algorithm |
2 |
26 Feb 07 |
jari |
559 |
private class ButtonListener implements ActionListener { |
2 |
26 Feb 07 |
jari |
560 |
public void actionPerformed(ActionEvent ae) { |
2 |
26 Feb 07 |
jari |
561 |
if(diversityButton.isSelected()) { |
2 |
26 Feb 07 |
jari |
562 |
previewPanel.setValues("Cluster Selection", "Diversity Ranking Cluster Selection"); |
2 |
26 Feb 07 |
jari |
563 |
algorithmType = ScriptConstants.ALGORITHM_TYPE_CLUSTER_SELECTION; |
2 |
26 Feb 07 |
jari |
564 |
currentAlgorithmName = "Diversity Ranking Cluster Selection"; |
2 |
26 Feb 07 |
jari |
565 |
} else if(centroidEntropyButton.isSelected()) { |
2 |
26 Feb 07 |
jari |
566 |
previewPanel.setValues("Cluster Selection", "Centroid Entropy Ranking Cluster Selection"); |
2 |
26 Feb 07 |
jari |
567 |
algorithmType = ScriptConstants.ALGORITHM_TYPE_CLUSTER_SELECTION; |
2 |
26 Feb 07 |
jari |
568 |
currentAlgorithmName = "Centroid Entropy/Variance Ranking Cluster Selection"; |
2 |
26 Feb 07 |
jari |
569 |
} |
2 |
26 Feb 07 |
jari |
570 |
} |
2 |
26 Feb 07 |
jari |
571 |
} |
2 |
26 Feb 07 |
jari |
572 |
} |
2 |
26 Feb 07 |
jari |
573 |
|
2 |
26 Feb 07 |
jari |
574 |
|
2 |
26 Feb 07 |
jari |
575 |
|
2 |
26 Feb 07 |
jari |
576 |
/** |
2 |
26 Feb 07 |
jari |
* The class to listen to the dialog events. |
2 |
26 Feb 07 |
jari |
578 |
*/ |
2 |
26 Feb 07 |
jari |
579 |
private class Listener extends DialogListener { |
2 |
26 Feb 07 |
jari |
580 |
|
2 |
26 Feb 07 |
jari |
581 |
public void actionPerformed(ActionEvent e) { |
2 |
26 Feb 07 |
jari |
582 |
Object source = e.getSource(); |
2 |
26 Feb 07 |
jari |
583 |
if (source == okButton) { |
2 |
26 Feb 07 |
jari |
584 |
result = JOptionPane.OK_OPTION; |
2 |
26 Feb 07 |
jari |
585 |
dispose(); |
2 |
26 Feb 07 |
jari |
586 |
} else if (source == cancelButton) { |
2 |
26 Feb 07 |
jari |
587 |
result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
588 |
dispose(); |
2 |
26 Feb 07 |
jari |
589 |
} |
2 |
26 Feb 07 |
jari |
590 |
else if (source == resetButton) { |
2 |
26 Feb 07 |
jari |
591 |
onReset(); |
2 |
26 Feb 07 |
jari |
592 |
} |
2 |
26 Feb 07 |
jari |
593 |
else if (source == infoButton){ |
2 |
26 Feb 07 |
jari |
594 |
HelpWindow hw = new HelpWindow(ScriptAlgorithmInitDialog.this, "Script Algorithm Initialization Dialog"); |
2 |
26 Feb 07 |
jari |
595 |
if(hw.getWindowContent()){ |
2 |
26 Feb 07 |
jari |
596 |
hw.setSize(450,650); |
2 |
26 Feb 07 |
jari |
597 |
hw.setLocation(); |
2 |
26 Feb 07 |
jari |
598 |
hw.show(); |
2 |
26 Feb 07 |
jari |
599 |
} |
2 |
26 Feb 07 |
jari |
600 |
else { |
2 |
26 Feb 07 |
jari |
601 |
hw.setVisible(false); |
2 |
26 Feb 07 |
jari |
602 |
hw.dispose(); |
2 |
26 Feb 07 |
jari |
603 |
} |
2 |
26 Feb 07 |
jari |
604 |
} |
2 |
26 Feb 07 |
jari |
605 |
} |
2 |
26 Feb 07 |
jari |
606 |
|
2 |
26 Feb 07 |
jari |
607 |
public void windowClosing(WindowEvent e) { |
2 |
26 Feb 07 |
jari |
608 |
result = JOptionPane.CLOSED_OPTION; |
2 |
26 Feb 07 |
jari |
609 |
dispose(); |
2 |
26 Feb 07 |
jari |
610 |
} |
2 |
26 Feb 07 |
jari |
611 |
} |
2 |
26 Feb 07 |
jari |
612 |
|
2 |
26 Feb 07 |
jari |
613 |
} |