JAL-1807 includes ?j2sdebug flag and DebugJS._(msg)
[jalviewjs.git] / bin / jalview / appletgui / AnnotationPanel.js
index 33f7259..6234bd3 100644 (file)
-Clazz.declarePackage ("jalview.appletgui");\r
-Clazz.load (["awt2swing.Panel", "jalview.renderer.AwtRenderPanelI", "java.awt.event.ActionListener", "$.AdjustmentListener", "$.MouseListener", "$.MouseMotionListener", "java.awt.Color"], "jalview.appletgui.AnnotationPanel", ["awt2swing.MenuItem", "$.PopupMenu", "jalview.appletgui.EditNameDialog", "$.UserDefinedColours", "jalview.datamodel.Annotation", "jalview.renderer.AnnotationRenderer", "jalview.util.MessageManager", "$.Platform", "java.awt.Dimension", "java.lang.StringBuffer"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.av = null;\r
-this.ap = null;\r
-this.activeRow = -1;\r
-this.HELIX = "Helix";\r
-this.SHEET = "Sheet";\r
-this.STEM = "RNA Helix";\r
-this.LABEL = "Label";\r
-this.REMOVE = "Remove Annotation";\r
-this.COLOUR = "Colour";\r
-this.HELIX_COLOUR = null;\r
-this.SHEET_COLOUR = null;\r
-this.image = null;\r
-this.gg = null;\r
-this.fm = null;\r
-this.imgWidth = 0;\r
-this.$fastPaint = false;\r
-this.graphStretch = -1;\r
-this.graphStretchY = -1;\r
-this.mouseDragging = false;\r
-this.MAC = false;\r
-this.renderer = null;\r
-this.needValidating = false;\r
-this.scrollOffset = 0;\r
-this.$bounds = null;\r
-Clazz.instantialize (this, arguments);\r
-}, jalview.appletgui, "AnnotationPanel", awt2swing.Panel, [jalview.renderer.AwtRenderPanelI, java.awt.event.AdjustmentListener, java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener]);\r
-Clazz.prepareFields (c$, function () {\r
-this.HELIX_COLOUR = java.awt.Color.red.darker ();\r
-this.SHEET_COLOUR = java.awt.Color.green.darker ().darker ();\r
-this.$bounds =  Clazz.newIntArray (2, 0);\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (ap) {\r
-Clazz.superConstructor (this, jalview.appletgui.AnnotationPanel, []);\r
-this.MAC = jalview.util.Platform.isAMac ();\r
-this.ap = ap;\r
-this.av = ap.av;\r
-this.setLayout (null);\r
-var height = this.adjustPanelHeight ();\r
-ap.apvscroll.setValues (0, this.getSize ().height, 0, height);\r
-this.addMouseMotionListener (this);\r
-this.addMouseListener (this);\r
-this.renderer =  new jalview.renderer.AnnotationRenderer ();\r
-}, "jalview.appletgui.AlignmentPanel");\r
-Clazz.makeConstructor (c$, \r
-function (av) {\r
-Clazz.superConstructor (this, jalview.appletgui.AnnotationPanel, []);\r
-this.av = av;\r
-this.renderer =  new jalview.renderer.AnnotationRenderer ();\r
-}, "jalview.appletgui.AlignViewport");\r
-Clazz.overrideMethod (c$, "adjustmentValueChanged", \r
-function (evt) {\r
-}, "java.awt.event.AdjustmentEvent");\r
-Clazz.overrideMethod (c$, "actionPerformed", \r
-function (evt) {\r
-var aa = this.av.getAlignment ().getAlignmentAnnotation ();\r
-if (aa == null) {\r
-return;\r
-}var anot = aa[this.activeRow].annotations;\r
-if (anot.length < this.av.getColumnSelection ().getMax ()) {\r
-var temp =  new Array (this.av.getColumnSelection ().getMax () + 2);\r
-System.arraycopy (anot, 0, temp, 0, anot.length);\r
-anot = temp;\r
-aa[this.activeRow].annotations = anot;\r
-}var label = "";\r
-if (this.av.getColumnSelection () != null && this.av.getColumnSelection ().size () > 0 && anot[this.av.getColumnSelection ().getMin ()] != null) {\r
-label = anot[this.av.getColumnSelection ().getMin ()].displayCharacter;\r
-}if (evt.getActionCommand ().equals ("Remove Annotation")) {\r
-for (var i = 0; i < this.av.getColumnSelection ().size (); i++) {\r
-anot[this.av.getColumnSelection ().columnAt (i)] = null;\r
-}\r
-} else if (evt.getActionCommand ().equals ("Label")) {\r
-label = this.enterLabel (label, "Enter Label");\r
-if (label == null) {\r
-return;\r
-}if ((label.length > 0) && !aa[this.activeRow].hasText) {\r
-aa[this.activeRow].hasText = true;\r
-}for (var i = 0; i < this.av.getColumnSelection ().size (); i++) {\r
-var index = this.av.getColumnSelection ().columnAt (i);\r
-if (!this.av.getColumnSelection ().isVisible (index)) {\r
-continue;\r
-}if (anot[index] == null) {\r
-anot[index] =  new jalview.datamodel.Annotation (label, "", ' ', 0);\r
-}anot[index].displayCharacter = label;\r
-}\r
-} else if (evt.getActionCommand ().equals ("Colour")) {\r
-var udc =  new jalview.appletgui.UserDefinedColours (this, java.awt.Color.black, this.ap.alignFrame);\r
-var col = udc.getColor ();\r
-for (var i = 0; i < this.av.getColumnSelection ().size (); i++) {\r
-var index = this.av.getColumnSelection ().columnAt (i);\r
-if (!this.av.getColumnSelection ().isVisible (index)) {\r
-continue;\r
-}if (anot[index] == null) {\r
-anot[index] =  new jalview.datamodel.Annotation ("", "", ' ', 0);\r
-}anot[index].colour = col;\r
-}\r
-} else {\r
-var type = String.fromCharCode (0);\r
-var symbol = "\u03B1";\r
-if (evt.getActionCommand ().equals ("Helix")) {\r
-type = 'H';\r
-} else if (evt.getActionCommand ().equals ("Sheet")) {\r
-type = 'E';\r
-symbol = "\u03B2";\r
-} else if (evt.getActionCommand ().equals ("RNA Helix")) {\r
-type = 'S';\r
-symbol = "\u03C3";\r
-}if (!aa[this.activeRow].hasIcons) {\r
-aa[this.activeRow].hasIcons = true;\r
-}label = this.enterLabel (symbol, "Enter Label");\r
-if (label == null) {\r
-return;\r
-}if ((label.length > 0) && !aa[this.activeRow].hasText) {\r
-aa[this.activeRow].hasText = true;\r
-if (evt.getActionCommand ().equals ("RNA Helix")) {\r
-aa[this.activeRow].showAllColLabels = true;\r
-}}for (var i = 0; i < this.av.getColumnSelection ().size (); i++) {\r
-var index = this.av.getColumnSelection ().columnAt (i);\r
-if (!this.av.getColumnSelection ().isVisible (index)) {\r
-continue;\r
-}if (anot[index] == null) {\r
-anot[index] =  new jalview.datamodel.Annotation (label, "", type, 0);\r
-}anot[index].secondaryStructure = type != 'S' ? type : label.length == 0 ? ' ' : label.charAt (0);\r
-anot[index].displayCharacter = label;\r
-}\r
-}this.av.getAlignment ().validateAnnotation (aa[this.activeRow]);\r
-this.ap.alignmentChanged ();\r
-this.adjustPanelHeight ();\r
-this.repaint ();\r
-return;\r
-}, "java.awt.event.ActionEvent");\r
-Clazz.defineMethod (c$, "enterLabel", \r
-function (text, label) {\r
-var dialog =  new jalview.appletgui.EditNameDialog (text, null, label, null, this.ap.alignFrame, "Enter Label", 400, 200, true);\r
-if (dialog.accept) {\r
-return dialog.getName ();\r
-} else {\r
-return null;\r
-}}, "~S,~S");\r
-Clazz.overrideMethod (c$, "mousePressed", \r
-function (evt) {\r
-var aa = this.av.getAlignment ().getAlignmentAnnotation ();\r
-if (aa == null) {\r
-return;\r
-}var height = -this.scrollOffset;\r
-this.activeRow = -1;\r
-for (var i = 0; i < aa.length; i++) {\r
-if (aa[i].visible) {\r
-height += aa[i].height;\r
-}if (evt.getY () < height) {\r
-if (aa[i].editable) {\r
-this.activeRow = i;\r
-} else if (aa[i].graph > 0) {\r
-this.graphStretch = i;\r
-this.graphStretchY = evt.getY ();\r
-}break;\r
-}}\r
-if ((evt.getModifiers () & 4) == 4 && this.activeRow != -1) {\r
-if (this.av.getColumnSelection () == null) {\r
-return;\r
-}var pop =  new awt2swing.PopupMenu (jalview.util.MessageManager.getString ("label.structure_type"));\r
-var item;\r
-if (this.av.getAlignment ().isNucleotide () == true) {\r
-item =  new awt2swing.MenuItem ("RNA Helix");\r
-item.addActionListener (this);\r
-pop.add (item);\r
-} else {\r
-item =  new awt2swing.MenuItem ("Helix");\r
-item.addActionListener (this);\r
-pop.add (item);\r
-item =  new awt2swing.MenuItem ("Sheet");\r
-item.addActionListener (this);\r
-pop.add (item);\r
-}item =  new awt2swing.MenuItem ("Label");\r
-item.addActionListener (this);\r
-pop.add (item);\r
-item =  new awt2swing.MenuItem ("Colour");\r
-item.addActionListener (this);\r
-pop.add (item);\r
-item =  new awt2swing.MenuItem ("Remove Annotation");\r
-item.addActionListener (this);\r
-pop.add (item);\r
-this.ap.alignFrame.add (pop);\r
-pop.show (this, evt.getX (), evt.getY ());\r
-return;\r
-}this.ap.scalePanel.mousePressed (evt);\r
-}, "java.awt.event.MouseEvent");\r
-Clazz.overrideMethod (c$, "mouseReleased", \r
-function (evt) {\r
-this.graphStretch = -1;\r
-this.graphStretchY = -1;\r
-this.mouseDragging = false;\r
-if (this.needValidating) {\r
-this.ap.validate ();\r
-this.needValidating = false;\r
-}this.ap.scalePanel.mouseReleased (evt);\r
-}, "java.awt.event.MouseEvent");\r
-Clazz.overrideMethod (c$, "mouseClicked", \r
-function (evt) {\r
-}, "java.awt.event.MouseEvent");\r
-Clazz.overrideMethod (c$, "mouseDragged", \r
-function (evt) {\r
-if (this.graphStretch > -1) {\r
-this.av.getAlignment ().getAlignmentAnnotation ()[this.graphStretch].graphHeight += this.graphStretchY - evt.getY ();\r
-if (this.av.getAlignment ().getAlignmentAnnotation ()[this.graphStretch].graphHeight < 0) {\r
-this.av.getAlignment ().getAlignmentAnnotation ()[this.graphStretch].graphHeight = 0;\r
-}this.graphStretchY = evt.getY ();\r
-this.av.calcPanelHeight ();\r
-this.needValidating = true;\r
-this.ap.paintAlignment (true);\r
-} else {\r
-this.ap.scalePanel.mouseDragged (evt);\r
-}}, "java.awt.event.MouseEvent");\r
-Clazz.overrideMethod (c$, "mouseMoved", \r
-function (evt) {\r
-var aa = this.av.getAlignment ().getAlignmentAnnotation ();\r
-if (aa == null) {\r
-return;\r
-}var row = -1;\r
-var height = -this.scrollOffset;\r
-for (var i = 0; i < aa.length; i++) {\r
-if (aa[i].visible) {\r
-height += aa[i].height;\r
-}if (evt.getY () < height) {\r
-row = i;\r
-break;\r
-}}\r
-var res = Clazz.doubleToInt (evt.getX () / this.av.getCharWidth ()) + this.av.getStartRes ();\r
-if (this.av.hasHiddenColumns ()) {\r
-res = this.av.getColumnSelection ().adjustForHiddenColumns (res);\r
-}if (row > -1 && res < aa[row].annotations.length && aa[row].annotations[res] != null) {\r
-var text =  new StringBuffer ("Sequence position " + (res + 1));\r
-if (aa[row].annotations[res].description != null) {\r
-text.append ("  " + aa[row].annotations[res].description);\r
-}this.ap.alignFrame.setStatus (text.toString ());\r
-}}, "java.awt.event.MouseEvent");\r
-Clazz.overrideMethod (c$, "mouseEntered", \r
-function (evt) {\r
-this.ap.scalePanel.mouseEntered (evt);\r
-}, "java.awt.event.MouseEvent");\r
-Clazz.overrideMethod (c$, "mouseExited", \r
-function (evt) {\r
-this.ap.scalePanel.mouseExited (evt);\r
-}, "java.awt.event.MouseEvent");\r
-Clazz.defineMethod (c$, "adjustPanelHeight", \r
-function () {\r
-return this.adjustPanelHeight (true);\r
-});\r
-Clazz.defineMethod (c$, "adjustPanelHeight", \r
-function (repaint) {\r
-var height = this.av.calcPanelHeight ();\r
-this.setSize ( new java.awt.Dimension (this.getSize ().width, height));\r
-if (repaint) {\r
-this.repaint ();\r
-}return height;\r
-}, "~B");\r
-Clazz.defineMethod (c$, "addEditableColumn", \r
-function (i) {\r
-if (this.activeRow == -1) {\r
-var aa = this.av.getAlignment ().getAlignmentAnnotation ();\r
-if (aa == null) {\r
-return;\r
-}for (var j = 0; j < aa.length; j++) {\r
-if (aa[j].editable) {\r
-this.activeRow = j;\r
-break;\r
-}}\r
-}}, "~N");\r
-Clazz.overrideMethod (c$, "paintComponent", \r
-function (g) {\r
-if (this.av.getWrapAlignment () || !this.av.isShowAnnotation ()) return;\r
-var d = this.getSize ();\r
-this.imgWidth = d.width;\r
-if (this.imgWidth < 1 || d.height < 1) {\r
-return;\r
-}if (this.image == null || this.imgWidth != this.image.getWidth (this) || d.height != this.image.getHeight (this)) {\r
-this.image = this.createImage (this.imgWidth, d.height);\r
-this.gg = this.image.getGraphics ();\r
-this.gg.setFont (this.av.getFont ());\r
-this.fm = this.gg.getFontMetrics ();\r
-this.$fastPaint = false;\r
-}if (this.$fastPaint) {\r
-g.drawImage (this.image, 0, 0, this);\r
-this.$fastPaint = false;\r
-return;\r
-}this.gg.setColor (java.awt.Color.white);\r
-this.gg.fillRect (0, 0, this.getSize ().width, this.getSize ().height);\r
-this.drawComponent (this.gg, this.av.startRes, this.av.endRes + 1);\r
-g.drawImage (this.image, 0, 0, this);\r
-}, "java.awt.Graphics");\r
-Clazz.defineMethod (c$, "fastPaint", \r
-function (horizontal) {\r
-if (horizontal == 0 || this.av.getAlignment ().getAlignmentAnnotation () == null || this.av.getAlignment ().getAlignmentAnnotation ().length < 1) {\r
-this.repaint ();\r
-return;\r
-}this.gg.copyArea (0, 0, this.imgWidth, this.getSize ().height, -horizontal * this.av.getCharWidth (), 0);\r
-var sr = this.av.startRes;\r
-var er = this.av.endRes + 1;\r
-var transX = 0;\r
-if (horizontal > 0) {\r
-transX = (er - sr - horizontal) * this.av.getCharWidth ();\r
-sr = er - horizontal;\r
-} else if (horizontal < 0) {\r
-er = sr - horizontal;\r
-}this.gg.translate (transX, 0);\r
-this.drawComponent (this.gg, sr, er);\r
-this.gg.translate (-transX, 0);\r
-this.$fastPaint = true;\r
-this.repaint ();\r
-}, "~N");\r
-Clazz.defineMethod (c$, "drawComponent", \r
-function (g, startRes, endRes) {\r
-var ofont = this.av.getFont ();\r
-g.setFont (ofont);\r
-g.setColor (java.awt.Color.white);\r
-g.fillRect (0, 0, (endRes - startRes) * this.av.getCharWidth (), this.getSize ().height);\r
-if (this.fm == null) {\r
-this.fm = g.getFontMetrics ();\r
-}if ((this.av.getAlignment ().getAlignmentAnnotation () == null) || (this.av.getAlignment ().getAlignmentAnnotation ().length < 1)) {\r
-g.setColor (java.awt.Color.white);\r
-g.fillRect (0, 0, this.getSize ().width, this.getSize ().height);\r
-g.setColor (java.awt.Color.black);\r
-if (this.av.validCharWidth) {\r
-g.drawString (jalview.util.MessageManager.getString ("label.alignment_has_no_annotations"), 20, 15);\r
-}return;\r
-}g.translate (0, -this.scrollOffset);\r
-this.renderer.drawComponent (this, this.av, g, this.activeRow, startRes, endRes);\r
-g.translate (0, +this.scrollOffset);\r
-}, "java.awt.Graphics,~N,~N");\r
-Clazz.defineMethod (c$, "setScrollOffset", \r
-function (value, repaint) {\r
-this.scrollOffset = value;\r
-if (repaint) {\r
-this.repaint ();\r
-}}, "~N,~B");\r
-Clazz.defineMethod (c$, "getFontMetrics", \r
-function () {\r
-return this.fm;\r
-});\r
-Clazz.overrideMethod (c$, "getFadedImage", \r
-function () {\r
-return this.image;\r
-});\r
-Clazz.overrideMethod (c$, "getFadedImageWidth", \r
-function () {\r
-return this.imgWidth;\r
-});\r
-Clazz.overrideMethod (c$, "getVisibleVRange", \r
-function () {\r
-if (this.ap != null && this.ap.alabels != null) {\r
-var sOffset = -this.ap.alabels.scrollOffset;\r
-var visHeight = sOffset + this.ap.annotationPanelHolder.getHeight ();\r
-this.$bounds[0] = sOffset;\r
-this.$bounds[1] = visHeight;\r
-return this.$bounds;\r
-} else {\r
-return null;\r
-}});\r
-Clazz.defineStatics (c$,\r
-"GRAPH_HEIGHT", 40);\r
-});\r
+Clazz.declarePackage ("jalview.appletgui");
+Clazz.load (["awt2swing.Panel", "jalview.renderer.AwtRenderPanelI", "java.awt.event.ActionListener", "$.AdjustmentListener", "$.MouseListener", "$.MouseMotionListener", "java.awt.Color"], "jalview.appletgui.AnnotationPanel", ["awt2swing.MenuItem", "$.PopupMenu", "jalview.appletgui.EditNameDialog", "$.UserDefinedColours", "jalview.datamodel.Annotation", "jalview.renderer.AnnotationRenderer", "jalview.util.MessageManager", "$.Platform", "java.awt.Dimension", "java.lang.StringBuffer"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.av = null;
+this.ap = null;
+this.activeRow = -1;
+this.HELIX = "Helix";
+this.SHEET = "Sheet";
+this.STEM = "RNA Helix";
+this.LABEL = "Label";
+this.REMOVE = "Remove Annotation";
+this.COLOUR = "Colour";
+this.HELIX_COLOUR = null;
+this.SHEET_COLOUR = null;
+this.image = null;
+this.gg = null;
+this.fm = null;
+this.imgWidth = 0;
+this.$fastPaint = false;
+this.graphStretch = -1;
+this.graphStretchY = -1;
+this.mouseDragging = false;
+this.MAC = false;
+this.renderer = null;
+this.needValidating = false;
+this.scrollOffset = 0;
+this.$bounds = null;
+Clazz.instantialize (this, arguments);
+}, jalview.appletgui, "AnnotationPanel", awt2swing.Panel, [jalview.renderer.AwtRenderPanelI, java.awt.event.AdjustmentListener, java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener]);
+Clazz.prepareFields (c$, function () {
+this.HELIX_COLOUR = java.awt.Color.red.darker ();
+this.SHEET_COLOUR = java.awt.Color.green.darker ().darker ();
+this.$bounds =  Clazz.newIntArray (2, 0);
+});
+Clazz.makeConstructor (c$, 
+function (ap) {
+Clazz.superConstructor (this, jalview.appletgui.AnnotationPanel, []);
+this.MAC = jalview.util.Platform.isAMac ();
+this.ap = ap;
+this.av = ap.av;
+this.setLayout (null);
+var height = this.adjustPanelHeight ();
+ap.apvscroll.setValues (0, this.getSize ().height, 0, height);
+this.addMouseMotionListener (this);
+this.addMouseListener (this);
+this.renderer =  new jalview.renderer.AnnotationRenderer ();
+}, "jalview.appletgui.AlignmentPanel");
+Clazz.makeConstructor (c$, 
+function (av) {
+Clazz.superConstructor (this, jalview.appletgui.AnnotationPanel, []);
+this.av = av;
+this.renderer =  new jalview.renderer.AnnotationRenderer ();
+}, "jalview.appletgui.AlignViewport");
+Clazz.overrideMethod (c$, "adjustmentValueChanged", 
+function (evt) {
+}, "java.awt.event.AdjustmentEvent");
+Clazz.overrideMethod (c$, "actionPerformed", 
+function (evt) {
+var aa = this.av.getAlignment ().getAlignmentAnnotation ();
+if (aa == null) {
+return;
+}var anot = aa[this.activeRow].annotations;
+if (anot.length < this.av.getColumnSelection ().getMax ()) {
+var temp =  new Array (this.av.getColumnSelection ().getMax () + 2);
+System.arraycopy (anot, 0, temp, 0, anot.length);
+anot = temp;
+aa[this.activeRow].annotations = anot;
+}var label = "";
+if (this.av.getColumnSelection () != null && this.av.getColumnSelection ().size () > 0 && anot[this.av.getColumnSelection ().getMin ()] != null) {
+label = anot[this.av.getColumnSelection ().getMin ()].displayCharacter;
+}if (evt.getActionCommand ().equals ("Remove Annotation")) {
+for (var i = 0; i < this.av.getColumnSelection ().size (); i++) {
+anot[this.av.getColumnSelection ().columnAt (i)] = null;
+}
+} else if (evt.getActionCommand ().equals ("Label")) {
+label = this.enterLabel (label, "Enter Label");
+if (label == null) {
+return;
+}if ((label.length > 0) && !aa[this.activeRow].hasText) {
+aa[this.activeRow].hasText = true;
+}for (var i = 0; i < this.av.getColumnSelection ().size (); i++) {
+var index = this.av.getColumnSelection ().columnAt (i);
+if (!this.av.getColumnSelection ().isVisible (index)) {
+continue;
+}if (anot[index] == null) {
+anot[index] =  new jalview.datamodel.Annotation (label, "", ' ', 0);
+}anot[index].displayCharacter = label;
+}
+} else if (evt.getActionCommand ().equals ("Colour")) {
+var udc =  new jalview.appletgui.UserDefinedColours (this, java.awt.Color.black, this.ap.alignFrame);
+var col = udc.getColor ();
+for (var i = 0; i < this.av.getColumnSelection ().size (); i++) {
+var index = this.av.getColumnSelection ().columnAt (i);
+if (!this.av.getColumnSelection ().isVisible (index)) {
+continue;
+}if (anot[index] == null) {
+anot[index] =  new jalview.datamodel.Annotation ("", "", ' ', 0);
+}anot[index].colour = col;
+}
+} else {
+var type = String.fromCharCode (0);
+var symbol = "\u03B1";
+if (evt.getActionCommand ().equals ("Helix")) {
+type = 'H';
+} else if (evt.getActionCommand ().equals ("Sheet")) {
+type = 'E';
+symbol = "\u03B2";
+} else if (evt.getActionCommand ().equals ("RNA Helix")) {
+type = 'S';
+symbol = "\u03C3";
+}if (!aa[this.activeRow].hasIcons) {
+aa[this.activeRow].hasIcons = true;
+}label = this.enterLabel (symbol, "Enter Label");
+if (label == null) {
+return;
+}if ((label.length > 0) && !aa[this.activeRow].hasText) {
+aa[this.activeRow].hasText = true;
+if (evt.getActionCommand ().equals ("RNA Helix")) {
+aa[this.activeRow].showAllColLabels = true;
+}}for (var i = 0; i < this.av.getColumnSelection ().size (); i++) {
+var index = this.av.getColumnSelection ().columnAt (i);
+if (!this.av.getColumnSelection ().isVisible (index)) {
+continue;
+}if (anot[index] == null) {
+anot[index] =  new jalview.datamodel.Annotation (label, "", type, 0);
+}anot[index].secondaryStructure = type != 'S' ? type : label.length == 0 ? ' ' : label.charAt (0);
+anot[index].displayCharacter = label;
+}
+}this.av.getAlignment ().validateAnnotation (aa[this.activeRow]);
+this.ap.alignmentChanged ();
+this.adjustPanelHeight ();
+this.repaint ();
+return;
+}, "java.awt.event.ActionEvent");
+Clazz.defineMethod (c$, "enterLabel", 
+function (text, label) {
+var dialog =  new jalview.appletgui.EditNameDialog (text, null, label, null, this.ap.alignFrame, "Enter Label", 400, 200, true);
+if (dialog.accept) {
+return dialog.getName ();
+} else {
+return null;
+}}, "~S,~S");
+Clazz.overrideMethod (c$, "mousePressed", 
+function (evt) {
+var aa = this.av.getAlignment ().getAlignmentAnnotation ();
+if (aa == null) {
+return;
+}var height = -this.scrollOffset;
+this.activeRow = -1;
+for (var i = 0; i < aa.length; i++) {
+if (aa[i].visible) {
+height += aa[i].height;
+}if (evt.getY () < height) {
+if (aa[i].editable) {
+this.activeRow = i;
+} else if (aa[i].graph > 0) {
+this.graphStretch = i;
+this.graphStretchY = evt.getY ();
+}break;
+}}
+if ((evt.getModifiers () & 4) == 4 && this.activeRow != -1) {
+if (this.av.getColumnSelection () == null) {
+return;
+}var pop =  new awt2swing.PopupMenu (jalview.util.MessageManager.getString ("label.structure_type"));
+var item;
+if (this.av.getAlignment ().isNucleotide () == true) {
+item =  new awt2swing.MenuItem ("RNA Helix");
+item.addActionListener (this);
+pop.add (item);
+} else {
+item =  new awt2swing.MenuItem ("Helix");
+item.addActionListener (this);
+pop.add (item);
+item =  new awt2swing.MenuItem ("Sheet");
+item.addActionListener (this);
+pop.add (item);
+}item =  new awt2swing.MenuItem ("Label");
+item.addActionListener (this);
+pop.add (item);
+item =  new awt2swing.MenuItem ("Colour");
+item.addActionListener (this);
+pop.add (item);
+item =  new awt2swing.MenuItem ("Remove Annotation");
+item.addActionListener (this);
+pop.add (item);
+this.ap.alignFrame.add (pop);
+pop.show (this, evt.getX (), evt.getY ());
+return;
+}this.ap.scalePanel.mousePressed (evt);
+}, "java.awt.event.MouseEvent");
+Clazz.overrideMethod (c$, "mouseReleased", 
+function (evt) {
+this.graphStretch = -1;
+this.graphStretchY = -1;
+this.mouseDragging = false;
+if (this.needValidating) {
+this.ap.validate ();
+this.needValidating = false;
+}this.ap.scalePanel.mouseReleased (evt);
+}, "java.awt.event.MouseEvent");
+Clazz.overrideMethod (c$, "mouseClicked", 
+function (evt) {
+}, "java.awt.event.MouseEvent");
+Clazz.overrideMethod (c$, "mouseDragged", 
+function (evt) {
+if (this.graphStretch > -1) {
+this.av.getAlignment ().getAlignmentAnnotation ()[this.graphStretch].graphHeight += this.graphStretchY - evt.getY ();
+if (this.av.getAlignment ().getAlignmentAnnotation ()[this.graphStretch].graphHeight < 0) {
+this.av.getAlignment ().getAlignmentAnnotation ()[this.graphStretch].graphHeight = 0;
+}this.graphStretchY = evt.getY ();
+this.av.calcPanelHeight ();
+this.needValidating = true;
+this.ap.paintAlignment (true);
+} else {
+this.ap.scalePanel.mouseDragged (evt);
+}}, "java.awt.event.MouseEvent");
+Clazz.overrideMethod (c$, "mouseMoved", 
+function (evt) {
+var aa = this.av.getAlignment ().getAlignmentAnnotation ();
+if (aa == null) {
+return;
+}var row = -1;
+var height = -this.scrollOffset;
+for (var i = 0; i < aa.length; i++) {
+if (aa[i].visible) {
+height += aa[i].height;
+}if (evt.getY () < height) {
+row = i;
+break;
+}}
+var res = Clazz.doubleToInt (evt.getX () / this.av.getCharWidth ()) + this.av.getStartRes ();
+if (this.av.hasHiddenColumns ()) {
+res = this.av.getColumnSelection ().adjustForHiddenColumns (res);
+}if (row > -1 && res < aa[row].annotations.length && aa[row].annotations[res] != null) {
+var text =  new StringBuffer ("Sequence position " + (res + 1));
+if (aa[row].annotations[res].description != null) {
+text.append ("  " + aa[row].annotations[res].description);
+}this.ap.alignFrame.setStatus (text.toString ());
+}}, "java.awt.event.MouseEvent");
+Clazz.overrideMethod (c$, "mouseEntered", 
+function (evt) {
+this.ap.scalePanel.mouseEntered (evt);
+}, "java.awt.event.MouseEvent");
+Clazz.overrideMethod (c$, "mouseExited", 
+function (evt) {
+this.ap.scalePanel.mouseExited (evt);
+}, "java.awt.event.MouseEvent");
+Clazz.defineMethod (c$, "adjustPanelHeight", 
+function () {
+return this.adjustPanelHeight (true);
+});
+Clazz.defineMethod (c$, "adjustPanelHeight", 
+function (repaint) {
+var height = this.av.calcPanelHeight ();
+this.setSize ( new java.awt.Dimension (this.getSize ().width, height));
+if (repaint) {
+this.repaint ();
+}return height;
+}, "~B");
+Clazz.defineMethod (c$, "addEditableColumn", 
+function (i) {
+if (this.activeRow == -1) {
+var aa = this.av.getAlignment ().getAlignmentAnnotation ();
+if (aa == null) {
+return;
+}for (var j = 0; j < aa.length; j++) {
+if (aa[j].editable) {
+this.activeRow = j;
+break;
+}}
+}}, "~N");
+Clazz.overrideMethod (c$, "paintComponent", 
+function (g) {
+if (this.av.getWrapAlignment () || !this.av.isShowAnnotation ()) return;
+var d = this.getSize ();
+this.imgWidth = d.width;
+if (this.imgWidth < 1 || d.height < 1) {
+return;
+}if (this.image == null || this.imgWidth != this.image.getWidth (this) || d.height != this.image.getHeight (this)) {
+this.image = this.createImage (this.imgWidth, d.height);
+this.gg = this.image.getGraphics ();
+this.gg.setFont (this.av.getFont ());
+this.fm = this.gg.getFontMetrics ();
+this.$fastPaint = false;
+}if (this.$fastPaint) {
+g.drawImage (this.image, 0, 0, this);
+this.$fastPaint = false;
+return;
+}this.gg.setColor (java.awt.Color.white);
+this.gg.fillRect (0, 0, this.getSize ().width, this.getSize ().height);
+this.drawComponent (this.gg, this.av.startRes, this.av.endRes + 1);
+g.drawImage (this.image, 0, 0, this);
+}, "java.awt.Graphics");
+Clazz.defineMethod (c$, "fastPaint", 
+function (horizontal) {
+if (horizontal == 0 || this.av.getAlignment ().getAlignmentAnnotation () == null || this.av.getAlignment ().getAlignmentAnnotation ().length < 1) {
+this.repaint ();
+return;
+}this.gg.copyArea (0, 0, this.imgWidth, this.getSize ().height, -horizontal * this.av.getCharWidth (), 0);
+var sr = this.av.startRes;
+var er = this.av.endRes + 1;
+var transX = 0;
+if (horizontal > 0) {
+transX = (er - sr - horizontal) * this.av.getCharWidth ();
+sr = er - horizontal;
+} else if (horizontal < 0) {
+er = sr - horizontal;
+}this.gg.translate (transX, 0);
+this.drawComponent (this.gg, sr, er);
+this.gg.translate (-transX, 0);
+this.$fastPaint = true;
+this.repaint ();
+}, "~N");
+Clazz.defineMethod (c$, "drawComponent", 
+function (g, startRes, endRes) {
+var ofont = this.av.getFont ();
+g.setFont (ofont);
+g.setColor (java.awt.Color.white);
+g.fillRect (0, 0, (endRes - startRes) * this.av.getCharWidth (), this.getSize ().height);
+if (this.fm == null) {
+this.fm = g.getFontMetrics ();
+}if ((this.av.getAlignment ().getAlignmentAnnotation () == null) || (this.av.getAlignment ().getAlignmentAnnotation ().length < 1)) {
+g.setColor (java.awt.Color.white);
+g.fillRect (0, 0, this.getSize ().width, this.getSize ().height);
+g.setColor (java.awt.Color.black);
+if (this.av.validCharWidth) {
+g.drawString (jalview.util.MessageManager.getString ("label.alignment_has_no_annotations"), 20, 15);
+}return;
+}g.translate (0, -this.scrollOffset);
+this.renderer.drawComponent (this, this.av, g, this.activeRow, startRes, endRes);
+g.translate (0, +this.scrollOffset);
+}, "java.awt.Graphics,~N,~N");
+Clazz.defineMethod (c$, "setScrollOffset", 
+function (value, repaint) {
+this.scrollOffset = value;
+if (repaint) {
+this.repaint ();
+}}, "~N,~B");
+Clazz.defineMethod (c$, "getFontMetrics", 
+function () {
+return this.fm;
+});
+Clazz.overrideMethod (c$, "getFadedImage", 
+function () {
+return this.image;
+});
+Clazz.overrideMethod (c$, "getFadedImageWidth", 
+function () {
+return this.imgWidth;
+});
+Clazz.overrideMethod (c$, "getVisibleVRange", 
+function () {
+if (this.ap != null && this.ap.alabels != null) {
+var sOffset = -this.ap.alabels.scrollOffset;
+var visHeight = sOffset + this.ap.annotationPanelHolder.getHeight ();
+this.$bounds[0] = sOffset;
+this.$bounds[1] = visHeight;
+return this.$bounds;
+} else {
+return null;
+}});
+Clazz.defineStatics (c$,
+"GRAPH_HEIGHT", 40);
+});