1 Clazz.declarePackage ("jalview.appletgui");
\r
2 Clazz.load (["awt2swing.Panel", "java.awt.event.MouseListener", "$.MouseMotionListener"], "jalview.appletgui.OverviewPanel", ["awt2swing.Frame", "jalview.appletgui.FeatureRenderer", "$.SequenceRenderer", "java.awt.Color", "$.Dimension", "java.awt.event.ComponentAdapter", "java.lang.Thread"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
5 this.offscreen = null;
\r
11 this.sequencesHeight = 0;
\r
12 this.graphHeight = 20;
\r
16 this.boxHeight = -1;
\r
17 this.resizing = false;
\r
20 this.nullFrame = null;
\r
21 this.resizeAgain = false;
\r
22 Clazz.instantialize (this, arguments);
\r
23 }, jalview.appletgui, "OverviewPanel", awt2swing.Panel, [Runnable, java.awt.event.MouseMotionListener, java.awt.event.MouseListener]);
\r
24 Clazz.makeConstructor (c$,
\r
26 Clazz.superConstructor (this, jalview.appletgui.OverviewPanel, []);
\r
29 this.setLayout (null);
\r
30 this.nullFrame = new awt2swing.Frame ();
\r
31 this.nullFrame.addNotify ();
\r
32 this.sr = new jalview.appletgui.SequenceRenderer (this.av);
\r
33 this.sr.graphics = this.nullFrame.getGraphics ();
\r
34 this.sr.renderGaps = false;
\r
35 this.sr.forOverview = true;
\r
36 this.fr = new jalview.appletgui.FeatureRenderer (this.av);
\r
37 var initialScale = this.av.getAlignment ().getWidth () / this.av.getAlignment ().getHeight ();
\r
38 if (this.av.getSequenceConsensusHash () == null) {
\r
39 this.graphHeight = 0;
\r
40 }if (this.av.getAlignment ().getWidth () > this.av.getAlignment ().getHeight ()) {
\r
42 this.sequencesHeight = Clazz.floatToInt (400 / initialScale);
\r
43 if (this.sequencesHeight < 40) {
\r
44 this.sequencesHeight = 40;
\r
46 this.$width = Clazz.floatToInt (400 * initialScale);
\r
47 this.sequencesHeight = 300;
\r
48 if (this.$width < 120) {
\r
50 }}this.setSize ( new java.awt.Dimension (this.$width, this.sequencesHeight + this.graphHeight));
\r
51 this.addComponentListener (((Clazz.isClassDefined ("jalview.appletgui.OverviewPanel$1") ? 0 : jalview.appletgui.OverviewPanel.$OverviewPanel$1$ ()), Clazz.innerTypeInstance (jalview.appletgui.OverviewPanel$1, this, null)));
\r
52 this.addMouseMotionListener (this);
\r
53 this.addMouseListener (this);
\r
54 this.updateOverviewImage ();
\r
55 }, "jalview.appletgui.AlignmentPanel");
\r
56 Clazz.overrideMethod (c$, "mouseEntered",
\r
58 }, "java.awt.event.MouseEvent");
\r
59 Clazz.overrideMethod (c$, "mouseExited",
\r
61 }, "java.awt.event.MouseEvent");
\r
62 Clazz.overrideMethod (c$, "mouseClicked",
\r
64 }, "java.awt.event.MouseEvent");
\r
65 Clazz.overrideMethod (c$, "mouseMoved",
\r
67 }, "java.awt.event.MouseEvent");
\r
68 Clazz.overrideMethod (c$, "mousePressed",
\r
70 this.boxX = evt.getX ();
\r
71 this.boxY = evt.getY ();
\r
73 }, "java.awt.event.MouseEvent");
\r
74 Clazz.overrideMethod (c$, "mouseReleased",
\r
76 this.boxX = evt.getX ();
\r
77 this.boxY = evt.getY ();
\r
79 }, "java.awt.event.MouseEvent");
\r
80 Clazz.overrideMethod (c$, "mouseDragged",
\r
82 this.boxX = evt.getX ();
\r
83 this.boxY = evt.getY ();
\r
85 }, "java.awt.event.MouseEvent");
\r
86 Clazz.defineMethod (c$, "checkValid",
\r
88 if (this.boxY < 0) {
\r
90 }if (this.boxY > (this.sequencesHeight - this.boxHeight)) {
\r
91 this.boxY = this.sequencesHeight - this.boxHeight + 1;
\r
92 }if (this.boxX < 0) {
\r
94 }if (this.boxX > (this.$width - this.boxWidth)) {
\r
95 if (this.av.hasHiddenColumns ()) {
\r
96 this.boxWidth = Clazz.floatToInt ((this.av.endRes - this.av.startRes + 1) * this.av.getCharWidth () * this.scalew);
\r
97 }this.boxX = this.$width - this.boxWidth;
\r
98 }var col = Clazz.floatToInt (this.boxX / this.scalew / this.av.getCharWidth ());
\r
99 var row = Clazz.floatToInt (this.boxY / this.scaleh / this.av.getCharHeight ());
\r
100 if (this.av.hasHiddenColumns ()) {
\r
101 if (!this.av.getColumnSelection ().isVisible (col)) {
\r
103 }col = this.av.getColumnSelection ().findColumnPosition (col);
\r
104 }if (this.av.hasHiddenRows ()) {
\r
105 row = this.av.getAlignment ().getHiddenSequences ().findIndexWithoutHiddenSeqs (row);
\r
106 }this.ap.setScrollValues (col, row);
\r
107 this.ap.paintAlignment (false);
\r
109 Clazz.defineMethod (c$, "updateOverviewImage",
\r
111 if (this.resizing) {
\r
112 this.resizeAgain = true;
\r
114 }if (this.av.isShowSequenceFeatures ()) {
\r
115 this.fr.transferSettings (this.ap.seqPanel.seqCanvas.fr);
\r
116 }this.resizing = true;
\r
117 if ((this.getSize ().width > 0) && (this.getSize ().height > 0)) {
\r
118 this.$width = this.getSize ().width;
\r
119 this.sequencesHeight = this.getSize ().height - this.graphHeight;
\r
120 }this.setSize ( new java.awt.Dimension (this.$width, this.sequencesHeight + this.graphHeight));
\r
121 var thread = new Thread (this);
\r
125 Clazz.overrideMethod (c$, "run",
\r
127 this.miniMe = null;
\r
128 var alwidth = this.av.getAlignment ().getWidth ();
\r
129 var alheight = this.av.getAlignment ().getHeight ();
\r
130 if (this.av.isShowSequenceFeatures ()) {
\r
131 this.fr.transferSettings (this.ap.seqPanel.seqCanvas.getFeatureRenderer ());
\r
132 }if (this.getSize ().width > 0 && this.getSize ().height > 0) {
\r
133 this.$width = this.getSize ().width;
\r
134 this.sequencesHeight = this.getSize ().height - this.graphHeight;
\r
135 }this.setSize ( new java.awt.Dimension (this.$width, this.sequencesHeight + this.graphHeight));
\r
136 var fullsizeWidth = alwidth * this.av.getCharWidth ();
\r
137 var fullsizeHeight = alheight * this.av.getCharHeight ();
\r
138 this.scalew = this.$width / fullsizeWidth;
\r
139 this.scaleh = this.sequencesHeight / fullsizeHeight;
\r
140 this.miniMe = this.nullFrame.createImage (this.$width, this.sequencesHeight + this.graphHeight);
\r
141 this.offscreen = this.nullFrame.createImage (this.$width, this.sequencesHeight + this.graphHeight);
\r
142 var mg = this.miniMe.getGraphics ();
\r
143 var sampleCol = alwidth / this.$width;
\r
144 var sampleRow = alheight / this.sequencesHeight;
\r
149 var color = java.awt.Color.yellow;
\r
155 var hasHiddenRows = this.av.hasHiddenRows ();
\r
156 var hasHiddenCols = this.av.hasHiddenColumns ();
\r
157 var hiddenRow = false;
\r
158 var alignment = this.av.getAlignment ();
\r
159 for (row = 0; row <= this.sequencesHeight; row++) {
\r
160 if (Clazz.floatToInt (row * sampleRow) == lastrow) {
\r
163 }hiddenRow = false;
\r
164 if (hasHiddenRows) {
\r
165 seq = alignment.getHiddenSequences ().getHiddenSequence (lastrow);
\r
167 var index = alignment.getHiddenSequences ().findIndexWithoutHiddenSeqs (lastrow);
\r
168 seq = alignment.getSequenceAt (index);
\r
172 seq = alignment.getSequenceAt (lastrow);
\r
173 }for (col = 0; col < this.$width; col++) {
\r
174 if (Clazz.floatToInt (col * sampleCol) == lastcol && Clazz.floatToInt (row * sampleRow) == lastrow) {
\r
177 }lastcol = Clazz.floatToInt (col * sampleCol);
\r
178 if (seq.getLength () > lastcol) {
\r
179 color = this.sr.getResidueBoxColour (seq, lastcol);
\r
180 if (this.av.isShowSequenceFeatures ()) {
\r
181 color = this.fr.findFeatureColour (color, seq, lastcol);
\r
183 color = java.awt.Color.white;
\r
184 }if (hiddenRow || (hasHiddenCols && !this.av.getColumnSelection ().isVisible (lastcol))) {
\r
185 color = color.darker ().darker ();
\r
186 }mg.setColor (color);
\r
187 if (sameCol == 1 && sameRow == 1) {
\r
188 mg.drawLine (xstart, ystart, xstart, ystart);
\r
190 mg.fillRect (xstart, ystart, sameCol, sameRow);
\r
194 lastrow = Clazz.floatToInt (row * sampleRow);
\r
198 if (this.av.getAlignmentConservationAnnotation () != null) {
\r
199 for (col = 0; col < this.$width; col++) {
\r
200 lastcol = Clazz.floatToInt (col * sampleCol);
\r
202 mg.translate (col, this.sequencesHeight);
\r
203 this.ap.annotationPanel.renderer.drawGraph (mg, this.av.getAlignmentConservationAnnotation (), this.av.getAlignmentConservationAnnotation ().annotations, Clazz.floatToInt (sampleCol) + 1, this.graphHeight, Clazz.floatToInt (col * sampleCol), Clazz.floatToInt (col * sampleCol) + 1);
\r
204 mg.translate (-col, -this.sequencesHeight);
\r
207 this.resizing = false;
\r
208 this.setBoxPosition ();
\r
209 if (this.resizeAgain) {
\r
210 this.resizeAgain = false;
\r
211 this.updateOverviewImage ();
\r
213 Clazz.defineMethod (c$, "setBoxPosition",
\r
215 var fullsizeWidth = this.av.getAlignment ().getWidth () * this.av.getCharWidth ();
\r
216 var fullsizeHeight = (this.av.getAlignment ().getHeight () + this.av.getAlignment ().getHiddenSequences ().getSize ()) * this.av.getCharHeight ();
\r
217 var startRes = this.av.getStartRes ();
\r
218 var endRes = this.av.getEndRes ();
\r
219 if (this.av.hasHiddenColumns ()) {
\r
220 startRes = this.av.getColumnSelection ().adjustForHiddenColumns (startRes);
\r
221 endRes = this.av.getColumnSelection ().adjustForHiddenColumns (endRes);
\r
222 }var startSeq = this.av.startSeq;
\r
223 var endSeq = this.av.endSeq;
\r
224 if (this.av.hasHiddenRows ()) {
\r
225 startSeq = this.av.getAlignment ().getHiddenSequences ().adjustForHiddenSeqs (startSeq);
\r
226 endSeq = this.av.getAlignment ().getHiddenSequences ().adjustForHiddenSeqs (endSeq);
\r
227 }this.scalew = this.$width / fullsizeWidth;
\r
228 this.scaleh = this.sequencesHeight / fullsizeHeight;
\r
229 this.boxX = Clazz.floatToInt (startRes * this.av.getCharWidth () * this.scalew);
\r
230 this.boxY = Clazz.floatToInt (startSeq * this.av.getCharHeight () * this.scaleh);
\r
231 if (this.av.hasHiddenColumns ()) {
\r
232 this.boxWidth = Clazz.floatToInt ((endRes - startRes + 1) * this.av.getCharWidth () * this.scalew);
\r
234 this.boxWidth = Clazz.floatToInt ((endRes - startRes + 1) * this.av.getCharWidth () * this.scalew);
\r
235 }this.boxHeight = Clazz.floatToInt ((endSeq - startSeq) * this.av.getCharHeight () * this.scaleh);
\r
238 Clazz.overrideMethod (c$, "update",
\r
241 }, "java.awt.Graphics");
\r
242 Clazz.overrideMethod (c$, "paintComponent",
\r
244 var og = this.offscreen.getGraphics ();
\r
245 if (this.miniMe != null) {
\r
246 og.drawImage (this.miniMe, 0, 0, this);
\r
247 og.setColor (java.awt.Color.red);
\r
248 og.drawRect (this.boxX, this.boxY, this.boxWidth, this.boxHeight);
\r
249 og.drawRect (this.boxX + 1, this.boxY + 1, this.boxWidth - 2, this.boxHeight - 2);
\r
250 g.drawImage (this.offscreen, 0, 0, this);
\r
251 }}, "java.awt.Graphics");
\r
252 c$.$OverviewPanel$1$ = function () {
\r
254 c$ = Clazz.declareAnonymous (jalview.appletgui, "OverviewPanel$1", java.awt.event.ComponentAdapter);
\r
255 Clazz.overrideMethod (c$, "componentResized",
\r
257 if (this.b$["jalview.appletgui.OverviewPanel"].getSize ().width != this.b$["jalview.appletgui.OverviewPanel"].$width || this.b$["jalview.appletgui.OverviewPanel"].getSize ().height != this.b$["jalview.appletgui.OverviewPanel"].sequencesHeight + this.b$["jalview.appletgui.OverviewPanel"].graphHeight) {
\r
258 this.b$["jalview.appletgui.OverviewPanel"].updateOverviewImage ();
\r
259 }}, "java.awt.event.ComponentEvent");
\r