2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
Copyright @ 1999-2005, 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 |
* DAMProcessInitDialog.java |
2 |
26 Feb 07 |
jari |
7 |
* |
2 |
26 Feb 07 |
jari |
8 |
*/ |
2 |
26 Feb 07 |
jari |
9 |
|
2 |
26 Feb 07 |
jari |
10 |
package org.tigr.microarray.mev.cluster.gui.impl.dam; |
2 |
26 Feb 07 |
jari |
11 |
|
2 |
26 Feb 07 |
jari |
12 |
import java.awt.Color; |
2 |
26 Feb 07 |
jari |
13 |
import java.awt.Dimension; |
2 |
26 Feb 07 |
jari |
14 |
import java.awt.Font; |
2 |
26 Feb 07 |
jari |
15 |
import java.awt.GridBagConstraints; |
2 |
26 Feb 07 |
jari |
16 |
import java.awt.GridBagLayout; |
2 |
26 Feb 07 |
jari |
17 |
import java.awt.Toolkit; |
2 |
26 Feb 07 |
jari |
18 |
import java.awt.event.ActionEvent; |
2 |
26 Feb 07 |
jari |
19 |
import java.awt.event.ItemEvent; |
2 |
26 Feb 07 |
jari |
20 |
import java.awt.event.ItemListener; |
2 |
26 Feb 07 |
jari |
21 |
import java.awt.event.WindowAdapter; |
2 |
26 Feb 07 |
jari |
22 |
import java.awt.event.WindowEvent; |
2 |
26 Feb 07 |
jari |
23 |
|
2 |
26 Feb 07 |
jari |
24 |
import javax.swing.ButtonGroup; |
2 |
26 Feb 07 |
jari |
25 |
import javax.swing.JCheckBox; |
2 |
26 Feb 07 |
jari |
26 |
import javax.swing.JOptionPane; |
2 |
26 Feb 07 |
jari |
27 |
import javax.swing.JPanel; |
2 |
26 Feb 07 |
jari |
28 |
import javax.swing.JRadioButton; |
2 |
26 Feb 07 |
jari |
29 |
import javax.swing.UIManager; |
2 |
26 Feb 07 |
jari |
30 |
import javax.swing.border.EtchedBorder; |
2 |
26 Feb 07 |
jari |
31 |
import javax.swing.border.TitledBorder; |
2 |
26 Feb 07 |
jari |
32 |
|
2 |
26 Feb 07 |
jari |
33 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.AlgorithmDialog; |
2 |
26 Feb 07 |
jari |
34 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.DialogListener; |
2 |
26 Feb 07 |
jari |
35 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.SampleSelectionPanel; |
2 |
26 Feb 07 |
jari |
36 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.dialogHelpUtil.HelpWindow; |
2 |
26 Feb 07 |
jari |
37 |
|
2 |
26 Feb 07 |
jari |
38 |
public class DAMProcessInitDialog extends AlgorithmDialog { |
2 |
26 Feb 07 |
jari |
39 |
|
2 |
26 Feb 07 |
jari |
40 |
int result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
41 |
boolean skipGeneScreeningStep = false; |
2 |
26 Feb 07 |
jari |
42 |
boolean skipCrossValidationStep = false; |
2 |
26 Feb 07 |
jari |
43 |
private SampleSelectionPanel sampleSelectionPanel; |
2 |
26 Feb 07 |
jari |
44 |
|
2 |
26 Feb 07 |
jari |
45 |
private JPanel processPanel; |
2 |
26 Feb 07 |
jari |
46 |
private JPanel KPanel; |
2 |
26 Feb 07 |
jari |
47 |
private JRadioButton defKbutton; |
2 |
26 Feb 07 |
jari |
48 |
private JRadioButton calcKbutton; |
2 |
26 Feb 07 |
jari |
49 |
private JCheckBox skipGeneScreenBox; |
2 |
26 Feb 07 |
jari |
50 |
private JCheckBox skipCrossValBox; |
2 |
26 Feb 07 |
jari |
51 |
|
2 |
26 Feb 07 |
jari |
52 |
private ButtonGroup Kselection; |
2 |
26 Feb 07 |
jari |
53 |
|
2 |
26 Feb 07 |
jari |
54 |
|
2 |
26 Feb 07 |
jari |
/** Creates new form SVMTrain_ClassifierSelectDialog */ |
2 |
26 Feb 07 |
jari |
56 |
public DAMProcessInitDialog(java.awt.Frame parent, boolean modal) { |
2 |
26 Feb 07 |
jari |
57 |
super(parent, "DAM Process Initialization" ,modal); |
2 |
26 Feb 07 |
jari |
58 |
|
2 |
26 Feb 07 |
jari |
59 |
okButton.setText("Next"); |
2 |
26 Feb 07 |
jari |
60 |
|
2 |
26 Feb 07 |
jari |
61 |
Listener listener = new Listener(); |
2 |
26 Feb 07 |
jari |
62 |
initComponents(listener); |
2 |
26 Feb 07 |
jari |
63 |
setActionListeners(listener); |
2 |
26 Feb 07 |
jari |
64 |
|
2 |
26 Feb 07 |
jari |
65 |
pack(); |
2 |
26 Feb 07 |
jari |
66 |
setResizable(false); |
2 |
26 Feb 07 |
jari |
67 |
} |
2 |
26 Feb 07 |
jari |
68 |
|
2 |
26 Feb 07 |
jari |
69 |
private void initComponents(Listener listener) { |
2 |
26 Feb 07 |
jari |
70 |
JPanel mainPanel = new JPanel(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
71 |
mainPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
72 |
|
2 |
26 Feb 07 |
jari |
73 |
setBackground(Color.lightGray); |
2 |
26 Feb 07 |
jari |
74 |
addWindowListener(new WindowAdapter() { |
2 |
26 Feb 07 |
jari |
75 |
public void windowClosing(WindowEvent evt) { |
2 |
26 Feb 07 |
jari |
76 |
closeDialog(evt); |
2 |
26 Feb 07 |
jari |
77 |
} |
2 |
26 Feb 07 |
jari |
78 |
}); |
2 |
26 Feb 07 |
jari |
79 |
|
2 |
26 Feb 07 |
jari |
80 |
|
2 |
26 Feb 07 |
jari |
81 |
processPanel = new JPanel(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
82 |
processPanel.setBorder(new javax.swing.border.TitledBorder(new EtchedBorder(EtchedBorder.RAISED), "DAM Process Selection", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), Color.black)); |
2 |
26 Feb 07 |
jari |
83 |
processPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
84 |
|
2 |
26 Feb 07 |
jari |
85 |
skipGeneScreenBox = new JCheckBox("Skip Gene Screening step (ANOVA)"); |
2 |
26 Feb 07 |
jari |
86 |
skipGeneScreenBox.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
87 |
skipGeneScreenBox.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
88 |
skipGeneScreenBox.setForeground(UIManager.getColor("Label.foreground")); |
2 |
26 Feb 07 |
jari |
89 |
skipGeneScreenBox.addItemListener(listener); |
2 |
26 Feb 07 |
jari |
90 |
|
2 |
26 Feb 07 |
jari |
91 |
GridBagConstraints gbc1 = new GridBagConstraints(); |
2 |
26 Feb 07 |
jari |
92 |
gbc1.gridx = 0; |
2 |
26 Feb 07 |
jari |
93 |
gbc1.gridy = 0; |
2 |
26 Feb 07 |
jari |
94 |
gbc1.weightx = 1; |
2 |
26 Feb 07 |
jari |
95 |
gbc1.fill = GridBagConstraints.HORIZONTAL; |
2 |
26 Feb 07 |
jari |
96 |
gbc1.insets = new java.awt.Insets(0, 60, 0, 0); |
2 |
26 Feb 07 |
jari |
97 |
gbc1.fill = GridBagConstraints.BOTH; |
2 |
26 Feb 07 |
jari |
98 |
gbc1.weightx = 1.0; |
2 |
26 Feb 07 |
jari |
99 |
processPanel.add(skipGeneScreenBox, gbc1); |
2 |
26 Feb 07 |
jari |
100 |
|
2 |
26 Feb 07 |
jari |
101 |
skipCrossValBox = new JCheckBox("Skip Cross Validation step (LOOCV)"); |
2 |
26 Feb 07 |
jari |
102 |
skipCrossValBox.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
103 |
skipCrossValBox.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
104 |
skipCrossValBox.setForeground(UIManager.getColor("Label.foreground")); |
2 |
26 Feb 07 |
jari |
105 |
skipCrossValBox.addItemListener(listener); |
2 |
26 Feb 07 |
jari |
106 |
|
2 |
26 Feb 07 |
jari |
107 |
gbc1 = new GridBagConstraints(); |
2 |
26 Feb 07 |
jari |
108 |
gbc1.gridx = 0; |
2 |
26 Feb 07 |
jari |
109 |
gbc1.gridy = 1; |
2 |
26 Feb 07 |
jari |
110 |
gbc1.weightx = 1; |
2 |
26 Feb 07 |
jari |
111 |
gbc1.fill = GridBagConstraints.BOTH; |
2 |
26 Feb 07 |
jari |
112 |
gbc1.insets = new java.awt.Insets(0, 60, 0, 0); |
2 |
26 Feb 07 |
jari |
113 |
gbc1.weightx = 1.0; |
2 |
26 Feb 07 |
jari |
114 |
processPanel.add(skipCrossValBox, gbc1); |
2 |
26 Feb 07 |
jari |
115 |
|
2 |
26 Feb 07 |
jari |
116 |
KPanel = new JPanel(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
117 |
KPanel.setBorder(new javax.swing.border.TitledBorder(new EtchedBorder(EtchedBorder.RAISED), "Determining K value", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), Color.black)); |
2 |
26 Feb 07 |
jari |
118 |
KPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
119 |
|
2 |
26 Feb 07 |
jari |
120 |
Kselection = new ButtonGroup(); |
2 |
26 Feb 07 |
jari |
121 |
defKbutton = new JRadioButton(); |
2 |
26 Feb 07 |
jari |
122 |
calcKbutton = new JRadioButton(); |
2 |
26 Feb 07 |
jari |
123 |
|
2 |
26 Feb 07 |
jari |
124 |
defKbutton.setToolTipText("Use default K = 3"); |
2 |
26 Feb 07 |
jari |
125 |
defKbutton.setSelected(true); |
2 |
26 Feb 07 |
jari |
126 |
defKbutton.setText("Default"); |
2 |
26 Feb 07 |
jari |
127 |
defKbutton.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
128 |
defKbutton.setForeground(UIManager.getColor("Label.foreground")); |
2 |
26 Feb 07 |
jari |
129 |
Kselection.add(defKbutton); |
2 |
26 Feb 07 |
jari |
130 |
defKbutton.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
131 |
GridBagConstraints gbc2 = new java.awt.GridBagConstraints(); |
2 |
26 Feb 07 |
jari |
132 |
gbc2.gridx = 0; |
2 |
26 Feb 07 |
jari |
133 |
gbc2.gridy = 0; |
2 |
26 Feb 07 |
jari |
134 |
gbc2.fill = GridBagConstraints.BOTH; |
2 |
26 Feb 07 |
jari |
135 |
gbc2.insets = new java.awt.Insets(0, 40, 0, 0); |
2 |
26 Feb 07 |
jari |
136 |
gbc2.weightx = 1.0; |
2 |
26 Feb 07 |
jari |
137 |
KPanel.add(defKbutton, gbc2); |
2 |
26 Feb 07 |
jari |
138 |
|
2 |
26 Feb 07 |
jari |
139 |
calcKbutton.setToolTipText("Calculate optimum K from loaded data"); |
2 |
26 Feb 07 |
jari |
140 |
calcKbutton.setText("Calculate"); |
2 |
26 Feb 07 |
jari |
141 |
calcKbutton.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
142 |
calcKbutton.setForeground(UIManager.getColor("Label.foreground")); |
2 |
26 Feb 07 |
jari |
143 |
Kselection.add(calcKbutton); |
2 |
26 Feb 07 |
jari |
144 |
calcKbutton.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
145 |
gbc2 = new java.awt.GridBagConstraints(); |
2 |
26 Feb 07 |
jari |
146 |
gbc2.gridx = 1; |
2 |
26 Feb 07 |
jari |
147 |
gbc2.gridy = 0; |
2 |
26 Feb 07 |
jari |
148 |
gbc2.fill = GridBagConstraints.BOTH; |
2 |
26 Feb 07 |
jari |
149 |
gbc2.insets = new java.awt.Insets(0, 40, 0, 0); |
2 |
26 Feb 07 |
jari |
150 |
gbc2.weightx = 1.0; |
2 |
26 Feb 07 |
jari |
151 |
KPanel.add(calcKbutton, gbc2); |
2 |
26 Feb 07 |
jari |
152 |
|
2 |
26 Feb 07 |
jari |
153 |
GridBagConstraints gbc3 = new GridBagConstraints(); |
2 |
26 Feb 07 |
jari |
154 |
gbc3.gridx = 0; |
2 |
26 Feb 07 |
jari |
155 |
gbc3.gridy = 0; |
2 |
26 Feb 07 |
jari |
156 |
gbc3.weightx = 1; |
2 |
26 Feb 07 |
jari |
157 |
gbc3.fill = GridBagConstraints.HORIZONTAL; |
2 |
26 Feb 07 |
jari |
158 |
gbc3.insets = new java.awt.Insets(4, 0, 0, 0); |
2 |
26 Feb 07 |
jari |
159 |
|
2 |
26 Feb 07 |
jari |
160 |
mainPanel.add(processPanel, gbc3); |
2 |
26 Feb 07 |
jari |
161 |
|
2 |
26 Feb 07 |
jari |
162 |
gbc3 = new GridBagConstraints(); |
2 |
26 Feb 07 |
jari |
163 |
gbc3.gridx = 0; |
2 |
26 Feb 07 |
jari |
164 |
gbc3.gridy = 1; |
2 |
26 Feb 07 |
jari |
165 |
gbc3.weightx = 1; |
2 |
26 Feb 07 |
jari |
166 |
gbc3.fill = GridBagConstraints.HORIZONTAL; |
2 |
26 Feb 07 |
jari |
167 |
gbc3.insets = new java.awt.Insets(4, 0, 0, 0); |
2 |
26 Feb 07 |
jari |
168 |
|
2 |
26 Feb 07 |
jari |
169 |
mainPanel.add(KPanel, gbc3); |
2 |
26 Feb 07 |
jari |
170 |
|
2 |
26 Feb 07 |
jari |
171 |
addContent(mainPanel); |
2 |
26 Feb 07 |
jari |
172 |
} |
2 |
26 Feb 07 |
jari |
173 |
|
2 |
26 Feb 07 |
jari |
/** Closes the dialog */ |
2 |
26 Feb 07 |
jari |
175 |
private void closeDialog(WindowEvent evt) { |
2 |
26 Feb 07 |
jari |
176 |
setVisible(false); |
2 |
26 Feb 07 |
jari |
177 |
dispose(); |
2 |
26 Feb 07 |
jari |
178 |
} |
2 |
26 Feb 07 |
jari |
179 |
|
2 |
26 Feb 07 |
jari |
180 |
|
2 |
26 Feb 07 |
jari |
181 |
public int showModal() { |
2 |
26 Feb 07 |
jari |
182 |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
2 |
26 Feb 07 |
jari |
183 |
setLocation((screenSize.width - getSize().width)/2, (screenSize.height - getSize().height)/2); |
2 |
26 Feb 07 |
jari |
184 |
show(); |
2 |
26 Feb 07 |
jari |
185 |
return result; |
2 |
26 Feb 07 |
jari |
186 |
} |
2 |
26 Feb 07 |
jari |
187 |
|
2 |
26 Feb 07 |
jari |
188 |
|
2 |
26 Feb 07 |
jari |
189 |
|
2 |
26 Feb 07 |
jari |
190 |
/** |
2 |
26 Feb 07 |
jari |
* @param args the command line arguments |
2 |
26 Feb 07 |
jari |
192 |
*/ |
2 |
26 Feb 07 |
jari |
193 |
public static void main(String args[]) { |
2 |
26 Feb 07 |
jari |
194 |
new DAMProcessInitDialog(new javax.swing.JFrame(), true).show(); |
2 |
26 Feb 07 |
jari |
195 |
System.exit(0); |
2 |
26 Feb 07 |
jari |
196 |
} |
2 |
26 Feb 07 |
jari |
197 |
|
2 |
26 Feb 07 |
jari |
198 |
|
2 |
26 Feb 07 |
jari |
199 |
public boolean getSkipGeneSelectionValue() { |
2 |
26 Feb 07 |
jari |
200 |
return skipGeneScreenBox.isSelected(); |
2 |
26 Feb 07 |
jari |
201 |
} |
2 |
26 Feb 07 |
jari |
202 |
|
2 |
26 Feb 07 |
jari |
203 |
public boolean getSkipLOOCVValue() { |
2 |
26 Feb 07 |
jari |
204 |
return skipCrossValBox.isSelected(); |
2 |
26 Feb 07 |
jari |
205 |
} |
2 |
26 Feb 07 |
jari |
206 |
|
2 |
26 Feb 07 |
jari |
207 |
private class Listener extends DialogListener implements ItemListener { |
2 |
26 Feb 07 |
jari |
208 |
|
2 |
26 Feb 07 |
jari |
209 |
public void actionPerformed(ActionEvent e) { |
2 |
26 Feb 07 |
jari |
210 |
String command = e.getActionCommand(); |
2 |
26 Feb 07 |
jari |
211 |
if (command.equals("ok-command")) { |
2 |
26 Feb 07 |
jari |
212 |
result = JOptionPane.OK_OPTION; |
2 |
26 Feb 07 |
jari |
213 |
dispose(); |
2 |
26 Feb 07 |
jari |
214 |
} else if (command.equals("cancel-command")) { |
2 |
26 Feb 07 |
jari |
215 |
result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
216 |
dispose(); |
2 |
26 Feb 07 |
jari |
217 |
} else if (command.equals("reset-command")){ |
2 |
26 Feb 07 |
jari |
218 |
skipGeneScreeningStep = false; |
2 |
26 Feb 07 |
jari |
219 |
skipCrossValidationStep = false; |
2 |
26 Feb 07 |
jari |
220 |
skipGeneScreenBox.setSelected(false); |
2 |
26 Feb 07 |
jari |
221 |
skipCrossValBox.setSelected(false); |
2 |
26 Feb 07 |
jari |
222 |
defKbutton.setSelected(true); |
2 |
26 Feb 07 |
jari |
223 |
} else if (command.equals("info-command")){ |
2 |
26 Feb 07 |
jari |
224 |
HelpWindow hw = new HelpWindow(DAMProcessInitDialog.this, "DAM Process Initialization Dialog"); |
2 |
26 Feb 07 |
jari |
225 |
if(hw.getWindowContent()){ |
2 |
26 Feb 07 |
jari |
226 |
hw.setSize(450,650); |
2 |
26 Feb 07 |
jari |
227 |
hw.setLocation(); |
2 |
26 Feb 07 |
jari |
228 |
hw.show(); |
2 |
26 Feb 07 |
jari |
229 |
} |
2 |
26 Feb 07 |
jari |
230 |
else { |
2 |
26 Feb 07 |
jari |
231 |
hw.setVisible(false); |
2 |
26 Feb 07 |
jari |
232 |
hw.dispose(); |
2 |
26 Feb 07 |
jari |
233 |
} |
2 |
26 Feb 07 |
jari |
234 |
} |
2 |
26 Feb 07 |
jari |
235 |
|
2 |
26 Feb 07 |
jari |
236 |
} |
2 |
26 Feb 07 |
jari |
237 |
|
2 |
26 Feb 07 |
jari |
238 |
public void itemStateChanged(ItemEvent e) { |
2 |
26 Feb 07 |
jari |
239 |
|
2 |
26 Feb 07 |
jari |
240 |
Object source = e.getItemSelectable(); |
2 |
26 Feb 07 |
jari |
241 |
|
2 |
26 Feb 07 |
jari |
242 |
if (source == skipGeneScreenBox) { |
2 |
26 Feb 07 |
jari |
243 |
if (skipGeneScreenBox.isSelected()) { |
2 |
26 Feb 07 |
jari |
244 |
skipGeneScreeningStep = true; |
2 |
26 Feb 07 |
jari |
245 |
} else { |
2 |
26 Feb 07 |
jari |
246 |
skipGeneScreeningStep = false; |
2 |
26 Feb 07 |
jari |
247 |
} |
2 |
26 Feb 07 |
jari |
248 |
} else if (source == skipCrossValBox) { |
2 |
26 Feb 07 |
jari |
249 |
if (skipCrossValBox.isSelected()) { |
2 |
26 Feb 07 |
jari |
250 |
skipCrossValidationStep = true; |
2 |
26 Feb 07 |
jari |
251 |
} else { |
2 |
26 Feb 07 |
jari |
252 |
skipCrossValidationStep = false; |
2 |
26 Feb 07 |
jari |
253 |
} |
2 |
26 Feb 07 |
jari |
254 |
} |
2 |
26 Feb 07 |
jari |
255 |
} |
2 |
26 Feb 07 |
jari |
256 |
|
2 |
26 Feb 07 |
jari |
257 |
|
2 |
26 Feb 07 |
jari |
258 |
public void windowClosing(WindowEvent e) { |
2 |
26 Feb 07 |
jari |
259 |
result = JOptionPane.CLOSED_OPTION; |
2 |
26 Feb 07 |
jari |
260 |
dispose(); |
2 |
26 Feb 07 |
jari |
261 |
} |
2 |
26 Feb 07 |
jari |
262 |
|
2 |
26 Feb 07 |
jari |
263 |
} |
2 |
26 Feb 07 |
jari |
264 |
|
2 |
26 Feb 07 |
jari |
265 |
} |
2 |
26 Feb 07 |
jari |
266 |
|