2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
* CGHPositionGraphCanvas.java |
2 |
26 Feb 07 |
jari |
3 |
* |
2 |
26 Feb 07 |
jari |
* Created on March 18, 2003, 9:30 PM |
2 |
26 Feb 07 |
jari |
5 |
*/ |
2 |
26 Feb 07 |
jari |
6 |
|
2 |
26 Feb 07 |
jari |
7 |
package org.tigr.microarray.mev.cgh.CGHGuiObj.CGHPositionGraph; |
2 |
26 Feb 07 |
jari |
8 |
|
2 |
26 Feb 07 |
jari |
9 |
import java.awt.Color; |
2 |
26 Feb 07 |
jari |
10 |
import java.awt.Insets; |
2 |
26 Feb 07 |
jari |
11 |
import java.util.EventObject; |
2 |
26 Feb 07 |
jari |
12 |
|
2 |
26 Feb 07 |
jari |
13 |
import javax.swing.JMenuItem; |
2 |
26 Feb 07 |
jari |
14 |
import javax.swing.JPanel; |
2 |
26 Feb 07 |
jari |
15 |
|
2 |
26 Feb 07 |
jari |
16 |
import org.tigr.microarray.mev.cgh.CGHDataModel.CGHAnnotationsModel; |
2 |
26 Feb 07 |
jari |
17 |
import org.tigr.microarray.mev.cgh.CGHDataModel.CGHPositionGraphDataModel; |
2 |
26 Feb 07 |
jari |
18 |
import org.tigr.microarray.mev.cgh.CGHDataObj.CGHDataRegionInfo; |
2 |
26 Feb 07 |
jari |
19 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.GuiUtil.GenomeBrowserLauncher; |
2 |
26 Feb 07 |
jari |
20 |
import org.tigr.microarray.mev.cgh.CGHListenerObj.IDataRegionSelectionListener; |
2 |
26 Feb 07 |
jari |
21 |
|
2 |
26 Feb 07 |
jari |
22 |
/** |
2 |
26 Feb 07 |
jari |
23 |
* |
2 |
26 Feb 07 |
jari |
* @author Adam Margolin |
2 |
26 Feb 07 |
jari |
* @author Raktim Sinha |
2 |
26 Feb 07 |
jari |
26 |
*/ |
2 |
26 Feb 07 |
jari |
27 |
|
2 |
26 Feb 07 |
jari |
28 |
public abstract class CGHPositionGraphCanvas extends JPanel{ |
2 |
26 Feb 07 |
jari |
29 |
Insets insets; |
2 |
26 Feb 07 |
jari |
30 |
CGHPositionGraphDataModel model; |
2 |
26 Feb 07 |
jari |
31 |
CGHAnnotationsModel annotationsModel; |
2 |
26 Feb 07 |
jari |
32 |
IDataRegionSelectionListener drsListener; |
2 |
26 Feb 07 |
jari |
33 |
CGHDataRegionInfo selectedDataRegion = null; |
2 |
26 Feb 07 |
jari |
34 |
boolean showFlankingRegions; |
2 |
26 Feb 07 |
jari |
35 |
|
2 |
26 Feb 07 |
jari |
//find a better way to do this |
2 |
26 Feb 07 |
jari |
37 |
int elementWidth = 40; |
2 |
26 Feb 07 |
jari |
38 |
int rectSpacing = 5; |
2 |
26 Feb 07 |
jari |
39 |
|
2 |
26 Feb 07 |
jari |
40 |
double unitLength; |
2 |
26 Feb 07 |
jari |
41 |
|
2 |
26 Feb 07 |
jari |
42 |
|
2 |
26 Feb 07 |
jari |
/** Creates a new instance of CGHPositionGraphCanvas */ |
2 |
26 Feb 07 |
jari |
44 |
public CGHPositionGraphCanvas(Insets insets) { |
2 |
26 Feb 07 |
jari |
45 |
setBackground(Color.black); |
2 |
26 Feb 07 |
jari |
46 |
this.insets = insets; |
2 |
26 Feb 07 |
jari |
47 |
|
2 |
26 Feb 07 |
jari |
48 |
addMouseListener(new java.awt.event.MouseAdapter() { |
2 |
26 Feb 07 |
jari |
49 |
public void mouseClicked(java.awt.event.MouseEvent evt) { |
2 |
26 Feb 07 |
jari |
50 |
formMouseClicked(evt); |
2 |
26 Feb 07 |
jari |
51 |
} |
2 |
26 Feb 07 |
jari |
52 |
}); |
2 |
26 Feb 07 |
jari |
53 |
} |
2 |
26 Feb 07 |
jari |
54 |
|
2 |
26 Feb 07 |
jari |
55 |
protected abstract void formMouseClicked(java.awt.event.MouseEvent evt); |
2 |
26 Feb 07 |
jari |
56 |
|
2 |
26 Feb 07 |
jari |
/** Getter for property model. |
2 |
26 Feb 07 |
jari |
* @return Value of property model. |
2 |
26 Feb 07 |
jari |
59 |
*/ |
2 |
26 Feb 07 |
jari |
60 |
public CGHPositionGraphDataModel getModel() { |
2 |
26 Feb 07 |
jari |
61 |
return model; |
2 |
26 Feb 07 |
jari |
62 |
} |
2 |
26 Feb 07 |
jari |
63 |
|
2 |
26 Feb 07 |
jari |
/** Setter for property model. |
2 |
26 Feb 07 |
jari |
* @param model New value of property model. |
2 |
26 Feb 07 |
jari |
66 |
*/ |
2 |
26 Feb 07 |
jari |
67 |
public void setModel(CGHPositionGraphDataModel model) { |
2 |
26 Feb 07 |
jari |
68 |
this.model = model; |
2 |
26 Feb 07 |
jari |
69 |
} |
2 |
26 Feb 07 |
jari |
70 |
|
2 |
26 Feb 07 |
jari |
/** Getter for property showFlankingRegions. |
2 |
26 Feb 07 |
jari |
* @return Value of property showFlankingRegions. |
2 |
26 Feb 07 |
jari |
73 |
*/ |
2 |
26 Feb 07 |
jari |
74 |
public boolean isShowFlankingRegions() { |
2 |
26 Feb 07 |
jari |
75 |
return showFlankingRegions; |
2 |
26 Feb 07 |
jari |
76 |
} |
2 |
26 Feb 07 |
jari |
77 |
|
2 |
26 Feb 07 |
jari |
/** Setter for property showFlankingRegions. |
2 |
26 Feb 07 |
jari |
* @param showFlankingRegions New value of property showFlankingRegions. |
2 |
26 Feb 07 |
jari |
80 |
*/ |
2 |
26 Feb 07 |
jari |
81 |
public void setShowFlankingRegions(boolean showFlankingRegions) { |
2 |
26 Feb 07 |
jari |
82 |
this.showFlankingRegions = showFlankingRegions; |
2 |
26 Feb 07 |
jari |
83 |
} |
2 |
26 Feb 07 |
jari |
84 |
|
2 |
26 Feb 07 |
jari |
/** Getter for property unitLength. |
2 |
26 Feb 07 |
jari |
* @return Value of property unitLength. |
2 |
26 Feb 07 |
jari |
87 |
*/ |
2 |
26 Feb 07 |
jari |
88 |
public double getUnitLength() { |
2 |
26 Feb 07 |
jari |
89 |
return unitLength; |
2 |
26 Feb 07 |
jari |
90 |
} |
2 |
26 Feb 07 |
jari |
91 |
|
2 |
26 Feb 07 |
jari |
/** Setter for property unitLength. |
2 |
26 Feb 07 |
jari |
* @param unitLength New value of property unitLength. |
2 |
26 Feb 07 |
jari |
94 |
*/ |
2 |
26 Feb 07 |
jari |
95 |
public void setUnitLength(double unitLength) { |
2 |
26 Feb 07 |
jari |
96 |
this.unitLength = unitLength; |
2 |
26 Feb 07 |
jari |
97 |
} |
2 |
26 Feb 07 |
jari |
98 |
|
2 |
26 Feb 07 |
jari |
/** Getter for property elementWidth. |
2 |
26 Feb 07 |
jari |
* @return Value of property elementWidth. |
2 |
26 Feb 07 |
jari |
101 |
*/ |
2 |
26 Feb 07 |
jari |
102 |
public int getElementWidth() { |
2 |
26 Feb 07 |
jari |
103 |
return elementWidth; |
2 |
26 Feb 07 |
jari |
104 |
} |
2 |
26 Feb 07 |
jari |
105 |
|
2 |
26 Feb 07 |
jari |
/** Setter for property elementWidth. |
2 |
26 Feb 07 |
jari |
* @param elementWidth New value of property elementWidth. |
2 |
26 Feb 07 |
jari |
108 |
*/ |
2 |
26 Feb 07 |
jari |
109 |
public void setElementWidth(int elementWidth) { |
2 |
26 Feb 07 |
jari |
110 |
this.elementWidth = elementWidth; |
2 |
26 Feb 07 |
jari |
111 |
} |
2 |
26 Feb 07 |
jari |
112 |
|
2 |
26 Feb 07 |
jari |
/** Getter for property drsListener. |
2 |
26 Feb 07 |
jari |
* @return Value of property drsListener. |
2 |
26 Feb 07 |
jari |
115 |
*/ |
2 |
26 Feb 07 |
jari |
116 |
public IDataRegionSelectionListener getDrsListener() { |
2 |
26 Feb 07 |
jari |
117 |
return drsListener; |
2 |
26 Feb 07 |
jari |
118 |
} |
2 |
26 Feb 07 |
jari |
119 |
|
2 |
26 Feb 07 |
jari |
/** Setter for property drsListener. |
2 |
26 Feb 07 |
jari |
* @param drsListener New value of property drsListener. |
2 |
26 Feb 07 |
jari |
122 |
*/ |
2 |
26 Feb 07 |
jari |
123 |
public void setDrsListener(IDataRegionSelectionListener drsListener) { |
2 |
26 Feb 07 |
jari |
124 |
this.drsListener = drsListener; |
2 |
26 Feb 07 |
jari |
125 |
} |
2 |
26 Feb 07 |
jari |
126 |
|
2 |
26 Feb 07 |
jari |
/** Getter for property annotationsModel. |
2 |
26 Feb 07 |
jari |
* @return Value of property annotationsModel. |
2 |
26 Feb 07 |
jari |
129 |
*/ |
2 |
26 Feb 07 |
jari |
130 |
public CGHAnnotationsModel getAnnotationsModel() { |
2 |
26 Feb 07 |
jari |
131 |
return annotationsModel; |
2 |
26 Feb 07 |
jari |
132 |
} |
2 |
26 Feb 07 |
jari |
133 |
|
2 |
26 Feb 07 |
jari |
/** Setter for property annotationsModel. |
2 |
26 Feb 07 |
jari |
* @param annotationsModel New value of property annotationsModel. |
2 |
26 Feb 07 |
jari |
136 |
*/ |
2 |
26 Feb 07 |
jari |
137 |
public void setAnnotationsModel(CGHAnnotationsModel annotationsModel) { |
2 |
26 Feb 07 |
jari |
138 |
this.annotationsModel = annotationsModel; |
2 |
26 Feb 07 |
jari |
139 |
} |
2 |
26 Feb 07 |
jari |
140 |
|
2 |
26 Feb 07 |
jari |
141 |
public void actionPerformed(java.awt.event.ActionEvent actionEvent) { |
2 |
26 Feb 07 |
jari |
142 |
JMenuItem item = (JMenuItem)actionEvent.getSource(); |
2 |
26 Feb 07 |
jari |
143 |
if(selectedDataRegion != null){ |
2 |
26 Feb 07 |
jari |
144 |
if("Show Genes in Region".equals(item.getActionCommand())){ |
2 |
26 Feb 07 |
jari |
145 |
drsListener.onShowGenes(new EventObject(selectedDataRegion)); |
2 |
26 Feb 07 |
jari |
146 |
}else if("Show Browser".equals(item.getActionCommand())){ |
2 |
26 Feb 07 |
jari |
147 |
drsListener.onShowBrowser(new EventObject(selectedDataRegion)); |
2 |
26 Feb 07 |
jari |
148 |
}else if("Display Data Values".equals(item.getActionCommand())){ |
2 |
26 Feb 07 |
jari |
149 |
drsListener.onDisplayDataValues(new EventObject(selectedDataRegion)); |
2 |
26 Feb 07 |
jari |
150 |
}else if("Launch Ensembl".equals(item.getActionCommand())){ |
2 |
26 Feb 07 |
jari |
151 |
GenomeBrowserLauncher.launchEnsembl(selectedDataRegion.getDataRegion(), model.getCGHSpecies()); |
2 |
26 Feb 07 |
jari |
152 |
}else if("Launch Golden Path".equals(item.getActionCommand())){ |
2 |
26 Feb 07 |
jari |
153 |
GenomeBrowserLauncher.launchGoldenPath(selectedDataRegion.getDataRegion(), model.getCGHSpecies()); |
2 |
26 Feb 07 |
jari |
154 |
}else if("Launch NCBI Viewer".equals(item.getActionCommand())){ |
2 |
26 Feb 07 |
jari |
155 |
GenomeBrowserLauncher.launchNCBIMapViewer(selectedDataRegion.getDataRegion(), model.getCGHSpecies()); |
2 |
26 Feb 07 |
jari |
156 |
} |
2 |
26 Feb 07 |
jari |
157 |
} |
2 |
26 Feb 07 |
jari |
158 |
} |
2 |
26 Feb 07 |
jari |
159 |
|
2 |
26 Feb 07 |
jari |
160 |
} |