2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
Copyright @ 1999-2004, 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 |
* ResultTree.java |
2 |
26 Feb 07 |
jari |
7 |
* |
2 |
26 Feb 07 |
jari |
* Created on December 22, 2003, 9:28 AM |
2 |
26 Feb 07 |
jari |
9 |
*/ |
2 |
26 Feb 07 |
jari |
10 |
|
2 |
26 Feb 07 |
jari |
11 |
package org.tigr.microarray.mev; |
2 |
26 Feb 07 |
jari |
12 |
|
2 |
26 Feb 07 |
jari |
13 |
import java.beans.*; |
2 |
26 Feb 07 |
jari |
14 |
|
2 |
26 Feb 07 |
jari |
15 |
import java.awt.Color; |
2 |
26 Feb 07 |
jari |
16 |
import java.awt.Component; |
2 |
26 Feb 07 |
jari |
17 |
import java.awt.Graphics; |
2 |
26 Feb 07 |
jari |
18 |
import java.io.IOException; |
2 |
26 Feb 07 |
jari |
19 |
import java.io.ObjectInputStream; |
2 |
26 Feb 07 |
jari |
20 |
import java.io.ObjectOutputStream; |
2 |
26 Feb 07 |
jari |
21 |
import java.util.Enumeration; |
2 |
26 Feb 07 |
jari |
22 |
import java.util.Hashtable; |
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.BorderFactory; |
2 |
26 Feb 07 |
jari |
26 |
import javax.swing.Icon; |
2 |
26 Feb 07 |
jari |
27 |
import javax.swing.JLabel; |
2 |
26 Feb 07 |
jari |
28 |
import javax.swing.JTree; |
2 |
26 Feb 07 |
jari |
29 |
import javax.swing.border.EmptyBorder; |
2 |
26 Feb 07 |
jari |
30 |
import javax.swing.tree.DefaultMutableTreeNode; |
2 |
26 Feb 07 |
jari |
31 |
import javax.swing.tree.DefaultTreeCellRenderer; |
2 |
26 Feb 07 |
jari |
32 |
import javax.swing.tree.DefaultTreeModel; |
2 |
26 Feb 07 |
jari |
33 |
|
2 |
26 Feb 07 |
jari |
34 |
import org.tigr.graph.GraphViewer; |
2 |
26 Feb 07 |
jari |
35 |
import org.tigr.microarray.mev.cluster.gui.Experiment; |
2 |
26 Feb 07 |
jari |
36 |
import org.tigr.microarray.mev.cluster.gui.IViewer; |
2 |
26 Feb 07 |
jari |
37 |
import org.tigr.microarray.mev.cluster.gui.LeafInfo; |
2 |
26 Feb 07 |
jari |
38 |
import org.tigr.microarray.mev.cluster.gui.helpers.ClusterTableViewer; |
2 |
26 Feb 07 |
jari |
39 |
import org.tigr.microarray.mev.cluster.gui.helpers.ExperimentClusterTableViewer; |
2 |
26 Feb 07 |
jari |
40 |
import org.tigr.microarray.mev.cluster.gui.helpers.ExperimentClusterViewer; |
2 |
26 Feb 07 |
jari |
41 |
import org.tigr.microarray.mev.cluster.gui.helpers.ExperimentViewer; |
2 |
26 Feb 07 |
jari |
42 |
import org.tigr.microarray.mev.cluster.gui.impl.GUIFactory; |
2 |
26 Feb 07 |
jari |
43 |
import org.tigr.util.FloatMatrix; |
2 |
26 Feb 07 |
jari |
44 |
|
2 |
26 Feb 07 |
jari |
45 |
/** |
2 |
26 Feb 07 |
jari |
46 |
* |
2 |
26 Feb 07 |
jari |
* @author braisted |
2 |
26 Feb 07 |
jari |
48 |
*/ |
2 |
26 Feb 07 |
jari |
49 |
public class ResultTree extends JTree implements java.io.Serializable { |
2 |
26 Feb 07 |
jari |
// public static final long serialVersionUID = 100010201070001L; |
2 |
26 Feb 07 |
jari |
51 |
|
2 |
26 Feb 07 |
jari |
52 |
|
2 |
26 Feb 07 |
jari |
/** Root node |
2 |
26 Feb 07 |
jari |
54 |
*/ |
2 |
26 Feb 07 |
jari |
55 |
private DefaultMutableTreeNode root; |
2 |
26 Feb 07 |
jari |
/** analysis node |
2 |
26 Feb 07 |
jari |
57 |
*/ |
2 |
26 Feb 07 |
jari |
58 |
private DefaultMutableTreeNode analysisNode; |
2 |
26 Feb 07 |
jari |
59 |
|
2 |
26 Feb 07 |
jari |
60 |
Vector dumpVector; |
2 |
26 Feb 07 |
jari |
61 |
|
2 |
26 Feb 07 |
jari |
62 |
public ResultTree(){ |
2 |
26 Feb 07 |
jari |
// super(); |
2 |
26 Feb 07 |
jari |
64 |
this.setCellRenderer(new ResultTreeNodeRenderer()); |
2 |
26 Feb 07 |
jari |
65 |
} |
2 |
26 Feb 07 |
jari |
66 |
|
2 |
26 Feb 07 |
jari |
/** Creates a new instance of ResultTree */ |
2 |
26 Feb 07 |
jari |
68 |
public ResultTree(DefaultMutableTreeNode root) { |
2 |
26 Feb 07 |
jari |
69 |
super(root); |
2 |
26 Feb 07 |
jari |
70 |
this.root = root; |
2 |
26 Feb 07 |
jari |
71 |
this.setCellRenderer(new ResultTreeNodeRenderer()); |
2 |
26 Feb 07 |
jari |
72 |
|
2 |
26 Feb 07 |
jari |
73 |
dumpVector = new Vector(); |
2 |
26 Feb 07 |
jari |
74 |
} |
2 |
26 Feb 07 |
jari |
75 |
public ResultTree(DefaultMutableTreeNode root, DefaultMutableTreeNode analysisNode) { |
2 |
26 Feb 07 |
jari |
76 |
super(root); |
2 |
26 Feb 07 |
jari |
77 |
this.root = root; |
2 |
26 Feb 07 |
jari |
78 |
this.setCellRenderer(new ResultTreeNodeRenderer()); |
2 |
26 Feb 07 |
jari |
79 |
this.analysisNode = analysisNode; |
2 |
26 Feb 07 |
jari |
80 |
dumpVector = new Vector(); |
2 |
26 Feb 07 |
jari |
81 |
} |
2 |
26 Feb 07 |
jari |
82 |
|
2 |
26 Feb 07 |
jari |
83 |
|
2 |
26 Feb 07 |
jari |
/** Returns the root node. |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
86 |
*/ |
2 |
26 Feb 07 |
jari |
87 |
public DefaultMutableTreeNode getRoot() { |
2 |
26 Feb 07 |
jari |
88 |
return root; |
2 |
26 Feb 07 |
jari |
89 |
} |
2 |
26 Feb 07 |
jari |
/** Sets the root node. |
2 |
26 Feb 07 |
jari |
91 |
*/ |
2 |
26 Feb 07 |
jari |
92 |
public void setRoot(DefaultMutableTreeNode r) { |
2 |
26 Feb 07 |
jari |
93 |
this.root = r; |
2 |
26 Feb 07 |
jari |
94 |
} |
2 |
26 Feb 07 |
jari |
/** Returns the analysis node. |
2 |
26 Feb 07 |
jari |
96 |
*/ |
2 |
26 Feb 07 |
jari |
97 |
public DefaultMutableTreeNode getAnalysisNode() { |
2 |
26 Feb 07 |
jari |
98 |
return analysisNode; |
2 |
26 Feb 07 |
jari |
99 |
} |
2 |
26 Feb 07 |
jari |
/** Sets the analysis node. |
2 |
26 Feb 07 |
jari |
101 |
*/ |
2 |
26 Feb 07 |
jari |
102 |
public void setAnalysisNode(DefaultMutableTreeNode n) { |
2 |
26 Feb 07 |
jari |
103 |
this.analysisNode = n; |
2 |
26 Feb 07 |
jari |
104 |
} |
2 |
26 Feb 07 |
jari |
105 |
|
2 |
26 Feb 07 |
jari |
/** Inserts a node. |
2 |
26 Feb 07 |
jari |
107 |
*/ |
2 |
26 Feb 07 |
jari |
108 |
public void insertNode(DefaultMutableTreeNode node, DefaultMutableTreeNode parentNode, int locationIndex){ |
2 |
26 Feb 07 |
jari |
109 |
if(node == null || parentNode == null) |
2 |
26 Feb 07 |
jari |
110 |
return; |
2 |
26 Feb 07 |
jari |
111 |
DefaultTreeModel treeModel = (DefaultTreeModel)getModel(); |
2 |
26 Feb 07 |
jari |
112 |
treeModel.insertNodeInto((DefaultMutableTreeNode)node, (DefaultMutableTreeNode)parentNode, locationIndex); |
2 |
26 Feb 07 |
jari |
113 |
} |
2 |
26 Feb 07 |
jari |
114 |
|
2 |
26 Feb 07 |
jari |
/** Removes a Node. |
2 |
26 Feb 07 |
jari |
116 |
*/ |
2 |
26 Feb 07 |
jari |
117 |
public void removeNode(DefaultMutableTreeNode node) { |
2 |
26 Feb 07 |
jari |
118 |
DefaultTreeModel treeModel = (DefaultTreeModel)getModel(); |
2 |
26 Feb 07 |
jari |
119 |
treeModel.removeNodeFromParent(node); |
2 |
26 Feb 07 |
jari |
120 |
} |
2 |
26 Feb 07 |
jari |
121 |
|
2 |
26 Feb 07 |
jari |
122 |
/** |
2 |
26 Feb 07 |
jari |
* @param object |
2 |
26 Feb 07 |
jari |
* @return */ |
2 |
26 Feb 07 |
jari |
125 |
public DefaultMutableTreeNode getNode(Object object) { |
2 |
26 Feb 07 |
jari |
126 |
Enumeration _enum = root.depthFirstEnumeration(); |
2 |
26 Feb 07 |
jari |
127 |
DefaultMutableTreeNode node; |
2 |
26 Feb 07 |
jari |
128 |
while(_enum.hasMoreElements()){ |
2 |
26 Feb 07 |
jari |
129 |
node = (DefaultMutableTreeNode)_enum.nextElement(); |
2 |
26 Feb 07 |
jari |
130 |
if(node.getUserObject() == object) |
2 |
26 Feb 07 |
jari |
131 |
return node; |
2 |
26 Feb 07 |
jari |
132 |
} |
2 |
26 Feb 07 |
jari |
133 |
return null; |
2 |
26 Feb 07 |
jari |
134 |
} |
2 |
26 Feb 07 |
jari |
135 |
|
2 |
26 Feb 07 |
jari |
/** Returns the terminal node give a node name |
2 |
26 Feb 07 |
jari |
* path from root to termial node. |
2 |
26 Feb 07 |
jari |
* @param nodeNames |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
140 |
*/ |
2 |
26 Feb 07 |
jari |
141 |
public DefaultMutableTreeNode getNode(String [] nodeNames) { |
2 |
26 Feb 07 |
jari |
142 |
DefaultMutableTreeNode node = root; |
2 |
26 Feb 07 |
jari |
143 |
|
2 |
26 Feb 07 |
jari |
144 |
for(int i = 0; i < nodeNames.length; i++) { |
2 |
26 Feb 07 |
jari |
145 |
for(int j = 0; j < node.getChildCount(); j++){ |
2 |
26 Feb 07 |
jari |
146 |
if( (node.getChildAt(j).toString()).equals(nodeNames[i])){ |
2 |
26 Feb 07 |
jari |
147 |
node = (DefaultMutableTreeNode)node.getChildAt(j); |
2 |
26 Feb 07 |
jari |
148 |
continue; |
2 |
26 Feb 07 |
jari |
149 |
} |
2 |
26 Feb 07 |
jari |
150 |
} |
2 |
26 Feb 07 |
jari |
151 |
} |
2 |
26 Feb 07 |
jari |
152 |
|
2 |
26 Feb 07 |
jari |
//If final node string equals last node name return node |
2 |
26 Feb 07 |
jari |
154 |
if(node.toString().equals(nodeNames[nodeNames.length-1])) |
2 |
26 Feb 07 |
jari |
155 |
return node; |
2 |
26 Feb 07 |
jari |
156 |
|
2 |
26 Feb 07 |
jari |
157 |
return null; |
2 |
26 Feb 07 |
jari |
158 |
} |
2 |
26 Feb 07 |
jari |
159 |
|
2 |
26 Feb 07 |
jari |
160 |
/** |
2 |
26 Feb 07 |
jari |
* EH - for state-saving |
2 |
26 Feb 07 |
jari |
* Returns a hashtable of all the experiments contained within the result tree, |
2 |
26 Feb 07 |
jari |
* keyed on their ExptID. Used by state-saving methods. |
2 |
26 Feb 07 |
jari |
164 |
*/ |
2 |
26 Feb 07 |
jari |
165 |
public Hashtable getAllExperiments() { |
2 |
26 Feb 07 |
jari |
166 |
Hashtable allExpts = new Hashtable(); |
2 |
26 Feb 07 |
jari |
167 |
Enumeration allTreeNodes = ((DefaultMutableTreeNode)analysisNode).breadthFirstEnumeration(); |
2 |
26 Feb 07 |
jari |
168 |
DefaultMutableTreeNode dmtn; |
2 |
26 Feb 07 |
jari |
169 |
while(allTreeNodes.hasMoreElements()){ |
2 |
26 Feb 07 |
jari |
170 |
dmtn = (DefaultMutableTreeNode)allTreeNodes.nextElement(); |
2 |
26 Feb 07 |
jari |
171 |
Object o = dmtn.getUserObject(); |
2 |
26 Feb 07 |
jari |
172 |
if(o instanceof LeafInfo) { |
2 |
26 Feb 07 |
jari |
173 |
LeafInfo l = (LeafInfo)o; |
2 |
26 Feb 07 |
jari |
174 |
if(l.getViewer() != null){ |
2 |
26 Feb 07 |
jari |
175 |
Experiment e = l.getViewer().getExperiment(); |
2 |
26 Feb 07 |
jari |
176 |
if(e != null){ |
2 |
26 Feb 07 |
jari |
177 |
allExpts.put(new Integer(e.getId()), l.getViewer().getExperiment()); |
2 |
26 Feb 07 |
jari |
178 |
} |
2 |
26 Feb 07 |
jari |
179 |
} |
2 |
26 Feb 07 |
jari |
180 |
} |
2 |
26 Feb 07 |
jari |
181 |
} |
2 |
26 Feb 07 |
jari |
182 |
return allExpts; |
2 |
26 Feb 07 |
jari |
183 |
} |
2 |
26 Feb 07 |
jari |
184 |
|
2 |
26 Feb 07 |
jari |
185 |
|
2 |
26 Feb 07 |
jari |
186 |
public Hashtable getResultHash(){ |
2 |
26 Feb 07 |
jari |
187 |
Hashtable table = new Hashtable(); |
2 |
26 Feb 07 |
jari |
188 |
DefaultMutableTreeNode analysisRoot; |
2 |
26 Feb 07 |
jari |
189 |
DefaultMutableTreeNode currentNode; |
2 |
26 Feb 07 |
jari |
190 |
Object object; |
2 |
26 Feb 07 |
jari |
191 |
Object [] vals; |
2 |
26 Feb 07 |
jari |
192 |
boolean stop = false; |
2 |
26 Feb 07 |
jari |
193 |
|
2 |
26 Feb 07 |
jari |
194 |
IViewer viewer; |
2 |
26 Feb 07 |
jari |
195 |
Experiment exp; |
2 |
26 Feb 07 |
jari |
196 |
int [][] clusters; |
2 |
26 Feb 07 |
jari |
197 |
|
2 |
26 Feb 07 |
jari |
198 |
int childCount = analysisNode.getChildCount(); |
2 |
26 Feb 07 |
jari |
//String algTitles = new String[analysisNode.getChildCount()]; |
2 |
26 Feb 07 |
jari |
200 |
String algName = ""; |
2 |
26 Feb 07 |
jari |
201 |
Enumeration _enum; |
2 |
26 Feb 07 |
jari |
202 |
|
2 |
26 Feb 07 |
jari |
203 |
for(int i = 0; i < childCount; i++){ |
2 |
26 Feb 07 |
jari |
204 |
analysisRoot = ((DefaultMutableTreeNode)(analysisNode.getChildAt(i))); |
2 |
26 Feb 07 |
jari |
205 |
object = analysisRoot.getUserObject(); |
2 |
26 Feb 07 |
jari |
206 |
if(object != null){ |
2 |
26 Feb 07 |
jari |
207 |
if(object instanceof LeafInfo){ |
2 |
26 Feb 07 |
jari |
208 |
algName = ((LeafInfo)object).toString(); |
2 |
26 Feb 07 |
jari |
209 |
} else if(object instanceof String) { |
2 |
26 Feb 07 |
jari |
210 |
algName = (String)object; |
2 |
26 Feb 07 |
jari |
211 |
} |
2 |
26 Feb 07 |
jari |
212 |
|
2 |
26 Feb 07 |
jari |
213 |
_enum = analysisRoot.depthFirstEnumeration(); |
2 |
26 Feb 07 |
jari |
214 |
while (!stop && _enum.hasMoreElements()){ |
2 |
26 Feb 07 |
jari |
215 |
currentNode = (DefaultMutableTreeNode)_enum.nextElement(); |
2 |
26 Feb 07 |
jari |
216 |
if(currentNode.getUserObject() instanceof LeafInfo){ |
2 |
26 Feb 07 |
jari |
217 |
viewer = ((LeafInfo)currentNode.getUserObject()).getViewer(); |
2 |
26 Feb 07 |
jari |
218 |
if(viewer != null) { |
2 |
26 Feb 07 |
jari |
219 |
exp = viewer.getExperiment(); |
2 |
26 Feb 07 |
jari |
220 |
clusters = viewer.getClusters(); |
2 |
26 Feb 07 |
jari |
221 |
if(exp != null && clusters != null) { |
2 |
26 Feb 07 |
jari |
222 |
vals = new Object[2]; |
2 |
26 Feb 07 |
jari |
223 |
vals[0] = exp; |
2 |
26 Feb 07 |
jari |
224 |
vals[1] = clusters; |
2 |
26 Feb 07 |
jari |
225 |
table.put(algName, vals); |
2 |
26 Feb 07 |
jari |
226 |
stop = true; |
2 |
26 Feb 07 |
jari |
227 |
} |
2 |
26 Feb 07 |
jari |
228 |
} |
2 |
26 Feb 07 |
jari |
229 |
} |
2 |
26 Feb 07 |
jari |
230 |
|
2 |
26 Feb 07 |
jari |
231 |
} |
2 |
26 Feb 07 |
jari |
232 |
stop = false; |
2 |
26 Feb 07 |
jari |
233 |
} |
2 |
26 Feb 07 |
jari |
234 |
} |
2 |
26 Feb 07 |
jari |
235 |
return table; |
2 |
26 Feb 07 |
jari |
236 |
} |
2 |
26 Feb 07 |
jari |
237 |
|
2 |
26 Feb 07 |
jari |
/** Support for gene or experiment search, retrieval of nodes for the |
2 |
26 Feb 07 |
jari |
* SearchResultDialg |
2 |
26 Feb 07 |
jari |
240 |
*/ |
2 |
26 Feb 07 |
jari |
241 |
|
2 |
26 Feb 07 |
jari |
242 |
public Vector findViewerCollection(int [] indices, boolean geneSearch) { |
2 |
26 Feb 07 |
jari |
243 |
Vector result = new Vector(); |
2 |
26 Feb 07 |
jari |
244 |
|
2 |
26 Feb 07 |
jari |
245 |
|
2 |
26 Feb 07 |
jari |
246 |
|
2 |
26 Feb 07 |
jari |
247 |
Vector analysisNodes = new Vector(); |
2 |
26 Feb 07 |
jari |
248 |
Hashtable expViewHash = new Hashtable(); |
2 |
26 Feb 07 |
jari |
249 |
Hashtable tabViewHash = new Hashtable(); |
2 |
26 Feb 07 |
jari |
250 |
|
2 |
26 Feb 07 |
jari |
251 |
Vector childNodes = new Vector(); |
2 |
26 Feb 07 |
jari |
252 |
DefaultMutableTreeNode node; |
2 |
26 Feb 07 |
jari |
253 |
|
2 |
26 Feb 07 |
jari |
254 |
|
2 |
26 Feb 07 |
jari |
255 |
int childCount = analysisNode.getChildCount(); |
2 |
26 Feb 07 |
jari |
256 |
boolean hasResult = false; |
2 |
26 Feb 07 |
jari |
257 |
|
2 |
26 Feb 07 |
jari |
258 |
for(int analysis = 0; analysis < childCount ; analysis++) { |
2 |
26 Feb 07 |
jari |
259 |
|
2 |
26 Feb 07 |
jari |
260 |
node = (DefaultMutableTreeNode)(analysisNode.getChildAt(analysis)); |
2 |
26 Feb 07 |
jari |
261 |
|
2 |
26 Feb 07 |
jari |
//for each analysis node accumulate result nodes |
2 |
26 Feb 07 |
jari |
263 |
DefaultMutableTreeNode aNode = getSearchResults(indices, node, expViewHash, tabViewHash, geneSearch); |
2 |
26 Feb 07 |
jari |
264 |
|
2 |
26 Feb 07 |
jari |
265 |
if(aNode != null) |
2 |
26 Feb 07 |
jari |
266 |
analysisNodes.addElement(aNode); |
2 |
26 Feb 07 |
jari |
267 |
} |
2 |
26 Feb 07 |
jari |
268 |
|
2 |
26 Feb 07 |
jari |
269 |
|
2 |
26 Feb 07 |
jari |
270 |
result.add(analysisNodes); |
2 |
26 Feb 07 |
jari |
271 |
result.add(expViewHash); |
2 |
26 Feb 07 |
jari |
272 |
result.add(tabViewHash); |
2 |
26 Feb 07 |
jari |
273 |
|
2 |
26 Feb 07 |
jari |
274 |
if(expViewHash.size() == 0 && expViewHash.size() == 0) |
2 |
26 Feb 07 |
jari |
275 |
return null; |
2 |
26 Feb 07 |
jari |
276 |
|
2 |
26 Feb 07 |
jari |
277 |
return result; |
2 |
26 Feb 07 |
jari |
278 |
} |
2 |
26 Feb 07 |
jari |
279 |
|
2 |
26 Feb 07 |
jari |
280 |
private DefaultMutableTreeNode getSearchResults(int [] indices, DefaultMutableTreeNode analRoot, Hashtable expHash, Hashtable tabHash, boolean geneSearch) { |
2 |
26 Feb 07 |
jari |
281 |
boolean result = false; |
2 |
26 Feb 07 |
jari |
282 |
|
2 |
26 Feb 07 |
jari |
283 |
Enumeration _enum = analRoot.depthFirstEnumeration(); |
2 |
26 Feb 07 |
jari |
284 |
DefaultMutableTreeNode currNode; |
2 |
26 Feb 07 |
jari |
285 |
Object currUserObject; |
2 |
26 Feb 07 |
jari |
286 |
IViewer currViewer; |
2 |
26 Feb 07 |
jari |
287 |
LeafInfo currLeafInfo; |
2 |
26 Feb 07 |
jari |
288 |
Experiment currExperiment; |
2 |
26 Feb 07 |
jari |
289 |
int [][] clusters; |
2 |
26 Feb 07 |
jari |
290 |
int clusterIndex; |
2 |
26 Feb 07 |
jari |
291 |
Object currIndexObject; |
2 |
26 Feb 07 |
jari |
292 |
boolean containsIndex; |
2 |
26 Feb 07 |
jari |
293 |
|
2 |
26 Feb 07 |
jari |
294 |
Vector expViewers = new Vector(); |
2 |
26 Feb 07 |
jari |
295 |
Vector tabViewers = new Vector(); |
2 |
26 Feb 07 |
jari |
296 |
|
2 |
26 Feb 07 |
jari |
297 |
DefaultMutableTreeNode newNode; |
2 |
26 Feb 07 |
jari |
298 |
|
2 |
26 Feb 07 |
jari |
299 |
DefaultMutableTreeNode newRoot = new DefaultMutableTreeNode(analRoot.getUserObject()); |
2 |
26 Feb 07 |
jari |
300 |
|
2 |
26 Feb 07 |
jari |
301 |
|
2 |
26 Feb 07 |
jari |
302 |
while(_enum.hasMoreElements()) { |
2 |
26 Feb 07 |
jari |
303 |
|
2 |
26 Feb 07 |
jari |
304 |
currNode = (DefaultMutableTreeNode)(_enum.nextElement()); |
2 |
26 Feb 07 |
jari |
305 |
currUserObject = currNode.getUserObject(); |
2 |
26 Feb 07 |
jari |
306 |
|
2 |
26 Feb 07 |
jari |
307 |
if(currUserObject instanceof LeafInfo) { |
2 |
26 Feb 07 |
jari |
308 |
currLeafInfo = (LeafInfo)currUserObject; |
2 |
26 Feb 07 |
jari |
309 |
currViewer = (currLeafInfo).getViewer(); |
2 |
26 Feb 07 |
jari |
310 |
|
2 |
26 Feb 07 |
jari |
311 |
if(currViewer != null) { |
2 |
26 Feb 07 |
jari |
312 |
|
2 |
26 Feb 07 |
jari |
313 |
if(geneSearch) { |
2 |
26 Feb 07 |
jari |
314 |
if( currViewer instanceof ExperimentViewer ) { |
2 |
26 Feb 07 |
jari |
315 |
currIndexObject = ((LeafInfo)currUserObject).getUserObject(); |
2 |
26 Feb 07 |
jari |
316 |
if(currIndexObject != null && currIndexObject instanceof Integer) { |
2 |
26 Feb 07 |
jari |
317 |
clusterIndex = ((Integer)currIndexObject).intValue(); |
2 |
26 Feb 07 |
jari |
318 |
|
2 |
26 Feb 07 |
jari |
319 |
clusters = currViewer.getClusters(); |
2 |
26 Feb 07 |
jari |
320 |
currExperiment = currViewer.getExperiment(); |
2 |
26 Feb 07 |
jari |
321 |
|
2 |
26 Feb 07 |
jari |
322 |
if(clusters != null && currExperiment != null) { |
2 |
26 Feb 07 |
jari |
323 |
if(containsGeneIndices(indices, clusters[clusterIndex], currExperiment)) { |
2 |
26 Feb 07 |
jari |
324 |
result = true; |
2 |
26 Feb 07 |
jari |
325 |
expViewers.addElement(currNode); |
2 |
26 Feb 07 |
jari |
//newNode = new DefaultMutableTreeNode(new LeafInfo(currLeafInfo.getName(), currLeafInfo.getViewer(), currLeafInfo.getJPopupMenu(), currLeafInfo.getUserObject())); |
2 |
26 Feb 07 |
jari |
//expViewers.addElement(newNode); |
2 |
26 Feb 07 |
jari |
328 |
} |
2 |
26 Feb 07 |
jari |
329 |
} |
2 |
26 Feb 07 |
jari |
330 |
} |
2 |
26 Feb 07 |
jari |
331 |
} else if(currViewer instanceof ClusterTableViewer) { |
2 |
26 Feb 07 |
jari |
332 |
currIndexObject = ((LeafInfo)currUserObject).getUserObject(); |
2 |
26 Feb 07 |
jari |
333 |
if(currIndexObject != null && currIndexObject instanceof Integer) { |
2 |
26 Feb 07 |
jari |
334 |
clusterIndex = ((Integer)currIndexObject).intValue(); |
2 |
26 Feb 07 |
jari |
335 |
|
2 |
26 Feb 07 |
jari |
336 |
clusters = currViewer.getClusters(); |
2 |
26 Feb 07 |
jari |
337 |
currExperiment = currViewer.getExperiment(); |
2 |
26 Feb 07 |
jari |
338 |
|
2 |
26 Feb 07 |
jari |
339 |
if(clusters != null && currExperiment != null) { |
2 |
26 Feb 07 |
jari |
340 |
if(containsGeneIndices(indices, clusters[clusterIndex], currExperiment)) { |
2 |
26 Feb 07 |
jari |
341 |
result = true; |
2 |
26 Feb 07 |
jari |
342 |
tabViewers.addElement(currNode); |
2 |
26 Feb 07 |
jari |
//newNode = new DefaultMutableTreeNode(new LeafInfo(currLeafInfo.getName(), currLeafInfo.getViewer(), currLeafInfo.getJPopupMenu(), currLeafInfo.getUserObject())); |
2 |
26 Feb 07 |
jari |
//tabViewers.addElement(newNode); |
2 |
26 Feb 07 |
jari |
345 |
} |
2 |
26 Feb 07 |
jari |
346 |
} |
2 |
26 Feb 07 |
jari |
347 |
} |
2 |
26 Feb 07 |
jari |
348 |
} |
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 |
353 |
} else { //experiment search |
2 |
26 Feb 07 |
jari |
354 |
|
2 |
26 Feb 07 |
jari |
355 |
if(currViewer instanceof ExperimentClusterViewer) { |
2 |
26 Feb 07 |
jari |
356 |
currIndexObject = ((LeafInfo)currUserObject).getUserObject(); |
2 |
26 Feb 07 |
jari |
357 |
if(currIndexObject != null && currIndexObject instanceof Integer) { |
2 |
26 Feb 07 |
jari |
358 |
clusterIndex = ((Integer)currIndexObject).intValue(); |
2 |
26 Feb 07 |
jari |
359 |
|
2 |
26 Feb 07 |
jari |
360 |
clusters = currViewer.getClusters(); |
2 |
26 Feb 07 |
jari |
361 |
currExperiment = currViewer.getExperiment(); |
2 |
26 Feb 07 |
jari |
362 |
|
2 |
26 Feb 07 |
jari |
363 |
if(clusters != null && currExperiment != null) { |
2 |
26 Feb 07 |
jari |
364 |
if(containsExperimentIndices(indices, clusters[clusterIndex], currExperiment)) { |
2 |
26 Feb 07 |
jari |
365 |
result = true; |
2 |
26 Feb 07 |
jari |
366 |
expViewers.addElement(currNode); |
2 |
26 Feb 07 |
jari |
//newNode = new DefaultMutableTreeNode(new LeafInfo(currLeafInfo.getName(), currLeafInfo.getViewer(), currLeafInfo.getJPopupMenu(), currLeafInfo.getUserObject())); |
2 |
26 Feb 07 |
jari |
//expViewers.addElement(newNode); |
2 |
26 Feb 07 |
jari |
369 |
} |
2 |
26 Feb 07 |
jari |
370 |
} |
2 |
26 Feb 07 |
jari |
371 |
} |
2 |
26 Feb 07 |
jari |
372 |
} else if(currViewer instanceof ExperimentClusterTableViewer){ |
2 |
26 Feb 07 |
jari |
373 |
currIndexObject = ((LeafInfo)currUserObject).getUserObject(); |
2 |
26 Feb 07 |
jari |
374 |
if(currIndexObject != null && currIndexObject instanceof Integer) { |
2 |
26 Feb 07 |
jari |
375 |
clusterIndex = ((Integer)currIndexObject).intValue(); |
2 |
26 Feb 07 |
jari |
376 |
|
2 |
26 Feb 07 |
jari |
377 |
clusters = currViewer.getClusters(); |
2 |
26 Feb 07 |
jari |
378 |
currExperiment = currViewer.getExperiment(); |
2 |
26 Feb 07 |
jari |
379 |
|
2 |
26 Feb 07 |
jari |
380 |
if(clusters != null && currExperiment != null) { |
2 |
26 Feb 07 |
jari |
381 |
if(containsExperimentIndices(indices, clusters[clusterIndex], currExperiment)) { |
2 |
26 Feb 07 |
jari |
382 |
result = true; |
2 |
26 Feb 07 |
jari |
383 |
tabViewers.addElement(currNode); |
2 |
26 Feb 07 |
jari |
//newNode = new DefaultMutableTreeNode(new LeafInfo(currLeafInfo.getName(), currLeafInfo.getViewer(), currLeafInfo.getJPopupMenu(), currLeafInfo.getUserObject())); |
2 |
26 Feb 07 |
jari |
//tabViewers.addElement(newNode); |
2 |
26 Feb 07 |
jari |
386 |
} |
2 |
26 Feb 07 |
jari |
387 |
} |
2 |
26 Feb 07 |
jari |
388 |
} |
2 |
26 Feb 07 |
jari |
389 |
|
2 |
26 Feb 07 |
jari |
390 |
|
2 |
26 Feb 07 |
jari |
391 |
|
2 |
26 Feb 07 |
jari |
392 |
} |
2 |
26 Feb 07 |
jari |
393 |
|
2 |
26 Feb 07 |
jari |
394 |
} |
2 |
26 Feb 07 |
jari |
395 |
} |
2 |
26 Feb 07 |
jari |
396 |
} |
2 |
26 Feb 07 |
jari |
397 |
|
2 |
26 Feb 07 |
jari |
398 |
} |
2 |
26 Feb 07 |
jari |
399 |
|
2 |
26 Feb 07 |
jari |
400 |
if(result) { |
2 |
26 Feb 07 |
jari |
401 |
expHash.put(newRoot, expViewers); |
2 |
26 Feb 07 |
jari |
402 |
tabHash.put(newRoot, tabViewers); |
2 |
26 Feb 07 |
jari |
403 |
return newRoot; |
2 |
26 Feb 07 |
jari |
404 |
} |
2 |
26 Feb 07 |
jari |
405 |
|
2 |
26 Feb 07 |
jari |
406 |
return null; |
2 |
26 Feb 07 |
jari |
407 |
} |
2 |
26 Feb 07 |
jari |
408 |
|
2 |
26 Feb 07 |
jari |
409 |
|
2 |
26 Feb 07 |
jari |
410 |
private boolean containsGeneIndices(int [] indices, int [] clusterIndices, Experiment experiment) { |
2 |
26 Feb 07 |
jari |
411 |
for(int i = 0; i < indices.length; i++) { |
2 |
26 Feb 07 |
jari |
412 |
for(int j = 0; j < clusterIndices.length; j++) { |
2 |
26 Feb 07 |
jari |
413 |
if(indices[i] == experiment.getGeneIndexMappedToData(clusterIndices[j])) |
2 |
26 Feb 07 |
jari |
414 |
return true; |
2 |
26 Feb 07 |
jari |
415 |
} |
2 |
26 Feb 07 |
jari |
416 |
} |
2 |
26 Feb 07 |
jari |
417 |
return false; |
2 |
26 Feb 07 |
jari |
418 |
} |
2 |
26 Feb 07 |
jari |
419 |
|
2 |
26 Feb 07 |
jari |
420 |
private boolean containsExperimentIndices(int [] indices, int [] clusterIndices, Experiment experiment) { |
2 |
26 Feb 07 |
jari |
421 |
int [] colIndices = experiment.getColumnIndicesCopy(); |
2 |
26 Feb 07 |
jari |
422 |
|
2 |
26 Feb 07 |
jari |
423 |
for(int i = 0; i < indices.length; i++) { |
2 |
26 Feb 07 |
jari |
424 |
for(int j = 0; j < clusterIndices.length; j++) { |
2 |
26 Feb 07 |
jari |
425 |
if(indices[i] == colIndices[clusterIndices[j]]) |
2 |
26 Feb 07 |
jari |
426 |
return true; |
2 |
26 Feb 07 |
jari |
427 |
} |
2 |
26 Feb 07 |
jari |
428 |
} |
2 |
26 Feb 07 |
jari |
429 |
|
2 |
26 Feb 07 |
jari |
430 |
return false; |
2 |
26 Feb 07 |
jari |
431 |
} |
2 |
26 Feb 07 |
jari |
432 |
|
2 |
26 Feb 07 |
jari |
433 |
/** |
2 |
26 Feb 07 |
jari |
* Clears data selection over the tree |
2 |
26 Feb 07 |
jari |
435 |
*/ |
2 |
26 Feb 07 |
jari |
436 |
public void clearDataSelection() { |
2 |
26 Feb 07 |
jari |
437 |
Enumeration _enum = this.root.depthFirstEnumeration(); |
2 |
26 Feb 07 |
jari |
438 |
DefaultMutableTreeNode node; |
2 |
26 Feb 07 |
jari |
439 |
while(_enum.hasMoreElements()) { |
2 |
26 Feb 07 |
jari |
440 |
node = (DefaultMutableTreeNode)(_enum.nextElement()); |
2 |
26 Feb 07 |
jari |
441 |
if(node.getUserObject() != null && node.getUserObject() instanceof LeafInfo) |
2 |
26 Feb 07 |
jari |
442 |
((LeafInfo)node.getUserObject()).setSelectedDataSource(false); |
2 |
26 Feb 07 |
jari |
443 |
} |
2 |
26 Feb 07 |
jari |
444 |
} |
2 |
26 Feb 07 |
jari |
445 |
|
2 |
26 Feb 07 |
jari |
/** Renders the <CODE>ResultTree</CODE>. |
2 |
26 Feb 07 |
jari |
447 |
*/ |
2 |
26 Feb 07 |
jari |
448 |
public class ResultTreeNodeRenderer extends DefaultTreeCellRenderer { |
2 |
26 Feb 07 |
jari |
449 |
|
2 |
26 Feb 07 |
jari |
/** Default leaf icon to display |
2 |
26 Feb 07 |
jari |
451 |
*/ |
2 |
26 Feb 07 |
jari |
452 |
private Icon defaultLeafIcon; |
2 |
26 Feb 07 |
jari |
/** Icon for primary level results |
2 |
26 Feb 07 |
jari |
454 |
*/ |
2 |
26 Feb 07 |
jari |
455 |
private Icon primaryResultIcon = GUIFactory.getIcon("PrimaryResult.gif"); |
2 |
26 Feb 07 |
jari |
/** Expression Image Icon |
2 |
26 Feb 07 |
jari |
457 |
*/ |
2 |
26 Feb 07 |
jari |
458 |
private Icon expressionImageIcon = GUIFactory.getIcon("ExpressionImageResult.gif"); |
2 |
26 Feb 07 |
jari |
/** Centroid Graph Icon |
2 |
26 Feb 07 |
jari |
460 |
*/ |
2 |
26 Feb 07 |
jari |
461 |
private Icon centroidGraphIcon = GUIFactory.getIcon("CentroidResult.gif"); |
2 |
26 Feb 07 |
jari |
/** Expression Graph Icon |
2 |
26 Feb 07 |
jari |
463 |
*/ |
2 |
26 Feb 07 |
jari |
464 |
private Icon expressionGraphIcon = GUIFactory.getIcon("ExpressionGraphResult.gif"); |
2 |
26 Feb 07 |
jari |
/** HCL tree icon |
2 |
26 Feb 07 |
jari |
466 |
*/ |
2 |
26 Feb 07 |
jari |
467 |
private Icon hclIcon = GUIFactory.getIcon("HCLResult.gif"); |
2 |
26 Feb 07 |
jari |
/** Node Height Graph Icon |
2 |
26 Feb 07 |
jari |
469 |
*/ |
2 |
26 Feb 07 |
jari |
470 |
private Icon nodeHeightIcon = GUIFactory.getIcon("NodeHeightResult.gif"); |
2 |
26 Feb 07 |
jari |
/** SAM Graph Icon |
2 |
26 Feb 07 |
jari |
472 |
*/ |
2 |
26 Feb 07 |
jari |
473 |
private Icon samGraphIcon = GUIFactory.getIcon("SAMGraphResult.gif"); |
2 |
26 Feb 07 |
jari |
/** Volcano Plot Icon |
2 |
26 Feb 07 |
jari |
475 |
*/ |
2 |
26 Feb 07 |
jari |
476 |
private Icon volcanoIcon = GUIFactory.getIcon("VolcanoPlotResult.gif"); |
2 |
26 Feb 07 |
jari |
/** Network Icon |
2 |
26 Feb 07 |
jari |
478 |
*/ |
2 |
26 Feb 07 |
jari |
479 |
private Icon networkIcon = GUIFactory.getIcon("NetworkResult.gif"); |
2 |
26 Feb 07 |
jari |
/** SOM Display Icon |
2 |
26 Feb 07 |
jari |
481 |
*/ |
2 |
26 Feb 07 |
jari |
482 |
private Icon SOMColorIcon = GUIFactory.getIcon("SOMColorResult.gif"); |
2 |
26 Feb 07 |
jari |
/** SOM B/W Icon |
2 |
26 Feb 07 |
jari |
484 |
*/ |
2 |
26 Feb 07 |
jari |
485 |
private Icon SOMBWIcon = GUIFactory.getIcon("SOMBWResult.gif"); |
2 |
26 Feb 07 |
jari |
/** GDM Matrix Icon |
2 |
26 Feb 07 |
jari |
487 |
*/ |
2 |
26 Feb 07 |
jari |
488 |
private Icon gdmMatrixIcon = GUIFactory.getIcon("GDMMatrixResult.gif"); |
2 |
26 Feb 07 |
jari |
/** Cluster Info Icon |
2 |
26 Feb 07 |
jari |
490 |
*/ |
2 |
26 Feb 07 |
jari |
491 |
private Icon clusterInfoIcon = GUIFactory.getIcon("ClusterInformationResult.gif"); |
2 |
26 Feb 07 |
jari |
/** General Information Icon |
2 |
26 Feb 07 |
jari |
493 |
*/ |
2 |
26 Feb 07 |
jari |
494 |
private Icon generalInfoIcon = GUIFactory.getIcon("Information16.gif"); |
2 |
26 Feb 07 |
jari |
/** Table Icon |
2 |
26 Feb 07 |
jari |
496 |
*/ |
2 |
26 Feb 07 |
jari |
497 |
private Icon tableIcon = GUIFactory.getIcon("TableViewerResult.gif"); |
2 |
26 Feb 07 |
jari |
/** PCA 3D icon |
2 |
26 Feb 07 |
jari |
499 |
*/ |
2 |
26 Feb 07 |
jari |
500 |
private Icon pca3DIcon = GUIFactory.getIcon("PCA3DResult.gif"); |
2 |
26 Feb 07 |
jari |
/** Terrain Icon |
2 |
26 Feb 07 |
jari |
502 |
*/ |
2 |
26 Feb 07 |
jari |
503 |
private Icon trn3DIcon = GUIFactory.getIcon("TerrainResult.gif"); |
2 |
26 Feb 07 |
jari |
504 |
|
2 |
26 Feb 07 |
jari |
/** MeV Root Icon |
2 |
26 Feb 07 |
jari |
506 |
*/ |
2 |
26 Feb 07 |
jari |
507 |
private Icon mevIcon = GUIFactory.getIcon("mev_mini_splash.gif"); |
2 |
26 Feb 07 |
jari |
/** Main Expression View Icon |
2 |
26 Feb 07 |
jari |
509 |
*/ |
2 |
26 Feb 07 |
jari |
510 |
private Icon mainViewIcon = GUIFactory.getIcon("MainView.gif"); |
2 |
26 Feb 07 |
jari |
/** Analysis Icon |
2 |
26 Feb 07 |
jari |
512 |
*/ |
2 |
26 Feb 07 |
jari |
513 |
private Icon analysisIcon = GUIFactory.getIcon("Analysis.gif"); |
2 |
26 Feb 07 |
jari |
/** Cluster Manager Icon |
2 |
26 Feb 07 |
jari |
515 |
*/ |
2 |
26 Feb 07 |
jari |
516 |
private Icon clusterManagerIcon = GUIFactory.getIcon("ClusterManager.gif"); |
2 |
26 Feb 07 |
jari |
/** History Icon |
2 |
26 Feb 07 |
jari |
518 |
*/ |
2 |
26 Feb 07 |
jari |
519 |
private Icon historyIcon = GUIFactory.getIcon("History.gif"); |
2 |
26 Feb 07 |
jari |
520 |
|
2 |
26 Feb 07 |
jari |
/** String Terminal Icon |
2 |
26 Feb 07 |
jari |
522 |
*/ |
2 |
26 Feb 07 |
jari |
523 |
private Icon dotTerminalIcon = GUIFactory.getIcon("TerminalDot.gif"); |
2 |
26 Feb 07 |
jari |
/**Script Manager Icon |
2 |
26 Feb 07 |
jari |
525 |
*/ |
2 |
26 Feb 07 |
jari |
526 |
private Icon scriptManagerIcon = GUIFactory.getIcon("ScriptManager.gif"); |
2 |
26 Feb 07 |
jari |
527 |
/** |
2 |
26 Feb 07 |
jari |
* Script Object Viewer Icon |
2 |
26 Feb 07 |
jari |
529 |
*/ |
2 |
26 Feb 07 |
jari |
530 |
private Icon scriptIcon = GUIFactory.getIcon("ScriptIcon.gif"); |
2 |
26 Feb 07 |
jari |
531 |
/** |
2 |
26 Feb 07 |
jari |
* Script Tree Viewer Icon |
2 |
26 Feb 07 |
jari |
533 |
*/ |
2 |
26 Feb 07 |
jari |
534 |
private Icon scriptTreeViewerIcon = GUIFactory.getIcon("ScriptTreeViewer.gif"); |
2 |
26 Feb 07 |
jari |
535 |
/** |
2 |
26 Feb 07 |
jari |
* Script XML Viewer Icon |
2 |
26 Feb 07 |
jari |
537 |
*/ |
2 |
26 Feb 07 |
jari |
538 |
private Icon scriptXMLViewerIcon = GUIFactory.getIcon("ScriptXMLViewer.gif"); |
2 |
26 Feb 07 |
jari |
539 |
/** |
2 |
26 Feb 07 |
jari |
* Search Icon |
2 |
26 Feb 07 |
jari |
541 |
*/ |
2 |
26 Feb 07 |
jari |
542 |
private Icon searchIcon = GUIFactory.getIcon("search_16.gif"); |
2 |
26 Feb 07 |
jari |
543 |
/** |
2 |
26 Feb 07 |
jari |
* GO hierarchy viewer Icon |
2 |
26 Feb 07 |
jari |
545 |
*/ |
2 |
26 Feb 07 |
jari |
546 |
private Icon goHierarchyViewerIcon = GUIFactory.getIcon("go_hierarchy_viewer.gif"); |
2 |
26 Feb 07 |
jari |
547 |
/** |
2 |
26 Feb 07 |
jari |
* Data Selection Icon |
2 |
26 Feb 07 |
jari |
549 |
*/ |
2 |
26 Feb 07 |
jari |
550 |
private Icon dataSelectionIcon = GUIFactory.getIcon("data_selection_icon.gif"); |
2 |
26 Feb 07 |
jari |
551 |
/** |
2 |
26 Feb 07 |
jari |
* Data Filter Icon |
2 |
26 Feb 07 |
jari |
553 |
*/ |
2 |
26 Feb 07 |
jari |
554 |
private Icon dataFilterIcon = GUIFactory.getIcon("DataFilterResult.gif"); |
2 |
26 Feb 07 |
jari |
555 |
/** |
2 |
26 Feb 07 |
jari |
* LEM Result Node |
2 |
26 Feb 07 |
jari |
557 |
*/ |
2 |
26 Feb 07 |
jari |
558 |
private Icon lemViewerIcon = GUIFactory.getIcon("LEM_result.gif"); |
2 |
26 Feb 07 |
jari |
559 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Chromosome Views Icon |
2 |
26 Feb 07 |
jari |
561 |
*/ |
2 |
26 Feb 07 |
jari |
562 |
private Icon chrViewIcon = GUIFactory.getIcon("cgh_chrom.gif"); |
2 |
26 Feb 07 |
jari |
563 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Experiment Views Icon |
2 |
26 Feb 07 |
jari |
565 |
*/ |
2 |
26 Feb 07 |
jari |
566 |
private Icon exprViewIcon = GUIFactory.getIcon("cgh_circular.gif"); |
2 |
26 Feb 07 |
jari |
567 |
private Icon cirViewIcon = GUIFactory.getIcon("Chr_Circular.gif"); |
2 |
26 Feb 07 |
jari |
568 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Sex Chromosomes Icon |
2 |
26 Feb 07 |
jari |
570 |
*/ |
2 |
26 Feb 07 |
jari |
571 |
private Icon chrXYIcon = GUIFactory.getIcon("Chr_XY.gif"); |
2 |
26 Feb 07 |
jari |
572 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Autosomes Icon |
2 |
26 Feb 07 |
jari |
574 |
*/ |
2 |
26 Feb 07 |
jari |
575 |
private Icon chrIcon = GUIFactory.getIcon("Chr_Auto.gif"); |
2 |
26 Feb 07 |
jari |
576 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Amplification Deletion Icon |
2 |
26 Feb 07 |
jari |
578 |
*/ |
2 |
26 Feb 07 |
jari |
579 |
private Icon ampDelIcon = GUIFactory.getIcon("Cgh_Amp_Del.gif"); |
2 |
26 Feb 07 |
jari |
/** Parent node |
2 |
26 Feb 07 |
jari |
581 |
*/ |
2 |
26 Feb 07 |
jari |
582 |
private DefaultMutableTreeNode parent; |
2 |
26 Feb 07 |
jari |
/** Grandparent node |
2 |
26 Feb 07 |
jari |
584 |
*/ |
2 |
26 Feb 07 |
jari |
585 |
private DefaultMutableTreeNode grandParent; |
2 |
26 Feb 07 |
jari |
586 |
|
2 |
26 Feb 07 |
jari |
/** node label |
2 |
26 Feb 07 |
jari |
588 |
*/ |
2 |
26 Feb 07 |
jari |
589 |
private JLabel label; |
2 |
26 Feb 07 |
jari |
590 |
|
2 |
26 Feb 07 |
jari |
/** Creats a new NodeRenderer. |
2 |
26 Feb 07 |
jari |
592 |
*/ |
2 |
26 Feb 07 |
jari |
593 |
public ResultTreeNodeRenderer(){ |
2 |
26 Feb 07 |
jari |
594 |
super(); |
2 |
26 Feb 07 |
jari |
595 |
|
2 |
26 Feb 07 |
jari |
596 |
this.setIcon(closedIcon); |
2 |
26 Feb 07 |
jari |
597 |
super.setOpaque(false); |
2 |
26 Feb 07 |
jari |
598 |
this.setIconTextGap(2); |
2 |
26 Feb 07 |
jari |
599 |
} |
2 |
26 Feb 07 |
jari |
600 |
|
2 |
26 Feb 07 |
jari |
601 |
|
2 |
26 Feb 07 |
jari |
/** Returns the component to display for a given |
2 |
26 Feb 07 |
jari |
* tree node. |
2 |
26 Feb 07 |
jari |
604 |
*/ |
2 |
26 Feb 07 |
jari |
605 |
public Component getTreeCellRendererComponent(JTree tree, Object value, |
2 |
26 Feb 07 |
jari |
606 |
boolean selected, boolean expanded, boolean isLeaf, int row, boolean hasFocus) { |
2 |
26 Feb 07 |
jari |
607 |
this.selected = selected; |
2 |
26 Feb 07 |
jari |
608 |
|
2 |
26 Feb 07 |
jari |
609 |
String text = "", parentText= "", grandParentText= ""; |
2 |
26 Feb 07 |
jari |
610 |
Object userObj = ((DefaultMutableTreeNode)value).getUserObject(); |
2 |
26 Feb 07 |
jari |
611 |
|
2 |
26 Feb 07 |
jari |
612 |
this.setBorder(BorderFactory.createEmptyBorder(1,1,1,1)); |
2 |
26 Feb 07 |
jari |
613 |
|
2 |
26 Feb 07 |
jari |
614 |
if(!isLeaf){ |
2 |
26 Feb 07 |
jari |
615 |
|
2 |
26 Feb 07 |
jari |
//set the text |
2 |
26 Feb 07 |
jari |
617 |
if(userObj instanceof String){ |
2 |
26 Feb 07 |
jari |
618 |
text = (String)userObj; |
2 |
26 Feb 07 |
jari |
619 |
setText(text); |
2 |
26 Feb 07 |
jari |
620 |
} else if(userObj instanceof LeafInfo){ |
2 |
26 Feb 07 |
jari |
621 |
text = ((LeafInfo)userObj).toString(); |
2 |
26 Feb 07 |
jari |
622 |
setText(text); |
2 |
26 Feb 07 |
jari |
623 |
if(((LeafInfo)userObj).isSelectedDataSource()) |
2 |
26 Feb 07 |
jari |
624 |
setBorder(BorderFactory.createLineBorder(Color.green, 2)); |
2 |
26 Feb 07 |
jari |
625 |
} |
2 |
26 Feb 07 |
jari |
626 |
|
2 |
26 Feb 07 |
jari |
//assign default icons |
2 |
26 Feb 07 |
jari |
628 |
if(expanded){ |
2 |
26 Feb 07 |
jari |
629 |
setIcon(openIcon); |
2 |
26 Feb 07 |
jari |
630 |
} else |
2 |
26 Feb 07 |
jari |
631 |
setIcon(closedIcon); |
2 |
26 Feb 07 |
jari |
632 |
|
2 |
26 Feb 07 |
jari |
//check for special Icons |
2 |
26 Feb 07 |
jari |
634 |
if(text.indexOf("Expression Image") != -1){ |
2 |
26 Feb 07 |
jari |
635 |
setIcon(expressionImageIcon); |
2 |
26 Feb 07 |
jari |
636 |
} else if(text.indexOf("Centroid") != -1){ |
2 |
26 Feb 07 |
jari |
637 |
setIcon(centroidGraphIcon); |
2 |
26 Feb 07 |
jari |
638 |
} else if(text.indexOf("Expression Graph") != -1){ |
2 |
26 Feb 07 |
jari |
639 |
setIcon(expressionGraphIcon); |
2 |
26 Feb 07 |
jari |
640 |
} else if(text.equals("Analysis Results")){ |
2 |
26 Feb 07 |
jari |
641 |
setIcon(analysisIcon); |
2 |
26 Feb 07 |
jari |
642 |
} else if(text.equals("Cluster Manager")){ |
2 |
26 Feb 07 |
jari |
643 |
setIcon(clusterManagerIcon); |
2 |
26 Feb 07 |
jari |
644 |
} else if (text.equals("Script Manager")){ |
2 |
26 Feb 07 |
jari |
645 |
setIcon(scriptManagerIcon); |
2 |
26 Feb 07 |
jari |
646 |
} else if(text.equals("History")){ |
2 |
26 Feb 07 |
jari |
647 |
setIcon(historyIcon); |
2 |
26 Feb 07 |
jari |
648 |
} else if(text.equals("General Information")){ |
2 |
26 Feb 07 |
jari |
649 |
setIcon(generalInfoIcon); |
2 |
26 Feb 07 |
jari |
650 |
} else if(text.indexOf('(') != -1 && ((DefaultMutableTreeNode)value).getParent() == root.getChildAt(2)){ |
2 |
26 Feb 07 |
jari |
651 |
setIcon(primaryResultIcon); |
2 |
26 Feb 07 |
jari |
652 |
} else if(text.indexOf("F-Ratio") != -1 || |
2 |
26 Feb 07 |
jari |
653 |
text.indexOf("Statistic") != -1 || text.indexOf("Table") != -1){ |
2 |
26 Feb 07 |
jari |
654 |
setIcon(tableIcon); |
2 |
26 Feb 07 |
jari |
655 |
} else if(text.equals("Cluster Information")){ |
2 |
26 Feb 07 |
jari |
656 |
setIcon(clusterInfoIcon); |
2 |
26 Feb 07 |
jari |
657 |
} else if(text.equals("MultipleExperimentViewer")){ |
2 |
26 Feb 07 |
jari |
658 |
this.setText(""); |
2 |
26 Feb 07 |
jari |
659 |
this.setBorder(new EmptyBorder(3,2,3,0)); |
2 |
26 Feb 07 |
jari |
660 |
setIcon(mevIcon); |
2 |
26 Feb 07 |
jari |
661 |
} else if(text.equals("Hierarchical Trees")){ |
2 |
26 Feb 07 |
jari |
662 |
setIcon(hclIcon); |
2 |
26 Feb 07 |
jari |
663 |
} else if(text.equals("SOM Visualization")){ |
2 |
26 Feb 07 |
jari |
664 |
setIcon(SOMColorIcon); |
2 |
26 Feb 07 |
jari |
665 |
} else if(text.indexOf("Network") != -1) { |
2 |
26 Feb 07 |
jari |
666 |
setIcon(networkIcon); |
2 |
26 Feb 07 |
jari |
667 |
} else if(text.indexOf("Script (") != -1) { |
2 |
26 Feb 07 |
jari |
668 |
setIcon(scriptIcon); |
2 |
26 Feb 07 |
jari |
669 |
} else if(text.equals("Search Result Shortcuts")) { |
2 |
26 Feb 07 |
jari |
670 |
setIcon(searchIcon); |
2 |
26 Feb 07 |
jari |
671 |
} else if(text.indexOf("Data Filter") != -1) { |
2 |
26 Feb 07 |
jari |
672 |
setIcon(dataFilterIcon); |
2 |
26 Feb 07 |
jari |
673 |
} else if(text.equals("Main View")){ |
2 |
26 Feb 07 |
jari |
674 |
setIcon(mainViewIcon); |
2 |
26 Feb 07 |
jari |
675 |
} /* CGH Icons */ else if(text.equals("Chromosome Views")){ |
2 |
26 Feb 07 |
jari |
676 |
setIcon(chrViewIcon); |
2 |
26 Feb 07 |
jari |
677 |
} else if(text.equals("Chromosome 1") | text.equals("Chromosome 2") | text.equals("Chromosome 3") |
2 |
26 Feb 07 |
jari |
678 |
|text.equals("Chromosome 4") | text.equals("Chromosome 5") | text.equals("Chromosome 6") |
2 |
26 Feb 07 |
jari |
679 |
|text.equals("Chromosome 7") | text.equals("Chromosome 8") | text.equals("Chromosome 9") |
2 |
26 Feb 07 |
jari |
680 |
|text.equals("Chromosome 10") | text.equals("Chromosome 11") | text.equals("Chromosome 12") |
2 |
26 Feb 07 |
jari |
681 |
|text.equals("Chromosome 13") | text.equals("Chromosome 14") | text.equals("Chromosome 15") |
2 |
26 Feb 07 |
jari |
682 |
|text.equals("Chromosome 16") | text.equals("Chromosome 17") | text.equals("Chromosome 18") |
2 |
26 Feb 07 |
jari |
683 |
|text.equals("Chromosome 19") | text.equals("Chromosome 20") | text.equals("Chromosome 21") |
2 |
26 Feb 07 |
jari |
684 |
|text.equals("Chromosome 22")){ |
2 |
26 Feb 07 |
jari |
685 |
setIcon(chrIcon); |
2 |
26 Feb 07 |
jari |
686 |
} else if(text.equals("Chromosome X") | text.equals("Chromosome Y")){ |
2 |
26 Feb 07 |
jari |
687 |
setIcon(chrXYIcon); |
2 |
26 Feb 07 |
jari |
688 |
} else if(text.equals("Experiment Views")){ |
2 |
26 Feb 07 |
jari |
689 |
setIcon(exprViewIcon); |
2 |
26 Feb 07 |
jari |
690 |
} else if(text.equals("Results")| text.equals("A and B") | text.equals("B Only") | text.equals("A Only")) { |
2 |
26 Feb 07 |
jari |
691 |
setIcon(tableIcon); |
2 |
26 Feb 07 |
jari |
692 |
} else if(text.indexOf("Amplifications") != -1 | text.indexOf("Deletions") != -1) { |
2 |
26 Feb 07 |
jari |
693 |
setIcon(ampDelIcon); |
2 |
26 Feb 07 |
jari |
694 |
} /* CGH Icons */ |
2 |
26 Feb 07 |
jari |
695 |
|
2 |
26 Feb 07 |
jari |
696 |
} else { //it's a leaf |
2 |
26 Feb 07 |
jari |
697 |
setIcon(leafIcon); |
2 |
26 Feb 07 |
jari |
698 |
if(userObj instanceof String){ |
2 |
26 Feb 07 |
jari |
699 |
text = ((String)userObj); |
2 |
26 Feb 07 |
jari |
700 |
setText(text); |
2 |
26 Feb 07 |
jari |
701 |
setIcon(dotTerminalIcon); |
2 |
26 Feb 07 |
jari |
702 |
} else if(userObj instanceof LeafInfo) { |
2 |
26 Feb 07 |
jari |
703 |
text = ((LeafInfo)userObj).toString(); |
2 |
26 Feb 07 |
jari |
704 |
setText(text); |
2 |
26 Feb 07 |
jari |
705 |
|
2 |
26 Feb 07 |
jari |
706 |
if(((LeafInfo)userObj).isSelectedDataSource()) |
2 |
26 Feb 07 |
jari |
707 |
setBorder(BorderFactory.createLineBorder(Color.green, 2)); |
2 |
26 Feb 07 |
jari |
708 |
|
2 |
26 Feb 07 |
jari |
709 |
parent = ((DefaultMutableTreeNode)((DefaultMutableTreeNode)value).getParent()); |
2 |
26 Feb 07 |
jari |
//get text |
2 |
26 Feb 07 |
jari |
711 |
if(parent.getUserObject() instanceof String) |
2 |
26 Feb 07 |
jari |
712 |
parentText = (String)(parent.getUserObject()); |
2 |
26 Feb 07 |
jari |
713 |
else if(parent.getUserObject() instanceof LeafInfo) |
2 |
26 Feb 07 |
jari |
714 |
parentText = ((LeafInfo)(parent.getUserObject())).toString(); |
2 |
26 Feb 07 |
jari |
715 |
|
2 |
26 Feb 07 |
jari |
716 |
grandParent = (DefaultMutableTreeNode)parent.getParent(); |
2 |
26 Feb 07 |
jari |
717 |
if(grandParent != null){ |
2 |
26 Feb 07 |
jari |
718 |
if(grandParent.getUserObject() instanceof String) |
2 |
26 Feb 07 |
jari |
719 |
grandParentText = (String)(grandParent.getUserObject()); |
2 |
26 Feb 07 |
jari |
720 |
else if(grandParent.getUserObject() instanceof LeafInfo) |
2 |
26 Feb 07 |
jari |
721 |
grandParentText = ((LeafInfo)(grandParent.getUserObject())).toString(); |
2 |
26 Feb 07 |
jari |
722 |
} else { |
2 |
26 Feb 07 |
jari |
723 |
grandParentText = null; |
2 |
26 Feb 07 |
jari |
724 |
} |
2 |
26 Feb 07 |
jari |
725 |
|
2 |
26 Feb 07 |
jari |
//assign icon |
2 |
26 Feb 07 |
jari |
727 |
if(parentText.indexOf("Expression Image") != -1){ |
2 |
26 Feb 07 |
jari |
728 |
setIcon(expressionImageIcon); |
2 |
26 Feb 07 |
jari |
729 |
} else if(parentText.indexOf("Centroid") != -1){ |
2 |
26 Feb 07 |
jari |
730 |
setIcon(centroidGraphIcon); |
2 |
26 Feb 07 |
jari |
731 |
} else if(parentText.indexOf("Expression Graph") != -1){ |
2 |
26 Feb 07 |
jari |
732 |
setIcon(expressionGraphIcon); |
2 |
26 Feb 07 |
jari |
733 |
} else if(parentText.indexOf("Cluster Manager") != -1){ |
2 |
26 Feb 07 |
jari |
734 |
setIcon(tableIcon); |
2 |
26 Feb 07 |
jari |
735 |
} else if(parentText.indexOf("F-Ratio") != -1 || |
2 |
26 Feb 07 |
jari |
736 |
parentText.indexOf("Statistic") != -1) { |
2 |
26 Feb 07 |
jari |
737 |
setIcon(tableIcon); |
2 |
26 Feb 07 |
jari |
738 |
} else if(parentText.equals("Cluster Information") || text.equals("Classification Information")){ |
2 |
26 Feb 07 |
jari |
739 |
setIcon(clusterInfoIcon); |
2 |
26 Feb 07 |
jari |
740 |
} else if(text.equals("MultipleExperimentViewer")){ |
2 |
26 Feb 07 |
jari |
741 |
setIcon(openIcon); |
2 |
26 Feb 07 |
jari |
742 |
} else if(text.equals("Main View")){ |
2 |
26 Feb 07 |
jari |
743 |
setIcon(mainViewIcon); |
2 |
26 Feb 07 |
jari |
744 |
} else if(text.equalsIgnoreCase("Analysis Results")){ |
2 |
26 Feb 07 |
jari |
745 |
setIcon(analysisIcon); |
2 |
26 Feb 07 |
jari |
746 |
} else if(text.equalsIgnoreCase("Cluster Manager")){ |
2 |
26 Feb 07 |
jari |
747 |
setIcon(clusterManagerIcon); |
2 |
26 Feb 07 |
jari |
748 |
} else if (text.equals("Script Manager")){ |
2 |
26 Feb 07 |
jari |
749 |
setIcon(scriptManagerIcon); |
2 |
26 Feb 07 |
jari |
750 |
} else if(text.equalsIgnoreCase("History")){ |
2 |
26 Feb 07 |
jari |
751 |
setIcon(historyIcon); |
2 |
26 Feb 07 |
jari |
752 |
} else if(text.indexOf("able") != -1){ //table viewer |
2 |
26 Feb 07 |
jari |
753 |
setIcon(tableIcon); |
2 |
26 Feb 07 |
jari |
754 |
} else if(parentText.indexOf("Hierarchical") != -1 || text.indexOf("Dendogram") != -1 |
2 |
26 Feb 07 |
jari |
755 |
|| text.indexOf("HCL Tree") != -1 || text.indexOf("Support Tree") != -1){ |
2 |
26 Feb 07 |
jari |
756 |
setIcon(hclIcon); |
2 |
26 Feb 07 |
jari |
757 |
} else if(text.equals("Expression Image")){ |
2 |
26 Feb 07 |
jari |
758 |
setIcon(expressionImageIcon); |
2 |
26 Feb 07 |
jari |
759 |
} else if(text.equals("Expression Graph")){ |
2 |
26 Feb 07 |
jari |
760 |
setIcon(expressionGraphIcon); |
2 |
26 Feb 07 |
jari |
761 |
} else if(text.equals("Centroid Graph")){ |
2 |
26 Feb 07 |
jari |
762 |
setIcon(centroidGraphIcon); |
2 |
26 Feb 07 |
jari |
763 |
} else if(parentText.indexOf("Table") != -1 || text.indexOf("SVM") != -1) { |
2 |
26 Feb 07 |
jari |
764 |
setIcon(tableIcon); |
2 |
26 Feb 07 |
jari |
765 |
} else if(text.indexOf("Height Plot") != -1 || text.indexOf("SOTA Diversity") != -1 || text.indexOf("Graph - FOM") != -1){ |
2 |
26 Feb 07 |
jari |
766 |
setIcon(nodeHeightIcon); |
2 |
26 Feb 07 |
jari |
767 |
} else if(text.equals("Volcano Plot")){ |
2 |
26 Feb 07 |
jari |
768 |
setIcon(volcanoIcon); |
2 |
26 Feb 07 |
jari |
769 |
} else if(text.equals("SAM Graph")){ |
2 |
26 Feb 07 |
jari |
770 |
setIcon(samGraphIcon); |
2 |
26 Feb 07 |
jari |
771 |
} else if(text.indexOf("Network") != -1){ |
2 |
26 Feb 07 |
jari |
772 |
setIcon(networkIcon); |
2 |
26 Feb 07 |
jari |
773 |
} else if(text.equals("Matrix View")){ |
2 |
26 Feb 07 |
jari |
774 |
setIcon(gdmMatrixIcon); |
2 |
26 Feb 07 |
jari |
775 |
} else if(text.equals("U-Matrix Color")){ |
2 |
26 Feb 07 |
jari |
776 |
setIcon(SOMColorIcon); |
2 |
26 Feb 07 |
jari |
777 |
} else if(text.equals("U-Matrix Distance")){ |
2 |
26 Feb 07 |
jari |
778 |
setIcon(SOMBWIcon); |
2 |
26 Feb 07 |
jari |
779 |
} else if(text.equals("3D view")) { |
2 |
26 Feb 07 |
jari |
780 |
setIcon(pca3DIcon); |
2 |
26 Feb 07 |
jari |
781 |
} else if(text.equals("Map") && parentText.indexOf("Terrain") != -1) { |
2 |
26 Feb 07 |
jari |
782 |
setIcon(trn3DIcon); |
2 |
26 Feb 07 |
jari |
783 |
} else if(text.indexOf("Script Tree") != -1) { |
2 |
26 Feb 07 |
jari |
784 |
setIcon(scriptTreeViewerIcon); |
2 |
26 Feb 07 |
jari |
785 |
} else if(text.equals("Script XML Viewer")) { |
2 |
26 Feb 07 |
jari |
786 |
setIcon(scriptXMLViewerIcon); |
2 |
26 Feb 07 |
jari |
787 |
} else if(text.indexOf("GO") != -1) { |
2 |
26 Feb 07 |
jari |
788 |
setIcon(goHierarchyViewerIcon); |
2 |
26 Feb 07 |
jari |
789 |
} else if(text.equals("Data Source Selection")) { |
2 |
26 Feb 07 |
jari |
790 |
setIcon(dataSelectionIcon); |
2 |
26 Feb 07 |
jari |
791 |
} else if(text.indexOf("LEM Viewer") != -1) { |
2 |
26 Feb 07 |
jari |
792 |
setIcon(lemViewerIcon); |
2 |
26 Feb 07 |
jari |
793 |
} /* CGH Icons */else if (text.equals("Experiment Views")) { |
2 |
26 Feb 07 |
jari |
794 |
setIcon(exprViewIcon); |
2 |
26 Feb 07 |
jari |
795 |
} else if(parentText.equals("Experiment Views")) { |
2 |
26 Feb 07 |
jari |
796 |
setIcon(cirViewIcon); |
2 |
26 Feb 07 |
jari |
797 |
} else if (text.equals("Chromosome Views")) { |
2 |
26 Feb 07 |
jari |
798 |
setIcon(chrViewIcon); |
2 |
26 Feb 07 |
jari |
799 |
} else if(text.equals("Chromosome 1") | text.equals("Chromosome 2") | text.equals("Chromosome 3") |
2 |
26 Feb 07 |
jari |
800 |
|text.equals("Chromosome 4") | text.equals("Chromosome 5") | text.equals("Chromosome 6") |
2 |
26 Feb 07 |
jari |
801 |
|text.equals("Chromosome 7") | text.equals("Chromosome 8") | text.equals("Chromosome 9") |
2 |
26 Feb 07 |
jari |
802 |
|text.equals("Chromosome 10") | text.equals("Chromosome 11") | text.equals("Chromosome 12") |
2 |
26 Feb 07 |
jari |
803 |
|text.equals("Chromosome 13") | text.equals("Chromosome 14") | text.equals("Chromosome 15") |
2 |
26 Feb 07 |
jari |
804 |
|text.equals("Chromosome 16") | text.equals("Chromosome 17") | text.equals("Chromosome 18") |
2 |
26 Feb 07 |
jari |
805 |
|text.equals("Chromosome 19") | text.equals("Chromosome 20") | text.equals("Chromosome 21") |
2 |
26 Feb 07 |
jari |
806 |
|text.equals("Chromosome 22") ){ |
2 |
26 Feb 07 |
jari |
807 |
setIcon(chrIcon); |
2 |
26 Feb 07 |
jari |
808 |
} else if(text.equals("Chromosome X") | text.equals("Chromosome Y")){ |
2 |
26 Feb 07 |
jari |
809 |
setIcon(chrXYIcon); |
2 |
26 Feb 07 |
jari |
810 |
} else if(text.equals("Results") | text.equals("A and B") | text.equals("B Only") | text.equals("A Only")) { |
2 |
26 Feb 07 |
jari |
811 |
setIcon(tableIcon); |
2 |
26 Feb 07 |
jari |
812 |
} else if(text.indexOf("Amplifications") != -1 | text.indexOf("Deletions") != -1) { |
2 |
26 Feb 07 |
jari |
813 |
setIcon(ampDelIcon); |
2 |
26 Feb 07 |
jari |
814 |
} /* CGH Icons */ |
2 |
26 Feb 07 |
jari |
//add new icons here for leaf icons |
2 |
26 Feb 07 |
jari |
816 |
|
2 |
26 Feb 07 |
jari |
817 |
|
2 |
26 Feb 07 |
jari |
818 |
else if(grandParentText != null){ |
2 |
26 Feb 07 |
jari |
819 |
if(grandParentText.indexOf("Expression Image") != -1){ |
2 |
26 Feb 07 |
jari |
820 |
setIcon(expressionImageIcon); |
2 |
26 Feb 07 |
jari |
821 |
} else if(grandParentText.indexOf("Centroid") != -1){ |
2 |
26 Feb 07 |
jari |
822 |
setIcon(centroidGraphIcon); |
2 |
26 Feb 07 |
jari |
823 |
} else if(grandParentText.indexOf("Expression Graph") != -1){ |
2 |
26 Feb 07 |
jari |
824 |
setIcon(expressionGraphIcon); |
2 |
26 Feb 07 |
jari |
825 |
} |
2 |
26 Feb 07 |
jari |
826 |
} |
2 |
26 Feb 07 |
jari |
827 |
} |
2 |
26 Feb 07 |
jari |
828 |
} |
2 |
26 Feb 07 |
jari |
829 |
|
2 |
26 Feb 07 |
jari |
830 |
if(selected){ |
2 |
26 Feb 07 |
jari |
831 |
setOpaque(true); |
2 |
26 Feb 07 |
jari |
832 |
} else { |
2 |
26 Feb 07 |
jari |
833 |
setOpaque(false); |
2 |
26 Feb 07 |
jari |
834 |
} |
2 |
26 Feb 07 |
jari |
835 |
|
2 |
26 Feb 07 |
jari |
836 |
return this; |
2 |
26 Feb 07 |
jari |
837 |
} |
2 |
26 Feb 07 |
jari |
838 |
|
2 |
26 Feb 07 |
jari |
/** Repaints the component. |
2 |
26 Feb 07 |
jari |
* @param g Graphics Object |
2 |
26 Feb 07 |
jari |
841 |
*/ |
2 |
26 Feb 07 |
jari |
842 |
public void paint(Graphics g){ |
2 |
26 Feb 07 |
jari |
843 |
|
2 |
26 Feb 07 |
jari |
844 |
if(g == null) |
2 |
26 Feb 07 |
jari |
845 |
return; |
2 |
26 Feb 07 |
jari |
846 |
|
2 |
26 Feb 07 |
jari |
847 |
Color c; |
2 |
26 Feb 07 |
jari |
848 |
if (this.selected) |
2 |
26 Feb 07 |
jari |
849 |
c = this.getBackgroundSelectionColor(); |
2 |
26 Feb 07 |
jari |
850 |
else |
2 |
26 Feb 07 |
jari |
851 |
c = this.getBackgroundNonSelectionColor(); |
2 |
26 Feb 07 |
jari |
852 |
|
2 |
26 Feb 07 |
jari |
853 |
g.setColor(c); |
2 |
26 Feb 07 |
jari |
854 |
|
2 |
26 Feb 07 |
jari |
855 |
int width = this.getWidth(); |
2 |
26 Feb 07 |
jari |
856 |
|
2 |
26 Feb 07 |
jari |
857 |
if(this.getIcon() != null) |
2 |
26 Feb 07 |
jari |
858 |
width -= this.getIcon().getIconWidth(); |
2 |
26 Feb 07 |
jari |
859 |
|
2 |
26 Feb 07 |
jari |
860 |
g.fillRect((this.getWidth() - width)+1, 0, width+1, this.getHeight()); |
2 |
26 Feb 07 |
jari |
861 |
|
2 |
26 Feb 07 |
jari |
862 |
super.setOpaque(false); |
2 |
26 Feb 07 |
jari |
863 |
super.paint(g); |
2 |
26 Feb 07 |
jari |
864 |
} |
2 |
26 Feb 07 |
jari |
865 |
|
2 |
26 Feb 07 |
jari |
866 |
|
2 |
26 Feb 07 |
jari |
867 |
|
2 |
26 Feb 07 |
jari |
868 |
} |
2 |
26 Feb 07 |
jari |
869 |
|
2 |
26 Feb 07 |
jari |
870 |
} |