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 |
* $RCSfile: ResampleTreeInitDialog.java,v $ |
2 |
26 Feb 07 |
jari |
* $Revision: 1.3 $ |
2 |
26 Feb 07 |
jari |
* $Date: 2005/03/10 20:32:37 $ |
2 |
26 Feb 07 |
jari |
* $Author: braistedj $ |
2 |
26 Feb 07 |
jari |
* $State: Exp $ |
2 |
26 Feb 07 |
jari |
11 |
*/ |
2 |
26 Feb 07 |
jari |
12 |
package org.tigr.microarray.mev.cluster.gui.impl.st; |
2 |
26 Feb 07 |
jari |
13 |
|
2 |
26 Feb 07 |
jari |
14 |
import java.awt.Color; |
2 |
26 Feb 07 |
jari |
15 |
import java.awt.Dimension; |
2 |
26 Feb 07 |
jari |
16 |
import java.awt.Font; |
2 |
26 Feb 07 |
jari |
17 |
import java.awt.GridBagLayout; |
2 |
26 Feb 07 |
jari |
18 |
import java.awt.Insets; |
2 |
26 Feb 07 |
jari |
19 |
import java.awt.Toolkit; |
2 |
26 Feb 07 |
jari |
20 |
import java.awt.event.ActionEvent; |
2 |
26 Feb 07 |
jari |
21 |
import java.awt.event.ActionListener; |
2 |
26 Feb 07 |
jari |
22 |
|
2 |
26 Feb 07 |
jari |
23 |
import javax.swing.ButtonGroup; |
2 |
26 Feb 07 |
jari |
24 |
import javax.swing.JCheckBox; |
2 |
26 Feb 07 |
jari |
25 |
import javax.swing.JFrame; |
2 |
26 Feb 07 |
jari |
26 |
import javax.swing.JLabel; |
2 |
26 Feb 07 |
jari |
27 |
import javax.swing.JOptionPane; |
2 |
26 Feb 07 |
jari |
28 |
import javax.swing.JPanel; |
2 |
26 Feb 07 |
jari |
29 |
import javax.swing.JRadioButton; |
2 |
26 Feb 07 |
jari |
30 |
import javax.swing.JTextField; |
2 |
26 Feb 07 |
jari |
31 |
import javax.swing.UIManager; |
2 |
26 Feb 07 |
jari |
32 |
import javax.swing.border.EtchedBorder; |
2 |
26 Feb 07 |
jari |
33 |
import javax.swing.border.TitledBorder; |
2 |
26 Feb 07 |
jari |
34 |
|
2 |
26 Feb 07 |
jari |
35 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.AlgorithmDialog; |
2 |
26 Feb 07 |
jari |
36 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.DistanceMetricPanel; |
2 |
26 Feb 07 |
jari |
37 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.dialogHelpUtil.HelpWindow; |
2 |
26 Feb 07 |
jari |
38 |
import org.tigr.util.awt.GBA; |
2 |
26 Feb 07 |
jari |
39 |
|
2 |
26 Feb 07 |
jari |
40 |
public class ResampleTreeInitDialog extends AlgorithmDialog { |
2 |
26 Feb 07 |
jari |
41 |
|
2 |
26 Feb 07 |
jari |
42 |
protected GBA gba; |
2 |
26 Feb 07 |
jari |
43 |
protected EventListener eventListener; |
2 |
26 Feb 07 |
jari |
44 |
|
2 |
26 Feb 07 |
jari |
45 |
protected JPanel geneTreePanel; |
2 |
26 Feb 07 |
jari |
46 |
public JCheckBox drawGeneTreeCheckBox; |
2 |
26 Feb 07 |
jari |
47 |
protected JPanel geneTreeResamplingOptionsPanel; |
2 |
26 Feb 07 |
jari |
48 |
protected JRadioButton geneBootstrapExpts; |
2 |
26 Feb 07 |
jari |
49 |
protected JRadioButton geneJackknifeExpts; |
2 |
26 Feb 07 |
jari |
50 |
protected JRadioButton geneStandard; |
2 |
26 Feb 07 |
jari |
51 |
protected JPanel geneTreeIterationsPanel; |
2 |
26 Feb 07 |
jari |
52 |
protected JLabel geneTreeIterationsLabel; |
2 |
26 Feb 07 |
jari |
53 |
public JTextField geneTreeIterationsTextField; |
2 |
26 Feb 07 |
jari |
54 |
|
2 |
26 Feb 07 |
jari |
55 |
protected JPanel exptTreePanel; |
2 |
26 Feb 07 |
jari |
56 |
public JCheckBox drawExptTreeCheckBox; |
2 |
26 Feb 07 |
jari |
57 |
protected JPanel exptTreeResamplingOptionsPanel; |
2 |
26 Feb 07 |
jari |
58 |
protected JRadioButton exptBootstrapGenes; |
2 |
26 Feb 07 |
jari |
59 |
protected JRadioButton exptJackknifeGenes; |
2 |
26 Feb 07 |
jari |
60 |
protected JRadioButton exptStandard; |
2 |
26 Feb 07 |
jari |
61 |
protected JPanel exptTreeIterationsPanel; |
2 |
26 Feb 07 |
jari |
62 |
protected JLabel exptTreeIterationsLabel; |
2 |
26 Feb 07 |
jari |
63 |
public JTextField exptTreeIterationsTextField; |
2 |
26 Feb 07 |
jari |
64 |
|
2 |
26 Feb 07 |
jari |
65 |
protected JPanel linkagePanel; |
2 |
26 Feb 07 |
jari |
66 |
protected JRadioButton averageLinkage; |
2 |
26 Feb 07 |
jari |
67 |
protected JRadioButton completeLinkage; |
2 |
26 Feb 07 |
jari |
68 |
protected JRadioButton singleLinkage; |
2 |
26 Feb 07 |
jari |
69 |
|
2 |
26 Feb 07 |
jari |
70 |
protected JPanel topPanel; |
2 |
26 Feb 07 |
jari |
71 |
protected JPanel bottomPanel; |
2 |
26 Feb 07 |
jari |
72 |
|
2 |
26 Feb 07 |
jari |
73 |
protected ButtonGroup buttonGroup; |
2 |
26 Feb 07 |
jari |
74 |
|
2 |
26 Feb 07 |
jari |
75 |
protected int linkageStyle = 0; |
2 |
26 Feb 07 |
jari |
76 |
protected int geneTreeAnalysisOption = 0; |
2 |
26 Feb 07 |
jari |
77 |
protected int exptTreeAnalysisOption = 0; |
2 |
26 Feb 07 |
jari |
78 |
|
2 |
26 Feb 07 |
jari |
79 |
protected boolean cancelled = true; |
2 |
26 Feb 07 |
jari |
80 |
protected Color labelColor; |
2 |
26 Feb 07 |
jari |
81 |
|
2 |
26 Feb 07 |
jari |
82 |
public final static int NONE = 0; |
2 |
26 Feb 07 |
jari |
83 |
public final static int BOOT_EXPTS = 1; |
2 |
26 Feb 07 |
jari |
84 |
public final static int BOOT_GENES = 2; |
2 |
26 Feb 07 |
jari |
85 |
public final static int JACK_EXPTS = 3; |
2 |
26 Feb 07 |
jari |
86 |
public final static int JACK_GENES = 4; |
2 |
26 Feb 07 |
jari |
87 |
|
2 |
26 Feb 07 |
jari |
88 |
private DistanceMetricPanel metricPanel; |
2 |
26 Feb 07 |
jari |
89 |
private String globalMetricName; |
2 |
26 Feb 07 |
jari |
90 |
private boolean globalAbsoluteSetting; |
2 |
26 Feb 07 |
jari |
91 |
|
2 |
26 Feb 07 |
jari |
92 |
public ResampleTreeInitDialog(JFrame parent, boolean modal, String globalMetricName, boolean globalAbsoluteSetting) { |
2 |
26 Feb 07 |
jari |
93 |
super(parent, "ST: Support Trees", modal); |
2 |
26 Feb 07 |
jari |
94 |
|
2 |
26 Feb 07 |
jari |
95 |
this.globalMetricName = globalMetricName; |
2 |
26 Feb 07 |
jari |
96 |
this.globalAbsoluteSetting = globalAbsoluteSetting; |
2 |
26 Feb 07 |
jari |
97 |
|
2 |
26 Feb 07 |
jari |
98 |
initialize(); |
2 |
26 Feb 07 |
jari |
99 |
} |
2 |
26 Feb 07 |
jari |
100 |
|
2 |
26 Feb 07 |
jari |
101 |
protected void initialize() { |
2 |
26 Feb 07 |
jari |
102 |
gba = new GBA(); |
2 |
26 Feb 07 |
jari |
103 |
labelColor = UIManager.getColor("Label.foreground"); |
2 |
26 Feb 07 |
jari |
104 |
eventListener = new EventListener(); |
2 |
26 Feb 07 |
jari |
105 |
|
2 |
26 Feb 07 |
jari |
106 |
drawGeneTreeCheckBox = new JCheckBox("Draw Gene Tree", true); |
2 |
26 Feb 07 |
jari |
107 |
this.drawGeneTreeCheckBox.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
108 |
this.drawGeneTreeCheckBox.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
109 |
this.drawGeneTreeCheckBox.setForeground(labelColor); |
2 |
26 Feb 07 |
jari |
110 |
buttonGroup = new ButtonGroup(); |
2 |
26 Feb 07 |
jari |
111 |
geneBootstrapExpts = new JRadioButton("Bootstrap Samples", true); |
2 |
26 Feb 07 |
jari |
112 |
this.geneBootstrapExpts.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
113 |
this.geneBootstrapExpts.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
114 |
this.geneBootstrapExpts.setForeground(labelColor); |
2 |
26 Feb 07 |
jari |
115 |
buttonGroup.add(geneBootstrapExpts); |
2 |
26 Feb 07 |
jari |
116 |
geneJackknifeExpts = new JRadioButton("Jackknife Samples"); |
2 |
26 Feb 07 |
jari |
117 |
this.geneJackknifeExpts.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
118 |
this.geneJackknifeExpts.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
119 |
this.geneJackknifeExpts.setForeground(labelColor); |
2 |
26 Feb 07 |
jari |
120 |
buttonGroup.add(geneJackknifeExpts); |
2 |
26 Feb 07 |
jari |
121 |
geneStandard = new JRadioButton("No resampling"); |
2 |
26 Feb 07 |
jari |
122 |
this.geneStandard.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
123 |
this.geneStandard.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
124 |
this.geneStandard.setForeground(labelColor); |
2 |
26 Feb 07 |
jari |
125 |
buttonGroup.add(geneStandard); |
2 |
26 Feb 07 |
jari |
126 |
|
2 |
26 Feb 07 |
jari |
127 |
geneTreeIterationsLabel = new JLabel("Iterations"); |
2 |
26 Feb 07 |
jari |
128 |
geneTreeIterationsTextField = new JTextField("100"); |
2 |
26 Feb 07 |
jari |
129 |
|
2 |
26 Feb 07 |
jari |
130 |
geneTreeIterationsPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
131 |
geneTreeIterationsPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
132 |
this.geneTreeIterationsPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
133 |
gba.add(geneTreeIterationsPanel, geneTreeIterationsLabel, 0, 0, 1, 1, 0, 0, GBA.NONE, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
134 |
gba.add(geneTreeIterationsPanel, geneTreeIterationsTextField, 1, 0, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
135 |
|
2 |
26 Feb 07 |
jari |
136 |
geneTreeResamplingOptionsPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
137 |
geneTreeResamplingOptionsPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
138 |
this.geneTreeResamplingOptionsPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
139 |
geneTreeResamplingOptionsPanel.setBorder(new TitledBorder(new EtchedBorder(), "Resampling Options", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), Color.black)); |
2 |
26 Feb 07 |
jari |
140 |
gba.add(geneTreeResamplingOptionsPanel, geneBootstrapExpts, 0, 0, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
141 |
gba.add(geneTreeResamplingOptionsPanel, geneJackknifeExpts, 0, 1, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
142 |
gba.add(geneTreeResamplingOptionsPanel, geneStandard, 0, 2, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
143 |
|
2 |
26 Feb 07 |
jari |
144 |
geneTreePanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
145 |
geneTreePanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
146 |
this.geneTreePanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
147 |
geneTreePanel.setBorder(new TitledBorder(new EtchedBorder(), "Gene Tree", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), Color.black)); |
2 |
26 Feb 07 |
jari |
148 |
|
2 |
26 Feb 07 |
jari |
149 |
gba.add(geneTreePanel, drawGeneTreeCheckBox, 0, 0, 1, 1, 1, 0, GBA.H, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
150 |
gba.add(geneTreePanel, geneTreeResamplingOptionsPanel, 0, 1, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
151 |
gba.add(geneTreePanel, geneTreeIterationsPanel, 0, 2, 1, 1, 1, 0, GBA.H, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
152 |
|
2 |
26 Feb 07 |
jari |
153 |
drawExptTreeCheckBox = new JCheckBox("Draw Sample Tree", true); |
2 |
26 Feb 07 |
jari |
154 |
drawExptTreeCheckBox.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
155 |
drawExptTreeCheckBox.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
156 |
drawExptTreeCheckBox.setForeground(labelColor); |
2 |
26 Feb 07 |
jari |
157 |
buttonGroup = new ButtonGroup(); |
2 |
26 Feb 07 |
jari |
158 |
exptBootstrapGenes = new JRadioButton("Bootstrap Genes", true); |
2 |
26 Feb 07 |
jari |
159 |
this.exptBootstrapGenes.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
160 |
this.exptBootstrapGenes.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
161 |
this.exptBootstrapGenes.setForeground(labelColor); |
2 |
26 Feb 07 |
jari |
162 |
buttonGroup.add(exptBootstrapGenes); |
2 |
26 Feb 07 |
jari |
163 |
exptJackknifeGenes = new JRadioButton("Jackknife Genes"); |
2 |
26 Feb 07 |
jari |
164 |
this.exptJackknifeGenes.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
165 |
this.exptJackknifeGenes.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
166 |
this.exptJackknifeGenes.setForeground(labelColor); |
2 |
26 Feb 07 |
jari |
167 |
buttonGroup.add(exptJackknifeGenes); |
2 |
26 Feb 07 |
jari |
168 |
exptStandard = new JRadioButton("No resampling"); |
2 |
26 Feb 07 |
jari |
169 |
this.exptStandard.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
170 |
this.exptStandard.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
171 |
this.exptStandard.setForeground(labelColor); |
2 |
26 Feb 07 |
jari |
172 |
buttonGroup.add(exptStandard); |
2 |
26 Feb 07 |
jari |
173 |
|
2 |
26 Feb 07 |
jari |
174 |
exptTreeIterationsLabel = new JLabel("Iterations"); |
2 |
26 Feb 07 |
jari |
175 |
exptTreeIterationsTextField = new JTextField("100"); |
2 |
26 Feb 07 |
jari |
176 |
|
2 |
26 Feb 07 |
jari |
177 |
exptTreeIterationsPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
178 |
exptTreeIterationsPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
179 |
this.exptTreeIterationsPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
180 |
gba.add(exptTreeIterationsPanel, exptTreeIterationsLabel, 0, 0, 1, 1, 0, 0, GBA.NONE, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
181 |
gba.add(exptTreeIterationsPanel, exptTreeIterationsTextField, 1, 0, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
182 |
|
2 |
26 Feb 07 |
jari |
183 |
exptTreeResamplingOptionsPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
184 |
exptTreeResamplingOptionsPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
185 |
this.exptTreeResamplingOptionsPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
186 |
exptTreeResamplingOptionsPanel.setBorder(new TitledBorder(new EtchedBorder(), "Resampling Options", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), Color.black)); |
2 |
26 Feb 07 |
jari |
187 |
|
2 |
26 Feb 07 |
jari |
188 |
gba.add(exptTreeResamplingOptionsPanel, exptBootstrapGenes, 0, 0, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
189 |
gba.add(exptTreeResamplingOptionsPanel, exptJackknifeGenes, 0, 1, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
190 |
gba.add(exptTreeResamplingOptionsPanel, exptStandard, 0, 2, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
191 |
|
2 |
26 Feb 07 |
jari |
192 |
exptTreePanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
193 |
exptTreePanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
194 |
this.exptTreePanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
195 |
exptTreePanel.setBorder(new TitledBorder(new EtchedBorder(), "Sample Tree", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), Color.black)); |
2 |
26 Feb 07 |
jari |
196 |
|
2 |
26 Feb 07 |
jari |
197 |
gba.add(exptTreePanel, drawExptTreeCheckBox, 0, 0, 1, 1, 1, 0, GBA.H, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
198 |
gba.add(exptTreePanel, exptTreeResamplingOptionsPanel, 0, 1, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
199 |
gba.add(exptTreePanel, exptTreeIterationsPanel, 0, 2, 1, 1, 1, 0, GBA.H, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
200 |
|
2 |
26 Feb 07 |
jari |
201 |
topPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
202 |
topPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
203 |
topPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
204 |
gba.add(topPanel, geneTreePanel, 0, 0, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
205 |
gba.add(topPanel, exptTreePanel, 1, 0, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
206 |
|
2 |
26 Feb 07 |
jari |
207 |
buttonGroup = new ButtonGroup(); |
2 |
26 Feb 07 |
jari |
208 |
averageLinkage = new JRadioButton("Average Linkage", true); |
2 |
26 Feb 07 |
jari |
209 |
this.averageLinkage.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
210 |
this.averageLinkage.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
211 |
this.averageLinkage.setForeground(labelColor); |
2 |
26 Feb 07 |
jari |
212 |
buttonGroup.add(averageLinkage); |
2 |
26 Feb 07 |
jari |
213 |
completeLinkage = new JRadioButton("Complete Linkage", false); |
2 |
26 Feb 07 |
jari |
214 |
this.completeLinkage.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
215 |
this.completeLinkage.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
216 |
this.completeLinkage.setForeground(labelColor); |
2 |
26 Feb 07 |
jari |
217 |
buttonGroup.add(completeLinkage); |
2 |
26 Feb 07 |
jari |
218 |
singleLinkage = new JRadioButton("Single Linkage", false); |
2 |
26 Feb 07 |
jari |
219 |
this.singleLinkage.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
220 |
this.singleLinkage.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
221 |
this.singleLinkage.setForeground(labelColor); |
2 |
26 Feb 07 |
jari |
222 |
buttonGroup.add(singleLinkage); |
2 |
26 Feb 07 |
jari |
223 |
|
2 |
26 Feb 07 |
jari |
224 |
metricPanel = new DistanceMetricPanel(globalMetricName, globalAbsoluteSetting, "Euclidean Distance", "ST", true, true); |
2 |
26 Feb 07 |
jari |
225 |
|
2 |
26 Feb 07 |
jari |
226 |
linkagePanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
227 |
linkagePanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
228 |
linkagePanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
229 |
linkagePanel.setBorder(new TitledBorder(new EtchedBorder(), "Linkage Method", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), Color.black)); |
2 |
26 Feb 07 |
jari |
230 |
|
2 |
26 Feb 07 |
jari |
231 |
gba.add(linkagePanel, averageLinkage, 0, 0, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
232 |
gba.add(linkagePanel, completeLinkage, 1, 0, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
233 |
gba.add(linkagePanel, singleLinkage, 2, 0, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
234 |
|
2 |
26 Feb 07 |
jari |
235 |
|
2 |
26 Feb 07 |
jari |
236 |
bottomPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
237 |
bottomPanel.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
238 |
bottomPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
239 |
gba.add(bottomPanel, linkagePanel, 0, 0, 2, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
240 |
|
2 |
26 Feb 07 |
jari |
241 |
JPanel contentPane = new JPanel(); |
2 |
26 Feb 07 |
jari |
242 |
contentPane.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
243 |
contentPane.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
244 |
|
2 |
26 Feb 07 |
jari |
245 |
gba.add(contentPane, topPanel, 0, 0, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
246 |
gba.add(contentPane, metricPanel, 0, 1, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
247 |
gba.add(contentPane, bottomPanel, 0, 2, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(0, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
248 |
|
2 |
26 Feb 07 |
jari |
249 |
addContent(contentPane); |
2 |
26 Feb 07 |
jari |
250 |
setActionListeners(eventListener); |
2 |
26 Feb 07 |
jari |
251 |
|
2 |
26 Feb 07 |
jari |
252 |
pack(); |
2 |
26 Feb 07 |
jari |
253 |
setResizable(false); |
2 |
26 Feb 07 |
jari |
254 |
} |
2 |
26 Feb 07 |
jari |
255 |
|
2 |
26 Feb 07 |
jari |
256 |
public void setVisible(boolean visible) { |
2 |
26 Feb 07 |
jari |
257 |
|
2 |
26 Feb 07 |
jari |
258 |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
2 |
26 Feb 07 |
jari |
259 |
setLocation((screenSize.width - getSize().width)/2, (screenSize.height - getSize().height)/2); |
2 |
26 Feb 07 |
jari |
260 |
|
2 |
26 Feb 07 |
jari |
261 |
super.setVisible(visible); |
2 |
26 Feb 07 |
jari |
262 |
if (visible) { |
2 |
26 Feb 07 |
jari |
263 |
|
2 |
26 Feb 07 |
jari |
264 |
|
2 |
26 Feb 07 |
jari |
265 |
} |
2 |
26 Feb 07 |
jari |
266 |
} |
2 |
26 Feb 07 |
jari |
267 |
|
2 |
26 Feb 07 |
jari |
268 |
public int getMethod(){ |
2 |
26 Feb 07 |
jari |
269 |
return linkageStyle; |
2 |
26 Feb 07 |
jari |
270 |
} |
2 |
26 Feb 07 |
jari |
271 |
|
2 |
26 Feb 07 |
jari |
272 |
|
2 |
26 Feb 07 |
jari |
273 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the currently selected metric |
2 |
26 Feb 07 |
jari |
275 |
*/ |
2 |
26 Feb 07 |
jari |
276 |
public int getDistanceMetric() { |
2 |
26 Feb 07 |
jari |
277 |
return metricPanel.getMetricIndex(); |
2 |
26 Feb 07 |
jari |
278 |
} |
2 |
26 Feb 07 |
jari |
279 |
|
2 |
26 Feb 07 |
jari |
280 |
|
2 |
26 Feb 07 |
jari |
281 |
/** |
2 |
26 Feb 07 |
jari |
* Returns true if the absolute checkbox is selected, else false |
2 |
26 Feb 07 |
jari |
283 |
*/ |
2 |
26 Feb 07 |
jari |
284 |
public boolean isAbsoluteDistance() { |
2 |
26 Feb 07 |
jari |
285 |
return metricPanel.getAbsoluteSelection(); |
2 |
26 Feb 07 |
jari |
286 |
} |
2 |
26 Feb 07 |
jari |
287 |
|
2 |
26 Feb 07 |
jari |
288 |
|
2 |
26 Feb 07 |
jari |
289 |
public boolean isCancelled() { |
2 |
26 Feb 07 |
jari |
290 |
return cancelled; |
2 |
26 Feb 07 |
jari |
291 |
} |
2 |
26 Feb 07 |
jari |
292 |
|
2 |
26 Feb 07 |
jari |
293 |
public int getGeneTreeAnalysisOption() { |
2 |
26 Feb 07 |
jari |
294 |
return geneTreeAnalysisOption; |
2 |
26 Feb 07 |
jari |
295 |
} |
2 |
26 Feb 07 |
jari |
296 |
|
2 |
26 Feb 07 |
jari |
297 |
public int getExptTreeAnalysisOption() { |
2 |
26 Feb 07 |
jari |
298 |
return exptTreeAnalysisOption; |
2 |
26 Feb 07 |
jari |
299 |
} |
2 |
26 Feb 07 |
jari |
300 |
|
2 |
26 Feb 07 |
jari |
301 |
protected void fireOkButtonEvent() { |
2 |
26 Feb 07 |
jari |
302 |
|
2 |
26 Feb 07 |
jari |
303 |
int geneTreeStyle; |
2 |
26 Feb 07 |
jari |
304 |
int exptTreeStyle; |
2 |
26 Feb 07 |
jari |
305 |
|
2 |
26 Feb 07 |
jari |
306 |
boolean drawGeneTree = drawGeneTreeCheckBox.isSelected(); |
2 |
26 Feb 07 |
jari |
307 |
int geneTreeIterations = Integer.parseInt(geneTreeIterationsTextField.getText()); |
2 |
26 Feb 07 |
jari |
308 |
boolean drawExptTree = drawExptTreeCheckBox.isSelected(); |
2 |
26 Feb 07 |
jari |
309 |
int exptTreeIterations = Integer.parseInt(exptTreeIterationsTextField.getText()); |
2 |
26 Feb 07 |
jari |
310 |
|
2 |
26 Feb 07 |
jari |
311 |
|
2 |
26 Feb 07 |
jari |
312 |
if (geneBootstrapExpts.isSelected()) geneTreeAnalysisOption = BOOT_EXPTS; |
2 |
26 Feb 07 |
jari |
313 |
else if (geneJackknifeExpts.isSelected()) geneTreeAnalysisOption = JACK_EXPTS; |
2 |
26 Feb 07 |
jari |
314 |
else geneTreeAnalysisOption = NONE; |
2 |
26 Feb 07 |
jari |
315 |
|
2 |
26 Feb 07 |
jari |
316 |
if (exptBootstrapGenes.isSelected()) exptTreeAnalysisOption = BOOT_GENES; |
2 |
26 Feb 07 |
jari |
317 |
else if (exptJackknifeGenes.isSelected()) exptTreeAnalysisOption = JACK_GENES; |
2 |
26 Feb 07 |
jari |
318 |
else exptTreeAnalysisOption = NONE; |
2 |
26 Feb 07 |
jari |
319 |
|
2 |
26 Feb 07 |
jari |
320 |
if (completeLinkage.isSelected()) linkageStyle = 1; |
2 |
26 Feb 07 |
jari |
321 |
else if (singleLinkage.isSelected()) linkageStyle = -1; |
2 |
26 Feb 07 |
jari |
322 |
else linkageStyle = 0; |
2 |
26 Feb 07 |
jari |
323 |
} |
2 |
26 Feb 07 |
jari |
324 |
|
2 |
26 Feb 07 |
jari |
325 |
private void resetControls(){ |
2 |
26 Feb 07 |
jari |
326 |
this.drawGeneTreeCheckBox.setSelected(true); |
2 |
26 Feb 07 |
jari |
327 |
this.drawExptTreeCheckBox.setSelected(true); |
2 |
26 Feb 07 |
jari |
328 |
this.geneStandard.setSelected(true); |
2 |
26 Feb 07 |
jari |
329 |
this.exptStandard.setSelected(true); |
2 |
26 Feb 07 |
jari |
330 |
this.averageLinkage.setSelected(true); |
2 |
26 Feb 07 |
jari |
331 |
this.geneTreeIterationsTextField.setText("100"); |
2 |
26 Feb 07 |
jari |
332 |
this.exptTreeIterationsTextField.setText("100"); |
2 |
26 Feb 07 |
jari |
333 |
metricPanel.reset(); |
2 |
26 Feb 07 |
jari |
334 |
} |
2 |
26 Feb 07 |
jari |
335 |
|
2 |
26 Feb 07 |
jari |
336 |
public static void main(String [] args){ |
2 |
26 Feb 07 |
jari |
337 |
ResampleTreeInitDialog dialog = new ResampleTreeInitDialog(new JFrame(), true, "Euclidean Distance", false); |
2 |
26 Feb 07 |
jari |
338 |
dialog.show(); |
2 |
26 Feb 07 |
jari |
339 |
System.exit(0); |
2 |
26 Feb 07 |
jari |
340 |
} |
2 |
26 Feb 07 |
jari |
341 |
|
2 |
26 Feb 07 |
jari |
342 |
protected class EventListener implements ActionListener { |
2 |
26 Feb 07 |
jari |
343 |
|
2 |
26 Feb 07 |
jari |
344 |
public void actionPerformed(ActionEvent e){ |
2 |
26 Feb 07 |
jari |
345 |
String command = e.getActionCommand(); |
2 |
26 Feb 07 |
jari |
346 |
|
2 |
26 Feb 07 |
jari |
347 |
int exptIter, geneIter; |
2 |
26 Feb 07 |
jari |
348 |
if (command.equals("ok-command")) { |
2 |
26 Feb 07 |
jari |
349 |
if(ResampleTreeInitDialog.this.drawExptTreeCheckBox.isSelected()){ |
2 |
26 Feb 07 |
jari |
350 |
try{ |
2 |
26 Feb 07 |
jari |
351 |
exptIter = Integer.parseInt(exptTreeIterationsTextField.getText()); |
2 |
26 Feb 07 |
jari |
352 |
if(exptIter < 1){ |
2 |
26 Feb 07 |
jari |
353 |
exptTreeIterationsTextField.requestFocus(); |
2 |
26 Feb 07 |
jari |
354 |
exptTreeIterationsTextField.selectAll(); |
2 |
26 Feb 07 |
jari |
355 |
JOptionPane.showMessageDialog(ResampleTreeInitDialog.this, "Number of iterations must be > 0", "Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
356 |
return; |
2 |
26 Feb 07 |
jari |
357 |
} |
2 |
26 Feb 07 |
jari |
358 |
} catch (NumberFormatException e1) { |
2 |
26 Feb 07 |
jari |
359 |
exptTreeIterationsTextField.requestFocus(); |
2 |
26 Feb 07 |
jari |
360 |
exptTreeIterationsTextField.selectAll(); |
2 |
26 Feb 07 |
jari |
361 |
JOptionPane.showMessageDialog(ResampleTreeInitDialog.this, "Entry format error.", "Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
362 |
return; |
2 |
26 Feb 07 |
jari |
363 |
} |
2 |
26 Feb 07 |
jari |
364 |
} |
2 |
26 Feb 07 |
jari |
365 |
if(ResampleTreeInitDialog.this.drawGeneTreeCheckBox.isSelected()){ |
2 |
26 Feb 07 |
jari |
366 |
try{ |
2 |
26 Feb 07 |
jari |
367 |
geneIter = Integer.parseInt(geneTreeIterationsTextField.getText()); |
2 |
26 Feb 07 |
jari |
368 |
if(geneIter < 1){ |
2 |
26 Feb 07 |
jari |
369 |
geneTreeIterationsTextField.requestFocus(); |
2 |
26 Feb 07 |
jari |
370 |
geneTreeIterationsTextField.selectAll(); |
2 |
26 Feb 07 |
jari |
371 |
JOptionPane.showMessageDialog(ResampleTreeInitDialog.this, "Number of iterations must be > 0", "Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
372 |
return; |
2 |
26 Feb 07 |
jari |
373 |
} |
2 |
26 Feb 07 |
jari |
374 |
} catch (NumberFormatException e1) { |
2 |
26 Feb 07 |
jari |
375 |
geneTreeIterationsTextField.requestFocus(); |
2 |
26 Feb 07 |
jari |
376 |
geneTreeIterationsTextField.selectAll(); |
2 |
26 Feb 07 |
jari |
377 |
JOptionPane.showMessageDialog(ResampleTreeInitDialog.this, "Entry format error.", "Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
378 |
return; |
2 |
26 Feb 07 |
jari |
379 |
} |
2 |
26 Feb 07 |
jari |
380 |
} |
2 |
26 Feb 07 |
jari |
381 |
fireOkButtonEvent(); |
2 |
26 Feb 07 |
jari |
382 |
cancelled = false; |
2 |
26 Feb 07 |
jari |
383 |
} else if (command.equals("cancel-command")) { |
2 |
26 Feb 07 |
jari |
384 |
cancelled = true; |
2 |
26 Feb 07 |
jari |
385 |
}else if (command.equals("reset-command")){ |
2 |
26 Feb 07 |
jari |
386 |
resetControls(); |
2 |
26 Feb 07 |
jari |
387 |
cancelled = false; |
2 |
26 Feb 07 |
jari |
388 |
return; |
2 |
26 Feb 07 |
jari |
389 |
} |
2 |
26 Feb 07 |
jari |
390 |
else if (command.equals("info-command")){ |
2 |
26 Feb 07 |
jari |
391 |
HelpWindow hw = new HelpWindow(ResampleTreeInitDialog.this, "ST Initialization Dialog"); |
2 |
26 Feb 07 |
jari |
392 |
cancelled = false; |
2 |
26 Feb 07 |
jari |
393 |
if(hw.getWindowContent()){ |
2 |
26 Feb 07 |
jari |
394 |
hw.setSize(450,650); |
2 |
26 Feb 07 |
jari |
395 |
hw.setLocation(); |
2 |
26 Feb 07 |
jari |
396 |
hw.show(); |
2 |
26 Feb 07 |
jari |
397 |
return; |
2 |
26 Feb 07 |
jari |
398 |
} |
2 |
26 Feb 07 |
jari |
399 |
else { |
2 |
26 Feb 07 |
jari |
400 |
hw.setVisible(false); |
2 |
26 Feb 07 |
jari |
401 |
hw.dispose(); |
2 |
26 Feb 07 |
jari |
402 |
return; |
2 |
26 Feb 07 |
jari |
403 |
} |
2 |
26 Feb 07 |
jari |
404 |
} |
2 |
26 Feb 07 |
jari |
405 |
dispose(); |
2 |
26 Feb 07 |
jari |
406 |
} |
2 |
26 Feb 07 |
jari |
407 |
|
2 |
26 Feb 07 |
jari |
408 |
} |
2 |
26 Feb 07 |
jari |
409 |
} |