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: HCLSupportViewer.java,v $ |
2 |
26 Feb 07 |
jari |
* $Revision: 1.5 $ |
2 |
26 Feb 07 |
jari |
* $Date: 2006/05/02 16:57:36 $ |
2 |
26 Feb 07 |
jari |
* $Author: eleanorahowe $ |
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.Component; |
2 |
26 Feb 07 |
jari |
16 |
import java.awt.GridBagLayout; |
2 |
26 Feb 07 |
jari |
17 |
import java.awt.event.ActionEvent; |
2 |
26 Feb 07 |
jari |
18 |
import java.awt.event.ActionListener; |
2 |
26 Feb 07 |
jari |
19 |
import java.awt.event.MouseAdapter; |
2 |
26 Feb 07 |
jari |
20 |
import java.awt.event.MouseEvent; |
2 |
26 Feb 07 |
jari |
21 |
import java.beans.Expression; |
2 |
26 Feb 07 |
jari |
22 |
import java.lang.reflect.Array; |
2 |
26 Feb 07 |
jari |
23 |
import java.util.Vector; |
2 |
26 Feb 07 |
jari |
24 |
|
2 |
26 Feb 07 |
jari |
25 |
import javax.swing.JCheckBoxMenuItem; |
2 |
26 Feb 07 |
jari |
26 |
import javax.swing.JMenuItem; |
2 |
26 Feb 07 |
jari |
27 |
import javax.swing.JPanel; |
2 |
26 Feb 07 |
jari |
28 |
import javax.swing.JPopupMenu; |
2 |
26 Feb 07 |
jari |
29 |
import javax.swing.SwingUtilities; |
2 |
26 Feb 07 |
jari |
30 |
import javax.swing.tree.DefaultMutableTreeNode; |
2 |
26 Feb 07 |
jari |
31 |
|
2 |
26 Feb 07 |
jari |
32 |
import org.tigr.microarray.mev.cluster.gui.Experiment; |
2 |
26 Feb 07 |
jari |
33 |
import org.tigr.microarray.mev.cluster.gui.IDisplayMenu; |
2 |
26 Feb 07 |
jari |
34 |
import org.tigr.microarray.mev.cluster.gui.helpers.ExperimentViewer; |
2 |
26 Feb 07 |
jari |
35 |
import org.tigr.microarray.mev.cluster.gui.impl.hcl.HCLCluster; |
2 |
26 Feb 07 |
jari |
36 |
import org.tigr.microarray.mev.cluster.gui.impl.hcl.HCLTree; |
2 |
26 Feb 07 |
jari |
37 |
import org.tigr.microarray.mev.cluster.gui.impl.hcl.HCLTreeData; |
2 |
26 Feb 07 |
jari |
38 |
import org.tigr.microarray.mev.cluster.gui.impl.hcl.HCLTreeListener; |
2 |
26 Feb 07 |
jari |
39 |
import org.tigr.microarray.mev.cluster.gui.impl.hcl.HCLViewer; |
2 |
26 Feb 07 |
jari |
40 |
|
2 |
26 Feb 07 |
jari |
41 |
public class HCLSupportViewer extends HCLViewer { |
2 |
26 Feb 07 |
jari |
42 |
|
2 |
26 Feb 07 |
jari |
43 |
protected static final String SET_CLUSTER_CMD = "set-cluster-cmd"; |
2 |
26 Feb 07 |
jari |
44 |
protected static final String SET_CLUSTER_TEXT_CMD = "set-cluster-text-cmd"; |
2 |
26 Feb 07 |
jari |
45 |
protected static final String SAVE_CLUSTER_CMD = "save-cluster-cmd"; |
2 |
26 Feb 07 |
jari |
46 |
protected static final String DELETE_CLUSTER_CMD = "delete-cluster-cmd"; |
2 |
26 Feb 07 |
jari |
47 |
protected static final String DELETE_ALL_CLUSTERS_CMD = "delete-all-clusters-cmd"; |
2 |
26 Feb 07 |
jari |
48 |
protected static final String GENE_TREE_PROPERTIES_CMD = "gene-tree-properties-cmd"; |
2 |
26 Feb 07 |
jari |
49 |
protected static final String SAMPLE_TREE_PROPERTIES_CMD = "sample-tree-properties-cmd"; |
2 |
26 Feb 07 |
jari |
50 |
protected static final String SUPPORT_LEGEND_CMD = "support-legend-cmd"; |
2 |
26 Feb 07 |
jari |
51 |
protected static final String SUPPORT_VALUES_CMD = "support-value-cmd"; |
2 |
26 Feb 07 |
jari |
52 |
|
2 |
26 Feb 07 |
jari |
53 |
|
2 |
26 Feb 07 |
jari |
54 |
Vector geneTreeSupportVector, exptTreeSupportVector; |
2 |
26 Feb 07 |
jari |
55 |
|
2 |
26 Feb 07 |
jari |
56 |
|
2 |
26 Feb 07 |
jari |
57 |
|
2 |
26 Feb 07 |
jari |
58 |
public HCLSupportViewer(Experiment Experiment, int[] Features, HCLTreeData genes_result, HCLTreeData samples_result, Vector geneTreeSupportVector, Vector exptTreeSupportVector, DefaultMutableTreeNode node) { |
2 |
26 Feb 07 |
jari |
59 |
super(Experiment, Features, genes_result, samples_result, node); |
2 |
26 Feb 07 |
jari |
60 |
setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
61 |
setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
62 |
|
2 |
26 Feb 07 |
jari |
63 |
this.geneTreeSupportVector = geneTreeSupportVector; |
2 |
26 Feb 07 |
jari |
64 |
this.exptTreeSupportVector = exptTreeSupportVector; |
2 |
26 Feb 07 |
jari |
65 |
|
2 |
26 Feb 07 |
jari |
66 |
if (genes_result != null && experiment.getNumberOfGenes() > 1) { |
2 |
26 Feb 07 |
jari |
67 |
this.genesTree = new HCLSupportTree(genes_result, HCLTree.HORIZONTAL, geneTreeSupportVector, exptTreeSupportVector); |
2 |
26 Feb 07 |
jari |
68 |
this.genesTree.addMouseListener(listener); |
2 |
26 Feb 07 |
jari |
69 |
this.genesTree.setListener(listener); |
2 |
26 Feb 07 |
jari |
70 |
} |
2 |
26 Feb 07 |
jari |
71 |
if (samples_result != null && experiment.getNumberOfSamples() > 1) { |
2 |
26 Feb 07 |
jari |
72 |
this.sampleTree = new HCLSupportTree(samples_result, HCLTree.VERTICAL, geneTreeSupportVector, exptTreeSupportVector); |
2 |
26 Feb 07 |
jari |
73 |
if(genes_result == null){ |
2 |
26 Feb 07 |
jari |
74 |
offset = 10; |
2 |
26 Feb 07 |
jari |
75 |
this.sampleTree.setHorizontalOffset(offset); |
2 |
26 Feb 07 |
jari |
76 |
} |
2 |
26 Feb 07 |
jari |
77 |
this.sampleTree.setListener(listener); |
2 |
26 Feb 07 |
jari |
78 |
this.sampleTree.addMouseListener(listener); |
2 |
26 Feb 07 |
jari |
79 |
} |
2 |
26 Feb 07 |
jari |
// super.numberOfSamples = experiment.getNumberOfSamples(); |
2 |
26 Feb 07 |
jari |
81 |
super.removeAll(); |
2 |
26 Feb 07 |
jari |
82 |
super.validate(); |
2 |
26 Feb 07 |
jari |
83 |
addComponents(this.sampleTree, this.genesTree, this.expViewer.getContentComponent(), this.colorBar, this.annotationBar); |
2 |
26 Feb 07 |
jari |
84 |
this.addMouseListener(listener); |
2 |
26 Feb 07 |
jari |
85 |
addSTMenuItems(popup); |
2 |
26 Feb 07 |
jari |
86 |
} |
2 |
26 Feb 07 |
jari |
87 |
public HCLSupportViewer(Experiment e, int[] features, HCLTreeData genesResult, HCLTreeData samplesResult, int [][] sampleClusters, boolean isExperimentCluster, HCLTree genesTree, HCLTree sampleTree, Integer offset, ExperimentViewer expViewer, Vector geneTreeSupportVector, Vector exptTreeSupportVector) { |
2 |
26 Feb 07 |
jari |
88 |
super(e, features, genesResult, samplesResult, sampleClusters, isExperimentCluster, genesTree, sampleTree, offset, expViewer); |
2 |
26 Feb 07 |
jari |
89 |
|
2 |
26 Feb 07 |
jari |
90 |
this.geneTreeSupportVector = geneTreeSupportVector; |
2 |
26 Feb 07 |
jari |
91 |
this.exptTreeSupportVector = exptTreeSupportVector; |
2 |
26 Feb 07 |
jari |
92 |
|
2 |
26 Feb 07 |
jari |
93 |
} |
2 |
26 Feb 07 |
jari |
94 |
|
2 |
26 Feb 07 |
jari |
95 |
public Expression getExpression(){ |
2 |
26 Feb 07 |
jari |
96 |
Expression e = super.getExpression(); |
2 |
26 Feb 07 |
jari |
97 |
int superArgsLength = e.getArguments().length; |
2 |
26 Feb 07 |
jari |
98 |
Object[] temp = new Object[superArgsLength + 2]; |
2 |
26 Feb 07 |
jari |
99 |
for(int i=0; i<superArgsLength; i++){ |
2 |
26 Feb 07 |
jari |
100 |
temp[i] = e.getArguments()[i]; |
2 |
26 Feb 07 |
jari |
101 |
} |
2 |
26 Feb 07 |
jari |
102 |
temp[temp.length-2] = geneTreeSupportVector; |
2 |
26 Feb 07 |
jari |
103 |
temp[temp.length-1] = exptTreeSupportVector; |
2 |
26 Feb 07 |
jari |
104 |
return new Expression(this, this.getClass(), "new", temp); |
2 |
26 Feb 07 |
jari |
105 |
|
2 |
26 Feb 07 |
jari |
106 |
} |
2 |
26 Feb 07 |
jari |
107 |
|
2 |
26 Feb 07 |
jari |
108 |
public void setExperiment(Experiment e) { |
2 |
26 Feb 07 |
jari |
109 |
super.setExperiment(e); |
2 |
26 Feb 07 |
jari |
110 |
} |
2 |
26 Feb 07 |
jari |
111 |
|
2 |
26 Feb 07 |
jari |
112 |
|
2 |
26 Feb 07 |
jari |
113 |
/** |
2 |
26 Feb 07 |
jari |
* Adds menu items to the specified popup menu. |
2 |
26 Feb 07 |
jari |
115 |
*/ |
2 |
26 Feb 07 |
jari |
116 |
private void addSTMenuItems(JPopupMenu menu) { |
2 |
26 Feb 07 |
jari |
117 |
Listener listener = new Listener(); |
2 |
26 Feb 07 |
jari |
118 |
|
2 |
26 Feb 07 |
jari |
119 |
boolean haveResamplingData = true; |
2 |
26 Feb 07 |
jari |
120 |
if((this.geneTreeSupportVector == null || this.geneTreeSupportVector.isEmpty()) |
2 |
26 Feb 07 |
jari |
121 |
&& (this.exptTreeSupportVector == null || this.exptTreeSupportVector.isEmpty())) |
2 |
26 Feb 07 |
jari |
122 |
haveResamplingData = false; |
2 |
26 Feb 07 |
jari |
123 |
|
2 |
26 Feb 07 |
jari |
124 |
JMenuItem menuItem; |
2 |
26 Feb 07 |
jari |
125 |
|
2 |
26 Feb 07 |
jari |
126 |
menuItem = new JMenuItem("Support tree legend..."); |
2 |
26 Feb 07 |
jari |
127 |
menuItem.setActionCommand(SUPPORT_LEGEND_CMD); |
2 |
26 Feb 07 |
jari |
128 |
menuItem.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
129 |
|
2 |
26 Feb 07 |
jari |
130 |
if(!haveResamplingData) |
2 |
26 Feb 07 |
jari |
131 |
menuItem.setEnabled(false); |
2 |
26 Feb 07 |
jari |
132 |
|
2 |
26 Feb 07 |
jari |
133 |
Component [] comps = menu.getComponents(); |
2 |
26 Feb 07 |
jari |
134 |
|
2 |
26 Feb 07 |
jari |
135 |
menu.removeAll(); |
2 |
26 Feb 07 |
jari |
136 |
menu.add(menuItem); |
2 |
26 Feb 07 |
jari |
137 |
menu.addSeparator(); |
2 |
26 Feb 07 |
jari |
138 |
|
2 |
26 Feb 07 |
jari |
139 |
menuItem = new JCheckBoxMenuItem("Show values...", false); |
2 |
26 Feb 07 |
jari |
140 |
menuItem.setActionCommand(SUPPORT_VALUES_CMD); |
2 |
26 Feb 07 |
jari |
141 |
menuItem.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
142 |
|
2 |
26 Feb 07 |
jari |
143 |
if(!haveResamplingData) |
2 |
26 Feb 07 |
jari |
144 |
menuItem.setEnabled(false); |
2 |
26 Feb 07 |
jari |
145 |
|
2 |
26 Feb 07 |
jari |
146 |
menu.add(menuItem); |
2 |
26 Feb 07 |
jari |
147 |
menu.addSeparator(); |
2 |
26 Feb 07 |
jari |
148 |
|
2 |
26 Feb 07 |
jari |
149 |
for(int i = 0; i < comps.length; i++) { |
2 |
26 Feb 07 |
jari |
150 |
menu.add(comps[i]); |
2 |
26 Feb 07 |
jari |
151 |
} |
2 |
26 Feb 07 |
jari |
152 |
} |
2 |
26 Feb 07 |
jari |
153 |
|
2 |
26 Feb 07 |
jari |
154 |
protected void showPopup(MouseEvent e) { |
2 |
26 Feb 07 |
jari |
155 |
int node = HCLSupportViewer.this.selectedCluster == null ? -1 : HCLSupportViewer.this.selectedCluster.root; |
2 |
26 Feb 07 |
jari |
156 |
setEnableMenuItem(SET_CLUSTER_CMD, node >= 0); |
2 |
26 Feb 07 |
jari |
157 |
setEnableMenuItem(SET_CLUSTER_TEXT_CMD, doesClusterExist()); |
2 |
26 Feb 07 |
jari |
158 |
setEnableMenuItem(DELETE_CLUSTER_CMD, doesClusterExist()); |
2 |
26 Feb 07 |
jari |
159 |
setEnableMenuItem(DELETE_ALL_CLUSTERS_CMD, doesClusterExist()); |
2 |
26 Feb 07 |
jari |
160 |
setEnableMenuItem(SAVE_CLUSTER_CMD, HCLSupportViewer.this.selectedCluster != null && HCLSupportViewer.this.selectedCluster.root != -1); |
2 |
26 Feb 07 |
jari |
161 |
popup.show(e.getComponent(), e.getX(), e.getY()); |
2 |
26 Feb 07 |
jari |
162 |
} |
2 |
26 Feb 07 |
jari |
163 |
|
2 |
26 Feb 07 |
jari |
164 |
/** |
2 |
26 Feb 07 |
jari |
* Shows the legend for HCLSupportTree coloring |
2 |
26 Feb 07 |
jari |
* This method will no longer be supported when the legend |
2 |
26 Feb 07 |
jari |
* is displayed as part of the HCLSupportTree image |
2 |
26 Feb 07 |
jari |
168 |
*/ |
2 |
26 Feb 07 |
jari |
169 |
private void onShowSupportTreeLegend() { |
2 |
26 Feb 07 |
jari |
170 |
javax.swing.JDialog legendFrame = new javax.swing.JDialog(this.framework.getFrame(), "Support Tree Legend"); |
2 |
26 Feb 07 |
jari |
171 |
JPanel legendPanel = HCLSupportTree.getColorLegendPanel(); |
2 |
26 Feb 07 |
jari |
172 |
legendFrame.getContentPane().add(legendPanel); |
2 |
26 Feb 07 |
jari |
173 |
legendFrame.setSize(200, 300); |
2 |
26 Feb 07 |
jari |
174 |
legendFrame.setLocation(300, 100); |
2 |
26 Feb 07 |
jari |
175 |
legendFrame.setVisible(true); |
2 |
26 Feb 07 |
jari |
176 |
} |
2 |
26 Feb 07 |
jari |
177 |
|
2 |
26 Feb 07 |
jari |
178 |
private void onShowSupportValues(boolean showValues) { |
2 |
26 Feb 07 |
jari |
179 |
if(this.genesTree != null) |
2 |
26 Feb 07 |
jari |
180 |
((HCLSupportTree)this.genesTree).toggleShowSupportValues(showValues); |
2 |
26 Feb 07 |
jari |
181 |
if(this.sampleTree != null) |
2 |
26 Feb 07 |
jari |
182 |
((HCLSupportTree)this.sampleTree).toggleShowSupportValues(showValues); |
2 |
26 Feb 07 |
jari |
183 |
this.header.updateSize(getCommonWidth(), this.elementSize.width); |
2 |
26 Feb 07 |
jari |
184 |
onSelected(framework); |
2 |
26 Feb 07 |
jari |
185 |
} |
2 |
26 Feb 07 |
jari |
186 |
|
2 |
26 Feb 07 |
jari |
187 |
/** |
2 |
26 Feb 07 |
jari |
* Delegates this invokation to wrapped viewers. |
2 |
26 Feb 07 |
jari |
189 |
*/ |
2 |
26 Feb 07 |
jari |
190 |
public void onMenuChanged(IDisplayMenu menu) { |
2 |
26 Feb 07 |
jari |
191 |
super.onMenuChanged(menu); |
2 |
26 Feb 07 |
jari |
// this.expViewer.onMenuChanged(menu); |
2 |
26 Feb 07 |
jari |
193 |
if (this.genesTree != null) { |
2 |
26 Feb 07 |
jari |
194 |
((HCLSupportTree)genesTree).adjustPixelHeightsForValueDisplay(); |
2 |
26 Feb 07 |
jari |
195 |
this.genesTree.onMenuChanged(menu); |
2 |
26 Feb 07 |
jari |
196 |
} |
2 |
26 Feb 07 |
jari |
197 |
if (this.sampleTree != null) { |
2 |
26 Feb 07 |
jari |
198 |
((HCLSupportTree)sampleTree).adjustPixelHeightsForValueDisplay(); |
2 |
26 Feb 07 |
jari |
199 |
this.sampleTree.onMenuChanged(menu); |
2 |
26 Feb 07 |
jari |
200 |
} |
2 |
26 Feb 07 |
jari |
201 |
onSelected(framework); |
2 |
26 Feb 07 |
jari |
202 |
} |
2 |
26 Feb 07 |
jari |
203 |
|
2 |
26 Feb 07 |
jari |
204 |
/** |
2 |
26 Feb 07 |
jari |
* The class to listen to mouse, action and hcl tree events. |
2 |
26 Feb 07 |
jari |
206 |
*/ |
2 |
26 Feb 07 |
jari |
207 |
private class Listener extends MouseAdapter implements ActionListener, HCLTreeListener { |
2 |
26 Feb 07 |
jari |
208 |
|
2 |
26 Feb 07 |
jari |
209 |
public void actionPerformed(ActionEvent e) { |
2 |
26 Feb 07 |
jari |
210 |
String command = e.getActionCommand(); |
2 |
26 Feb 07 |
jari |
211 |
if (command.equals(SET_CLUSTER_CMD)) { |
2 |
26 Feb 07 |
jari |
212 |
onSetCluster(); |
2 |
26 Feb 07 |
jari |
213 |
} else if (command.equals(SET_CLUSTER_TEXT_CMD)) { |
2 |
26 Feb 07 |
jari |
214 |
onSetClusterText(); |
2 |
26 Feb 07 |
jari |
215 |
} else if (command.equals(SAVE_CLUSTER_CMD)) { |
2 |
26 Feb 07 |
jari |
216 |
onSaveCluster(); |
2 |
26 Feb 07 |
jari |
217 |
} else if (command.equals(DELETE_CLUSTER_CMD)) { |
2 |
26 Feb 07 |
jari |
218 |
onDeleteCluster(); |
2 |
26 Feb 07 |
jari |
219 |
} else if (command.equals(DELETE_ALL_CLUSTERS_CMD)) { |
2 |
26 Feb 07 |
jari |
220 |
onDeleteAllClusters(); |
2 |
26 Feb 07 |
jari |
221 |
} else if (command.equals(GENE_TREE_PROPERTIES_CMD)) { |
2 |
26 Feb 07 |
jari |
222 |
onGeneTreeProperties(); |
2 |
26 Feb 07 |
jari |
223 |
} else if (command.equals(SAMPLE_TREE_PROPERTIES_CMD)) { |
2 |
26 Feb 07 |
jari |
224 |
onSampleTreeProperties(); |
2 |
26 Feb 07 |
jari |
225 |
} else if (command.equals(SUPPORT_LEGEND_CMD)) { |
2 |
26 Feb 07 |
jari |
226 |
onShowSupportTreeLegend(); |
2 |
26 Feb 07 |
jari |
227 |
} else if (command.equals(SUPPORT_VALUES_CMD)) { |
2 |
26 Feb 07 |
jari |
228 |
onShowSupportValues(((JCheckBoxMenuItem)e.getSource()).isSelected()); |
2 |
26 Feb 07 |
jari |
229 |
} |
2 |
26 Feb 07 |
jari |
230 |
} |
2 |
26 Feb 07 |
jari |
231 |
|
2 |
26 Feb 07 |
jari |
232 |
public void valueChanged(HCLTree source, HCLCluster cluster) { |
2 |
26 Feb 07 |
jari |
233 |
HCLSupportViewer.this.valueChanged(source, cluster); |
2 |
26 Feb 07 |
jari |
234 |
} |
2 |
26 Feb 07 |
jari |
235 |
|
2 |
26 Feb 07 |
jari |
236 |
public void mouseReleased(MouseEvent event) { |
2 |
26 Feb 07 |
jari |
237 |
maybeShowPopup(event); |
2 |
26 Feb 07 |
jari |
238 |
} |
2 |
26 Feb 07 |
jari |
239 |
|
2 |
26 Feb 07 |
jari |
240 |
public void mousePressed(MouseEvent event) { |
2 |
26 Feb 07 |
jari |
241 |
maybeShowPopup(event); |
2 |
26 Feb 07 |
jari |
242 |
if (SwingUtilities.isRightMouseButton(event)) { |
2 |
26 Feb 07 |
jari |
243 |
return; |
2 |
26 Feb 07 |
jari |
244 |
} |
2 |
26 Feb 07 |
jari |
245 |
deselect(event); |
2 |
26 Feb 07 |
jari |
246 |
} |
2 |
26 Feb 07 |
jari |
247 |
|
2 |
26 Feb 07 |
jari |
248 |
private void maybeShowPopup(MouseEvent e) { |
2 |
26 Feb 07 |
jari |
249 |
if (!e.isPopupTrigger()) { |
2 |
26 Feb 07 |
jari |
250 |
return; |
2 |
26 Feb 07 |
jari |
251 |
} |
2 |
26 Feb 07 |
jari |
252 |
|
2 |
26 Feb 07 |
jari |
253 |
showPopup(e); |
2 |
26 Feb 07 |
jari |
254 |
} |
2 |
26 Feb 07 |
jari |
255 |
|
2 |
26 Feb 07 |
jari |
256 |
|
2 |
26 Feb 07 |
jari |
257 |
private void deselect(MouseEvent e){ |
2 |
26 Feb 07 |
jari |
258 |
Object source = e.getSource(); |
2 |
26 Feb 07 |
jari |
259 |
|
2 |
26 Feb 07 |
jari |
260 |
if(source instanceof HCLTree){ //in a tree don't deselect |
2 |
26 Feb 07 |
jari |
261 |
if(source == genesTree) { //if colloring rows (genes) |
2 |
26 Feb 07 |
jari |
262 |
|
2 |
26 Feb 07 |
jari |
263 |
|
2 |
26 Feb 07 |
jari |
264 |
((ExperimentViewer)expViewer).selectColumns(-1, -1); |
2 |
26 Feb 07 |
jari |
265 |
|
2 |
26 Feb 07 |
jari |
266 |
if(sampleTree != null) |
2 |
26 Feb 07 |
jari |
267 |
sampleTree.deselectAllNodes(); |
2 |
26 Feb 07 |
jari |
268 |
|
2 |
26 Feb 07 |
jari |
269 |
((ExperimentViewer)expViewer).selectRows(-1, -1); |
2 |
26 Feb 07 |
jari |
270 |
|
2 |
26 Feb 07 |
jari |
271 |
if(genesTree != null) |
2 |
26 Feb 07 |
jari |
272 |
genesTree.deselectAllNodes(); |
2 |
26 Feb 07 |
jari |
273 |
|
2 |
26 Feb 07 |
jari |
274 |
repaint(); |
2 |
26 Feb 07 |
jari |
275 |
return; |
2 |
26 Feb 07 |
jari |
276 |
} |
2 |
26 Feb 07 |
jari |
277 |
|
2 |
26 Feb 07 |
jari |
278 |
int x = e.getX(); |
2 |
26 Feb 07 |
jari |
279 |
int y = e.getY(); |
2 |
26 Feb 07 |
jari |
280 |
|
2 |
26 Feb 07 |
jari |
//now know we are not on a tree |
2 |
26 Feb 07 |
jari |
282 |
if(!(source instanceof HCLViewer) && (source != expViewer)){ |
2 |
26 Feb 07 |
jari |
283 |
deselectAllNodes(); |
2 |
26 Feb 07 |
jari |
284 |
repaint(); |
2 |
26 Feb 07 |
jari |
285 |
} |
2 |
26 Feb 07 |
jari |
//know we are in the HCLViewer but not in the tree areas but above matrix |
2 |
26 Feb 07 |
jari |
287 |
else if(source instanceof HCLViewer && sampleTree != null && y < sampleTree.getHeight()){ |
2 |
26 Feb 07 |
jari |
288 |
deselectAllNodes(); |
2 |
26 Feb 07 |
jari |
289 |
repaint(); |
2 |
26 Feb 07 |
jari |
290 |
} |
2 |
26 Feb 07 |
jari |
291 |
else if(source == expViewer){ |
2 |
26 Feb 07 |
jari |
292 |
int numSamples = numberOfSamples; |
2 |
26 Feb 07 |
jari |
293 |
if(x > elementSize.width * numSamples + offset || x < offset){ |
2 |
26 Feb 07 |
jari |
294 |
deselectAllNodes(); |
2 |
26 Feb 07 |
jari |
295 |
repaint(); |
2 |
26 Feb 07 |
jari |
296 |
} |
2 |
26 Feb 07 |
jari |
297 |
} |
2 |
26 Feb 07 |
jari |
298 |
else if((source == expViewer) && x < offset){ |
2 |
26 Feb 07 |
jari |
299 |
deselectAllNodes(); |
2 |
26 Feb 07 |
jari |
300 |
repaint(); |
2 |
26 Feb 07 |
jari |
301 |
} |
2 |
26 Feb 07 |
jari |
302 |
} |
2 |
26 Feb 07 |
jari |
303 |
|
2 |
26 Feb 07 |
jari |
304 |
} |
2 |
26 Feb 07 |
jari |
305 |
private void deselectAllNodes(){ |
2 |
26 Feb 07 |
jari |
306 |
if(genesTree != null) |
2 |
26 Feb 07 |
jari |
307 |
genesTree.deselectAllNodes(); |
2 |
26 Feb 07 |
jari |
308 |
if(sampleTree != null) |
2 |
26 Feb 07 |
jari |
309 |
sampleTree.deselectAllNodes(); |
2 |
26 Feb 07 |
jari |
310 |
|
2 |
26 Feb 07 |
jari |
311 |
|
2 |
26 Feb 07 |
jari |
312 |
((ExperimentViewer)expViewer).selectRows(-1, -1); |
2 |
26 Feb 07 |
jari |
313 |
((ExperimentViewer)expViewer).selectColumns(-1, -1); |
2 |
26 Feb 07 |
jari |
314 |
|
2 |
26 Feb 07 |
jari |
315 |
} |
2 |
26 Feb 07 |
jari |
316 |
} |
2 |
26 Feb 07 |
jari |
317 |
|
2 |
26 Feb 07 |
jari |
318 |
} |