2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
* Created on Jul 1, 2005 |
2 |
26 Feb 07 |
jari |
3 |
*/ |
2 |
26 Feb 07 |
jari |
4 |
package org.tigr.microarray.mev.r; |
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 |
|
2 |
26 Feb 07 |
jari |
45 |
/** |
2 |
26 Feb 07 |
jari |
* @author iVu |
2 |
26 Feb 07 |
jari |
47 |
*/ |
2 |
26 Feb 07 |
jari |
48 |
public class RamaInitDialog extends AlgorithmDialog { |
2 |
26 Feb 07 |
jari |
49 |
private int result; |
2 |
26 Feb 07 |
jari |
50 |
private int dataType; |
2 |
26 Feb 07 |
jari |
51 |
private boolean connAdded = false; |
2 |
26 Feb 07 |
jari |
52 |
|
2 |
26 Feb 07 |
jari |
53 |
private RHyb[] ramaHybs; |
2 |
26 Feb 07 |
jari |
54 |
|
2 |
26 Feb 07 |
jari |
55 |
private Vector vCy3Radio; |
2 |
26 Feb 07 |
jari |
56 |
private Vector vRamaHyb; |
2 |
26 Feb 07 |
jari |
57 |
|
2 |
26 Feb 07 |
jari |
58 |
private JCheckBox advCheckBox; |
2 |
26 Feb 07 |
jari |
59 |
private JSpinner burnInSpinner; |
2 |
26 Feb 07 |
jari |
60 |
private JSpinner numIterSpinner; |
2 |
26 Feb 07 |
jari |
61 |
private JLabel burnInLabel; |
2 |
26 Feb 07 |
jari |
62 |
private JLabel numIterLabel; |
2 |
26 Feb 07 |
jari |
63 |
private JButton addConnButton; |
2 |
26 Feb 07 |
jari |
64 |
private JComboBox connCombo; |
2 |
26 Feb 07 |
jari |
65 |
private JTextField newConn; |
2 |
26 Feb 07 |
jari |
66 |
private JCheckBox allOutBox; |
2 |
26 Feb 07 |
jari |
67 |
private JLabel allOutLabel; |
2 |
26 Feb 07 |
jari |
68 |
|
2 |
26 Feb 07 |
jari |
69 |
public static String DEFAULT_ADD_TEXT = "or enter a new server"; |
2 |
26 Feb 07 |
jari |
70 |
|
2 |
26 Feb 07 |
jari |
71 |
|
2 |
26 Feb 07 |
jari |
72 |
/** |
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 |
76 |
*/ |
2 |
26 Feb 07 |
jari |
77 |
public RamaInitDialog( Frame parent, String[] hybNames, int dataTypeP ) { |
2 |
26 Feb 07 |
jari |
78 |
super( parent, "RamaInitDialog", true ); |
2 |
26 Feb 07 |
jari |
79 |
this.setResizable( true ); |
2 |
26 Feb 07 |
jari |
80 |
this.setSize( 600, 500 ); |
2 |
26 Feb 07 |
jari |
81 |
this.dataType = dataTypeP; |
2 |
26 Feb 07 |
jari |
82 |
|
2 |
26 Feb 07 |
jari |
83 |
Listener listener = new Listener(); |
2 |
26 Feb 07 |
jari |
84 |
super.addWindowListener(listener); |
2 |
26 Feb 07 |
jari |
85 |
super.setActionListeners(listener); |
2 |
26 Feb 07 |
jari |
86 |
|
2 |
26 Feb 07 |
jari |
//initialize variables |
2 |
26 Feb 07 |
jari |
88 |
this.vCy3Radio = new Vector(); |
2 |
26 Feb 07 |
jari |
89 |
this.vRamaHyb = new Vector(); |
2 |
26 Feb 07 |
jari |
90 |
this.ramaHybs = new RHyb[ hybNames.length ]; |
2 |
26 Feb 07 |
jari |
91 |
|
2 |
26 Feb 07 |
jari |
92 |
JPanel mainPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
93 |
mainPanel.add( this.createTwoColorPanel( hybNames, this.dataType ), BorderLayout.CENTER ); |
2 |
26 Feb 07 |
jari |
94 |
mainPanel.add( this.createParamPanel(), BorderLayout.SOUTH ); |
2 |
26 Feb 07 |
jari |
95 |
this.addContent( mainPanel ); |
2 |
26 Feb 07 |
jari |
96 |
}//constructor |
2 |
26 Feb 07 |
jari |
97 |
|
2 |
26 Feb 07 |
jari |
98 |
|
2 |
26 Feb 07 |
jari |
99 |
/** |
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 |
102 |
*/ |
2 |
26 Feb 07 |
jari |
103 |
private JPanel createParamPanel() { |
2 |
26 Feb 07 |
jari |
104 |
Font font11 = new Font( "Arial", Font.PLAIN, 11 ); |
2 |
26 Feb 07 |
jari |
105 |
Font font = new Font( "Arial", Font.PLAIN, 12 ); |
2 |
26 Feb 07 |
jari |
106 |
Dimension dSpinner = new Dimension( 70, 25 ); |
2 |
26 Feb 07 |
jari |
107 |
Dimension dArea = new Dimension( 140, 80 ); |
2 |
26 Feb 07 |
jari |
108 |
Dimension dCombo = new Dimension( 170, 25 ); |
2 |
26 Feb 07 |
jari |
109 |
Dimension dSpace = new Dimension( 100, 5 ); |
2 |
26 Feb 07 |
jari |
110 |
Dimension dButton = new Dimension( 60, 20 ); |
2 |
26 Feb 07 |
jari |
111 |
Dimension dAddConn = new Dimension( 120, 20 ); |
2 |
26 Feb 07 |
jari |
112 |
|
2 |
26 Feb 07 |
jari |
//create a JCheckBox allowing user to activate Adv Params |
2 |
26 Feb 07 |
jari |
114 |
this.advCheckBox = new JCheckBox( "Advanced Parameters" ); |
2 |
26 Feb 07 |
jari |
115 |
this.advCheckBox.setFont( font11 ); |
2 |
26 Feb 07 |
jari |
116 |
AdvListener al = new AdvListener(); |
2 |
26 Feb 07 |
jari |
117 |
this.advCheckBox.addActionListener( al ); |
2 |
26 Feb 07 |
jari |
118 |
JPanel checkPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
119 |
checkPanel.add( this.advCheckBox ); |
2 |
26 Feb 07 |
jari |
120 |
|
2 |
26 Feb 07 |
jari |
//create adv params |
2 |
26 Feb 07 |
jari |
122 |
SpinnerNumberModel burnInModel = new SpinnerNumberModel( 1000, 1, 100000, 1 ); |
2 |
26 Feb 07 |
jari |
123 |
SpinnerNumberModel numIterModel = new SpinnerNumberModel( 21000, 1, 100000, 1 ); |
2 |
26 Feb 07 |
jari |
124 |
this.burnInSpinner = new JSpinner( burnInModel ); |
2 |
26 Feb 07 |
jari |
125 |
this.numIterSpinner = new JSpinner( numIterModel ); |
2 |
26 Feb 07 |
jari |
126 |
this.burnInSpinner.setPreferredSize( dSpinner ); |
2 |
26 Feb 07 |
jari |
127 |
this.numIterSpinner.setPreferredSize( dSpinner ); |
2 |
26 Feb 07 |
jari |
128 |
this.burnInSpinner.setMaximumSize( dSpinner ); |
2 |
26 Feb 07 |
jari |
129 |
this.numIterSpinner.setMaximumSize( dSpinner ); |
2 |
26 Feb 07 |
jari |
130 |
this.burnInLabel = new JLabel( "Burn In Period" ); //min.Iter |
2 |
26 Feb 07 |
jari |
131 |
this.numIterLabel = new JLabel( "# Iterations" ); //B |
2 |
26 Feb 07 |
jari |
132 |
this.burnInLabel.setFont( font11 ); |
2 |
26 Feb 07 |
jari |
133 |
this.numIterLabel.setFont( font11 ); |
2 |
26 Feb 07 |
jari |
134 |
this.allOutBox = new JCheckBox(); |
2 |
26 Feb 07 |
jari |
135 |
this.allOutLabel = new JLabel( "log credible intervals" ); |
2 |
26 Feb 07 |
jari |
136 |
this.allOutLabel.setFont( font11 ); |
2 |
26 Feb 07 |
jari |
137 |
this.allOutBox.setSelected( true ); |
2 |
26 Feb 07 |
jari |
138 |
|
2 |
26 Feb 07 |
jari |
//create connection pull down |
2 |
26 Feb 07 |
jari |
140 |
String[] connStrings = this.getConnString(); |
2 |
26 Feb 07 |
jari |
141 |
this.connCombo = new JComboBox( connStrings ); |
2 |
26 Feb 07 |
jari |
142 |
this.connCombo.setPreferredSize( dCombo ); |
2 |
26 Feb 07 |
jari |
143 |
|
2 |
26 Feb 07 |
jari |
144 |
this.newConn = new JTextField( RamaInitDialog.DEFAULT_ADD_TEXT ); |
2 |
26 Feb 07 |
jari |
145 |
this.newConn.setPreferredSize( dAddConn ); |
2 |
26 Feb 07 |
jari |
146 |
this.newConn.setFont( font11 ); |
2 |
26 Feb 07 |
jari |
147 |
this.addConnButton = new JButton( "Add" ); |
2 |
26 Feb 07 |
jari |
148 |
this.addConnButton.addActionListener( al ); |
2 |
26 Feb 07 |
jari |
149 |
this.addConnButton.setPreferredSize( dButton ); |
2 |
26 Feb 07 |
jari |
150 |
this.addConnButton.setFont( font11 ); |
2 |
26 Feb 07 |
jari |
151 |
JPanel addPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
152 |
addPanel.add( this.newConn ); |
2 |
26 Feb 07 |
jari |
153 |
addPanel.add( this.addConnButton ); |
2 |
26 Feb 07 |
jari |
154 |
|
2 |
26 Feb 07 |
jari |
//add to its own panel |
2 |
26 Feb 07 |
jari |
156 |
JPanel comboPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
157 |
BoxLayout box = new BoxLayout( comboPanel, BoxLayout.Y_AXIS ) ; |
2 |
26 Feb 07 |
jari |
158 |
comboPanel.setLayout( box ); |
2 |
26 Feb 07 |
jari |
159 |
comboPanel.add( Box.createRigidArea( dSpace ) ); |
2 |
26 Feb 07 |
jari |
160 |
comboPanel.add( this.connCombo ); |
2 |
26 Feb 07 |
jari |
161 |
comboPanel.add( Box.createRigidArea( dSpace ) ); |
2 |
26 Feb 07 |
jari |
162 |
comboPanel.add( addPanel ); |
2 |
26 Feb 07 |
jari |
163 |
Border greyLine = BorderFactory.createLineBorder( Color.LIGHT_GRAY, 1 ); |
2 |
26 Feb 07 |
jari |
164 |
TitledBorder border = BorderFactory.createTitledBorder( greyLine, |
2 |
26 Feb 07 |
jari |
165 |
"Rserve Connection", TitledBorder.TOP, TitledBorder.CENTER, font11 ); |
2 |
26 Feb 07 |
jari |
166 |
// |
2 |
26 Feb 07 |
jari |
167 |
comboPanel.setBorder( border ); |
2 |
26 Feb 07 |
jari |
168 |
|
2 |
26 Feb 07 |
jari |
//disable as default |
2 |
26 Feb 07 |
jari |
170 |
this.burnInSpinner.setEnabled( false ); |
2 |
26 Feb 07 |
jari |
171 |
this.numIterSpinner.setEnabled( false ); |
2 |
26 Feb 07 |
jari |
172 |
this.allOutBox.setEnabled( false ); |
2 |
26 Feb 07 |
jari |
173 |
this.burnInLabel.setForeground( Color.GRAY ); |
2 |
26 Feb 07 |
jari |
174 |
this.numIterLabel.setForeground( Color.GRAY ); |
2 |
26 Feb 07 |
jari |
175 |
this.allOutLabel.setForeground( Color.GRAY ); |
2 |
26 Feb 07 |
jari |
176 |
|
2 |
26 Feb 07 |
jari |
177 |
JPanel paramPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
178 |
SpringLayout sl = new SpringLayout(); |
2 |
26 Feb 07 |
jari |
179 |
paramPanel.setLayout( sl ); |
2 |
26 Feb 07 |
jari |
180 |
paramPanel.add( this.burnInLabel ); |
2 |
26 Feb 07 |
jari |
181 |
paramPanel.add( this.burnInSpinner ); |
2 |
26 Feb 07 |
jari |
182 |
paramPanel.add( this.numIterLabel ); |
2 |
26 Feb 07 |
jari |
183 |
paramPanel.add( this.numIterSpinner ); |
2 |
26 Feb 07 |
jari |
//paramPanel.add( this.allOutLabel ); |
2 |
26 Feb 07 |
jari |
//paramPanel.add( this.allOutBox ); |
2 |
26 Feb 07 |
jari |
186 |
SpringUtilities.makeCompactGrid( paramPanel, 2, 2, 5, 5, 5, 5 ); |
2 |
26 Feb 07 |
jari |
187 |
|
2 |
26 Feb 07 |
jari |
188 |
JPanel leftPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
189 |
leftPanel.setLayout( new BorderLayout() ); |
2 |
26 Feb 07 |
jari |
190 |
leftPanel.add( checkPanel, BorderLayout.NORTH ); |
2 |
26 Feb 07 |
jari |
191 |
leftPanel.add( paramPanel, BorderLayout.CENTER ); |
2 |
26 Feb 07 |
jari |
192 |
leftPanel.setBorder( BorderFactory.createLineBorder( Color.LIGHT_GRAY, 1 ) ); |
2 |
26 Feb 07 |
jari |
193 |
|
2 |
26 Feb 07 |
jari |
194 |
JPanel labelPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
195 |
Color color = labelPanel.getBackground(); |
2 |
26 Feb 07 |
jari |
196 |
JTextArea area = new JTextArea(); |
2 |
26 Feb 07 |
jari |
197 |
area.setBackground( color ); |
2 |
26 Feb 07 |
jari |
198 |
area.setForeground( Color.BLUE ); |
2 |
26 Feb 07 |
jari |
199 |
area.setEditable( false ); |
2 |
26 Feb 07 |
jari |
200 |
area.setPreferredSize( dArea ); |
2 |
26 Feb 07 |
jari |
201 |
area.setFont( font ); |
2 |
26 Feb 07 |
jari |
202 |
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 |
203 |
labelPanel.add( area ); |
2 |
26 Feb 07 |
jari |
204 |
|
2 |
26 Feb 07 |
jari |
205 |
JPanel returnPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
206 |
returnPanel.add( leftPanel ); |
2 |
26 Feb 07 |
jari |
207 |
returnPanel.add( labelPanel ); |
2 |
26 Feb 07 |
jari |
208 |
returnPanel.add( comboPanel ); |
2 |
26 Feb 07 |
jari |
209 |
|
2 |
26 Feb 07 |
jari |
210 |
return returnPanel; |
2 |
26 Feb 07 |
jari |
211 |
}//createParamPanel() |
2 |
26 Feb 07 |
jari |
212 |
|
2 |
26 Feb 07 |
jari |
213 |
|
2 |
26 Feb 07 |
jari |
//need to list the hybs and let user label exp vs control |
2 |
26 Feb 07 |
jari |
215 |
private JPanel createTwoColorPanel( 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 |
217 |
JPanel listPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
218 |
BoxLayout hybBox = new BoxLayout( listPanel, BoxLayout.Y_AXIS ); |
2 |
26 Feb 07 |
jari |
219 |
listPanel.setLayout( hybBox ); |
2 |
26 Feb 07 |
jari |
220 |
|
2 |
26 Feb 07 |
jari |
221 |
Dimension dLabel = new Dimension( 330, 15 ); |
2 |
26 Feb 07 |
jari |
222 |
Dimension dCheck = new Dimension( 50, 15 ); |
2 |
26 Feb 07 |
jari |
223 |
Dimension dRow = new Dimension( 450, 25 ); |
2 |
26 Feb 07 |
jari |
224 |
Font font = new Font( "Arial", Font.PLAIN, 11 ); |
2 |
26 Feb 07 |
jari |
225 |
|
2 |
26 Feb 07 |
jari |
//JLabel spacer |
2 |
26 Feb 07 |
jari |
227 |
JLabel spacer = new JLabel( "" ); |
2 |
26 Feb 07 |
jari |
228 |
spacer.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
229 |
spacer.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
230 |
spacer.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
231 |
|
2 |
26 Feb 07 |
jari |
//Column headers |
2 |
26 Feb 07 |
jari |
233 |
JLabel hybColLabel; |
2 |
26 Feb 07 |
jari |
234 |
JLabel cy3Label; |
2 |
26 Feb 07 |
jari |
235 |
JLabel cy5Label; |
2 |
26 Feb 07 |
jari |
236 |
if( dataTypeP == IData.DATA_TYPE_AFFY_ABS ) { |
2 |
26 Feb 07 |
jari |
237 |
hybColLabel = new JLabel( "For each chip, denote whether it is Treated or Control" ); |
2 |
26 Feb 07 |
jari |
238 |
cy3Label = new JLabel( "Treated" ); |
2 |
26 Feb 07 |
jari |
239 |
cy5Label = new JLabel( "Control" ); |
2 |
26 Feb 07 |
jari |
240 |
} else { |
2 |
26 Feb 07 |
jari |
241 |
hybColLabel = new JLabel( "For each slide, mark Control Sample's dye color" ); |
2 |
26 Feb 07 |
jari |
242 |
cy3Label = new JLabel( "Cy3" ); |
2 |
26 Feb 07 |
jari |
243 |
cy5Label = new JLabel( "Cy5" ); |
2 |
26 Feb 07 |
jari |
244 |
} |
2 |
26 Feb 07 |
jari |
245 |
hybColLabel.setFont( font ); |
2 |
26 Feb 07 |
jari |
246 |
hybColLabel.setForeground( Color.gray ); |
2 |
26 Feb 07 |
jari |
247 |
hybColLabel.setMinimumSize( dLabel ); |
2 |
26 Feb 07 |
jari |
248 |
hybColLabel.setMaximumSize( dLabel ); |
2 |
26 Feb 07 |
jari |
249 |
hybColLabel.setPreferredSize( dLabel ); |
2 |
26 Feb 07 |
jari |
250 |
cy3Label.setFont( font ); |
2 |
26 Feb 07 |
jari |
251 |
cy3Label.setForeground( Color.gray ); |
2 |
26 Feb 07 |
jari |
252 |
cy3Label.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
253 |
cy3Label.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
254 |
cy3Label.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
255 |
cy5Label.setFont( font ); |
2 |
26 Feb 07 |
jari |
256 |
cy5Label.setForeground( Color.gray ); |
2 |
26 Feb 07 |
jari |
257 |
cy5Label.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
258 |
cy5Label.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
259 |
cy5Label.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
260 |
|
2 |
26 Feb 07 |
jari |
261 |
JPanel titlePanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
262 |
titlePanel.add( hybColLabel ); |
2 |
26 Feb 07 |
jari |
263 |
titlePanel.add( cy3Label ); |
2 |
26 Feb 07 |
jari |
264 |
titlePanel.add( cy5Label ); |
2 |
26 Feb 07 |
jari |
265 |
listPanel.add( titlePanel ); |
2 |
26 Feb 07 |
jari |
266 |
|
2 |
26 Feb 07 |
jari |
267 |
int iHyb = hybNames.length; |
2 |
26 Feb 07 |
jari |
268 |
int iHalf = iHyb / 2; |
2 |
26 Feb 07 |
jari |
269 |
|
2 |
26 Feb 07 |
jari |
270 |
for( int h = 0; h < iHyb; h ++ ) { |
2 |
26 Feb 07 |
jari |
//JLabel spacer |
2 |
26 Feb 07 |
jari |
272 |
JLabel spaceLabel = new JLabel( "" ); |
2 |
26 Feb 07 |
jari |
273 |
spaceLabel.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
274 |
spaceLabel.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
275 |
spaceLabel.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
276 |
|
2 |
26 Feb 07 |
jari |
//display the hyb name and radio buttons so user can label them |
2 |
26 Feb 07 |
jari |
278 |
JLabel hybLabel = new JLabel( hybNames[ h ] ); |
2 |
26 Feb 07 |
jari |
279 |
hybLabel.setMinimumSize( dLabel ); |
2 |
26 Feb 07 |
jari |
280 |
hybLabel.setMaximumSize( dLabel ); |
2 |
26 Feb 07 |
jari |
281 |
hybLabel.setPreferredSize( dLabel ); |
2 |
26 Feb 07 |
jari |
282 |
|
2 |
26 Feb 07 |
jari |
283 |
JRadioButton cy3Button = new JRadioButton(); |
2 |
26 Feb 07 |
jari |
284 |
JRadioButton cy5Button = new JRadioButton(); |
2 |
26 Feb 07 |
jari |
285 |
cy3Button.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
286 |
cy3Button.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
287 |
cy3Button.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
288 |
cy5Button.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
289 |
cy5Button.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
290 |
cy5Button.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
291 |
|
2 |
26 Feb 07 |
jari |
//add them to a group so they are mutually exclusive |
2 |
26 Feb 07 |
jari |
293 |
ButtonGroup sampleGroup = new ButtonGroup(); |
2 |
26 Feb 07 |
jari |
294 |
sampleGroup.add( cy3Button ); |
2 |
26 Feb 07 |
jari |
295 |
sampleGroup.add( cy5Button ); |
2 |
26 Feb 07 |
jari |
296 |
// |
2 |
26 Feb 07 |
jari |
//by default, split the hybs in half for ease |
2 |
26 Feb 07 |
jari |
298 |
if( h < iHalf ) { |
2 |
26 Feb 07 |
jari |
299 |
cy3Button.setSelected( false ); |
2 |
26 Feb 07 |
jari |
300 |
cy5Button.setSelected( true ); |
2 |
26 Feb 07 |
jari |
301 |
} else { |
2 |
26 Feb 07 |
jari |
302 |
cy3Button.setSelected( true ); |
2 |
26 Feb 07 |
jari |
303 |
cy5Button.setSelected( false ); |
2 |
26 Feb 07 |
jari |
304 |
} |
2 |
26 Feb 07 |
jari |
305 |
|
2 |
26 Feb 07 |
jari |
306 |
JPanel rowPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
307 |
rowPanel.add( hybLabel ); |
2 |
26 Feb 07 |
jari |
308 |
rowPanel.add( cy3Button ); |
2 |
26 Feb 07 |
jari |
309 |
rowPanel.add( cy5Button ); |
2 |
26 Feb 07 |
jari |
310 |
rowPanel.setMaximumSize( dRow ); |
2 |
26 Feb 07 |
jari |
311 |
rowPanel.setMinimumSize( dRow ); |
2 |
26 Feb 07 |
jari |
312 |
rowPanel.setPreferredSize( dRow ); |
2 |
26 Feb 07 |
jari |
313 |
|
2 |
26 Feb 07 |
jari |
//color every other row |
2 |
26 Feb 07 |
jari |
315 |
if( h % 2 == 0 ) { |
2 |
26 Feb 07 |
jari |
316 |
rowPanel.setBackground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
317 |
cy3Button.setBackground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
318 |
cy5Button.setBackground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
319 |
} |
2 |
26 Feb 07 |
jari |
320 |
|
2 |
26 Feb 07 |
jari |
321 |
RHyb hyb; |
2 |
26 Feb 07 |
jari |
322 |
|
2 |
26 Feb 07 |
jari |
323 |
if( dataTypeP == IData.DATA_TYPE_AFFY_ABS ) { |
2 |
26 Feb 07 |
jari |
324 |
hyb = new RHyb( h, hybNames[ h ], cy3Button, |
2 |
26 Feb 07 |
jari |
325 |
IData.DATA_TYPE_AFFY_ABS ); |
2 |
26 Feb 07 |
jari |
326 |
} else { |
2 |
26 Feb 07 |
jari |
327 |
hyb = new RHyb( h, hybNames[ h ], cy3Button, |
2 |
26 Feb 07 |
jari |
328 |
IData.DATA_TYPE_TWO_INTENSITY ); |
2 |
26 Feb 07 |
jari |
329 |
} |
2 |
26 Feb 07 |
jari |
330 |
this.ramaHybs[ h ] = hyb; |
2 |
26 Feb 07 |
jari |
331 |
this.vRamaHyb.add( hyb ); |
2 |
26 Feb 07 |
jari |
332 |
listPanel.add( rowPanel ); |
2 |
26 Feb 07 |
jari |
333 |
} |
2 |
26 Feb 07 |
jari |
334 |
|
2 |
26 Feb 07 |
jari |
335 |
listPanel.add( Box.createVerticalGlue() ); |
2 |
26 Feb 07 |
jari |
336 |
listPanel.setBorder( BorderFactory.createLineBorder( Color.LIGHT_GRAY, 1 ) ); |
2 |
26 Feb 07 |
jari |
337 |
return listPanel; |
2 |
26 Feb 07 |
jari |
338 |
} |
2 |
26 Feb 07 |
jari |
339 |
|
2 |
26 Feb 07 |
jari |
340 |
/** |
2 |
26 Feb 07 |
jari |
* Shows the dialog. |
2 |
26 Feb 07 |
jari |
342 |
*/ |
2 |
26 Feb 07 |
jari |
343 |
public int showModal() { |
2 |
26 Feb 07 |
jari |
344 |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
2 |
26 Feb 07 |
jari |
345 |
setLocation((screenSize.width - getSize().width)/2, (screenSize.height - getSize().height)/2); |
2 |
26 Feb 07 |
jari |
346 |
show(); |
2 |
26 Feb 07 |
jari |
347 |
return result; |
2 |
26 Feb 07 |
jari |
348 |
}//end showModal() |
2 |
26 Feb 07 |
jari |
349 |
|
2 |
26 Feb 07 |
jari |
350 |
|
2 |
26 Feb 07 |
jari |
351 |
/** |
2 |
26 Feb 07 |
jari |
352 |
* |
2 |
26 Feb 07 |
jari |
* @param message |
2 |
26 Feb 07 |
jari |
354 |
*/ |
2 |
26 Feb 07 |
jari |
355 |
public void error( String message ) { |
2 |
26 Feb 07 |
jari |
356 |
JOptionPane.showMessageDialog( this, message, "Input Error", JOptionPane.ERROR_MESSAGE ); |
2 |
26 Feb 07 |
jari |
357 |
}//end error() |
2 |
26 Feb 07 |
jari |
358 |
|
2 |
26 Feb 07 |
jari |
359 |
|
2 |
26 Feb 07 |
jari |
360 |
/** |
2 |
26 Feb 07 |
jari |
361 |
* |
2 |
26 Feb 07 |
jari |
* @author iVu |
2 |
26 Feb 07 |
jari |
363 |
*/ |
2 |
26 Feb 07 |
jari |
364 |
private class AdvListener implements ActionListener { |
2 |
26 Feb 07 |
jari |
365 |
public void actionPerformed(ActionEvent e) { |
2 |
26 Feb 07 |
jari |
366 |
Object source = e.getSource(); |
2 |
26 Feb 07 |
jari |
367 |
|
2 |
26 Feb 07 |
jari |
368 |
if( source == advCheckBox ) { |
2 |
26 Feb 07 |
jari |
369 |
onAdvancedClicked(); |
2 |
26 Feb 07 |
jari |
370 |
} |
2 |
26 Feb 07 |
jari |
371 |
if( source == addConnButton ) { |
2 |
26 Feb 07 |
jari |
372 |
String s = ( String ) newConn.getText().trim(); |
2 |
26 Feb 07 |
jari |
373 |
if( s.equals( RamaInitDialog.DEFAULT_ADD_TEXT ) ) { |
2 |
26 Feb 07 |
jari |
//do nothing |
2 |
26 Feb 07 |
jari |
375 |
} else if( s.equals( "" ) ) { |
2 |
26 Feb 07 |
jari |
//do nothing |
2 |
26 Feb 07 |
jari |
377 |
} else { |
2 |
26 Feb 07 |
jari |
378 |
int itemKount = connCombo.getItemCount(); |
2 |
26 Feb 07 |
jari |
379 |
boolean alreadyThere = false; |
2 |
26 Feb 07 |
jari |
380 |
for( int i = 0; i < itemKount; i ++ ) { |
2 |
26 Feb 07 |
jari |
381 |
String item = ( String ) connCombo.getItemAt( i ); |
2 |
26 Feb 07 |
jari |
382 |
if( s.equals( item ) ) { |
2 |
26 Feb 07 |
jari |
383 |
alreadyThere = true; |
2 |
26 Feb 07 |
jari |
384 |
break; |
2 |
26 Feb 07 |
jari |
385 |
} |
2 |
26 Feb 07 |
jari |
386 |
} |
2 |
26 Feb 07 |
jari |
387 |
if( ! alreadyThere ) { |
2 |
26 Feb 07 |
jari |
388 |
connAdded = true; |
2 |
26 Feb 07 |
jari |
389 |
connCombo.insertItemAt( s, 0 ); |
2 |
26 Feb 07 |
jari |
390 |
connCombo.setSelectedIndex( 0 ); |
2 |
26 Feb 07 |
jari |
391 |
} |
2 |
26 Feb 07 |
jari |
392 |
} |
2 |
26 Feb 07 |
jari |
393 |
} |
2 |
26 Feb 07 |
jari |
394 |
}//end actionPerformed() |
2 |
26 Feb 07 |
jari |
395 |
}//end class |
2 |
26 Feb 07 |
jari |
396 |
|
2 |
26 Feb 07 |
jari |
397 |
|
2 |
26 Feb 07 |
jari |
398 |
/** |
2 |
26 Feb 07 |
jari |
* Enable or Disable the advanced parameters |
2 |
26 Feb 07 |
jari |
400 |
* |
2 |
26 Feb 07 |
jari |
401 |
*/ |
2 |
26 Feb 07 |
jari |
402 |
private void onAdvancedClicked() { |
2 |
26 Feb 07 |
jari |
403 |
if( this.advCheckBox.isSelected() ) { |
2 |
26 Feb 07 |
jari |
404 |
this.burnInSpinner.setEnabled( true ); |
2 |
26 Feb 07 |
jari |
405 |
this.numIterSpinner.setEnabled( true ); |
2 |
26 Feb 07 |
jari |
406 |
this.allOutBox.setEnabled( true ); |
2 |
26 Feb 07 |
jari |
407 |
this.burnInLabel.setForeground( Color.BLACK ); |
2 |
26 Feb 07 |
jari |
408 |
this.numIterLabel.setForeground( Color.BLACK ); |
2 |
26 Feb 07 |
jari |
409 |
this.allOutLabel.setForeground( Color.BLACK ); |
2 |
26 Feb 07 |
jari |
410 |
} else { |
2 |
26 Feb 07 |
jari |
411 |
this.burnInSpinner.setEnabled( false ); |
2 |
26 Feb 07 |
jari |
412 |
this.numIterSpinner.setEnabled( false ); |
2 |
26 Feb 07 |
jari |
413 |
this.allOutBox.setEnabled( false ); |
2 |
26 Feb 07 |
jari |
414 |
this.burnInLabel.setForeground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
415 |
this.numIterLabel.setForeground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
416 |
this.allOutLabel.setForeground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
417 |
} |
2 |
26 Feb 07 |
jari |
418 |
}//onAdvancedClicked() |
2 |
26 Feb 07 |
jari |
419 |
|
2 |
26 Feb 07 |
jari |
420 |
|
2 |
26 Feb 07 |
jari |
421 |
|
2 |
26 Feb 07 |
jari |
422 |
private boolean verifyHybs() { |
2 |
26 Feb 07 |
jari |
423 |
RHybSet rhs = this.getRamaHybSet(); |
2 |
26 Feb 07 |
jari |
424 |
|
2 |
26 Feb 07 |
jari |
425 |
if( this.dataType == IData.DATA_TYPE_TWO_INTENSITY ) { |
2 |
26 Feb 07 |
jari |
426 |
if( rhs.isFlip() ) { |
2 |
26 Feb 07 |
jari |
//make sure there are at least 2 of each |
2 |
26 Feb 07 |
jari |
428 |
return this.atLeastTwo( rhs ); |
2 |
26 Feb 07 |
jari |
429 |
} else { |
2 |
26 Feb 07 |
jari |
430 |
return true; |
2 |
26 Feb 07 |
jari |
431 |
} |
2 |
26 Feb 07 |
jari |
432 |
} else { //Affy data |
2 |
26 Feb 07 |
jari |
433 |
return this.isBalanced( rhs ); |
2 |
26 Feb 07 |
jari |
434 |
} |
2 |
26 Feb 07 |
jari |
435 |
}//verifyHybs() |
2 |
26 Feb 07 |
jari |
436 |
|
2 |
26 Feb 07 |
jari |
437 |
/** |
2 |
26 Feb 07 |
jari |
* Can't average less than 2 |
2 |
26 Feb 07 |
jari |
* @param rhs |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
441 |
*/ |
2 |
26 Feb 07 |
jari |
442 |
private boolean atLeastTwo( RHybSet rhs ) { |
2 |
26 Feb 07 |
jari |
443 |
Vector vRamaHyb = rhs.getVRamaHyb(); |
2 |
26 Feb 07 |
jari |
444 |
|
2 |
26 Feb 07 |
jari |
445 |
int iOne = 0; |
2 |
26 Feb 07 |
jari |
446 |
int iTwo = 0; |
2 |
26 Feb 07 |
jari |
447 |
|
2 |
26 Feb 07 |
jari |
448 |
for( int r = 0; r < vRamaHyb.size(); r ++ ) { |
2 |
26 Feb 07 |
jari |
449 |
RHyb hyb = ( RHyb ) vRamaHyb.elementAt( r ); |
2 |
26 Feb 07 |
jari |
450 |
if( hyb.controlCy3() ) { |
2 |
26 Feb 07 |
jari |
451 |
iOne ++; |
2 |
26 Feb 07 |
jari |
452 |
} else { |
2 |
26 Feb 07 |
jari |
453 |
iTwo ++; |
2 |
26 Feb 07 |
jari |
454 |
} |
2 |
26 Feb 07 |
jari |
455 |
}//r |
2 |
26 Feb 07 |
jari |
456 |
|
2 |
26 Feb 07 |
jari |
457 |
if( iOne > 1 && iTwo > 1 ) { |
2 |
26 Feb 07 |
jari |
//good |
2 |
26 Feb 07 |
jari |
459 |
return true; |
2 |
26 Feb 07 |
jari |
460 |
} else { |
2 |
26 Feb 07 |
jari |
//bad |
2 |
26 Feb 07 |
jari |
462 |
this.error( "For dye-swap experiments, there must be at least 2 hybs of each color state" ); |
2 |
26 Feb 07 |
jari |
463 |
return false; |
2 |
26 Feb 07 |
jari |
464 |
} |
2 |
26 Feb 07 |
jari |
465 |
} |
2 |
26 Feb 07 |
jari |
466 |
|
2 |
26 Feb 07 |
jari |
467 |
/** |
2 |
26 Feb 07 |
jari |
* Tests to make sure there is a Treated for every Control and vice versa |
2 |
26 Feb 07 |
jari |
* @param rhs |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
471 |
*/ |
2 |
26 Feb 07 |
jari |
472 |
private boolean isBalanced( RHybSet rhs ) { |
2 |
26 Feb 07 |
jari |
473 |
Vector vRamaHyb = rhs.getVRamaHyb(); |
2 |
26 Feb 07 |
jari |
474 |
|
2 |
26 Feb 07 |
jari |
475 |
int iTreated = 0; |
2 |
26 Feb 07 |
jari |
476 |
int iControl = 0; |
2 |
26 Feb 07 |
jari |
477 |
|
2 |
26 Feb 07 |
jari |
478 |
for( int r = 0; r < vRamaHyb.size(); r ++ ) { |
2 |
26 Feb 07 |
jari |
479 |
RHyb hyb = ( RHyb ) vRamaHyb.elementAt( r ); |
2 |
26 Feb 07 |
jari |
480 |
if( hyb.oneIsTreated() ) { |
2 |
26 Feb 07 |
jari |
481 |
iTreated ++; |
2 |
26 Feb 07 |
jari |
482 |
} else { |
2 |
26 Feb 07 |
jari |
483 |
iControl ++; |
2 |
26 Feb 07 |
jari |
484 |
} |
2 |
26 Feb 07 |
jari |
485 |
}//r |
2 |
26 Feb 07 |
jari |
486 |
|
2 |
26 Feb 07 |
jari |
487 |
if( iTreated == iControl ) { |
2 |
26 Feb 07 |
jari |
488 |
return true; |
2 |
26 Feb 07 |
jari |
489 |
} else { |
2 |
26 Feb 07 |
jari |
490 |
this.error( "For affy data, you must have the same # of Treated and Control Chips" ); |
2 |
26 Feb 07 |
jari |
491 |
return false; |
2 |
26 Feb 07 |
jari |
492 |
} |
2 |
26 Feb 07 |
jari |
493 |
} |
2 |
26 Feb 07 |
jari |
494 |
|
2 |
26 Feb 07 |
jari |
495 |
|
2 |
26 Feb 07 |
jari |
496 |
/** |
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 |
500 |
*/ |
2 |
26 Feb 07 |
jari |
501 |
private String[] getConnString() { |
2 |
26 Feb 07 |
jari |
//try to get the connection string from the pref file default is ("localhost:6311") |
2 |
26 Feb 07 |
jari |
503 |
String rPath = TMEV.getRPath(); |
2 |
26 Feb 07 |
jari |
504 |
|
2 |
26 Feb 07 |
jari |
505 |
String[] toReturn; |
2 |
26 Feb 07 |
jari |
506 |
|
2 |
26 Feb 07 |
jari |
507 |
StringTokenizer st = new StringTokenizer( rPath, ";" ); |
2 |
26 Feb 07 |
jari |
508 |
int tokenKount = st.countTokens(); |
2 |
26 Feb 07 |
jari |
509 |
toReturn = new String[ tokenKount ]; |
2 |
26 Feb 07 |
jari |
510 |
for( int i = 0; i < tokenKount; i ++ ) { |
2 |
26 Feb 07 |
jari |
511 |
String token = st.nextToken(); |
2 |
26 Feb 07 |
jari |
512 |
toReturn[ i ] = token; |
2 |
26 Feb 07 |
jari |
513 |
}//i |
2 |
26 Feb 07 |
jari |
514 |
|
2 |
26 Feb 07 |
jari |
515 |
return toReturn; |
2 |
26 Feb 07 |
jari |
516 |
}//getConnString |
2 |
26 Feb 07 |
jari |
517 |
|
2 |
26 Feb 07 |
jari |
518 |
|
2 |
26 Feb 07 |
jari |
519 |
/** |
2 |
26 Feb 07 |
jari |
* The class to listen to the dialog and check boxes items events. |
2 |
26 Feb 07 |
jari |
521 |
*/ |
2 |
26 Feb 07 |
jari |
522 |
private class Listener extends DialogListener implements ItemListener { |
2 |
26 Feb 07 |
jari |
523 |
|
2 |
26 Feb 07 |
jari |
524 |
public void actionPerformed(ActionEvent e) { |
2 |
26 Feb 07 |
jari |
525 |
String command = e.getActionCommand(); |
2 |
26 Feb 07 |
jari |
526 |
if (command.equals("ok-command")) { |
2 |
26 Feb 07 |
jari |
527 |
if( verifyHybs() ) { |
2 |
26 Feb 07 |
jari |
528 |
result = JOptionPane.OK_OPTION; |
2 |
26 Feb 07 |
jari |
529 |
dispose(); |
2 |
26 Feb 07 |
jari |
530 |
} |
2 |
26 Feb 07 |
jari |
531 |
} else if (command.equals("cancel-command")) { |
2 |
26 Feb 07 |
jari |
532 |
result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
533 |
dispose(); |
2 |
26 Feb 07 |
jari |
534 |
} else if (command.equals("reset-command")) { |
2 |
26 Feb 07 |
jari |
//resetControls(); |
2 |
26 Feb 07 |
jari |
536 |
result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
537 |
return; |
2 |
26 Feb 07 |
jari |
538 |
} else if (command.equals("info-command")) { |
2 |
26 Feb 07 |
jari |
539 |
HelpWindow hw = new HelpWindow(RamaInitDialog.this, "RAMA Initialization Dialog"); |
2 |
26 Feb 07 |
jari |
540 |
result = JOptionPane.CANCEL_OPTION; |
2 |
26 Feb 07 |
jari |
541 |
if(hw.getWindowContent()){ |
2 |
26 Feb 07 |
jari |
542 |
hw.setSize(450,600); |
2 |
26 Feb 07 |
jari |
543 |
hw.setLocation(); |
2 |
26 Feb 07 |
jari |
544 |
hw.show(); |
2 |
26 Feb 07 |
jari |
545 |
return; |
2 |
26 Feb 07 |
jari |
546 |
} else { |
2 |
26 Feb 07 |
jari |
547 |
hw.setVisible(false); |
2 |
26 Feb 07 |
jari |
548 |
hw.dispose(); |
2 |
26 Feb 07 |
jari |
549 |
return; |
2 |
26 Feb 07 |
jari |
550 |
} |
2 |
26 Feb 07 |
jari |
551 |
} |
2 |
26 Feb 07 |
jari |
552 |
}//end actionPerformed() |
2 |
26 Feb 07 |
jari |
553 |
|
2 |
26 Feb 07 |
jari |
554 |
public void itemStateChanged(ItemEvent e) { |
2 |
26 Feb 07 |
jari |
//okButton.setEnabled(genes_box.isSelected() || cluster_box.isSelected()); |
2 |
26 Feb 07 |
jari |
556 |
} |
2 |
26 Feb 07 |
jari |
557 |
|
2 |
26 Feb 07 |
jari |
558 |
public void windowClosing(WindowEvent e) { |
2 |
26 Feb 07 |
jari |
559 |
result = JOptionPane.CLOSED_OPTION; |
2 |
26 Feb 07 |
jari |
560 |
dispose(); |
2 |
26 Feb 07 |
jari |
561 |
} |
2 |
26 Feb 07 |
jari |
562 |
}//end internal Listener class |
2 |
26 Feb 07 |
jari |
563 |
|
2 |
26 Feb 07 |
jari |
564 |
|
2 |
26 Feb 07 |
jari |
565 |
public boolean getAllOut() { |
2 |
26 Feb 07 |
jari |
566 |
return this.allOutBox.isSelected(); |
2 |
26 Feb 07 |
jari |
567 |
} |
2 |
26 Feb 07 |
jari |
568 |
public int getBurnIn() { |
2 |
26 Feb 07 |
jari |
569 |
SpinnerNumberModel model = ( SpinnerNumberModel ) this.burnInSpinner.getModel(); |
2 |
26 Feb 07 |
jari |
570 |
return model.getNumber().intValue(); |
2 |
26 Feb 07 |
jari |
571 |
} |
2 |
26 Feb 07 |
jari |
572 |
public int getNumIter() { |
2 |
26 Feb 07 |
jari |
573 |
SpinnerNumberModel model = ( SpinnerNumberModel ) this.numIterSpinner.getModel(); |
2 |
26 Feb 07 |
jari |
574 |
return model.getNumber().intValue(); |
2 |
26 Feb 07 |
jari |
575 |
} |
2 |
26 Feb 07 |
jari |
576 |
public RHybSet getRamaHybSet() { |
2 |
26 Feb 07 |
jari |
577 |
return new RHybSet( this.vRamaHyb ); |
2 |
26 Feb 07 |
jari |
578 |
} |
2 |
26 Feb 07 |
jari |
579 |
public String getSelectedConnString() { |
2 |
26 Feb 07 |
jari |
580 |
return ( String ) this.connCombo.getSelectedItem(); |
2 |
26 Feb 07 |
jari |
581 |
} |
2 |
26 Feb 07 |
jari |
582 |
public String getRPathToWrite() { |
2 |
26 Feb 07 |
jari |
583 |
StringBuffer sb = new StringBuffer(); |
2 |
26 Feb 07 |
jari |
584 |
for( int i = 0; i < this.connCombo.getItemCount(); i ++ ) { |
2 |
26 Feb 07 |
jari |
585 |
String s = ( String ) this.connCombo.getItemAt( i ); |
2 |
26 Feb 07 |
jari |
586 |
if( i > 0 ) { |
2 |
26 Feb 07 |
jari |
587 |
sb.append( ";" ); |
2 |
26 Feb 07 |
jari |
588 |
} |
2 |
26 Feb 07 |
jari |
589 |
sb.append( s ); |
2 |
26 Feb 07 |
jari |
590 |
} |
2 |
26 Feb 07 |
jari |
591 |
return sb.toString(); |
2 |
26 Feb 07 |
jari |
592 |
} |
2 |
26 Feb 07 |
jari |
593 |
public boolean connAdded() { |
2 |
26 Feb 07 |
jari |
594 |
return this.connAdded; |
2 |
26 Feb 07 |
jari |
595 |
} |
2 |
26 Feb 07 |
jari |
596 |
|
2 |
26 Feb 07 |
jari |
597 |
|
2 |
26 Feb 07 |
jari |
// test harness |
2 |
26 Feb 07 |
jari |
599 |
public static void main(String [] args) { |
2 |
26 Feb 07 |
jari |
600 |
System.out.println( "RamaInitDialog invoked by main" ); |
2 |
26 Feb 07 |
jari |
601 |
|
2 |
26 Feb 07 |
jari |
602 |
String[] names = new String[ 8 ]; |
2 |
26 Feb 07 |
jari |
603 |
names[ 0 ] = "one"; |
2 |
26 Feb 07 |
jari |
604 |
names[ 1 ] = "two"; |
2 |
26 Feb 07 |
jari |
605 |
names[ 2 ] = "three"; |
2 |
26 Feb 07 |
jari |
606 |
names[ 3 ] = "four"; |
2 |
26 Feb 07 |
jari |
607 |
names[ 4 ] = "five"; |
2 |
26 Feb 07 |
jari |
608 |
names[ 5 ] = "six"; |
2 |
26 Feb 07 |
jari |
609 |
names[ 6 ] = "seven"; |
2 |
26 Feb 07 |
jari |
610 |
names[ 7 ] = "eight"; |
2 |
26 Feb 07 |
jari |
611 |
|
2 |
26 Feb 07 |
jari |
612 |
RamaInitDialog uid = new RamaInitDialog( new Frame(), names, IData.DATA_TYPE_AFFY_ABS ); |
2 |
26 Feb 07 |
jari |
//RamaInitDialog uid = new RamaInitDialog( new Frame(), names, IData.DATA_TYPE_TWO_INTENSITY ); |
2 |
26 Feb 07 |
jari |
614 |
uid.showModal(); |
2 |
26 Feb 07 |
jari |
615 |
}//end main |
2 |
26 Feb 07 |
jari |
616 |
}//end class |
2 |
26 Feb 07 |
jari |
617 |
|
2 |
26 Feb 07 |
jari |
618 |
|
2 |
26 Feb 07 |
jari |
619 |
/* |
2 |
26 Feb 07 |
jari |
620 |
*/ |
2 |
26 Feb 07 |
jari |
621 |
/* |
2 |
26 Feb 07 |
jari |
public Vector getVRamaHyb() { |
2 |
26 Feb 07 |
jari |
return this.vRamaHyb; |
2 |
26 Feb 07 |
jari |
624 |
} |
2 |
26 Feb 07 |
jari |
public Vector getVOne() { |
2 |
26 Feb 07 |
jari |
return this.vOne; |
2 |
26 Feb 07 |
jari |
627 |
} |
2 |
26 Feb 07 |
jari |
public Vector getVTwo() { |
2 |
26 Feb 07 |
jari |
return this.vTwo; |
2 |
26 Feb 07 |
jari |
630 |
} |
2 |
26 Feb 07 |
jari |
public Vector getVOneFlip() { |
2 |
26 Feb 07 |
jari |
return this.vOneFlip; |
2 |
26 Feb 07 |
jari |
633 |
} |
2 |
26 Feb 07 |
jari |
public Vector getVTwoFlip() { |
2 |
26 Feb 07 |
jari |
return this.vTwoFlip; |
2 |
26 Feb 07 |
jari |
636 |
} |
2 |
26 Feb 07 |
jari |
637 |
/** |
2 |
26 Feb 07 |
jari |
* Creates a Vector of RamaHybs where: treated-Cy3 | control-Cy5 |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
640 |
|
2 |
26 Feb 07 |
jari |
public Vector getVRamaHybTreatCy3() { |
2 |
26 Feb 07 |
jari |
Vector vReturn = new Vector(); |
2 |
26 Feb 07 |
jari |
643 |
|
2 |
26 Feb 07 |
jari |
for( int h = 0; h < this.ramaHybs.length; h ++ ) { |
2 |
26 Feb 07 |
jari |
if( ! this.ramaHybs[ h ].controlCy3() ) { |
2 |
26 Feb 07 |
jari |
vReturn.add( this.ramaHybs[ h ] ); |
2 |
26 Feb 07 |
jari |
647 |
} |
2 |
26 Feb 07 |
jari |
648 |
} |
2 |
26 Feb 07 |
jari |
649 |
|
2 |
26 Feb 07 |
jari |
return vReturn; |
2 |
26 Feb 07 |
jari |
651 |
} |
2 |
26 Feb 07 |
jari |
652 |
/** |
2 |
26 Feb 07 |
jari |
* Creates a Vector of RamaHybs where: control-Cy3 | treated-Cy5 |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
655 |
|
2 |
26 Feb 07 |
jari |
public Vector getVRamaHybTreatCy5() { |
2 |
26 Feb 07 |
jari |
Vector vReturn = new Vector(); |
2 |
26 Feb 07 |
jari |
658 |
|
2 |
26 Feb 07 |
jari |
for( int h = 0; h < this.ramaHybs.length; h ++ ) { |
2 |
26 Feb 07 |
jari |
if( this.ramaHybs[ h ].controlCy3() ) { |
2 |
26 Feb 07 |
jari |
vReturn.add( this.ramaHybs[ h ] ); |
2 |
26 Feb 07 |
jari |
662 |
} |
2 |
26 Feb 07 |
jari |
663 |
} |
2 |
26 Feb 07 |
jari |
664 |
|
2 |
26 Feb 07 |
jari |
return vReturn; |
2 |
26 Feb 07 |
jari |
666 |
} |
2 |
26 Feb 07 |
jari |
667 |
|
2 |
26 Feb 07 |
jari |
668 |
|
2 |
26 Feb 07 |
jari |
private JPanel createListPanel( String[] hybNames ) { |
2 |
26 Feb 07 |
jari |
Dimension dLabel = new Dimension( 180, 15 ); |
2 |
26 Feb 07 |
jari |
Dimension dCheck = new Dimension( 20, 15 ); |
2 |
26 Feb 07 |
jari |
Dimension dForty = new Dimension( 40, 15 ); |
2 |
26 Feb 07 |
jari |
Font font = new Font( "Arial", Font.PLAIN, 11 ); |
2 |
26 Feb 07 |
jari |
674 |
|
2 |
26 Feb 07 |
jari |
//JLabel spacer |
2 |
26 Feb 07 |
jari |
JLabel spacer = new JLabel( "" ); |
2 |
26 Feb 07 |
jari |
spacer.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
spacer.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
spacer.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
680 |
|
2 |
26 Feb 07 |
jari |
//JPanel for listing the hybs and the radio buttons and check boxes |
2 |
26 Feb 07 |
jari |
JPanel listPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
BoxLayout hybBox = new BoxLayout( listPanel, BoxLayout.Y_AXIS ); |
2 |
26 Feb 07 |
jari |
listPanel.setLayout( hybBox ); |
2 |
26 Feb 07 |
jari |
685 |
|
2 |
26 Feb 07 |
jari |
//column labels |
2 |
26 Feb 07 |
jari |
JLabel hybColLabel = new JLabel( "Slide Name" ); |
2 |
26 Feb 07 |
jari |
hybColLabel.setFont( font ); |
2 |
26 Feb 07 |
jari |
hybColLabel.setForeground( Color.gray ); |
2 |
26 Feb 07 |
jari |
hybColLabel.setMinimumSize( dLabel ); |
2 |
26 Feb 07 |
jari |
hybColLabel.setMaximumSize( dLabel ); |
2 |
26 Feb 07 |
jari |
hybColLabel.setPreferredSize( dLabel ); |
2 |
26 Feb 07 |
jari |
JLabel expLabel = new JLabel( "Exp" ); |
2 |
26 Feb 07 |
jari |
expLabel.setFont( font ); |
2 |
26 Feb 07 |
jari |
expLabel.setForeground( Color.gray ); |
2 |
26 Feb 07 |
jari |
expLabel.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
expLabel.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
expLabel.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
JLabel conLabel = new JLabel( "Con" ); |
2 |
26 Feb 07 |
jari |
conLabel.setFont( font ); |
2 |
26 Feb 07 |
jari |
conLabel.setForeground( Color.gray ); |
2 |
26 Feb 07 |
jari |
conLabel.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
conLabel.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
conLabel.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
JLabel flipLabel = new JLabel( "Flip" ); |
2 |
26 Feb 07 |
jari |
flipLabel.setFont( font ); |
2 |
26 Feb 07 |
jari |
flipLabel.setForeground( Color.gray ); |
2 |
26 Feb 07 |
jari |
flipLabel.setMinimumSize( dForty ); |
2 |
26 Feb 07 |
jari |
flipLabel.setMaximumSize( dForty ); |
2 |
26 Feb 07 |
jari |
flipLabel.setPreferredSize( dForty ); |
2 |
26 Feb 07 |
jari |
JPanel titlePanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
titlePanel.add( hybColLabel ); |
2 |
26 Feb 07 |
jari |
titlePanel.add( expLabel ); |
2 |
26 Feb 07 |
jari |
titlePanel.add( conLabel ); |
2 |
26 Feb 07 |
jari |
titlePanel.add( spacer ); |
2 |
26 Feb 07 |
jari |
titlePanel.add( flipLabel ); |
2 |
26 Feb 07 |
jari |
listPanel.add( titlePanel ); |
2 |
26 Feb 07 |
jari |
718 |
|
2 |
26 Feb 07 |
jari |
//display a list of the hybs and ask |
2 |
26 Feb 07 |
jari |
int iHybs = hybNames.length; |
2 |
26 Feb 07 |
jari |
int iHalf = iHybs / 2; |
2 |
26 Feb 07 |
jari |
722 |
|
2 |
26 Feb 07 |
jari |
//loop through the hybs |
2 |
26 Feb 07 |
jari |
for( int h = 0; h < iHybs; h ++ ) { |
2 |
26 Feb 07 |
jari |
//JLabel spacer |
2 |
26 Feb 07 |
jari |
JLabel spaceLabel = new JLabel( "" ); |
2 |
26 Feb 07 |
jari |
spaceLabel.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
spaceLabel.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
spaceLabel.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
730 |
|
2 |
26 Feb 07 |
jari |
//display the hyb name and radio buttons so user can label them |
2 |
26 Feb 07 |
jari |
JLabel hybLabel = new JLabel( hybNames[ h ] ); |
2 |
26 Feb 07 |
jari |
hybLabel.setMinimumSize( dLabel ); |
2 |
26 Feb 07 |
jari |
hybLabel.setMaximumSize( dLabel ); |
2 |
26 Feb 07 |
jari |
hybLabel.setPreferredSize( dLabel ); |
2 |
26 Feb 07 |
jari |
736 |
|
2 |
26 Feb 07 |
jari |
JRadioButton oneButton = new JRadioButton(); |
2 |
26 Feb 07 |
jari |
JRadioButton twoButton = new JRadioButton(); |
2 |
26 Feb 07 |
jari |
oneButton.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
oneButton.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
oneButton.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
twoButton.setMinimumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
twoButton.setMaximumSize( dCheck ); |
2 |
26 Feb 07 |
jari |
twoButton.setPreferredSize( dCheck ); |
2 |
26 Feb 07 |
jari |
this.vCy3Radio.add( twoButton ); |
2 |
26 Feb 07 |
jari |
//this.vExpRadio.add( expButton ); |
2 |
26 Feb 07 |
jari |
747 |
|
2 |
26 Feb 07 |
jari |
//add them to a group so they are mutually exclusive |
2 |
26 Feb 07 |
jari |
ButtonGroup sampleGroup = new ButtonGroup(); |
2 |
26 Feb 07 |
jari |
sampleGroup.add( oneButton ); |
2 |
26 Feb 07 |
jari |
sampleGroup.add( twoButton ); |
2 |
26 Feb 07 |
jari |
752 |
|
2 |
26 Feb 07 |
jari |
JCheckBox flipBox = new JCheckBox(); |
2 |
26 Feb 07 |
jari |
flipBox.setMinimumSize( dForty ); |
2 |
26 Feb 07 |
jari |
flipBox.setMaximumSize( dForty ); |
2 |
26 Feb 07 |
jari |
flipBox.setPreferredSize( dForty ); |
2 |
26 Feb 07 |
jari |
this.vFlipCheck.add( flipBox ); |
2 |
26 Feb 07 |
jari |
758 |
|
2 |
26 Feb 07 |
jari |
//by default, split the hybs in half for ease |
2 |
26 Feb 07 |
jari |
if( h < iHalf ) { |
2 |
26 Feb 07 |
jari |
oneButton.setSelected( false ); |
2 |
26 Feb 07 |
jari |
twoButton.setSelected( true ); |
2 |
26 Feb 07 |
jari |
} else { |
2 |
26 Feb 07 |
jari |
oneButton.setSelected( true ); |
2 |
26 Feb 07 |
jari |
twoButton.setSelected( false ); |
2 |
26 Feb 07 |
jari |
766 |
} |
2 |
26 Feb 07 |
jari |
767 |
|
2 |
26 Feb 07 |
jari |
//also check half the hybs as flipped |
2 |
26 Feb 07 |
jari |
if( h >= iHalf/2 && h < iHalf ) { |
2 |
26 Feb 07 |
jari |
flipBox.setSelected( true ); |
2 |
26 Feb 07 |
jari |
} else if( h >= ( iHalf + iHalf / 2 ) ) { |
2 |
26 Feb 07 |
jari |
flipBox.setSelected( true ); |
2 |
26 Feb 07 |
jari |
773 |
} |
2 |
26 Feb 07 |
jari |
774 |
|
2 |
26 Feb 07 |
jari |
JPanel rowPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
rowPanel.add( hybLabel ); |
2 |
26 Feb 07 |
jari |
rowPanel.add( oneButton ); |
2 |
26 Feb 07 |
jari |
rowPanel.add( twoButton ); |
2 |
26 Feb 07 |
jari |
rowPanel.add( spaceLabel ); |
2 |
26 Feb 07 |
jari |
rowPanel.add( flipBox ); |
2 |
26 Feb 07 |
jari |
Dimension dRow = new Dimension( 350, 25 ); |
2 |
26 Feb 07 |
jari |
rowPanel.setMaximumSize( dRow ); |
2 |
26 Feb 07 |
jari |
rowPanel.setMinimumSize( dRow ); |
2 |
26 Feb 07 |
jari |
rowPanel.setPreferredSize( dRow ); |
2 |
26 Feb 07 |
jari |
785 |
|
2 |
26 Feb 07 |
jari |
//color every other row |
2 |
26 Feb 07 |
jari |
if( h % 2 == 0 ) { |
2 |
26 Feb 07 |
jari |
rowPanel.setBackground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
oneButton.setBackground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
twoButton.setBackground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
flipBox.setBackground( Color.LIGHT_GRAY ); |
2 |
26 Feb 07 |
jari |
792 |
} |
2 |
26 Feb 07 |
jari |
793 |
|
2 |
26 Feb 07 |
jari |
RamaHyb hyb = new RamaHyb( h, hybNames[ h ], oneButton, flipBox ); |
2 |
26 Feb 07 |
jari |
this.vRamaHyb.add( hyb ); |
2 |
26 Feb 07 |
jari |
listPanel.add( rowPanel ); |
2 |
26 Feb 07 |
jari |
}//h |
2 |
26 Feb 07 |
jari |
798 |
|
2 |
26 Feb 07 |
jari |
//listPanel.add( Box.createRigidArea( new Dimension( 100, 200 ) ) ); |
2 |
26 Feb 07 |
jari |
listPanel.add( Box.createVerticalGlue() ); |
2 |
26 Feb 07 |
jari |
listPanel.setBorder( BorderFactory.createLineBorder( Color.LIGHT_GRAY, 1 ) ); |
2 |
26 Feb 07 |
jari |
return listPanel; |
2 |
26 Feb 07 |
jari |
}//initializeGUI() |
2 |
26 Feb 07 |
jari |
804 |
*/ |
2 |
26 Feb 07 |
jari |
805 |
|
2 |
26 Feb 07 |
jari |
806 |
/* |
2 |
26 Feb 07 |
jari |
private boolean verifyHybs() { |
2 |
26 Feb 07 |
jari |
this.vOne = new Vector(); |
2 |
26 Feb 07 |
jari |
this.vOneFlip = new Vector(); |
2 |
26 Feb 07 |
jari |
this.vTwo = new Vector(); |
2 |
26 Feb 07 |
jari |
this.vTwoFlip = new Vector(); |
2 |
26 Feb 07 |
jari |
812 |
|
2 |
26 Feb 07 |
jari |
//loop through the RamaHybs |
2 |
26 Feb 07 |
jari |
for( int h = 0; h < vRamaHyb.size(); h ++ ) { |
2 |
26 Feb 07 |
jari |
RamaHyb hyb = ( RamaHyb ) vRamaHyb.elementAt( h ); |
2 |
26 Feb 07 |
jari |
816 |
|
2 |
26 Feb 07 |
jari |
//place it in the appropriate array |
2 |
26 Feb 07 |
jari |
if( hyb.controlCy3() ) { |
2 |
26 Feb 07 |
jari |
if( hyb.isFlip() ) { |
2 |
26 Feb 07 |
jari |
this.vOneFlip.add( hyb ); |
2 |
26 Feb 07 |
jari |
} else { |
2 |
26 Feb 07 |
jari |
this.vOne.add( hyb ); |
2 |
26 Feb 07 |
jari |
823 |
} |
2 |
26 Feb 07 |
jari |
} else { |
2 |
26 Feb 07 |
jari |
if( hyb.isFlip() ) { |
2 |
26 Feb 07 |
jari |
this.vTwoFlip.add( hyb ); |
2 |
26 Feb 07 |
jari |
} else { |
2 |
26 Feb 07 |
jari |
this.vTwo.add( hyb ); |
2 |
26 Feb 07 |
jari |
829 |
} |
2 |
26 Feb 07 |
jari |
830 |
} |
2 |
26 Feb 07 |
jari |
}//h |
2 |
26 Feb 07 |
jari |
832 |
|
2 |
26 Feb 07 |
jari |
//make sure there is balance |
2 |
26 Feb 07 |
jari |
if( vOne.size() != vTwo.size() ) { |
2 |
26 Feb 07 |
jari |
//problems |
2 |
26 Feb 07 |
jari |
this.error( "Rama will only work if there are the hybs are balanced" |
2 |
26 Feb 07 |
jari |
+ " for treatments and color flips" ); |
2 |
26 Feb 07 |
jari |
return false; |
2 |
26 Feb 07 |
jari |
839 |
} |
2 |
26 Feb 07 |
jari |
840 |
|
2 |
26 Feb 07 |
jari |
return true; |
2 |
26 Feb 07 |
jari |
}//verifyHybs() |
2 |
26 Feb 07 |
jari |
843 |
*/ |