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 |
* $RCSfile: EASETableViewer.java,v $ |
2 |
26 Feb 07 |
jari |
* $Revision: 1.8 $ |
2 |
26 Feb 07 |
jari |
* $Date: 2006/03/24 15:50:01 $ |
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 |
/* |
2 |
26 Feb 07 |
jari |
* EASETableViewer.java |
2 |
26 Feb 07 |
jari |
14 |
* |
2 |
26 Feb 07 |
jari |
* Created on October 8, 2003, 2:02 PM |
2 |
26 Feb 07 |
jari |
16 |
*/ |
2 |
26 Feb 07 |
jari |
17 |
|
2 |
26 Feb 07 |
jari |
18 |
package org.tigr.microarray.mev.cluster.gui.impl.ease; |
2 |
26 Feb 07 |
jari |
19 |
|
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 |
import java.awt.event.MouseAdapter; |
2 |
26 Feb 07 |
jari |
23 |
import java.awt.event.MouseEvent; |
2 |
26 Feb 07 |
jari |
24 |
import java.io.File; |
2 |
26 Feb 07 |
jari |
25 |
import java.io.FileOutputStream; |
2 |
26 Feb 07 |
jari |
26 |
import java.io.IOException; |
2 |
26 Feb 07 |
jari |
27 |
import java.io.PrintWriter; |
2 |
26 Feb 07 |
jari |
28 |
import java.io.Serializable; |
2 |
26 Feb 07 |
jari |
29 |
|
2 |
26 Feb 07 |
jari |
30 |
import javax.swing.JFileChooser; |
2 |
26 Feb 07 |
jari |
31 |
import javax.swing.JMenu; |
2 |
26 Feb 07 |
jari |
32 |
import javax.swing.JMenuItem; |
2 |
26 Feb 07 |
jari |
33 |
import javax.swing.JOptionPane; |
2 |
26 Feb 07 |
jari |
34 |
import javax.swing.JPopupMenu; |
2 |
26 Feb 07 |
jari |
35 |
import javax.swing.tree.DefaultMutableTreeNode; |
2 |
26 Feb 07 |
jari |
36 |
|
2 |
26 Feb 07 |
jari |
37 |
import org.tigr.microarray.mev.TMEV; |
2 |
26 Feb 07 |
jari |
38 |
import org.tigr.microarray.mev.cluster.clusterUtil.ClusterRepository; |
2 |
26 Feb 07 |
jari |
39 |
import org.tigr.microarray.mev.cluster.gui.Experiment; |
2 |
26 Feb 07 |
jari |
40 |
import org.tigr.microarray.mev.cluster.gui.IFramework; |
2 |
26 Feb 07 |
jari |
41 |
import org.tigr.microarray.mev.cluster.gui.helpers.TableViewer; |
2 |
26 Feb 07 |
jari |
42 |
import org.tigr.util.BrowserLauncher; |
2 |
26 Feb 07 |
jari |
43 |
|
2 |
26 Feb 07 |
jari |
/** Displays ease results |
2 |
26 Feb 07 |
jari |
45 |
*/ |
2 |
26 Feb 07 |
jari |
46 |
public class EASETableViewer extends TableViewer implements Serializable { |
2 |
26 Feb 07 |
jari |
47 |
|
2 |
26 Feb 07 |
jari |
48 |
private DefaultMutableTreeNode easeRoot; |
2 |
26 Feb 07 |
jari |
49 |
private JPopupMenu menu; |
2 |
26 Feb 07 |
jari |
50 |
|
2 |
26 Feb 07 |
jari |
51 |
private Experiment experiment; |
2 |
26 Feb 07 |
jari |
52 |
private int [][] clusters; |
2 |
26 Feb 07 |
jari |
53 |
private String [] headerNames; |
2 |
26 Feb 07 |
jari |
54 |
private boolean clusterAnalysis; |
2 |
26 Feb 07 |
jari |
55 |
private boolean haveAccessionNumbers; |
2 |
26 Feb 07 |
jari |
56 |
private JMenuItem launchMenuItem; |
2 |
26 Feb 07 |
jari |
57 |
|
2 |
26 Feb 07 |
jari |
/** Creates a new instance of EASETableViewer |
2 |
26 Feb 07 |
jari |
* @param headerNames Header names |
2 |
26 Feb 07 |
jari |
* @param data Primary data structure |
2 |
26 Feb 07 |
jari |
* @param analysisNode EASE analysis node. This permits references to cluster viewers. |
2 |
26 Feb 07 |
jari |
* @param experiment The <CODE>Experiment</CODE> object encapsultes index mapping to <CODE>IData</CODE> |
2 |
26 Feb 07 |
jari |
* @param clusters Cluster indices |
2 |
26 Feb 07 |
jari |
* @param haveAccessionNumbers True if acc. numbers are appended |
2 |
26 Feb 07 |
jari |
* @param clusterAnalysis true if result is cluter analysis, else result is a survey |
2 |
26 Feb 07 |
jari |
66 |
*/ |
2 |
26 Feb 07 |
jari |
67 |
public EASETableViewer(String [] headerNames, Object [][] data, DefaultMutableTreeNode analysisNode, Experiment experiment, int [][] clusters, boolean haveAccessionNumbers, boolean clusterAnalysis) { |
2 |
26 Feb 07 |
jari |
68 |
super(headerNames, data); |
2 |
26 Feb 07 |
jari |
69 |
this.headerNames = headerNames; |
2 |
26 Feb 07 |
jari |
70 |
this.clusterAnalysis = clusterAnalysis; |
2 |
26 Feb 07 |
jari |
71 |
this.haveAccessionNumbers = haveAccessionNumbers; |
2 |
26 Feb 07 |
jari |
72 |
|
2 |
26 Feb 07 |
jari |
73 |
setNumerical(0, true); |
2 |
26 Feb 07 |
jari |
74 |
if(clusterAnalysis){ |
2 |
26 Feb 07 |
jari |
75 |
if(!haveAccessionNumbers){ |
2 |
26 Feb 07 |
jari |
76 |
setNumerical(3, true); |
2 |
26 Feb 07 |
jari |
77 |
} |
2 |
26 Feb 07 |
jari |
//set the rest to numerical for proper sorting |
2 |
26 Feb 07 |
jari |
79 |
for(int i = 4; i < headerNames.length; i++) |
2 |
26 Feb 07 |
jari |
80 |
setNumerical(i, true); |
2 |
26 Feb 07 |
jari |
81 |
} else { |
2 |
26 Feb 07 |
jari |
82 |
if(!haveAccessionNumbers){ |
2 |
26 Feb 07 |
jari |
83 |
setNumerical(3, true); |
2 |
26 Feb 07 |
jari |
84 |
} else { |
2 |
26 Feb 07 |
jari |
85 |
setNumerical(5, true); |
2 |
26 Feb 07 |
jari |
86 |
} |
2 |
26 Feb 07 |
jari |
87 |
setNumerical(4, true); |
2 |
26 Feb 07 |
jari |
88 |
} |
2 |
26 Feb 07 |
jari |
89 |
easeRoot = analysisNode; |
2 |
26 Feb 07 |
jari |
90 |
menu = createPopupMenu(); |
2 |
26 Feb 07 |
jari |
91 |
this.experiment = experiment; |
2 |
26 Feb 07 |
jari |
92 |
this.clusters = clusters; |
2 |
26 Feb 07 |
jari |
93 |
table.addMouseListener(new Listener()); |
2 |
26 Feb 07 |
jari |
94 |
if(table.getRowCount() > 0) |
2 |
26 Feb 07 |
jari |
95 |
table.getSelectionModel().setSelectionInterval(0,0); |
2 |
26 Feb 07 |
jari |
96 |
} |
2 |
26 Feb 07 |
jari |
97 |
|
2 |
26 Feb 07 |
jari |
98 |
|
2 |
26 Feb 07 |
jari |
99 |
public EASETableViewer(String [] headerNames, Object [][] data) { |
2 |
26 Feb 07 |
jari |
100 |
super(headerNames, data); |
2 |
26 Feb 07 |
jari |
101 |
} |
2 |
26 Feb 07 |
jari |
102 |
|
2 |
26 Feb 07 |
jari |
103 |
|
2 |
26 Feb 07 |
jari |
104 |
|
2 |
26 Feb 07 |
jari |
/** Creats the context menu |
2 |
26 Feb 07 |
jari |
* @return */ |
2 |
26 Feb 07 |
jari |
107 |
private JPopupMenu createPopupMenu(){ |
2 |
26 Feb 07 |
jari |
108 |
Listener listener = new Listener(); |
2 |
26 Feb 07 |
jari |
109 |
JPopupMenu menu = new JPopupMenu(); |
2 |
26 Feb 07 |
jari |
110 |
JMenuItem item; |
2 |
26 Feb 07 |
jari |
111 |
|
2 |
26 Feb 07 |
jari |
112 |
|
2 |
26 Feb 07 |
jari |
113 |
item = new JMenuItem("Store Selection as Cluster"); |
2 |
26 Feb 07 |
jari |
114 |
item.setActionCommand("store-cluster-command"); |
2 |
26 Feb 07 |
jari |
115 |
item.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
116 |
menu.add(item); |
2 |
26 Feb 07 |
jari |
117 |
|
2 |
26 Feb 07 |
jari |
118 |
JMenu launchMenu = new JMenu("Open Viewer"); |
2 |
26 Feb 07 |
jari |
119 |
|
2 |
26 Feb 07 |
jari |
120 |
item = new JMenuItem("Expression Image"); |
2 |
26 Feb 07 |
jari |
121 |
item.setActionCommand("launch-expression-image-command"); |
2 |
26 Feb 07 |
jari |
122 |
item.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
123 |
launchMenu.add(item); |
2 |
26 Feb 07 |
jari |
124 |
|
2 |
26 Feb 07 |
jari |
125 |
item = new JMenuItem("Centroid Graph"); |
2 |
26 Feb 07 |
jari |
126 |
item.setActionCommand("launch-centroid-graph-command"); |
2 |
26 Feb 07 |
jari |
127 |
item.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
128 |
launchMenu.add(item); |
2 |
26 Feb 07 |
jari |
129 |
|
2 |
26 Feb 07 |
jari |
130 |
item = new JMenuItem("Expression Graph"); |
2 |
26 Feb 07 |
jari |
131 |
item.setActionCommand("launch-expression-graph-command"); |
2 |
26 Feb 07 |
jari |
132 |
item.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
133 |
launchMenu.add(item); |
2 |
26 Feb 07 |
jari |
134 |
|
2 |
26 Feb 07 |
jari |
135 |
menu.add(launchMenu); |
2 |
26 Feb 07 |
jari |
136 |
|
2 |
26 Feb 07 |
jari |
137 |
menu.addSeparator(); |
2 |
26 Feb 07 |
jari |
138 |
|
2 |
26 Feb 07 |
jari |
139 |
item = new JMenuItem("Save EASE Table"); |
2 |
26 Feb 07 |
jari |
140 |
item.setActionCommand("save-ease-table-command"); |
2 |
26 Feb 07 |
jari |
141 |
item.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
142 |
menu.add(item); |
2 |
26 Feb 07 |
jari |
143 |
|
2 |
26 Feb 07 |
jari |
144 |
|
2 |
26 Feb 07 |
jari |
145 |
menu.addSeparator(); |
2 |
26 Feb 07 |
jari |
146 |
|
2 |
26 Feb 07 |
jari |
147 |
if(this.haveAccessionNumbers){ |
2 |
26 Feb 07 |
jari |
148 |
this.launchMenuItem = new JMenuItem("Open Web Page"); |
2 |
26 Feb 07 |
jari |
149 |
this.launchMenuItem.setActionCommand("launch-browser-command"); |
2 |
26 Feb 07 |
jari |
150 |
this.launchMenuItem.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
151 |
menu.add(this.launchMenuItem); |
2 |
26 Feb 07 |
jari |
152 |
} |
2 |
26 Feb 07 |
jari |
153 |
|
2 |
26 Feb 07 |
jari |
154 |
return menu; |
2 |
26 Feb 07 |
jari |
155 |
} |
2 |
26 Feb 07 |
jari |
156 |
|
2 |
26 Feb 07 |
jari |
157 |
public void onSelected(IFramework framework) { |
2 |
26 Feb 07 |
jari |
158 |
super.onSelected(framework); |
2 |
26 Feb 07 |
jari |
159 |
if(this.easeRoot == null){ |
2 |
26 Feb 07 |
jari |
160 |
try { |
2 |
26 Feb 07 |
jari |
161 |
DefaultMutableTreeNode node = (DefaultMutableTreeNode)framework.getCurrentNode().getParent(); |
2 |
26 Feb 07 |
jari |
162 |
Object userObject = node.getUserObject(); |
2 |
26 Feb 07 |
jari |
163 |
if(userObject instanceof String){ |
2 |
26 Feb 07 |
jari |
164 |
if(((String)userObject).indexOf("EASE") != -1) { |
2 |
26 Feb 07 |
jari |
165 |
this.easeRoot = node; |
2 |
26 Feb 07 |
jari |
166 |
} |
2 |
26 Feb 07 |
jari |
167 |
} |
2 |
26 Feb 07 |
jari |
168 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
169 |
System.out.println("selection exception"); |
2 |
26 Feb 07 |
jari |
170 |
e.printStackTrace(); |
2 |
26 Feb 07 |
jari |
171 |
} |
2 |
26 Feb 07 |
jari |
172 |
} |
2 |
26 Feb 07 |
jari |
173 |
} |
2 |
26 Feb 07 |
jari |
174 |
|
2 |
26 Feb 07 |
jari |
/** Handles opening cluster viewers. |
2 |
26 Feb 07 |
jari |
176 |
*/ |
2 |
26 Feb 07 |
jari |
177 |
private void onOpenViewer(String viewerType){ |
2 |
26 Feb 07 |
jari |
178 |
int index = getSelectedRow(); |
2 |
26 Feb 07 |
jari |
179 |
|
2 |
26 Feb 07 |
jari |
180 |
if(index == -1 || easeRoot == null) |
2 |
26 Feb 07 |
jari |
181 |
return; |
2 |
26 Feb 07 |
jari |
182 |
|
2 |
26 Feb 07 |
jari |
183 |
DefaultMutableTreeNode node = (DefaultMutableTreeNode)easeRoot.getChildAt(1); |
2 |
26 Feb 07 |
jari |
184 |
if(node.getChildCount() < index) |
2 |
26 Feb 07 |
jari |
185 |
return; |
2 |
26 Feb 07 |
jari |
186 |
node = (DefaultMutableTreeNode)(node.getChildAt(index)); |
2 |
26 Feb 07 |
jari |
187 |
|
2 |
26 Feb 07 |
jari |
188 |
if(viewerType.equals("expression image")){ |
2 |
26 Feb 07 |
jari |
189 |
node = (DefaultMutableTreeNode)(node.getChildAt(0)); |
2 |
26 Feb 07 |
jari |
190 |
} else if(viewerType.equals("centroid graph")){ |
2 |
26 Feb 07 |
jari |
191 |
node = (DefaultMutableTreeNode)(node.getChildAt(1)); |
2 |
26 Feb 07 |
jari |
192 |
} else if(viewerType.equals("expression graph")){ |
2 |
26 Feb 07 |
jari |
193 |
node = (DefaultMutableTreeNode)(node.getChildAt(2)); |
2 |
26 Feb 07 |
jari |
194 |
} |
2 |
26 Feb 07 |
jari |
195 |
|
2 |
26 Feb 07 |
jari |
196 |
if(framework != null) |
2 |
26 Feb 07 |
jari |
197 |
framework.setTreeNode(node); |
2 |
26 Feb 07 |
jari |
198 |
} |
2 |
26 Feb 07 |
jari |
199 |
|
2 |
26 Feb 07 |
jari |
200 |
|
2 |
26 Feb 07 |
jari |
/** Handles sotrage of clusters from selected line. |
2 |
26 Feb 07 |
jari |
202 |
*/ |
2 |
26 Feb 07 |
jari |
203 |
private void onStoreCluster(){ |
2 |
26 Feb 07 |
jari |
204 |
int [] tableIndices = table.getSelectedRows(); |
2 |
26 Feb 07 |
jari |
205 |
if(tableIndices == null || tableIndices.length == 0) |
2 |
26 Feb 07 |
jari |
206 |
return; |
2 |
26 Feb 07 |
jari |
//convert to possibly sorted table indices |
2 |
26 Feb 07 |
jari |
208 |
for(int i = 0; i < tableIndices.length; i++) |
2 |
26 Feb 07 |
jari |
209 |
tableIndices[i] = ((DefaultViewerTableModel) model).getRow( tableIndices[i] ); |
2 |
26 Feb 07 |
jari |
210 |
|
2 |
26 Feb 07 |
jari |
211 |
int [] geneIndices = getGeneIndices(tableIndices); |
2 |
26 Feb 07 |
jari |
212 |
geneIndices = mapExperimentIndicesToIData(geneIndices); |
2 |
26 Feb 07 |
jari |
//storing as sub-cluster allows storing various sets of indices as separate clusters from |
2 |
26 Feb 07 |
jari |
//the same viewer. |
2 |
26 Feb 07 |
jari |
215 |
framework.storeSubCluster(geneIndices, experiment, ClusterRepository.GENE_CLUSTER); |
2 |
26 Feb 07 |
jari |
216 |
} |
2 |
26 Feb 07 |
jari |
217 |
|
2 |
26 Feb 07 |
jari |
/** Handles opening browser on accessions. |
2 |
26 Feb 07 |
jari |
219 |
*/ |
2 |
26 Feb 07 |
jari |
220 |
private void onOpenBrowser(){ |
2 |
26 Feb 07 |
jari |
221 |
int [] tableIndices = table.getSelectedRows(); |
2 |
26 Feb 07 |
jari |
222 |
if( tableIndices == null || tableIndices.length < 1) |
2 |
26 Feb 07 |
jari |
223 |
return; |
2 |
26 Feb 07 |
jari |
224 |
String file = (String) this.table.getValueAt(tableIndices[0], 1); |
2 |
26 Feb 07 |
jari |
225 |
String acc = (String) this.table.getValueAt(tableIndices[0], 2); |
2 |
26 Feb 07 |
jari |
226 |
|
2 |
26 Feb 07 |
jari |
227 |
if(acc == null || acc.equals("") || acc.equals(" ")){ |
2 |
26 Feb 07 |
jari |
228 |
JOptionPane.showMessageDialog(this.framework.getFrame(), "No accession exists for this entry.", "Web access denial", JOptionPane.INFORMATION_MESSAGE); |
2 |
26 Feb 07 |
jari |
229 |
return; |
2 |
26 Feb 07 |
jari |
230 |
} |
2 |
26 Feb 07 |
jari |
231 |
|
2 |
26 Feb 07 |
jari |
232 |
String url = EASEURLFactory.constructURL(file,acc); |
2 |
26 Feb 07 |
jari |
233 |
if(url == null) |
2 |
26 Feb 07 |
jari |
234 |
return; |
2 |
26 Feb 07 |
jari |
235 |
try{ |
2 |
26 Feb 07 |
jari |
236 |
BrowserLauncher.openURL(url); |
2 |
26 Feb 07 |
jari |
237 |
} catch (java.io.IOException e) { |
2 |
26 Feb 07 |
jari |
238 |
e.printStackTrace(); |
2 |
26 Feb 07 |
jari |
239 |
} |
2 |
26 Feb 07 |
jari |
240 |
} |
2 |
26 Feb 07 |
jari |
241 |
|
2 |
26 Feb 07 |
jari |
/** Saves the ease table to file |
2 |
26 Feb 07 |
jari |
243 |
*/ |
2 |
26 Feb 07 |
jari |
244 |
private void onSaveEaseTable(){ |
2 |
26 Feb 07 |
jari |
245 |
JFileChooser chooser = new JFileChooser(TMEV.getFile("/Data")); |
2 |
26 Feb 07 |
jari |
246 |
String fileName = ""; |
2 |
26 Feb 07 |
jari |
247 |
if(chooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ |
2 |
26 Feb 07 |
jari |
248 |
File file = chooser.getSelectedFile(); |
2 |
26 Feb 07 |
jari |
249 |
fileName = file.getName(); |
2 |
26 Feb 07 |
jari |
250 |
try{ |
2 |
26 Feb 07 |
jari |
251 |
PrintWriter pw = new PrintWriter(new FileOutputStream(file)); |
2 |
26 Feb 07 |
jari |
252 |
int rows = table.getRowCount(); |
2 |
26 Feb 07 |
jari |
253 |
int cols = table.getColumnCount(); |
2 |
26 Feb 07 |
jari |
254 |
|
2 |
26 Feb 07 |
jari |
255 |
for(int row = 0; row < rows; row++){ |
2 |
26 Feb 07 |
jari |
256 |
for(int col = 0; col < cols; col++){ |
2 |
26 Feb 07 |
jari |
257 |
pw.print(((String)(table.getValueAt(row, col))) + "\t"); |
2 |
26 Feb 07 |
jari |
258 |
} |
2 |
26 Feb 07 |
jari |
259 |
pw.print("\n"); |
2 |
26 Feb 07 |
jari |
260 |
} |
2 |
26 Feb 07 |
jari |
261 |
pw.flush(); |
2 |
26 Feb 07 |
jari |
262 |
pw.close(); |
2 |
26 Feb 07 |
jari |
263 |
} catch ( IOException ioe) { |
2 |
26 Feb 07 |
jari |
264 |
ioe.printStackTrace(); |
2 |
26 Feb 07 |
jari |
265 |
javax.swing.JOptionPane.showMessageDialog(this, ("Error Saving Table to file: "+fileName), "Output Error", JOptionPane.WARNING_MESSAGE); |
2 |
26 Feb 07 |
jari |
266 |
} |
2 |
26 Feb 07 |
jari |
267 |
|
2 |
26 Feb 07 |
jari |
268 |
} |
2 |
26 Feb 07 |
jari |
269 |
} |
2 |
26 Feb 07 |
jari |
270 |
|
2 |
26 Feb 07 |
jari |
/** Returns genes indices on selected row. |
2 |
26 Feb 07 |
jari |
* @param rows Selected rows |
2 |
26 Feb 07 |
jari |
* @return Associated indices |
2 |
26 Feb 07 |
jari |
274 |
*/ |
2 |
26 Feb 07 |
jari |
275 |
private int [] getGeneIndices(int [] rows){ |
2 |
26 Feb 07 |
jari |
276 |
int numGenes = 0; |
2 |
26 Feb 07 |
jari |
277 |
for(int i = 0; i < rows.length; i++) |
2 |
26 Feb 07 |
jari |
278 |
numGenes += clusters[rows[i]].length; |
2 |
26 Feb 07 |
jari |
279 |
int [] indices = new int [numGenes]; |
2 |
26 Feb 07 |
jari |
280 |
int cnt = 0; |
2 |
26 Feb 07 |
jari |
281 |
for(int i = 0; i < rows.length; i++){ |
2 |
26 Feb 07 |
jari |
282 |
for(int j = 0; j < clusters[rows[i]].length; j++){ |
2 |
26 Feb 07 |
jari |
283 |
indices[cnt] = clusters[rows[i]][j]; |
2 |
26 Feb 07 |
jari |
284 |
cnt++; |
2 |
26 Feb 07 |
jari |
285 |
} |
2 |
26 Feb 07 |
jari |
286 |
} |
2 |
26 Feb 07 |
jari |
287 |
return indices; |
2 |
26 Feb 07 |
jari |
288 |
} |
2 |
26 Feb 07 |
jari |
289 |
|
2 |
26 Feb 07 |
jari |
290 |
private int [] mapExperimentIndicesToIData(int [] indices){ |
2 |
26 Feb 07 |
jari |
291 |
int [] idataIndices = new int [indices.length]; |
2 |
26 Feb 07 |
jari |
292 |
for(int i = 0; i < indices.length; i++) |
2 |
26 Feb 07 |
jari |
293 |
idataIndices[i] = this.experiment.getGeneIndexMappedToData(indices[i]); |
2 |
26 Feb 07 |
jari |
294 |
return idataIndices; |
2 |
26 Feb 07 |
jari |
295 |
} |
2 |
26 Feb 07 |
jari |
296 |
|
2 |
26 Feb 07 |
jari |
297 |
private void validateMenuOptions(){ |
2 |
26 Feb 07 |
jari |
298 |
int row = this.getSelectedRow(); |
2 |
26 Feb 07 |
jari |
299 |
if(row < 0) |
2 |
26 Feb 07 |
jari |
300 |
return; |
2 |
26 Feb 07 |
jari |
//know that accessions exist |
2 |
26 Feb 07 |
jari |
302 |
this.launchMenuItem.setEnabled( this.table.getValueAt(row, 1) != null && !this.table.getValueAt(row, 1).equals(" ") ); |
2 |
26 Feb 07 |
jari |
303 |
} |
2 |
26 Feb 07 |
jari |
304 |
|
2 |
26 Feb 07 |
jari |
/** Handles events |
2 |
26 Feb 07 |
jari |
306 |
*/ |
2 |
26 Feb 07 |
jari |
307 |
private class Listener extends MouseAdapter implements ActionListener{ |
2 |
26 Feb 07 |
jari |
308 |
|
2 |
26 Feb 07 |
jari |
309 |
public void actionPerformed(ActionEvent ae) { |
2 |
26 Feb 07 |
jari |
310 |
String command = ae.getActionCommand(); |
2 |
26 Feb 07 |
jari |
311 |
if(command.equals("store-cluster-command")){ |
2 |
26 Feb 07 |
jari |
312 |
onStoreCluster(); |
2 |
26 Feb 07 |
jari |
313 |
} else if(command.equals("launch-expression-image-command")){ |
2 |
26 Feb 07 |
jari |
314 |
onOpenViewer("expression image"); |
2 |
26 Feb 07 |
jari |
315 |
} else if(command.equals("launch-centroid-graph-command")){ |
2 |
26 Feb 07 |
jari |
316 |
onOpenViewer("centroid graph"); |
2 |
26 Feb 07 |
jari |
317 |
} else if(command.equals("launch-expression-graph-command")){ |
2 |
26 Feb 07 |
jari |
318 |
onOpenViewer("expression graph"); |
2 |
26 Feb 07 |
jari |
319 |
} else if(command.equals("launch-browser-command")){ |
2 |
26 Feb 07 |
jari |
320 |
onOpenBrowser(); |
2 |
26 Feb 07 |
jari |
321 |
} else if(command.equals("save-ease-table-command")){ |
2 |
26 Feb 07 |
jari |
322 |
onSaveEaseTable(); |
2 |
26 Feb 07 |
jari |
323 |
} |
2 |
26 Feb 07 |
jari |
324 |
} |
2 |
26 Feb 07 |
jari |
325 |
|
2 |
26 Feb 07 |
jari |
326 |
public void mousePressed(MouseEvent me){ |
2 |
26 Feb 07 |
jari |
327 |
if(me.isPopupTrigger()){ |
2 |
26 Feb 07 |
jari |
328 |
if(launchMenuItem != null) |
2 |
26 Feb 07 |
jari |
329 |
validateMenuOptions(); |
2 |
26 Feb 07 |
jari |
330 |
menu.show(me.getComponent(), me.getX(), me.getY()); |
2 |
26 Feb 07 |
jari |
331 |
} |
2 |
26 Feb 07 |
jari |
332 |
} |
2 |
26 Feb 07 |
jari |
333 |
|
2 |
26 Feb 07 |
jari |
334 |
public void mouseReleased(MouseEvent me){ |
2 |
26 Feb 07 |
jari |
335 |
if(me.isPopupTrigger()){ |
2 |
26 Feb 07 |
jari |
336 |
if(launchMenuItem != null) |
2 |
26 Feb 07 |
jari |
337 |
validateMenuOptions(); |
2 |
26 Feb 07 |
jari |
338 |
menu.show(me.getComponent(), me.getX(), me.getY()); |
2 |
26 Feb 07 |
jari |
339 |
} |
2 |
26 Feb 07 |
jari |
340 |
} |
2 |
26 Feb 07 |
jari |
341 |
|
2 |
26 Feb 07 |
jari |
342 |
} |
2 |
26 Feb 07 |
jari |
343 |
|
2 |
26 Feb 07 |
jari |
344 |
|
2 |
26 Feb 07 |
jari |
345 |
|
2 |
26 Feb 07 |
jari |
346 |
} |