JAL-1807 includes ?j2sdebug flag and DebugJS._(msg)
[jalviewjs.git] / bin / jalview / appletgui / IdCanvas.js
index 7c5a1c2..673b00e 100644 (file)
-Clazz.declarePackage ("jalview.appletgui");\r
-Clazz.load (["awt2swing.Panel"], "jalview.appletgui.IdCanvas", ["jalview.appletgui.AnnotationLabels", "$.AnnotationPanel", "$.PaintRefresher", "java.awt.Color", "$.Font"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.av = null;\r
-this.showScores = true;\r
-this.maxIdLength = -1;\r
-this.maxIdStr = null;\r
-this.image = null;\r
-this.gg = null;\r
-this.imgHeight = 0;\r
-this.$fastPaint = false;\r
-this.searchResults = null;\r
-this.avcharHeight = 0;\r
-Clazz.instantialize (this, arguments);\r
-}, jalview.appletgui, "IdCanvas", awt2swing.Panel);\r
-Clazz.makeConstructor (c$, \r
-function (av) {\r
-Clazz.superConstructor (this, jalview.appletgui.IdCanvas, []);\r
-this.setLayout (null);\r
-this.av = av;\r
-jalview.appletgui.PaintRefresher.Register (this, av.getSequenceSetId ());\r
-}, "jalview.appletgui.AlignViewport");\r
-Clazz.defineMethod (c$, "drawIdString", \r
-function (gg, hiddenRows, s, i, starty, ypos) {\r
-var charHeight = this.av.getCharHeight ();\r
-if (this.searchResults != null && this.searchResults.contains (s)) {\r
-gg.setColor (java.awt.Color.black);\r
-gg.fillRect (0, ((i - starty) * charHeight) + ypos, this.getSize ().width, charHeight);\r
-gg.setColor (java.awt.Color.white);\r
-} else if (this.av.getSelectionGroup () != null && this.av.getSelectionGroup ().getSequences (null).contains (s)) {\r
-gg.setColor (java.awt.Color.lightGray);\r
-gg.fillRect (0, ((i - starty) * charHeight) + ypos, this.getSize ().width, charHeight);\r
-gg.setColor (java.awt.Color.white);\r
-} else {\r
-gg.setColor (this.av.getSequenceColour (s));\r
-gg.fillRect (0, ((i - starty) * charHeight) + ypos, this.getSize ().width, charHeight);\r
-gg.setColor (java.awt.Color.black);\r
-}gg.drawString (s.getDisplayId (this.av.getShowJVSuffix ()), 0, ((i - starty) * charHeight) + ypos + charHeight - (Clazz.doubleToInt (charHeight / 5)));\r
-if (hiddenRows) {\r
-this.drawMarker (i, starty, ypos);\r
-}}, "java.awt.Graphics,~B,jalview.datamodel.SequenceI,~N,~N,~N");\r
-Clazz.defineMethod (c$, "fastPaint", \r
-function (vertical) {\r
-if (this.gg == null) {\r
-this.repaint ();\r
-return;\r
-}this.gg.copyArea (0, 0, this.getSize ().width, this.imgHeight, 0, -vertical * this.av.getCharHeight ());\r
-var ss = this.av.startSeq;\r
-var es = this.av.endSeq;\r
-var transY = 0;\r
-if (vertical > 0) {\r
-ss = es - vertical;\r
-if (ss < this.av.startSeq) {\r
-ss = this.av.startSeq;\r
-} else {\r
-transY = this.imgHeight - vertical * this.av.getCharHeight ();\r
-}} else if (vertical < 0) {\r
-es = ss - vertical;\r
-if (es > this.av.endSeq) {\r
-es = this.av.endSeq;\r
-}}this.gg.translate (0, transY);\r
-this.drawIds (ss, es);\r
-this.gg.translate (0, -transY);\r
-this.$fastPaint = true;\r
-this.repaint ();\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "paintComponent", \r
-function (g) {\r
-if (this.getSize ().height < 0 || this.getSize ().width < 0) {\r
-return;\r
-}if (this.$fastPaint) {\r
-this.$fastPaint = false;\r
-g.drawImage (this.image, 0, 0, this);\r
-return;\r
-}this.imgHeight = this.getSize ().height;\r
-this.imgHeight -= this.imgHeight % this.av.getCharHeight ();\r
-if (this.imgHeight < 1) {\r
-return;\r
-}if (this.image == null || this.imgHeight != this.image.getHeight (this)) {\r
-this.image = this.createImage (this.getSize ().width, this.imgHeight);\r
-this.gg = this.image.getGraphics ();\r
-this.gg.setFont (this.av.getFont ());\r
-}this.gg.setColor (java.awt.Color.white);\r
-var italic =  new java.awt.Font (this.av.getFont ().getName (), 2, this.av.getFont ().getSize ());\r
-this.gg.setFont (italic);\r
-this.gg.fillRect (0, 0, this.getSize ().width, this.getSize ().height);\r
-this.drawIds (this.av.startSeq, this.av.endSeq);\r
-g.drawImage (this.image, 0, 0, this);\r
-}, "java.awt.Graphics");\r
-Clazz.defineMethod (c$, "drawIds", \r
-function (starty, endy) {\r
-var italic =  new java.awt.Font (this.av.getFont ().getName (), 2, this.av.getFont ().getSize ());\r
-this.avcharHeight = this.av.getCharHeight ();\r
-this.gg.setFont (italic);\r
-var currentColor = java.awt.Color.white;\r
-var currentTextColor = java.awt.Color.black;\r
-var doHiddenCheck = this.av.isDisplayReferenceSeq () || this.av.hasHiddenRows ();\r
-var hiddenRows = this.av.hasHiddenRows () && this.av.getShowHiddenMarkers ();\r
-if (this.av.getWrapAlignment ()) {\r
-var maxwidth = this.av.getAlignment ().getWidth ();\r
-var alheight = this.av.getAlignment ().getHeight ();\r
-if (this.av.hasHiddenColumns ()) {\r
-maxwidth = this.av.getColumnSelection ().findColumnPosition (maxwidth) - 1;\r
-}var annotationHeight = 0;\r
-var labels = null;\r
-if (this.av.isShowAnnotation ()) {\r
-var ap =  new jalview.appletgui.AnnotationPanel (this.av);\r
-annotationHeight = ap.adjustPanelHeight ();\r
-labels =  new jalview.appletgui.AnnotationLabels (this.av);\r
-}var hgap = this.avcharHeight;\r
-if (this.av.getScaleAboveWrapped ()) {\r
-hgap += this.avcharHeight;\r
-}var cHeight = alheight * this.avcharHeight + hgap + annotationHeight;\r
-var rowSize = this.av.getEndRes () - this.av.getStartRes ();\r
-for (var ypos = hgap, row = this.av.startRes; (ypos <= this.getSize ().height) && (row < maxwidth); ypos += cHeight, row += rowSize) {\r
-for (var i = starty; i < alheight; i++) {\r
-var s = this.av.getAlignment ().getSequenceAt (i);\r
-this.gg.setFont (italic);\r
-if (doHiddenCheck) {\r
-this.setHiddenFont (s);\r
-}this.drawIdString (this.gg, hiddenRows, s, i, 0, ypos);\r
-}\r
-if (labels != null) {\r
-this.gg.translate (0, ypos + (alheight * this.avcharHeight));\r
-labels.drawComponent (this.gg, this.getSize ().width);\r
-this.gg.translate (0, -ypos - (alheight * this.avcharHeight));\r
-}}\r
-} else {\r
-var seq;\r
-for (var i = starty; i < endy; i++) {\r
-seq = this.av.getAlignment ().getSequenceAt (i);\r
-if (seq == null) {\r
-continue;\r
-}this.gg.setFont (italic);\r
-if (doHiddenCheck) {\r
-this.setHiddenFont (seq);\r
-}if ((this.searchResults != null) && this.searchResults.contains (seq)) {\r
-currentColor = java.awt.Color.black;\r
-currentTextColor = java.awt.Color.white;\r
-} else if ((this.av.getSelectionGroup () != null) && this.av.getSelectionGroup ().getSequences (null).contains (seq)) {\r
-currentColor = java.awt.Color.lightGray;\r
-currentTextColor = java.awt.Color.black;\r
-} else {\r
-currentColor = this.av.getSequenceColour (seq);\r
-currentTextColor = java.awt.Color.black;\r
-}this.gg.setColor (currentColor);\r
-this.gg.fillRect (0, (i - starty) * this.avcharHeight, this.getSize ().width, this.avcharHeight);\r
-this.gg.setColor (currentTextColor);\r
-this.gg.drawString (seq.getDisplayId (this.av.getShowJVSuffix ()), 0, (((i - starty) * this.avcharHeight) + this.avcharHeight) - (Clazz.doubleToInt (this.avcharHeight / 5)));\r
-if (hiddenRows) {\r
-this.drawMarker (i, starty, 0);\r
-}}\r
-}}, "~N,~N");\r
-Clazz.defineMethod (c$, "setHighlighted", \r
-function (list) {\r
-this.searchResults = list;\r
-this.repaint ();\r
-}, "java.util.List");\r
-Clazz.defineMethod (c$, "drawMarker", \r
-function (i, starty, yoffset) {\r
-var hseqs = this.av.getAlignment ().getHiddenSequences ().hiddenSequences;\r
-var hSize = hseqs.length;\r
-var hiddenIndex = i;\r
-var lastIndex = i - 1;\r
-var nextIndex = i + 1;\r
-for (var j = 0; j < hSize; j++) {\r
-if (hseqs[j] != null) {\r
-if (j - 1 < hiddenIndex) {\r
-hiddenIndex++;\r
-}if (j - 1 < lastIndex) {\r
-lastIndex++;\r
-}if (j - 1 < nextIndex) {\r
-nextIndex++;\r
-}}}\r
-var below = (hiddenIndex > lastIndex + 1);\r
-var above = (nextIndex > hiddenIndex + 1);\r
-this.gg.setColor (java.awt.Color.blue);\r
-if (below) {\r
-this.gg.fillPolygon ( Clazz.newIntArray (-1, [this.getSize ().width - this.avcharHeight, this.getSize ().width - this.avcharHeight, this.getSize ().width]),  Clazz.newIntArray (-1, [(i - starty) * this.avcharHeight + yoffset, (i - starty) * this.avcharHeight + yoffset + Clazz.doubleToInt (this.avcharHeight / 4), (i - starty) * this.avcharHeight + yoffset]), 3);\r
-}if (above) {\r
-this.gg.fillPolygon ( Clazz.newIntArray (-1, [this.getSize ().width - this.avcharHeight, this.getSize ().width - this.avcharHeight, this.getSize ().width]),  Clazz.newIntArray (-1, [(i - starty + 1) * this.avcharHeight + yoffset, (i - starty + 1) * this.avcharHeight + yoffset - Clazz.doubleToInt (this.avcharHeight / 4), (i - starty + 1) * this.avcharHeight + yoffset]), 3);\r
-}}, "~N,~N,~N");\r
-Clazz.defineMethod (c$, "setHiddenFont", \r
-function (seq) {\r
-var bold =  new java.awt.Font (this.av.getFont ().getName (), 1, this.av.getFont ().getSize ());\r
-if (this.av.isHiddenRepSequence (seq)) {\r
-this.gg.setFont (bold);\r
-return true;\r
-}return false;\r
-}, "jalview.datamodel.SequenceI");\r
-});\r
+Clazz.declarePackage ("jalview.appletgui");
+Clazz.load (["awt2swing.Panel"], "jalview.appletgui.IdCanvas", ["jalview.appletgui.AnnotationLabels", "$.AnnotationPanel", "$.PaintRefresher", "java.awt.Color", "$.Font"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.av = null;
+this.showScores = true;
+this.maxIdLength = -1;
+this.maxIdStr = null;
+this.image = null;
+this.gg = null;
+this.imgHeight = 0;
+this.$fastPaint = false;
+this.searchResults = null;
+this.avcharHeight = 0;
+Clazz.instantialize (this, arguments);
+}, jalview.appletgui, "IdCanvas", awt2swing.Panel);
+Clazz.makeConstructor (c$, 
+function (av) {
+Clazz.superConstructor (this, jalview.appletgui.IdCanvas, []);
+this.setLayout (null);
+this.av = av;
+jalview.appletgui.PaintRefresher.Register (this, av.getSequenceSetId ());
+}, "jalview.appletgui.AlignViewport");
+Clazz.defineMethod (c$, "drawIdString", 
+function (gg, hiddenRows, s, i, starty, ypos) {
+var charHeight = this.av.getCharHeight ();
+if (this.searchResults != null && this.searchResults.contains (s)) {
+gg.setColor (java.awt.Color.black);
+gg.fillRect (0, ((i - starty) * charHeight) + ypos, this.getSize ().width, charHeight);
+gg.setColor (java.awt.Color.white);
+} else if (this.av.getSelectionGroup () != null && this.av.getSelectionGroup ().getSequences (null).contains (s)) {
+gg.setColor (java.awt.Color.lightGray);
+gg.fillRect (0, ((i - starty) * charHeight) + ypos, this.getSize ().width, charHeight);
+gg.setColor (java.awt.Color.white);
+} else {
+gg.setColor (this.av.getSequenceColour (s));
+gg.fillRect (0, ((i - starty) * charHeight) + ypos, this.getSize ().width, charHeight);
+gg.setColor (java.awt.Color.black);
+}gg.drawString (s.getDisplayId (this.av.getShowJVSuffix ()), 0, ((i - starty) * charHeight) + ypos + charHeight - (Clazz.doubleToInt (charHeight / 5)));
+if (hiddenRows) {
+this.drawMarker (i, starty, ypos);
+}}, "java.awt.Graphics,~B,jalview.datamodel.SequenceI,~N,~N,~N");
+Clazz.defineMethod (c$, "fastPaint", 
+function (vertical) {
+if (this.gg == null) {
+this.repaint ();
+return;
+}this.gg.copyArea (0, 0, this.getSize ().width, this.imgHeight, 0, -vertical * this.av.getCharHeight ());
+var ss = this.av.startSeq;
+var es = this.av.endSeq;
+var transY = 0;
+if (vertical > 0) {
+ss = es - vertical;
+if (ss < this.av.startSeq) {
+ss = this.av.startSeq;
+} else {
+transY = this.imgHeight - vertical * this.av.getCharHeight ();
+}} else if (vertical < 0) {
+es = ss - vertical;
+if (es > this.av.endSeq) {
+es = this.av.endSeq;
+}}this.gg.translate (0, transY);
+this.drawIds (ss, es);
+this.gg.translate (0, -transY);
+this.$fastPaint = true;
+this.repaint ();
+}, "~N");
+Clazz.overrideMethod (c$, "paintComponent", 
+function (g) {
+if (this.getSize ().height < 0 || this.getSize ().width < 0) {
+return;
+}if (this.$fastPaint) {
+this.$fastPaint = false;
+g.drawImage (this.image, 0, 0, this);
+return;
+}this.imgHeight = this.getSize ().height;
+this.imgHeight -= this.imgHeight % this.av.getCharHeight ();
+if (this.imgHeight < 1) {
+return;
+}if (this.image == null || this.imgHeight != this.image.getHeight (this)) {
+this.image = this.createImage (this.getSize ().width, this.imgHeight);
+this.gg = this.image.getGraphics ();
+this.gg.setFont (this.av.getFont ());
+}this.gg.setColor (java.awt.Color.white);
+var italic =  new java.awt.Font (this.av.getFont ().getName (), 2, this.av.getFont ().getSize ());
+this.gg.setFont (italic);
+this.gg.fillRect (0, 0, this.getSize ().width, this.getSize ().height);
+this.drawIds (this.av.startSeq, this.av.endSeq);
+g.drawImage (this.image, 0, 0, this);
+}, "java.awt.Graphics");
+Clazz.defineMethod (c$, "drawIds", 
+function (starty, endy) {
+var italic =  new java.awt.Font (this.av.getFont ().getName (), 2, this.av.getFont ().getSize ());
+this.avcharHeight = this.av.getCharHeight ();
+this.gg.setFont (italic);
+var currentColor = java.awt.Color.white;
+var currentTextColor = java.awt.Color.black;
+var doHiddenCheck = this.av.isDisplayReferenceSeq () || this.av.hasHiddenRows ();
+var hiddenRows = this.av.hasHiddenRows () && this.av.getShowHiddenMarkers ();
+if (this.av.getWrapAlignment ()) {
+var maxwidth = this.av.getAlignment ().getWidth ();
+var alheight = this.av.getAlignment ().getHeight ();
+if (this.av.hasHiddenColumns ()) {
+maxwidth = this.av.getColumnSelection ().findColumnPosition (maxwidth) - 1;
+}var annotationHeight = 0;
+var labels = null;
+if (this.av.isShowAnnotation ()) {
+var ap =  new jalview.appletgui.AnnotationPanel (this.av);
+annotationHeight = ap.adjustPanelHeight ();
+labels =  new jalview.appletgui.AnnotationLabels (this.av);
+}var hgap = this.avcharHeight;
+if (this.av.getScaleAboveWrapped ()) {
+hgap += this.avcharHeight;
+}var cHeight = alheight * this.avcharHeight + hgap + annotationHeight;
+var rowSize = this.av.getEndRes () - this.av.getStartRes ();
+for (var ypos = hgap, row = this.av.startRes; (ypos <= this.getSize ().height) && (row < maxwidth); ypos += cHeight, row += rowSize) {
+for (var i = starty; i < alheight; i++) {
+var s = this.av.getAlignment ().getSequenceAt (i);
+this.gg.setFont (italic);
+if (doHiddenCheck) {
+this.setHiddenFont (s);
+}this.drawIdString (this.gg, hiddenRows, s, i, 0, ypos);
+}
+if (labels != null) {
+this.gg.translate (0, ypos + (alheight * this.avcharHeight));
+labels.drawComponent (this.gg, this.getSize ().width);
+this.gg.translate (0, -ypos - (alheight * this.avcharHeight));
+}}
+} else {
+var seq;
+for (var i = starty; i < endy; i++) {
+seq = this.av.getAlignment ().getSequenceAt (i);
+if (seq == null) {
+continue;
+}this.gg.setFont (italic);
+if (doHiddenCheck) {
+this.setHiddenFont (seq);
+}if ((this.searchResults != null) && this.searchResults.contains (seq)) {
+currentColor = java.awt.Color.black;
+currentTextColor = java.awt.Color.white;
+} else if ((this.av.getSelectionGroup () != null) && this.av.getSelectionGroup ().getSequences (null).contains (seq)) {
+currentColor = java.awt.Color.lightGray;
+currentTextColor = java.awt.Color.black;
+} else {
+currentColor = this.av.getSequenceColour (seq);
+currentTextColor = java.awt.Color.black;
+}this.gg.setColor (currentColor);
+this.gg.fillRect (0, (i - starty) * this.avcharHeight, this.getSize ().width, this.avcharHeight);
+this.gg.setColor (currentTextColor);
+this.gg.drawString (seq.getDisplayId (this.av.getShowJVSuffix ()), 0, (((i - starty) * this.avcharHeight) + this.avcharHeight) - (Clazz.doubleToInt (this.avcharHeight / 5)));
+if (hiddenRows) {
+this.drawMarker (i, starty, 0);
+}}
+}}, "~N,~N");
+Clazz.defineMethod (c$, "setHighlighted", 
+function (list) {
+this.searchResults = list;
+this.repaint ();
+}, "java.util.List");
+Clazz.defineMethod (c$, "drawMarker", 
+function (i, starty, yoffset) {
+var hseqs = this.av.getAlignment ().getHiddenSequences ().hiddenSequences;
+var hSize = hseqs.length;
+var hiddenIndex = i;
+var lastIndex = i - 1;
+var nextIndex = i + 1;
+for (var j = 0; j < hSize; j++) {
+if (hseqs[j] != null) {
+if (j - 1 < hiddenIndex) {
+hiddenIndex++;
+}if (j - 1 < lastIndex) {
+lastIndex++;
+}if (j - 1 < nextIndex) {
+nextIndex++;
+}}}
+var below = (hiddenIndex > lastIndex + 1);
+var above = (nextIndex > hiddenIndex + 1);
+this.gg.setColor (java.awt.Color.blue);
+if (below) {
+this.gg.fillPolygon ( Clazz.newIntArray (-1, [this.getSize ().width - this.avcharHeight, this.getSize ().width - this.avcharHeight, this.getSize ().width]),  Clazz.newIntArray (-1, [(i - starty) * this.avcharHeight + yoffset, (i - starty) * this.avcharHeight + yoffset + Clazz.doubleToInt (this.avcharHeight / 4), (i - starty) * this.avcharHeight + yoffset]), 3);
+}if (above) {
+this.gg.fillPolygon ( Clazz.newIntArray (-1, [this.getSize ().width - this.avcharHeight, this.getSize ().width - this.avcharHeight, this.getSize ().width]),  Clazz.newIntArray (-1, [(i - starty + 1) * this.avcharHeight + yoffset, (i - starty + 1) * this.avcharHeight + yoffset - Clazz.doubleToInt (this.avcharHeight / 4), (i - starty + 1) * this.avcharHeight + yoffset]), 3);
+}}, "~N,~N,~N");
+Clazz.defineMethod (c$, "setHiddenFont", 
+function (seq) {
+var bold =  new java.awt.Font (this.av.getFont ().getName (), 1, this.av.getFont ().getSize ());
+if (this.av.isHiddenRepSequence (seq)) {
+this.gg.setFont (bold);
+return true;
+}return false;
+}, "jalview.datamodel.SequenceI");
+});