2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
* Created on Sep 1, 2005 |
2 |
26 Feb 07 |
jari |
3 |
*/ |
2 |
26 Feb 07 |
jari |
4 |
package org.tigr.microarray.mev.cluster.gui.impl.bridge; |
2 |
26 Feb 07 |
jari |
5 |
|
2 |
26 Feb 07 |
jari |
6 |
import java.awt.BorderLayout; |
2 |
26 Feb 07 |
jari |
7 |
import java.awt.Color; |
2 |
26 Feb 07 |
jari |
8 |
import java.awt.Dimension; |
2 |
26 Feb 07 |
jari |
9 |
import java.awt.Font; |
2 |
26 Feb 07 |
jari |
10 |
import java.awt.Frame; |
2 |
26 Feb 07 |
jari |
11 |
import java.awt.Toolkit; |
2 |
26 Feb 07 |
jari |
12 |
import java.awt.event.ActionEvent; |
2 |
26 Feb 07 |
jari |
13 |
import java.awt.event.ActionListener; |
2 |
26 Feb 07 |
jari |
14 |
import java.awt.event.ItemEvent; |
2 |
26 Feb 07 |
jari |
15 |
import java.awt.event.ItemListener; |
2 |
26 Feb 07 |
jari |
16 |
import java.awt.event.WindowEvent; |
2 |
26 Feb 07 |
jari |
17 |
import java.util.StringTokenizer; |
2 |
26 Feb 07 |
jari |
18 |
import java.util.Vector; |
2 |
26 Feb 07 |
jari |
19 |
|
2 |
26 Feb 07 |
jari |
20 |
import javax.swing.BorderFactory; |
2 |
26 Feb 07 |
jari |
21 |
import javax.swing.Box; |
2 |
26 Feb 07 |
jari |
22 |
import javax.swing.BoxLayout; |
2 |
26 Feb 07 |
jari |
23 |
import javax.swing.ButtonGroup; |
2 |
26 Feb 07 |
jari |
24 |
import javax.swing.JButton; |
2 |
26 Feb 07 |
jari |
25 |
import javax.swing.JCheckBox; |
2 |
26 Feb 07 |
jari |
26 |
import javax.swing.JComboBox; |
2 |
26 Feb 07 |
jari |
27 |
import javax.swing.JLabel; |
2 |
26 Feb 07 |
jari |
28 |
import javax.swing.JOptionPane; |
2 |
26 Feb 07 |
jari |
29 |
import javax.swing.JPanel; |
2 |
26 Feb 07 |
jari |
30 |
import javax.swing.JRadioButton; |
2 |
26 Feb 07 |
jari |
31 |
import javax.swing.JSpinner; |
2 |
26 Feb 07 |
jari |
32 |
import javax.swing.JTextArea; |
2 |
26 Feb 07 |
jari |
33 |
import javax.swing.JTextField; |
2 |
26 Feb 07 |
jari |
34 |
import javax.swing.SpinnerNumberModel; |
2 |
26 Feb 07 |
jari |
35 |
import javax.swing.SpringLayout; |
2 |
26 Feb 07 |
jari |
36 |
import javax.swing.border.Border; |
2 |
26 Feb 07 |
jari |
37 |
import javax.swing.border.TitledBorder; |
2 |
26 Feb 07 |
jari |
38 |
|
2 |
26 Feb 07 |
jari |
39 |
import org.tigr.microarray.mev.TMEV; |
2 |
26 Feb 07 |
jari |
40 |
import org.tigr.microarray.mev.cluster.gui.IData; |
2 |
26 Feb 07 |
jari |
41 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.AlgorithmDialog; |
2 |
26 Feb 07 |
jari |
42 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.DialogListener; |
2 |
26 Feb 07 |
jari |
43 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.dialogHelpUtil.HelpWindow; |
2 |
26 Feb 07 |
jari |
44 |
import org.tigr.microarray.mev.r.RHyb; |
2 |
26 Feb 07 |
jari |
45 |
import org.tigr.microarray.mev.r.RHybSet; |
2 |
26 Feb 07 |
jari |
46 |
import org.tigr.microarray.mev.r.SpringUtilities; |
2 |
26 Feb 07 |
jari |
47 |
|
2 |
26 Feb 07 |
jari |
48 |
/** |
2 |
26 Feb 07 |
jari |
* @author iVu |
2 |
26 Feb 07 |
jari |
50 |
*/ |
2 |
26 Feb 07 |
jari |
51 |
public class BridgeInitDialog extends AlgorithmDialog { |
2 |
26 Feb 07 |
jari |
52 |
private int result; |
2 |
26 Feb 07 |
jari |
53 |
private int dataType; |
2 |
26 Feb 07 |
jari |
54 |
private boolean connAdded = false; |
2 |
26 Feb 07 |
jari |
55 |
|
2 |
26 Feb 07 |
jari |
56 |
private AdvListener al; |
2 |
26 Feb 07 |
jari |
57 |
|
2 |
26 Feb 07 |
jari |
//private BridgeHyb[] bridgeHybs; |
2 |
26 Feb 07 |
jari |
59 |
private RHyb[] rHybs; |
2 |
26 Feb 07 |
jari |
60 |
|
2 |
26 Feb 07 |
jari |
//private Vector vCy3Radio; |
2 |
26 Feb 07 |
jari |
62 |
private Vector vRHyb; |
2 |
26 Feb 07 |
jari |
63 |
|
2 |
26 Feb 07 |
jari |
64 |
private JCheckBox advCheckBox; |
2 |
26 Feb 07 |
jari |
65 |
private JSpinner burnInSpinner; |
2 |
26 Feb 07 |
jari |
66 |
private JSpinner numIterSpinner; |
2 |
26 Feb 07 |
jari |
67 |
private JSpinner thresholdSpinner; |
2 |
26 Feb 07 |
jari |
68 |
private JLabel burnInLabel; |
2 |
26 Feb 07 |
jari |
69 |
private JLabel numIterLabel; |
2 |
26 Feb 07 |
jari |
70 |
private JLabel thresholdLabel; |
2 |
26 Feb 07 |
jari |
71 |
private JButton addConnButton; |
2 |
26 Feb 07 |
jari |
72 |
private JComboBox connCombo; |
2 |
26 Feb 07 |
jari |
73 |
private JTextField newConn; |
2 |
26 Feb 07 |
jari |
74 |
|
2 |
26 Feb 07 |
jari |
75 |
private JRadioButton ratioButton; |
2 |
26 Feb 07 |
jari |
76 |
private JRadioButton affyButton; |
2 |
26 Feb 07 |
jari |
77 |
|
2 |
26 Feb 07 |
jari |
78 |
private JLabel hybColLabel; |
2 |
26 Feb 07 |
jari |
79 |
private JLabel cy3Label; |
2 |
26 Feb 07 |
jari |
80 |
private JLabel cy5Label; |
2 |
26 Feb 07 |
jari |
81 |
|
2 |
26 Feb 07 |
jari |
82 |
private String yNum = "IntB"; |
2 |
26 Feb 07 |
jari |
83 |
private String yDen = "IntA"; |
2 |
26 Feb 07 |
jari |
84 |
|
2 |
26 Feb 07 |
jari |
85 |
public static String DEFAULT_ADD_TEXT = "Enter a new location"; |
2 |
26 Feb 07 |
jari |
86 |
|
2 |
26 Feb 07 |
jari |
87 |
|
2 |
26 Feb 07 |
jari |
88 |
|
2 |
26 Feb 07 |
jari |
89 |
|
2 |
26 Feb 07 |
jari |
90 |
/** |
2 |
26 Feb 07 |
jari |
* @param parent |
2 |
26 Feb 07 |
jari |
* @param title |
2 |
26 Feb 07 |
jari |
* @param modal |
2 |
26 Feb 07 |
jari |
94 |
*/ |
2 |
26 Feb 07 |
jari |
95 |
public BridgeInitDialog( Frame parent, String[] hybNames, int dataTypeP ) { |
2 |
26 Feb 07 |
jari |
96 |
super( parent, "Bridge Initialization Dialog", true ); |
2 |
26 Feb 07 |
jari |
97 |
this.setSize( 600, 600 ); |
2 |
26 Feb 07 |
jari |
98 |
this.dataType = dataTypeP; |
2 |
26 Feb 07 |
jari |
99 |
|
2 |
26 Feb 07 |
jari |
//create the listener for this dialog and add it |
2 |
26 Feb 07 |
jari |
101 |
Listener listener = new Listener(); |
2 |
26 Feb 07 |
jari |
102 |
super.addWindowListener(listener); |
2 |
26 Feb 07 |
jari |
103 |
super.setActionListeners(listener); |
2 |
26 Feb 07 |
jari |
104 |
|
2 |
26 Feb 07 |
jari |
105 |
this.al = new AdvListener(); |
2 |
26 Feb 07 |
jari |
106 |
|
2 |
26 Feb 07 |
jari |
//initialize variables |
2 |
26 Feb 07 |
jari |
108 |
this.vRHyb = new Vector(); |
2 |
26 Feb 07 |
jari |
109 |
this.rHybs = new RHyb[ hybNames.length ]; |
2 |
26 Feb 07 |
jari |
110 |
|
2 |
26 Feb 07 |
jari |
//create the GUI |
2 |
26 Feb 07 |
jari |
112 |
JPanel mainPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
113 |
if( dataTypeP == IData.DATA_TYPE_TWO_INTENSITY ) { |
2 |
26 Feb 07 |
jari |
//System.out.println( "dataType = TWO_INTENSITY" ); |
2 |
26 Feb 07 |
jari |
115 |
mainPanel.add( this.createDataTypePanel(), BorderLayout.NORTH ); |
2 |
26 Feb 07 |
jari |
116 |
} else { |
2 |
26 Feb 07 |
jari |
//System.out.println( "dataType = Unknown" ); |
2 |
26 Feb 07 |
jari |
118 |
} |
2 |
26 Feb 07 |
jari |
119 |
mainPanel.add( this.createHybPanel( hybNames, this.dataType ), BorderLayout.CENTER ); |
2 |
26 Feb 07 |
jari |
120 |
mainPanel.add( this.createParamPanel(), BorderLayout.SOUTH ); |
2 |
26 Feb 07 |
jari |
121 |
this.addContent( mainPanel ); |
2 |
26 Feb 07 |
jari |
122 |
}//constructor |
2 |
26 Feb 07 |
jari |
123 |
|
2 |
26 Feb 07 |
jari |
124 |
|
2 |
26 Feb 07 |
jari |
125 |
private JPanel createDataTypePanel() { |
2 |
26 Feb 07 |
jari |
126 |
Font font11 = new Font( "Arial", Font.PLAIN, 11 ); |
2 |
26 Feb 07 |
jari |
127 |
Font font = new Font( "Arial", Font.PLAIN, 12 ); |
2 |
26 Feb 07 |
jari |
128 |
|
2 |
26 Feb 07 |
jari |
129 |
this.ratioButton = new JRadioButton( "2 Color Data" ); |
2 |
26 Feb 07 |
jari |
130 |
this.affyButton = new JRadioButton( "Intensity Data" ); |
2 |
26 Feb 07 |
jari |
131 |
this.ratioButton.setSelected( true ); |
2 |
26 Feb 07 |
jari |
132 |
this.ratioButton.addActionListener( this.al ); |
2 |
26 Feb 07 |
jari |
133 |
this.affyButton.addActionListener( this.al ); |
2 |
26 Feb 07 |
jari |
134 |
|
2 |
26 Feb 07 |
jari |
135 |
ButtonGroup dataTypeGroup = new ButtonGroup(); |
2 |
26 Feb 07 |
jari |
136 |
dataTypeGroup.add( this.ratioButton ); |
2 |
26 Feb 07 |
jari |
137 |
dataTypeGroup.add( this.affyButton ); |
2 |
26 Feb 07 |
jari |
138 |
|
2 |
26 Feb 07 |
jari |
139 |
JPanel returnPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
140 |
returnPanel.setLayout( new BoxLayout( returnPanel, BoxLayout.X_AXIS ) ); |
2 |
26 Feb 07 |
jari |
141 |
returnPanel.add( Box.createRigidArea( new Dimension( 75, 50 ) ) ); |
2 |
26 Feb 07 |
jari |
142 |
returnPanel.add( this.ratioButton ); |
2 |
26 Feb 07 |
jari |
143 |
returnPanel.add( Box.createRigidArea( new Dimension( 75, 50 ) ) ); |
2 |
26 Feb 07 |
jari |
144 |
returnPanel.add( this.affyButton ); |
2 |
26 Feb 07 |
jari |
145 |
returnPanel.add( Box.createRigidArea( new Dimension( 75, 50 ) ) ); |
2 |
26 Feb 07 |
jari |
146 |
returnPanel.setBorder( BorderFactory.createTitledBorder( "Data Type" ) ); |
2 |
26 Feb 07 |
jari |
147 |
|
2 |
26 Feb 07 |
jari |
148 |
return returnPanel; |
2 |
26 Feb 07 |
jari |
149 |
}//createDataTypePanel() |
2 |
26 Feb 07 |
jari |
150 |
|
2 |
26 Feb 07 |
jari |
151 |
|
2 |
26 Feb 07 |
jari |
152 |
/** |
2 |
26 Feb 07 |
jari |
* This is the main content window of the dialog box |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
155 |
*/ |
2 |
26 Feb 07 |
jari |
156 |
private JPanel createParamPanel() { |
2 |
26 Feb 07 |
jari |
157 |
Font font11 = new Font( "Arial", Font.PLAIN, 11 ); |
2 |
26 Feb 07 |
jari |
158 |
Font font = new Font( "Arial", Font.PLAIN, 12 ); |
2 |
26 Feb 07 |
jari |
159 |
Dimension dSpinner = new Dimension( 70, 25 ); |
2 |
26 Feb 07 |
jari |
160 |
Dimension dArea = new Dimension( 140, 80 ); |
2 |
26 Feb 07 |
jari |
161 |
Dimension dCombo = new Dimension( 170, 25 ); |
2 |
26 Feb 07 |
jari |
162 |
Dimension dSpace = new Dimension( 100, 5 ); |
2 |
26 Feb 07 |
jari |
163 |
Dimension dButton = new Dimension( 60, 20 ); |
2 |
26 Feb 07 |
jari |
164 |
Dimension dAddConn = new Dimension( 120, 20 ); |
2 |
26 Feb 07 |
jari |
165 |
|
2 |
26 Feb 07 |
jari |
//create a JCheckBox allowing user to activate Adv Params |
2 |
26 Feb 07 |
jari |
167 |
this.advCheckBox = new JCheckBox( "Advanced Parameters" ); |
2 |
26 Feb 07 |
jari |
168 |
this.advCheckBox.setFont( font11 ); |
2 |
26 Feb 07 |
jari |
//AdvListener al = new AdvListener(); |
2 |
26 Feb 07 |
jari |
170 |
this.advCheckBox.addActionListener( this.al ); |
2 |
26 Feb 07 |
jari |
171 |
JPanel checkPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
172 |
checkPanel.add( this.advCheckBox ); |
2 |
26 Feb 07 |
jari |
173 |
|
2 |
26 Feb 07 |
jari |
//create adv params |
2 |
26 Feb 07 |
jari |
175 |
SpinnerNumberModel burnInModel = new SpinnerNumberModel( 1000, 1, 100000, 1 ); |
2 |
26 Feb 07 |
jari |
176 |
SpinnerNumberModel numIterModel = new SpinnerNumberModel( 21000, 1, 100000, 1 ); |
2 |
26 Feb 07 |
jari |
177 |
this.burnInSpinner = new JSpinner( burnInModel ); |
2 |
26 Feb 07 |
jari |
178 |
this.numIterSpinner = new JSpinner( numIterModel ); |
2 |
26 Feb 07 |
jari |
179 |
this.burnInSpinner.setPreferredSize( dSpinner ); |
2 |
26 Feb 07 |
jari |
180 |
this.numIterSpinner.setPreferredSize( dSpinner ); |
2 |
26 Feb 07 |
jari |
181 |
this.burnInSpinner.setMaximumSize( dSpinner ); |
2 |
26 Feb 07 |
jari |
182 |
this.numIterSpinner.setMaximumSize( dSpinner ); |
2 |
26 Feb 07 |
jari |
183 |
this.burnInLabel = new JLabel( "Burn In Period" ); //min.Iter |
2 |
26 Feb 07 |
jari |
184 |
this.numIterLabel = new JLabel( "# Iterations" ); //B |
2 |
26 Feb 07 |
jari |
185 |
this.burnInLabel.setFont( font11 ); |
2 |
26 Feb 07 |
jari |
186 |
this.numIterLabel.setFont( font11 ); |
2 |
26 Feb 07 |
jari |
187 |
|
2 |
26 Feb 07 |
jari |
188 |
SpinnerNumberModel threshModel = new SpinnerNumberModel( .5d, 0, 1000, .1d ); |
2 |
26 Feb 07 |
jari |
189 |
this.thresholdSpinner = new JSpinner( threshModel ); |
2 |
26 Feb 07 |
jari |
190 |
this.thresholdSpinner.setPreferredSize( dSpinner ); |
2 |
26 Feb 07 |
jari |
191 |
this.thresholdSpinner.setMaximumSize( dSpinner ); |
2 |
26 Feb 07 |
jari |
192 |
this.thresholdSpinner.setMinimumSize( dSpinner ); |
2 |
26 Feb 07 |
jari |
193 |
this.thresholdLabel = new JLabel( "Post.P Threshold" ); |
2 |
26 Feb 07 |
jari |
194 |
this.thresholdLabel.setFont( font11); |
2 |
26 Feb 07 |
jari |
195 |
|
2 |
26 Feb 07 |
jari |
//create connection pull down |
2 |
26 Feb 07 |
jari |
197 |
String[] connStrings = this.getConnString( TMEV.getRPath() ); |
2 |
26 Feb 07 |
jari |
//String[] connStrings = { "a", "b", "c" }; |
2 |
26 Feb 07 |
jari |
199 |
this.connCombo = new JComboBox( connStrings ); |
2 |
26 Feb 07 |
jari |
200 |
this.connCombo.setPreferredSize( dCombo ); |
2 |
26 Feb 07 |
jari |
201 |
|
2 |
26 Feb 07 |
jari |
202 |
this.newConn = new JTextField( BridgeInitDialog.DEFAULT_ADD_TEXT ); |
2 |
26 Feb 07 |
jari |
203 |
this.newConn.setPreferredSize( dAddConn ); |
2 |
26 Feb 07 |
jari |
204 |
this.newConn.setFont( font11 ); |
2 |
26 Feb 07 |
jari |
205 |
this.addConnButton = new JButton( "Add" ); |
2 |
26 Feb 07 |
jari |
206 |
this.addConnButton.addActionListener( al ); |
2 |
26 Feb 07 |
jari |
207 |
this.addConnButton.setPreferredSize( dButton ); |
2 |
26 Feb 07 |
jari |
208 |
this.addConnButton.setFont( font11 ); |
2 |
26 Feb 07 |
jari |
209 |
JPanel addPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
210 |
addPanel.add( this.newConn ); |
2 |
26 Feb 07 |
jari |
211 |
addPanel.add( this.addConnButton ); |
2 |
26 Feb 07 |
jari |
212 |
|
2 |
26 Feb 07 |
jari |
//add to its own panel |
2 |
26 Feb 07 |
jari |
214 |
JPanel comboPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
215 |
BoxLayout box = new BoxLayout( comboPanel, BoxLayout.Y_AXIS ) ; |
2 |
26 Feb 07 |
jari |
216 |
comboPanel.setLayout( box ); |
2 |
26 Feb 07 |
jari |
217 |
comboPanel.add( Box.createRigidArea( dSpace ) ); |
2 |
26 Feb 07 |
jari |
218 |
comboPanel.add( addPanel ); |
2 |
26 Feb 07 |
jari |
219 |
comboPanel.add( Box.createRigidArea( dSpace ) ); |
2 |
26 Feb 07 |
jari |
220 |
comboPanel.add( this.connCombo ); |
2 |
26 Feb 07 |
jari |
221 |
Border greyLine = BorderFactory.createLineBorder( Color.LIGHT_GRAY, 1 ); |
2 |
26 Feb 07 |
jari |
222 |
TitledBorder border = BorderFactory.createTitledBorder( greyLine, |
2 |
26 Feb 07 |
jari |
223 |
"Rserve Connection", TitledBorder.TOP, TitledBorder.CENTER, font11 ); |
2 |
26 Feb 07 |
jari |
224 |
// |
2 |
26 Feb 07 |
jari |
225 |
comboPanel.setBorder( border ); |
2 |
26 Feb 07 |
jari |
226 |
|
2 |
26 Feb 07 |
jari |
//disable as default |
2 |
26 Feb 07 |
jari |
228 |
this.burnInSpinner.setEnabled( false ); |
2 |
26 Feb 07 |
jari |
229 |
this.numIterSpinner.setEnabled( false ); |
2 |
26 Feb 07 |
jari |
230 |
this.thresholdSpinner.setEnabled( false ); |
2 |
26 Feb 07 |
jari |
231 |
this.burnInLabel.setForeground( Color.GRAY ); |
2 |
26 Feb 07 |
jari |
232 |
this.numIterLabel.setForeground( Color.GRAY ); |
2 |
26 Feb 07 |
jari |
233 |
this.thresholdLabel.setForeground( Color.GRAY ); |
2 |
26 Feb 07 |
jari |
234 |
|
2 |
26 Feb 07 |
jari |
235 |
JPanel paramPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
236 |
SpringLayout sl = new SpringLayout(); |
2 |
26 Feb 07 |
jari |
237 |
paramPanel.setLayout( sl ); |
2 |
26 Feb 07 |
jari |
238 |
paramPanel.add( this.burnInLabel ); |
2 |
26 Feb 07 |
jari |
239 |
paramPanel.add( this.burnInSpinner ); |
2 |
26 Feb 07 |
jari |
240 |
paramPanel.add( this.numIterLabel ); |
2 |
26 Feb 07 |
jari |
241 |
paramPanel.add( this.numIterSpinner ); |
2 |
26 Feb 07 |
jari |
242 |
paramPanel.add( this.thresholdLabel ); |
2 |
26 Feb 07 |
jari |
243 |
paramPanel.add( this.thresholdSpinner ); |
2 |
26 Feb 07 |
jari |
244 |
SpringUtilities.makeCompactGrid( paramPanel, 3, 2, 5, 5, 5, 5 ); |
2 |
26 Feb 07 |
jari |
245 |
|
2 |
26 Feb 07 |
jari |
246 |
JPanel leftPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
247 |
leftPanel.setLayout( new BorderLayout() ); |
2 |
26 Feb 07 |
jari |
248 |
leftPanel.add( checkPanel, BorderLayout.NORTH ); |
2 |
26 Feb 07 |
jari |
249 |
leftPanel.add( paramPanel, BorderLayout.CENTER ); |
2 |
26 Feb 07 |
jari |
250 |
leftPanel.setBorder( BorderFactory.createLineBorder( Color.LIGHT_GRAY, 1 ) ); |
2 |
26 Feb 07 |
jari |
251 |
|
2 |
26 Feb 07 |
jari |
252 |
JPanel labelPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
253 |
Color color = labelPanel.getBackground(); |
2 |
26 Feb 07 |
jari |
254 |
JTextArea area = new JTextArea(); |
2 |
26 Feb 07 |
jari |
255 |
area.setBackground( color ); |
2 |
26 Feb 07 |
jari |
256 |
area.setForeground( Color.BLUE ); |
2 |
26 Feb 07 |
jari |
257 |
area.setEditable( false ); |
2 |
26 Feb 07 |
jari |
258 |
area.setPreferredSize( dArea ); |
2 |
26 Feb 07 |
jari |
259 |
area.setFont( font ); |
2 |
26 Feb 07 |
jari |
260 |
area.setText( "Now would be a good\ntime to start Rserve\n\nClick the info button\nfor help (lower left)" ); |
2 |
26 Feb 07 |
jari |
261 |
labelPanel.add( area ); |
2 |
26 Feb 07 |
jari |
262 |
|
2 |
26 Feb 07 |
jari |
263 |
JPanel returnPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
264 |
returnPanel.add( leftPanel ); |
2 |
26 Feb 07 |
jari |
265 |
returnPanel.add( labelPanel ); |
2 |
26 Feb 07 |
jari |
266 |
returnPanel.add( comboPanel ); |
2 |
26 Feb 07 |
jari |
267 |
|
2 |
26 Feb 07 |
jari |
268 |
return returnPanel; |
2 |
26 Feb 07 |
jari |
269 |
}//createParamPanel() |
2 |
26 Feb 07 |
jari |
270 |
|
2 |
26 Feb 07 |
jari |
271 |
|
2 |
26 Feb 07 |
jari |
//need to list the hybs and let user label exp vs control |
2 |
26 Feb 07 |
jari |
273 |
private JPanel createHybPanel( String[] hybNames, int dataTypeP ) { |
2 |
26 Feb 07 |
jari |
//JPanel for listing the hybs and the radio buttons and check boxes |
2 |
26 Feb 07 |
jari |
275 |
JPanel listPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
276 |
BoxLayout hybBox = new BoxLayout( listPanel, BoxLayout.Y_AXIS ); |
2 |
26 Feb 07 |
jari |
277 |
listPanel.setLayout( hybBox ); |
2 |
26 Feb 07 |
jari |
278 |
|
2 |
26 Feb 07 |
jari |
279 |
Dimension dLabel = new Dimension( 330, 15 ); |
2 |
26 Feb 07 |
jari |
280 |
Dimension dCheck = new Dimension( 50, 15 ); |
2 |
26 Feb 07 |
jari |
281 |
Dimension dRow = new Dimension( 450, 25 ); |
2 |
26 Feb 07 |
jari |
282 |
Font font = new Font( "Arial", Font.PLAIN, 11 ); |
2 |
26 Feb 07 |
jari |
283 |
|
2 |
26 Feb 07 |
jari |
//JLabel spacer |
2 |
26 Feb 07 |
jari |
285 |
JLabel spacer = new JLabel( "" ); |
2 |
26 Feb 07 |
jari |
286 |
spacer.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
287 |
spacer.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
288 |
spacer.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
289 |
|
2 |
26 Feb 07 |
jari |
//Column headers |
2 |
26 Feb 07 |
jari |
291 |
|
2 |
26 Feb 07 |
jari |
292 |
if( dataTypeP == IData.DATA_TYPE_AFFY_ABS ) { |
2 |
26 Feb 07 |
jari |
293 |
this.hybColLabel = new JLabel( "For each chip, denote whether it is Treated or Control" ); |
2 |
26 Feb 07 |
jari |
294 |
this.cy3Label = new JLabel( "Treated" ); |
2 |
26 Feb 07 |
jari |
295 |
this.cy5Label = new JLabel( "Control" ); |
2 |
26 Feb 07 |
jari |
296 |
this.yNum = "IntB"; |
2 |
26 Feb 07 |
jari |
297 |
this.yDen = "IntA"; |
2 |
26 Feb 07 |
jari |
298 |
} else { |
2 |
26 Feb 07 |
jari |
299 |
this.hybColLabel = new JLabel( "For each slide, mark the Control Sample's dye color" ); |
2 |
26 Feb 07 |
jari |
300 |
this.cy3Label = new JLabel( "Cy3" ); |
2 |
26 Feb 07 |
jari |
301 |
this.cy5Label = new JLabel( "Cy5" ); |
2 |
26 Feb 07 |
jari |
302 |
this.yNum = "Cy5"; |
2 |
26 Feb 07 |
jari |
303 |
this.yDen = "Cy3"; |
2 |
26 Feb 07 |
jari |
304 |
} |
2 |
26 Feb 07 |
jari |
305 |
this.hybColLabel.setFont( font ); |
2 |
26 Feb 07 |
jari |
306 |
this.hybColLabel.setForeground( Color.DARK_GRAY ); |
2 |
26 Feb 07 |
jari |
307 |
this.hybColLabel.setMinimumSize( dLabel ); |
2 |
26 Feb 07 |
jari |
308 |
this.hybColLabel.setMaximumSize( dLabel ); |
2 |
26 Feb 07 |
jari |
309 |
this.hybColLabel.setPreferredSize( dLabel ); |
2 |
26 Feb 07 |
jari |
310 |
this.cy3Label.setFont( font ); |
2 |
26 Feb 07 |
jari |
311 |
this.cy3Label.setForeground( Color.DARK_GRAY ); |
2 |
26 Feb 07 |
jari |
312 |
this.cy3Label.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
313 |
this.cy3Label.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
314 |
this.cy3Label.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
315 |
this.cy5Label.setFont( font ); |
2 |
26 Feb 07 |
jari |
316 |
this.cy5Label.setForeground( Color.DARK_GRAY ); |
2 |
26 Feb 07 |
jari |
317 |
this.cy5Label.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
318 |
this.cy5Label.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
319 |
this.cy5Label.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
320 |
|
2 |
26 Feb 07 |
jari |
321 |
JPanel titlePanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
322 |
titlePanel.add( hybColLabel ); |
2 |
26 Feb 07 |
jari |
323 |
titlePanel.add( cy3Label ); |
2 |
26 Feb 07 |
jari |
324 |
titlePanel.add( cy5Label ); |
2 |
26 Feb 07 |
jari |
325 |
listPanel.add( titlePanel ); |
2 |
26 Feb 07 |
jari |
326 |
|
2 |
26 Feb 07 |
jari |
327 |
int iHyb = hybNames.length; |
2 |
26 Feb 07 |
jari |
328 |
int iHalf = iHyb / 2; |
2 |
26 Feb 07 |
jari |
329 |
|
2 |
26 Feb 07 |
jari |
330 |
for( int h = 0; h < iHyb; h ++ ) { |
2 |
26 Feb 07 |
jari |
//JLabel spacer |
2 |
26 Feb 07 |
jari |
332 |
JLabel spaceLabel = new JLabel( "" ); |
2 |
26 Feb 07 |
jari |
333 |
spaceLabel.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
334 |
spaceLabel.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
335 |
spaceLabel.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
336 |
|
2 |
26 Feb 07 |
jari |
//display the hyb name and radio buttons so user can label them |
2 |
26 Feb 07 |
jari |
338 |
JLabel hybLabel = new JLabel( hybNames[ h ] ); |
2 |
26 Feb 07 |
jari |
339 |
hybLabel.setMinimumSize( dLabel ); |
2 |
26 Feb 07 |
jari |
340 |
hybLabel.setMaximumSize( dLabel ); |
2 |
26 Feb 07 |
jari |
341 |
hybLabel.setPreferredSize( dLabel ); |
2 |
26 Feb 07 |
jari |
342 |
|
2 |
26 Feb 07 |
jari |
343 |
JRadioButton cy3Button = new JRadioButton(); |
2 |
26 Feb 07 |
jari |
344 |
JRadioButton cy5Button = new JRadioButton(); |
2 |
26 Feb 07 |
jari |
345 |
cy3Button.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
346 |
cy3Button.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
347 |
cy3Button.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
348 |
cy5Button.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
349 |
cy5Button.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
350 |
cy5Button.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
351 |
|
2 |
26 Feb 07 |
jari |
//add them to a group so they are mutually exclusive |
2 |
26 Feb 07 |
jari |
353 |
ButtonGroup sampleGroup = new ButtonGroup(); |
2 |
26 Feb 07 |
jari |
354 |
sampleGroup.add( cy3Button ); |
2 |
26 Feb 07 |
jari |
355 |
sampleGroup.add( cy5Button ); |
2 |
26 Feb 07 |
jari |
356 |
// |
2 |
26 Feb 07 |
jari |
//by default, split the hybs in half for ease |
2 |
26 Feb 07 |
jari |
358 |
if( h < iHalf ) { |
2 |
26 Feb 07 |
jari |
359 |
cy3Button.setSelected( false ); |
2 |
26 Feb 07 |
jari |
360 |
cy5Button.setSelected( true ); |
2 |
26 Feb 07 |
jari |
361 |
} else { |
2 |
26 Feb 07 |
jari |
362 |
cy3Button.setSelected( true ); |
2 |
26 Feb 07 |
jari |
363 |
cy5Button.setSelected( false ); |
2 |
26 Feb 07 |
jari |
364 |
} |
2 |
26 Feb 07 |
jari |
365 |
|
2 |
26 Feb 07 |
jari |
366 |
JPanel rowPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
367 |
rowPanel.add( hybLabel ); |
2 |
26 Feb 07 |
jari |
368 |
rowPanel.add( cy3Button ); |
2 |
26 Feb 07 |
jari |
369 |
rowPanel.add( cy5Button ); |
2 |
26 Feb 07 |
jari |
370 |
rowPanel.setMaximumSize( dRow ); |
2 |
26 Feb 07 |
jari |
371 |
rowPanel.setMinimumSize( dRow ); |
2 |
26 Feb 07 |
jari |
372 |
rowPanel.setPreferredSize( dRow ); |
2 |
26 Feb 07 |
jari |
373 |
|
2 |
26 Feb 07 |
jari |
//color every other row |
2 |
26 Feb 07 |
jari |
375 |
if( h % 2 == 0 ) { |
2 |
26 Feb 07 |
jari |
376 |
rowPanel.setBackground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
377 |
cy3Button.setBackground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
378 |
cy5Button.setBackground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
379 |
} |
2 |
26 Feb 07 |
jari |
380 |
|
2 |
26 Feb 07 |
jari |
381 |
RHyb hyb; |
2 |
26 Feb 07 |
jari |
382 |
|
2 |
26 Feb 07 |
jari |
383 |
if( dataTypeP == IData.DATA_TYPE_AFFY_ABS ) { |
2 |
26 Feb 07 |
jari |
384 |
hyb = new RHyb( h, hybNames[ h ], cy3Button, |
2 |
26 Feb 07 |
jari |
385 |
IData.DATA_TYPE_AFFY_ABS ); |
2 |
26 Feb 07 |
jari |
386 |
} else { |
2 |
26 Feb 07 |
jari |
387 |
hyb = new RHyb( h, hybNames[ h ], cy3Button, |
2 |
26 Feb 07 |
jari |
388 |
IData.DATA_TYPE_TWO_INTENSITY ); |
2 |
26 Feb 07 |
jari |
389 |
} |
2 |
26 Feb 07 |
jari |
390 |
this.rHybs[ h ] = hyb; |
2 |
26 Feb 07 |
jari |
391 |
this.vRHyb.add( hyb ); |
2 |
26 Feb 07 |
jari |
392 |
listPanel.add( rowPanel ); |
2 |
26 Feb 07 |
jari |
393 |
} |
2 |
26 Feb 07 |
jari |
394 |
|
2 |
26 Feb 07 |
jari |
395 |
listPanel.add( Box.createVerticalGlue() ); |
2 |
26 Feb 07 |
jari |
396 |
listPanel.setBorder( BorderFactory.createLineBorder( Color.LIGHT_GRAY, 1 ) ); |
2 |
26 Feb 07 |
jari |
397 |
return listPanel; |
2 |
26 Feb 07 |
jari |
398 |
} |
2 |
26 Feb 07 |
jari |
399 |
|
2 |
26 Feb 07 |
jari |
400 |
/** |
2 |
26 Feb 07 |
jari |
* Shows the dialog. |
2 |
26 Feb 07 |
jari |
402 |
*/ |
2 |
26 Feb 07 |
jari |
403 |
public int showModal() { |
2 |
26 Feb 07 |
jari |
404 |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
2 |
26 Feb 07 |
jari |
405 |
setLocation((screenSize.width - getSize().width)/2, (screenSize.height - getSize().height)/2); |
2 |
26 Feb 07 |
jari |
406 |
show(); |
2 |
26 Feb 07 |
jari |
407 |
return result; |
2 |
26 Feb 07 |
jari |
408 |
}//end showModal() |
2 |
26 Feb 07 |
jari |
409 |
|
2 |
26 Feb 07 |
jari |
410 |
|
2 |
26 Feb 07 |
jari |
411 |
/** |
2 |
26 Feb 07 |
jari |
412 |
* |
2 |
26 Feb 07 |
jari |
* @param message |
2 |
26 Feb 07 |
jari |
414 |
*/ |
2 |
26 Feb 07 |
jari |
415 |
public void error( String message ) { |
2 |
26 Feb 07 |
jari |
416 |
JOptionPane.showMessageDialog( this, message, "Input Error", JOptionPane.ERROR_MESSAGE ); |
2 |
26 Feb 07 |
jari |
417 |
}//end error() |
2 |
26 Feb 07 |
jari |
418 |
|
2 |
26 Feb 07 |
jari |
419 |
|
2 |
26 Feb 07 |
jari |
420 |
/** |
2 |
26 Feb 07 |
jari |
421 |
* |
2 |
26 Feb 07 |
jari |
* @author iVu |
2 |
26 Feb 07 |
jari |
423 |
*/ |
2 |
26 Feb 07 |
jari |
424 |
private class AdvListener implements ActionListener { |
2 |
26 Feb 07 |
jari |
425 |
public void actionPerformed(ActionEvent e) { |
2 |
26 Feb 07 |
jari |
426 |
Object source = e.getSource(); |
2 |
26 Feb 07 |
jari |
427 |
|
2 |
26 Feb 07 |
jari |
428 |
if( source == advCheckBox ) { |
2 |
26 Feb 07 |
jari |
429 |
onAdvancedClicked(); |
2 |
26 Feb 07 |
jari |
430 |
} |
2 |
26 Feb 07 |
jari |
431 |
if( source == addConnButton ) { |
2 |
26 Feb 07 |
jari |
432 |
String s = ( String ) newConn.getText().trim(); |
2 |
26 Feb 07 |
jari |
433 |
if( s.equals( BridgeInitDialog.DEFAULT_ADD_TEXT ) ) { |
2 |
26 Feb 07 |
jari |
//do nothing |
2 |
26 Feb 07 |
jari |
435 |
} else if( s.equals( "" ) ) { |
2 |
26 Feb 07 |
jari |
//do nothing |
2 |
26 Feb 07 |
jari |
437 |
} else { |
2 |
26 Feb 07 |
jari |
438 |
int itemKount = connCombo.getItemCount(); |
2 |
26 Feb 07 |
jari |
439 |
boolean alreadyThere = false; |
2 |
26 Feb 07 |
jari |
440 |
for( int i = 0; i < itemKount; i ++ ) { |
2 |
26 Feb 07 |
jari |
441 |
String item = ( String ) connCombo.getItemAt( i ); |
2 |
26 Feb 07 |
jari |
442 |
if( s.equals( item ) ) { |
2 |
26 Feb 07 |
jari |
443 |
alreadyThere = true; |
2 |
26 Feb 07 |
jari |
444 |
break; |
2 |
26 Feb 07 |
jari |
445 |
} |
2 |
26 Feb 07 |
jari |
446 |
} |
2 |
26 Feb 07 |
jari |
447 |
if( ! alreadyThere ) { |
2 |
26 Feb 07 |
jari |
448 |
connAdded = true; |
2 |
26 Feb 07 |
jari |
449 |
connCombo.insertItemAt( s, 0 ); |
2 |
26 Feb 07 |
jari |
450 |
connCombo.setSelectedIndex( 0 ); |
2 |
26 Feb 07 |
jari |
451 |
} |
2 |
26 Feb 07 |
jari |
452 |
} |
2 |
26 Feb 07 |
jari |
453 |
} |
2 |
26 Feb 07 |
jari |
454 |
if( source == ratioButton ) { |
2 |
26 Feb 07 |
jari |
455 |
onDataTypeSelected(); |
2 |
26 Feb 07 |
jari |
456 |
} |
2 |
26 Feb 07 |
jari |
457 |
if( source == affyButton ) { |
2 |
26 Feb 07 |
jari |
458 |
onDataTypeSelected(); |
2 |
26 Feb 07 |
jari |
459 |
} |
2 |
26 Feb 07 |
jari |
460 |
}//end actionPerformed() |
2 |
26 Feb 07 |
jari |
461 |
}//end class |
2 |
26 Feb 07 |
jari |
462 |
|
2 |
26 Feb 07 |
jari |
463 |
|
2 |
26 Feb 07 |
jari |
464 |
private void onDataTypeSelected() { |
2 |
26 Feb 07 |
jari |
//user selected either ratio or intensity data, refresh display |
2 |
26 Feb 07 |
jari |
466 |
if( this.affyButton.isSelected() ) { |
2 |
26 Feb 07 |
jari |
//affy data |
2 |
26 Feb 07 |
jari |
468 |
hybColLabel.setText( "For each chip, denote whether it is Treated or Control" ); |
2 |
26 Feb 07 |
jari |
469 |
cy3Label.setText( "Treated" ); |
2 |
26 Feb 07 |
jari |
470 |
cy5Label.setText( "Control" ); |
2 |
26 Feb 07 |
jari |
471 |
this.repaint(); |
2 |
26 Feb 07 |
jari |
472 |
|
2 |
26 Feb 07 |
jari |
//set the y axis labels accordingly |
2 |
26 Feb 07 |
jari |
474 |
this.yNum = "IntB"; |
2 |
26 Feb 07 |
jari |
475 |
this.yDen = "IntA"; |
2 |
26 Feb 07 |
jari |
476 |
} else { |
2 |
26 Feb 07 |
jari |
//ratio data |
2 |
26 Feb 07 |
jari |
478 |
hybColLabel.setText( "For each slide, mark the Control Sample's dye color" ); |
2 |
26 Feb 07 |
jari |
479 |
cy3Label.setText( "Cy3" ); |
2 |
26 Feb 07 |
jari |
480 |
cy5Label.setText( "Cy5" ); |
2 |
26 Feb 07 |
jari |
481 |
this.repaint(); |
2 |
26 Feb 07 |
jari |
482 |
|
2 |
26 Feb 07 |
jari |
483 |
this.yNum = "Cy5"; |
2 |
26 Feb 07 |
jari |
484 |
this.yDen = "Cy3"; |
2 |
26 Feb 07 |
jari |
485 |
} |
2 |
26 Feb 07 |
jari |
486 |
/* |
2 |
26 Feb 07 |
jari |
if( dataTypeP == IData.DATA_TYPE_AFFY_ABS ) { |
2 |
26 Feb 07 |
jari |
this.hybColLabel = new JLabel( "For each chip, denote whether it is Treated or Control" ); |
2 |
26 Feb 07 |
jari |
this.cy3Label = new JLabel( "Treated" ); |
2 |
26 Feb 07 |
jari |
this.cy5Label = new JLabel( "Control" ); |
2 |
26 Feb 07 |
jari |
} else { |
2 |
26 Feb 07 |
jari |
this.hybColLabel = new JLabel( "For each slide, mark Control Sample's dye color" ); |
2 |
26 Feb 07 |
jari |
this.cy3Label = new JLabel( "Cy3" ); |
2 |
26 Feb 07 |
jari |
this.cy5Label = new JLabel( "Cy5" ); |
2 |
26 Feb 07 |
jari |
495 |
}*/ |
2 |
26 Feb 07 |
jari |
496 |
}//onDataTypeSelected() |
2 |
26 Feb 07 |
jari |
497 |
|
2 |
26 Feb 07 |
jari |
498 |
|
2 |
26 Feb 07 |
jari |
499 |
/** |
2 |
26 Feb 07 |
jari |
* Enable or Disable the advanced parameters |
2 |
26 Feb 07 |
jari |
501 |
* |
2 |
26 Feb 07 |
jari |
502 |
*/ |
2 |
26 Feb 07 |
jari |
503 |
private void onAdvancedClicked() { |
2 |
26 Feb 07 |
jari |
504 |
if( this.advCheckBox.isSelected() ) { |
2 |
26 Feb 07 |
jari |
505 |
this.burnInSpinner.setEnabled( true ); |
2 |
26 Feb 07 |
jari |
506 |
this.numIterSpinner.setEnabled( true ); |
2 |
26 Feb 07 |
jari |
507 |
this.thresholdSpinner.setEnabled( true ); |
2 |
26 Feb 07 |
jari |
508 |
this.burnInLabel.setForeground( Color.BLACK ); |
2 |
26 Feb 07 |
jari |
509 |
this.numIterLabel.setForeground( Color.BLACK ); |
2 |
26 Feb 07 |
jari |
510 |
this.thresholdLabel.setForeground( Color.BLACK ); |
2 |
26 Feb 07 |
jari |
511 |
} else { |
2 |
26 Feb 07 |
jari |
512 |
this.burnInSpinner.setEnabled( false ); |
2 |
26 Feb 07 |
jari |
513 |
this.numIterSpinner.setEnabled( false ); |
2 |
26 Feb 07 |
jari |
514 |
this.thresholdSpinner.setEnabled( false ); |
2 |
26 Feb 07 |
jari |
515 |
this.burnInLabel.setForeground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
516 |
this.numIterLabel.setForeground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
517 |
this.thresholdLabel.setForeground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
518 |
} |
2 |
26 Feb 07 |
jari |
519 |
}//onAdvancedClicked() |
2 |
26 Feb 07 |
jari |
520 |
|
2 |
26 Feb 07 |
jari |
521 |
|
2 |
26 Feb 07 |
jari |
522 |
/** |
2 |
26 Feb 07 |
jari |
* Splits semicolon separated strings into String[] |
2 |
26 Feb 07 |
jari |
* @param rPath |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
526 |
*/ |
2 |
26 Feb 07 |
jari |
527 |
private String[] getConnString( String rPath ) { |
2 |
26 Feb 07 |
jari |
528 |
String[] toReturn; |
2 |
26 Feb 07 |
jari |
529 |
|
2 |
26 Feb 07 |
jari |
530 |
StringTokenizer st = new StringTokenizer( rPath, ";" ); |
2 |
26 Feb 07 |
jari |
531 |
int tokenKount = st.countTokens(); |
2 |
26 Feb 07 |
jari |
532 |
toReturn = new String[ tokenKount ]; |
2 |
26 Feb 07 |
jari |
533 |
for( int i = 0; i < tokenKount; i ++ ) { |
2 |
26 Feb 07 |
jari |
534 |
String token = st.nextToken(); |
2 |
26 Feb 07 |
jari |
535 |
toReturn[ i ] = token; |
2 |
26 Feb 07 |
jari |
536 |
} |
2 |
26 Feb 07 |
jari |
537 |
|
2 |
26 Feb 07 |
jari |
538 |
return toReturn; |
2 |
26 Feb 07 |
jari |
539 |
}//getConnString |
2 |
26 Feb 07 |
jari |
540 |
|
2 |
26 Feb 07 |
jari |
541 |
|
2 |
26 Feb 07 |
jari |
542 |
/** |
2 |
26 Feb 07 |
jari |
* The class to listen to the dialog and check boxes items events. |
2 |
26 Feb 07 |
jari |
544 |
*/ |
2 |
26 Feb 07 |
jari |
545 |
private class Listener extends DialogListener implements ItemListener { |
2 |
26 Feb 07 |
jari |
546 |
|
2 |
26 Feb 07 |
jari |
547 |
public void actionPerformed(ActionEvent e) { |
2 |
26 Feb 07 |
jari |
548 |
String command = e.getActionCommand(); |
2 |
26 Feb 07 |
jari |
549 |
if (command.equals("ok-command")) { |
2 |
26 Feb 07 |
jari |
//if( verifyHybs() ) { |
2 |
26 Feb 07 |
jari |
551 |
result = JOptionPane.OK_OPTION; |
2 |
26 Feb 07 |
jari |
552 |
dispose(); |
2 |
26 Feb 07 |
jari |
553 |
//} |
2 |
26 Feb 07 |
jari |
554 |
} else if (command.equals("cancel-command")) { |
2 |
26 Feb 07 |
jari |
555 |
result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
556 |
dispose(); |
2 |
26 Feb 07 |
jari |
557 |
} else if (command.equals("reset-command")) { |
2 |
26 Feb 07 |
jari |
//resetControls(); |
2 |
26 Feb 07 |
jari |
559 |
result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
560 |
return; |
2 |
26 Feb 07 |
jari |
561 |
} else if (command.equals("info-command")) { |
2 |
26 Feb 07 |
jari |
562 |
HelpWindow hw = new HelpWindow(BridgeInitDialog.this, "Bridge Initialization Dialog"); |
2 |
26 Feb 07 |
jari |
563 |
result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
564 |
if(hw.getWindowContent()){ |
2 |
26 Feb 07 |
jari |
565 |
hw.setSize(450,600); |
2 |
26 Feb 07 |
jari |
566 |
hw.setLocation(); |
2 |
26 Feb 07 |
jari |
567 |
hw.show(); |
2 |
26 Feb 07 |
jari |
568 |
return; |
2 |
26 Feb 07 |
jari |
569 |
} else { |
2 |
26 Feb 07 |
jari |
570 |
hw.setVisible(false); |
2 |
26 Feb 07 |
jari |
571 |
hw.dispose(); |
2 |
26 Feb 07 |
jari |
572 |
return; |
2 |
26 Feb 07 |
jari |
573 |
} |
2 |
26 Feb 07 |
jari |
574 |
} |
2 |
26 Feb 07 |
jari |
575 |
}//end actionPerformed() |
2 |
26 Feb 07 |
jari |
576 |
|
2 |
26 Feb 07 |
jari |
577 |
public void itemStateChanged(ItemEvent e) { |
2 |
26 Feb 07 |
jari |
//okButton.setEnabled(genes_box.isSelected() || cluster_box.isSelected()); |
2 |
26 Feb 07 |
jari |
579 |
} |
2 |
26 Feb 07 |
jari |
580 |
|
2 |
26 Feb 07 |
jari |
581 |
public void windowClosing(WindowEvent e) { |
2 |
26 Feb 07 |
jari |
582 |
result = JOptionPane.CLOSED_OPTION; |
2 |
26 Feb 07 |
jari |
583 |
dispose(); |
2 |
26 Feb 07 |
jari |
584 |
} |
2 |
26 Feb 07 |
jari |
585 |
}//end internal Listener class |
2 |
26 Feb 07 |
jari |
586 |
|
2 |
26 Feb 07 |
jari |
587 |
|
2 |
26 Feb 07 |
jari |
588 |
public int getBurnIn() { |
2 |
26 Feb 07 |
jari |
589 |
SpinnerNumberModel model = ( SpinnerNumberModel ) this.burnInSpinner.getModel(); |
2 |
26 Feb 07 |
jari |
590 |
return model.getNumber().intValue(); |
2 |
26 Feb 07 |
jari |
591 |
} |
2 |
26 Feb 07 |
jari |
592 |
public int getNumIter() { |
2 |
26 Feb 07 |
jari |
593 |
SpinnerNumberModel model = ( SpinnerNumberModel ) this.numIterSpinner.getModel(); |
2 |
26 Feb 07 |
jari |
594 |
return model.getNumber().intValue(); |
2 |
26 Feb 07 |
jari |
595 |
} |
2 |
26 Feb 07 |
jari |
596 |
public double getThreshold() { |
2 |
26 Feb 07 |
jari |
597 |
SpinnerNumberModel model = ( SpinnerNumberModel ) this.thresholdSpinner.getModel(); |
2 |
26 Feb 07 |
jari |
598 |
return model.getNumber().doubleValue(); |
2 |
26 Feb 07 |
jari |
599 |
} |
2 |
26 Feb 07 |
jari |
600 |
public RHybSet getBridgeHybSet() { |
2 |
26 Feb 07 |
jari |
601 |
return new RHybSet( this.vRHyb ); |
2 |
26 Feb 07 |
jari |
602 |
} |
2 |
26 Feb 07 |
jari |
603 |
public String getSelectedConnString() { |
2 |
26 Feb 07 |
jari |
604 |
return ( String ) this.connCombo.getSelectedItem(); |
2 |
26 Feb 07 |
jari |
605 |
} |
2 |
26 Feb 07 |
jari |
606 |
public String getRPathToWrite() { |
2 |
26 Feb 07 |
jari |
607 |
StringBuffer sb = new StringBuffer(); |
2 |
26 Feb 07 |
jari |
608 |
for( int i = 0; i < this.connCombo.getItemCount(); i ++ ) { |
2 |
26 Feb 07 |
jari |
609 |
String s = ( String ) this.connCombo.getItemAt( i ); |
2 |
26 Feb 07 |
jari |
610 |
if( i > 0 ) { |
2 |
26 Feb 07 |
jari |
611 |
sb.append( ";" ); |
2 |
26 Feb 07 |
jari |
612 |
} |
2 |
26 Feb 07 |
jari |
613 |
sb.append( s ); |
2 |
26 Feb 07 |
jari |
614 |
} |
2 |
26 Feb 07 |
jari |
615 |
return sb.toString(); |
2 |
26 Feb 07 |
jari |
616 |
} |
2 |
26 Feb 07 |
jari |
617 |
public boolean connAdded() { |
2 |
26 Feb 07 |
jari |
618 |
return this.connAdded; |
2 |
26 Feb 07 |
jari |
619 |
} |
2 |
26 Feb 07 |
jari |
620 |
public String getYNum() { |
2 |
26 Feb 07 |
jari |
621 |
return this.yNum; |
2 |
26 Feb 07 |
jari |
622 |
} |
2 |
26 Feb 07 |
jari |
623 |
public String getYDen() { |
2 |
26 Feb 07 |
jari |
624 |
return this.yDen; |
2 |
26 Feb 07 |
jari |
625 |
} |
2 |
26 Feb 07 |
jari |
626 |
|
2 |
26 Feb 07 |
jari |
627 |
|
2 |
26 Feb 07 |
jari |
// test harness |
2 |
26 Feb 07 |
jari |
629 |
public static void main(String [] args) { |
2 |
26 Feb 07 |
jari |
630 |
System.out.println( "RamaInitDialog invoked by main" ); |
2 |
26 Feb 07 |
jari |
631 |
|
2 |
26 Feb 07 |
jari |
632 |
String[] names = new String[ 8 ]; |
2 |
26 Feb 07 |
jari |
633 |
names[ 0 ] = "one"; |
2 |
26 Feb 07 |
jari |
634 |
names[ 1 ] = "two"; |
2 |
26 Feb 07 |
jari |
635 |
names[ 2 ] = "three"; |
2 |
26 Feb 07 |
jari |
636 |
names[ 3 ] = "four"; |
2 |
26 Feb 07 |
jari |
637 |
names[ 4 ] = "five"; |
2 |
26 Feb 07 |
jari |
638 |
names[ 5 ] = "six"; |
2 |
26 Feb 07 |
jari |
639 |
names[ 6 ] = "seven"; |
2 |
26 Feb 07 |
jari |
640 |
names[ 7 ] = "eight"; |
2 |
26 Feb 07 |
jari |
641 |
|
2 |
26 Feb 07 |
jari |
//BridgeInitDialog uid = new BridgeInitDialog( new Frame(), names, IData.DATA_TYPE_AFFY_ABS ); |
2 |
26 Feb 07 |
jari |
643 |
BridgeInitDialog uid = new BridgeInitDialog( new Frame(), names, IData.DATA_TYPE_TWO_INTENSITY ); |
2 |
26 Feb 07 |
jari |
644 |
uid.showModal(); |
2 |
26 Feb 07 |
jari |
645 |
}//end main |
2 |
26 Feb 07 |
jari |
646 |
|
2 |
26 Feb 07 |
jari |
647 |
|
2 |
26 Feb 07 |
jari |
648 |
// |
2 |
26 Feb 07 |
jari |
649 |
}//end class |