JAL-1807 still testing
[jalviewjs.git] / bin / jalview / appletgui / AnnotationColourChooser.js
index 668d9cd..fce2267 100644 (file)
-Clazz.declarePackage ("jalview.appletgui");
-Clazz.load (["awt2swing.Panel", "java.awt.event.ActionListener", "$.AdjustmentListener", "$.ItemListener", "$.MouseListener", "awt2swing.Button", "$.Checkbox", "$.Choice", "$.Scrollbar", "$.TextField", "java.awt.BorderLayout", "$.FlowLayout"], "jalview.appletgui.AnnotationColourChooser", ["awt2swing.Frame", "jalview.appletgui.UserDefinedColours", "jalview.bin.JalviewLite", "jalview.datamodel.GraphLine", "jalview.schemes.AnnotationColourGradient", "$.ColourSchemeI", "jalview.util.MessageManager", "java.awt.Color", "$.Dimension", "$.Font", "java.lang.Error", "$.Float", "java.util.Hashtable", "$.Vector"], function () {
-c$ = Clazz.decorateAsClass (function () {
-this.frame = null;
-this.av = null;
-this.ap = null;
-this.oldcs = null;
-this.oldgroupColours = null;
-this.currentAnnotation = null;
-this.adjusting = false;
-this.annotations = null;
-this.minColour = null;
-this.maxColour = null;
-this.ok = null;
-this.cancel = null;
-this.defColours = null;
-this.jPanel1 = null;
-this.jPanel2 = null;
-this.threshold = null;
-this.flowLayout1 = null;
-this.jPanel3 = null;
-this.slider = null;
-this.thresholdValue = null;
-this.currentColours = null;
-this.borderLayout1 = null;
-this.thresholdIsMin = null;
-Clazz.instantialize (this, arguments);
-}, jalview.appletgui, "AnnotationColourChooser", awt2swing.Panel, [java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.event.ItemListener, java.awt.event.MouseListener]);
-Clazz.prepareFields (c$, function () {
-this.annotations =  new awt2swing.Choice ();
-this.minColour =  new awt2swing.Button ();
-this.maxColour =  new awt2swing.Button ();
-this.ok =  new awt2swing.Button ();
-this.cancel =  new awt2swing.Button ();
-this.defColours =  new awt2swing.Button ();
-this.jPanel1 =  new awt2swing.Panel ();
-this.jPanel2 =  new awt2swing.Panel ();
-this.threshold =  new awt2swing.Choice ();
-this.flowLayout1 =  new java.awt.FlowLayout ();
-this.jPanel3 =  new awt2swing.Panel ();
-this.slider =  new awt2swing.Scrollbar (0);
-this.thresholdValue =  new awt2swing.TextField (20);
-this.currentColours =  new awt2swing.Checkbox ();
-this.borderLayout1 =  new java.awt.BorderLayout ();
-this.thresholdIsMin =  new awt2swing.Checkbox ();
-});
-Clazz.makeConstructor (c$, 
-function (av, ap) {
-Clazz.superConstructor (this, jalview.appletgui.AnnotationColourChooser, []);
-try {
-this.jbInit ();
-} catch (ex) {
-if (Clazz.exceptionOf (ex, Exception)) {
-} else {
-throw ex;
-}
-}
-this.oldcs = av.getGlobalColourScheme ();
-if (av.getAlignment ().getGroups () != null) {
-this.oldgroupColours =  new java.util.Hashtable ();
-for (var sg, $sg = ap.av.getAlignment ().getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {
-if (sg.cs != null) {
-this.oldgroupColours.put (sg, sg.cs);
-} else {
-this.oldgroupColours.put (sg, "null");
-}}
-}this.av = av;
-this.ap = ap;
-this.slider.addAdjustmentListener (this);
-this.slider.addMouseListener (this);
-if (av.getAlignment ().getAlignmentAnnotation () == null) {
-return;
-}this.setDefaultMinMax ();
-this.adjusting = true;
-if (Clazz.instanceOf (this.oldcs, jalview.schemes.AnnotationColourGradient)) {
-var acg = this.oldcs;
-this.currentColours.setState (acg.isPredefinedColours () || acg.getBaseColour () != null);
-if (!acg.isPredefinedColours () && acg.getBaseColour () == null) {
-this.minColour.setBackground (acg.getMinColour ());
-this.maxColour.setBackground (acg.getMaxColour ());
-}}var list =  new java.util.Vector ();
-var index = 1;
-for (var i = 0; i < av.getAlignment ().getAlignmentAnnotation ().length; i++) {
-var label = av.getAlignment ().getAlignmentAnnotation ()[i].label;
-if (!list.contains (label)) {
-list.addElement (label);
-} else {
-list.addElement (label + "_" + (index++));
-}}
-for (var i = 0; i < list.size (); i++) {
-this.annotations.addItem (list.elementAt (i).toString ());
-}
-this.threshold.addItem (jalview.util.MessageManager.getString ("label.threshold_feature_no_thereshold"));
-this.threshold.addItem (jalview.util.MessageManager.getString ("label.threshold_feature_above_thereshold"));
-this.threshold.addItem (jalview.util.MessageManager.getString ("label.threshold_feature_below_thereshold"));
-if (Clazz.instanceOf (this.oldcs, jalview.schemes.AnnotationColourGradient)) {
-var acg = this.oldcs;
-this.annotations.select (acg.getAnnotation ());
-switch (acg.getAboveThreshold ()) {
-case -1:
-this.threshold.select (new Integer (0));
-break;
-case 1:
-this.threshold.select (new Integer (1));
-break;
-case 0:
-this.threshold.select (new Integer (1));
-break;
-default:
-throw  new Error (jalview.util.MessageManager.getString ("error.implementation_error_dont_know_thereshold_annotationcolourgradient"));
-}
-this.thresholdIsMin.setState (acg.thresholdIsMinMax);
-this.thresholdValue.setText ("" + acg.getAnnotationThreshold ());
-}this.adjusting = false;
-this.changeColour ();
-this.frame =  new awt2swing.Frame ();
-this.frame.add (this);
-jalview.bin.JalviewLite.addFrame (this.frame, jalview.util.MessageManager.getString ("label.colour_by_annotation"), 560, 175);
-this.validate ();
-}, "jalview.appletgui.AlignViewport,jalview.appletgui.AlignmentPanel");
-Clazz.defineMethod (c$, "setDefaultMinMax", 
-($fz = function () {
-this.minColour.setBackground (this.av.applet.getDefaultColourParameter ("ANNOTATIONCOLOUR_MIN", java.awt.Color.orange));
-this.maxColour.setBackground (this.av.applet.getDefaultColourParameter ("ANNOTATIONCOLOUR_MAX", java.awt.Color.red));
-}, $fz.isPrivate = true, $fz));
-Clazz.makeConstructor (c$, 
-function () {
-Clazz.superConstructor (this, jalview.appletgui.AnnotationColourChooser, []);
-try {
-this.jbInit ();
-} catch (ex) {
-if (Clazz.exceptionOf (ex, Exception)) {
-ex.printStackTrace ();
-} else {
-throw ex;
-}
-}
-});
-Clazz.defineMethod (c$, "jbInit", 
-($fz = function () {
-this.minColour.setFont ( new java.awt.Font ("Verdana", 0, 11));
-this.minColour.setLabel (jalview.util.MessageManager.getString ("label.min_colour"));
-this.minColour.addActionListener (this);
-this.maxColour.setFont ( new java.awt.Font ("Verdana", 0, 11));
-this.maxColour.setLabel (jalview.util.MessageManager.getString ("label.max_colour"));
-this.maxColour.addActionListener (this);
-this.thresholdIsMin.addItemListener (this);
-this.ok.setLabel (jalview.util.MessageManager.getString ("action.ok"));
-this.ok.addActionListener (this);
-this.cancel.setLabel (jalview.util.MessageManager.getString ("action.cancel"));
-this.cancel.addActionListener (this);
-this.defColours.setLabel (jalview.util.MessageManager.getString ("action.set_defaults"));
-this.defColours.addActionListener (this);
-this.annotations.addItemListener (this);
-this.thresholdValue.addActionListener (this);
-this.slider.setBackground (java.awt.Color.white);
-this.slider.setPreferredSize ( new java.awt.Dimension (193, 21));
-this.slider.setEnabled (false);
-this.thresholdValue.setPreferredSize ( new java.awt.Dimension (79, 22));
-this.thresholdValue.setEnabled (false);
-this.thresholdValue.setColumns (5);
-this.currentColours.setFont ( new java.awt.Font ("Verdana", 0, 11));
-this.currentColours.setLabel (jalview.util.MessageManager.getString ("label.use_original_colours"));
-this.currentColours.addItemListener (this);
-this.thresholdIsMin.setBackground (java.awt.Color.white);
-this.thresholdIsMin.setLabel (jalview.util.MessageManager.getString ("label.threshold_minmax"));
-this.setLayout (this.borderLayout1);
-this.jPanel1.setBackground (java.awt.Color.white);
-this.jPanel2.setLayout ( new java.awt.FlowLayout ());
-this.jPanel2.setBackground (java.awt.Color.white);
-this.threshold.addItemListener (this);
-this.jPanel3.setLayout ( new java.awt.FlowLayout ());
-this.jPanel3.setBackground (java.awt.Color.white);
-var jPanel4 =  new awt2swing.Panel ();
-jPanel4.setLayout ( new java.awt.BorderLayout ());
-jPanel4.setBackground (java.awt.Color.white);
-this.jPanel1.add (this.ok);
-this.jPanel1.add (this.cancel);
-this.jPanel2.add (this.annotations);
-this.jPanel2.add (this.currentColours);
-this.jPanel2.add (this.minColour);
-this.jPanel2.add (this.maxColour);
-jPanel4.add (this.thresholdIsMin, "West");
-jPanel4.add (this.slider, "Center");
-jPanel4.add (this.thresholdValue, "East");
-var jPanel34 =  new awt2swing.Panel ();
-jPanel34.setLayout ( new java.awt.BorderLayout ());
-jPanel34.setBackground (java.awt.Color.white);
-jPanel34.add (this.jPanel2, "North");
-jPanel34.add (this.threshold, "West");
-this.jPanel3.add (this.defColours);
-jPanel34.add (this.jPanel3, "East");
-jPanel34.add (jPanel4, "South");
-this.add (jPanel34, "Center");
-this.add (this.jPanel1, "South");
-}, $fz.isPrivate = true, $fz));
-Clazz.overrideMethod (c$, "actionPerformed", 
-function (evt) {
-if (evt.getSource () === this.thresholdValue) {
-try {
-var f =  new Float (this.thresholdValue.getText ()).floatValue ();
-this.slider.setValue (Clazz.floatToInt (f * 1000));
-this.adjustmentValueChanged (null);
-} catch (ex) {
-if (Clazz.exceptionOf (ex, NumberFormatException)) {
-} else {
-throw ex;
-}
-}
-} else if (evt.getSource () === this.minColour) {
-this.minColour_actionPerformed (null);
-} else if (evt.getSource () === this.maxColour) {
-this.maxColour_actionPerformed (null);
-} else if (evt.getSource () === this.defColours) {
-this.defColour_actionPerformed ();
-} else if (evt.getSource () === this.ok) {
-this.changeColour ();
-this.frame.setVisible (false);
-} else if (evt.getSource () === this.cancel) {
-this.reset ();
-this.ap.paintAlignment (true);
-this.frame.setVisible (false);
-} else {
-this.changeColour ();
-}}, "java.awt.event.ActionEvent");
-Clazz.overrideMethod (c$, "itemStateChanged", 
-function (evt) {
-if (evt.getSource () === this.currentColours) {
-if (this.currentColours.getState ()) {
-this.reset ();
-}this.maxColour.setEnabled (!this.currentColours.getState ());
-this.minColour.setEnabled (!this.currentColours.getState ());
-}this.changeColour ();
-}, "java.awt.event.ItemEvent");
-Clazz.overrideMethod (c$, "adjustmentValueChanged", 
-function (evt) {
-if (!this.adjusting) {
-this.thresholdValue.setText ((this.slider.getValue () / 1000) + "");
-if (this.currentColours.getState () && !(Clazz.instanceOf (this.av.getGlobalColourScheme (), jalview.schemes.AnnotationColourGradient))) {
-this.changeColour ();
-}this.currentAnnotation.threshold.value = this.slider.getValue () / 1000;
-this.ap.paintAlignment (false);
-}}, "java.awt.event.AdjustmentEvent");
-Clazz.defineMethod (c$, "minColour_actionPerformed", 
-function (newCol) {
-if (newCol != null) {
-this.minColour.setBackground (newCol);
-this.minColour.repaint ();
-this.changeColour ();
-} else {
- new jalview.appletgui.UserDefinedColours (this, "Min Colour", this.minColour.getBackground ());
-}}, "java.awt.Color");
-Clazz.defineMethod (c$, "maxColour_actionPerformed", 
-function (newCol) {
-if (newCol != null) {
-this.maxColour.setBackground (newCol);
-this.maxColour.repaint ();
-this.changeColour ();
-} else {
- new jalview.appletgui.UserDefinedColours (this, "Max Colour", this.maxColour.getBackground ());
-}}, "java.awt.Color");
-Clazz.defineMethod (c$, "defColour_actionPerformed", 
-function () {
-this.setDefaultMinMax ();
-this.minColour.repaint ();
-this.maxColour.repaint ();
-this.changeColour ();
-});
-Clazz.defineMethod (c$, "changeColour", 
-function () {
-if (this.adjusting) {
-return;
-}this.currentAnnotation = this.av.getAlignment ().getAlignmentAnnotation ()[this.annotations.getSelectedIndex ()];
-var aboveThreshold = -1;
-if (this.threshold.getSelectedIndex () == 1) {
-aboveThreshold = 1;
-} else if (this.threshold.getSelectedIndex () == 2) {
-aboveThreshold = 0;
-}this.slider.setEnabled (true);
-this.thresholdValue.setEnabled (true);
-this.thresholdIsMin.setEnabled (true);
-if (aboveThreshold == -1) {
-this.slider.setEnabled (false);
-this.thresholdValue.setEnabled (false);
-this.thresholdIsMin.setEnabled (false);
-this.thresholdValue.setText ("");
-} else if (aboveThreshold != -1 && this.currentAnnotation.threshold == null) {
-this.currentAnnotation.setThreshold ( new jalview.datamodel.GraphLine ((this.currentAnnotation.graphMax - this.currentAnnotation.graphMin) / 2, "Threshold", java.awt.Color.black));
-}if (aboveThreshold != -1) {
-this.adjusting = true;
-this.slider.setMinimum (Clazz.floatToInt (this.currentAnnotation.graphMin * 1000));
-this.slider.setMaximum (Clazz.floatToInt (this.currentAnnotation.graphMax * 1000));
-this.slider.setValue (Clazz.floatToInt (this.currentAnnotation.threshold.value * 1000));
-this.thresholdValue.setText (this.currentAnnotation.threshold.value + "");
-this.slider.setEnabled (true);
-this.thresholdValue.setEnabled (true);
-this.adjusting = false;
-}var acg = null;
-if (this.currentColours.getState ()) {
-acg =  new jalview.schemes.AnnotationColourGradient (this.currentAnnotation, this.av.getGlobalColourScheme (), aboveThreshold);
-} else {
-acg =  new jalview.schemes.AnnotationColourGradient (this.currentAnnotation, this.minColour.getBackground (), this.maxColour.getBackground (), aboveThreshold);
-}if (this.currentAnnotation.graphMin == 0 && this.currentAnnotation.graphMax == 0) {
-acg.setPredefinedColours (true);
-}acg.thresholdIsMinMax = this.thresholdIsMin.getState ();
-this.av.setGlobalColourScheme (acg);
-if (this.av.getAlignment ().getGroups () != null) {
-for (var sg, $sg = this.ap.av.getAlignment ().getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {
-if (sg.cs == null) {
-continue;
-}if (this.currentColours.getState ()) {
-sg.cs =  new jalview.schemes.AnnotationColourGradient (this.currentAnnotation, sg.cs, aboveThreshold);
-} else {
-sg.cs =  new jalview.schemes.AnnotationColourGradient (this.currentAnnotation, this.minColour.getBackground (), this.maxColour.getBackground (), aboveThreshold);
-}}
-}this.ap.alignmentChanged ();
-this.ap.paintAlignment (true);
-});
-Clazz.defineMethod (c$, "reset", 
-function () {
-this.av.setGlobalColourScheme (this.oldcs);
-if (this.av.getAlignment ().getGroups () != null) {
-for (var sg, $sg = this.ap.av.getAlignment ().getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {
-var cs = this.oldgroupColours.get (sg);
-if (Clazz.instanceOf (cs, jalview.schemes.ColourSchemeI)) {
-sg.cs = cs;
-} else {
-sg.cs = null;
-}}
-}this.ap.paintAlignment (true);
-});
-Clazz.overrideMethod (c$, "mouseClicked", 
-function (evt) {
-}, "java.awt.event.MouseEvent");
-Clazz.overrideMethod (c$, "mousePressed", 
-function (evt) {
-}, "java.awt.event.MouseEvent");
-Clazz.overrideMethod (c$, "mouseReleased", 
-function (evt) {
-this.ap.paintAlignment (true);
-}, "java.awt.event.MouseEvent");
-Clazz.overrideMethod (c$, "mouseEntered", 
-function (evt) {
-}, "java.awt.event.MouseEvent");
-Clazz.overrideMethod (c$, "mouseExited", 
-function (evt) {
-}, "java.awt.event.MouseEvent");
-});
+Clazz.declarePackage ("jalview.appletgui");\r
+Clazz.load (["awt2swing.Panel", "java.awt.event.ActionListener", "$.AdjustmentListener", "$.ItemListener", "$.MouseListener", "awt2swing.Button", "$.Checkbox", "$.Choice", "$.Scrollbar", "$.TextField", "java.awt.BorderLayout", "$.FlowLayout"], "jalview.appletgui.AnnotationColourChooser", ["awt2swing.Frame", "jalview.appletgui.UserDefinedColours", "jalview.bin.JalviewLite", "jalview.datamodel.GraphLine", "jalview.schemes.AnnotationColourGradient", "$.ColourSchemeI", "jalview.util.MessageManager", "java.awt.Color", "$.Dimension", "$.Font", "java.lang.Error", "$.Float", "java.util.Hashtable", "$.Vector"], function () {\r
+c$ = Clazz.decorateAsClass (function () {\r
+this.frame = null;\r
+this.av = null;\r
+this.ap = null;\r
+this.oldcs = null;\r
+this.oldgroupColours = null;\r
+this.currentAnnotation = null;\r
+this.adjusting = false;\r
+this.annotations = null;\r
+this.minColour = null;\r
+this.maxColour = null;\r
+this.ok = null;\r
+this.cancel = null;\r
+this.defColours = null;\r
+this.jPanel1 = null;\r
+this.jPanel2 = null;\r
+this.threshold = null;\r
+this.flowLayout1 = null;\r
+this.jPanel3 = null;\r
+this.slider = null;\r
+this.thresholdValue = null;\r
+this.currentColours = null;\r
+this.borderLayout1 = null;\r
+this.thresholdIsMin = null;\r
+Clazz.instantialize (this, arguments);\r
+}, jalview.appletgui, "AnnotationColourChooser", awt2swing.Panel, [java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.event.ItemListener, java.awt.event.MouseListener]);\r
+Clazz.prepareFields (c$, function () {\r
+this.annotations =  new awt2swing.Choice ();\r
+this.minColour =  new awt2swing.Button ();\r
+this.maxColour =  new awt2swing.Button ();\r
+this.ok =  new awt2swing.Button ();\r
+this.cancel =  new awt2swing.Button ();\r
+this.defColours =  new awt2swing.Button ();\r
+this.jPanel1 =  new awt2swing.Panel ();\r
+this.jPanel2 =  new awt2swing.Panel ();\r
+this.threshold =  new awt2swing.Choice ();\r
+this.flowLayout1 =  new java.awt.FlowLayout ();\r
+this.jPanel3 =  new awt2swing.Panel ();\r
+this.slider =  new awt2swing.Scrollbar (0);\r
+this.thresholdValue =  new awt2swing.TextField (20);\r
+this.currentColours =  new awt2swing.Checkbox ();\r
+this.borderLayout1 =  new java.awt.BorderLayout ();\r
+this.thresholdIsMin =  new awt2swing.Checkbox ();\r
+});\r
+Clazz.makeConstructor (c$, \r
+function (av, ap) {\r
+Clazz.superConstructor (this, jalview.appletgui.AnnotationColourChooser, []);\r
+try {\r
+this.jbInit ();\r
+} catch (ex) {\r
+if (Clazz.exceptionOf (ex, Exception)) {\r
+} else {\r
+throw ex;\r
+}\r
+}\r
+this.oldcs = av.getGlobalColourScheme ();\r
+if (av.getAlignment ().getGroups () != null) {\r
+this.oldgroupColours =  new java.util.Hashtable ();\r
+for (var sg, $sg = ap.av.getAlignment ().getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {\r
+if (sg.cs != null) {\r
+this.oldgroupColours.put (sg, sg.cs);\r
+} else {\r
+this.oldgroupColours.put (sg, "null");\r
+}}\r
+}this.av = av;\r
+this.ap = ap;\r
+this.slider.addAdjustmentListener (this);\r
+this.slider.addMouseListener (this);\r
+if (av.getAlignment ().getAlignmentAnnotation () == null) {\r
+return;\r
+}this.setDefaultMinMax ();\r
+this.adjusting = true;\r
+if (Clazz.instanceOf (this.oldcs, jalview.schemes.AnnotationColourGradient)) {\r
+var acg = this.oldcs;\r
+this.currentColours.setState (acg.isPredefinedColours () || acg.getBaseColour () != null);\r
+if (!acg.isPredefinedColours () && acg.getBaseColour () == null) {\r
+this.minColour.setBackground (acg.getMinColour ());\r
+this.maxColour.setBackground (acg.getMaxColour ());\r
+}}var list =  new java.util.Vector ();\r
+var index = 1;\r
+for (var i = 0; i < av.getAlignment ().getAlignmentAnnotation ().length; i++) {\r
+var label = av.getAlignment ().getAlignmentAnnotation ()[i].label;\r
+if (!list.contains (label)) {\r
+list.addElement (label);\r
+} else {\r
+list.addElement (label + "_" + (index++));\r
+}}\r
+for (var i = 0; i < list.size (); i++) {\r
+this.annotations.addItem (list.elementAt (i).toString ());\r
+}\r
+this.threshold.addItem (jalview.util.MessageManager.getString ("label.threshold_feature_no_thereshold"));\r
+this.threshold.addItem (jalview.util.MessageManager.getString ("label.threshold_feature_above_thereshold"));\r
+this.threshold.addItem (jalview.util.MessageManager.getString ("label.threshold_feature_below_thereshold"));\r
+if (Clazz.instanceOf (this.oldcs, jalview.schemes.AnnotationColourGradient)) {\r
+var acg = this.oldcs;\r
+this.annotations.select (acg.getAnnotation ());\r
+switch (acg.getAboveThreshold ()) {\r
+case -1:\r
+this.threshold.select (new Integer (0));\r
+break;\r
+case 1:\r
+this.threshold.select (new Integer (1));\r
+break;\r
+case 0:\r
+this.threshold.select (new Integer (1));\r
+break;\r
+default:\r
+throw  new Error (jalview.util.MessageManager.getString ("error.implementation_error_dont_know_thereshold_annotationcolourgradient"));\r
+}\r
+this.thresholdIsMin.setState (acg.thresholdIsMinMax);\r
+this.thresholdValue.setText ("" + acg.getAnnotationThreshold ());\r
+}this.adjusting = false;\r
+this.changeColour ();\r
+this.frame =  new awt2swing.Frame ();\r
+this.frame.add (this);\r
+jalview.bin.JalviewLite.addFrame (this.frame, jalview.util.MessageManager.getString ("label.colour_by_annotation"), 560, 175);\r
+this.validate ();\r
+}, "jalview.appletgui.AlignViewport,jalview.appletgui.AlignmentPanel");\r
+Clazz.defineMethod (c$, "setDefaultMinMax", \r
+($fz = function () {\r
+this.minColour.setBackground (this.av.applet.getDefaultColourParameter ("ANNOTATIONCOLOUR_MIN", java.awt.Color.orange));\r
+this.maxColour.setBackground (this.av.applet.getDefaultColourParameter ("ANNOTATIONCOLOUR_MAX", java.awt.Color.red));\r
+}, $fz.isPrivate = true, $fz));\r
+Clazz.makeConstructor (c$, \r
+function () {\r
+Clazz.superConstructor (this, jalview.appletgui.AnnotationColourChooser, []);\r
+try {\r
+this.jbInit ();\r
+} catch (ex) {\r
+if (Clazz.exceptionOf (ex, Exception)) {\r
+ex.printStackTrace ();\r
+} else {\r
+throw ex;\r
+}\r
+}\r
+});\r
+Clazz.defineMethod (c$, "jbInit", \r
+($fz = function () {\r
+this.minColour.setFont ( new java.awt.Font ("Verdana", 0, 11));\r
+this.minColour.setLabel (jalview.util.MessageManager.getString ("label.min_colour"));\r
+this.minColour.addActionListener (this);\r
+this.maxColour.setFont ( new java.awt.Font ("Verdana", 0, 11));\r
+this.maxColour.setLabel (jalview.util.MessageManager.getString ("label.max_colour"));\r
+this.maxColour.addActionListener (this);\r
+this.thresholdIsMin.addItemListener (this);\r
+this.ok.setLabel (jalview.util.MessageManager.getString ("action.ok"));\r
+this.ok.addActionListener (this);\r
+this.cancel.setLabel (jalview.util.MessageManager.getString ("action.cancel"));\r
+this.cancel.addActionListener (this);\r
+this.defColours.setLabel (jalview.util.MessageManager.getString ("action.set_defaults"));\r
+this.defColours.addActionListener (this);\r
+this.annotations.addItemListener (this);\r
+this.thresholdValue.addActionListener (this);\r
+this.slider.setBackground (java.awt.Color.white);\r
+this.slider.setPreferredSize ( new java.awt.Dimension (193, 21));\r
+this.slider.setEnabled (false);\r
+this.thresholdValue.setPreferredSize ( new java.awt.Dimension (79, 22));\r
+this.thresholdValue.setEnabled (false);\r
+this.thresholdValue.setColumns (5);\r
+this.currentColours.setFont ( new java.awt.Font ("Verdana", 0, 11));\r
+this.currentColours.setLabel (jalview.util.MessageManager.getString ("label.use_original_colours"));\r
+this.currentColours.addItemListener (this);\r
+this.thresholdIsMin.setBackground (java.awt.Color.white);\r
+this.thresholdIsMin.setLabel (jalview.util.MessageManager.getString ("label.threshold_minmax"));\r
+this.setLayout (this.borderLayout1);\r
+this.jPanel1.setBackground (java.awt.Color.white);\r
+this.jPanel2.setLayout ( new java.awt.FlowLayout ());\r
+this.jPanel2.setBackground (java.awt.Color.white);\r
+this.threshold.addItemListener (this);\r
+this.jPanel3.setLayout ( new java.awt.FlowLayout ());\r
+this.jPanel3.setBackground (java.awt.Color.white);\r
+var jPanel4 =  new awt2swing.Panel ();\r
+jPanel4.setLayout ( new java.awt.BorderLayout ());\r
+jPanel4.setBackground (java.awt.Color.white);\r
+this.jPanel1.add (this.ok);\r
+this.jPanel1.add (this.cancel);\r
+this.jPanel2.add (this.annotations);\r
+this.jPanel2.add (this.currentColours);\r
+this.jPanel2.add (this.minColour);\r
+this.jPanel2.add (this.maxColour);\r
+jPanel4.add (this.thresholdIsMin, "West");\r
+jPanel4.add (this.slider, "Center");\r
+jPanel4.add (this.thresholdValue, "East");\r
+var jPanel34 =  new awt2swing.Panel ();\r
+jPanel34.setLayout ( new java.awt.BorderLayout ());\r
+jPanel34.setBackground (java.awt.Color.white);\r
+jPanel34.add (this.jPanel2, "North");\r
+jPanel34.add (this.threshold, "West");\r
+this.jPanel3.add (this.defColours);\r
+jPanel34.add (this.jPanel3, "East");\r
+jPanel34.add (jPanel4, "South");\r
+this.add (jPanel34, "Center");\r
+this.add (this.jPanel1, "South");\r
+}, $fz.isPrivate = true, $fz));\r
+Clazz.overrideMethod (c$, "actionPerformed", \r
+function (evt) {\r
+if (evt.getSource () === this.thresholdValue) {\r
+try {\r
+var f =  new Float (this.thresholdValue.getText ()).floatValue ();\r
+this.slider.setValue (Clazz.floatToInt (f * 1000));\r
+this.adjustmentValueChanged (null);\r
+} catch (ex) {\r
+if (Clazz.exceptionOf (ex, NumberFormatException)) {\r
+} else {\r
+throw ex;\r
+}\r
+}\r
+} else if (evt.getSource () === this.minColour) {\r
+this.minColour_actionPerformed (null);\r
+} else if (evt.getSource () === this.maxColour) {\r
+this.maxColour_actionPerformed (null);\r
+} else if (evt.getSource () === this.defColours) {\r
+this.defColour_actionPerformed ();\r
+} else if (evt.getSource () === this.ok) {\r
+this.changeColour ();\r
+this.frame.setVisible (false);\r
+} else if (evt.getSource () === this.cancel) {\r
+this.reset ();\r
+this.ap.paintAlignment (true);\r
+this.frame.setVisible (false);\r
+} else {\r
+this.changeColour ();\r
+}}, "java.awt.event.ActionEvent");\r
+Clazz.overrideMethod (c$, "itemStateChanged", \r
+function (evt) {\r
+if (evt.getSource () === this.currentColours) {\r
+if (this.currentColours.getState ()) {\r
+this.reset ();\r
+}this.maxColour.setEnabled (!this.currentColours.getState ());\r
+this.minColour.setEnabled (!this.currentColours.getState ());\r
+}this.changeColour ();\r
+}, "java.awt.event.ItemEvent");\r
+Clazz.overrideMethod (c$, "adjustmentValueChanged", \r
+function (evt) {\r
+if (!this.adjusting) {\r
+this.thresholdValue.setText ((this.slider.getValue () / 1000) + "");\r
+if (this.currentColours.getState () && !(Clazz.instanceOf (this.av.getGlobalColourScheme (), jalview.schemes.AnnotationColourGradient))) {\r
+this.changeColour ();\r
+}this.currentAnnotation.threshold.value = this.slider.getValue () / 1000;\r
+this.ap.paintAlignment (false);\r
+}}, "java.awt.event.AdjustmentEvent");\r
+Clazz.defineMethod (c$, "minColour_actionPerformed", \r
+function (newCol) {\r
+if (newCol != null) {\r
+this.minColour.setBackground (newCol);\r
+this.minColour.repaint ();\r
+this.changeColour ();\r
+} else {\r
+ new jalview.appletgui.UserDefinedColours (this, "Min Colour", this.minColour.getBackground ());\r
+}}, "java.awt.Color");\r
+Clazz.defineMethod (c$, "maxColour_actionPerformed", \r
+function (newCol) {\r
+if (newCol != null) {\r
+this.maxColour.setBackground (newCol);\r
+this.maxColour.repaint ();\r
+this.changeColour ();\r
+} else {\r
+ new jalview.appletgui.UserDefinedColours (this, "Max Colour", this.maxColour.getBackground ());\r
+}}, "java.awt.Color");\r
+Clazz.defineMethod (c$, "defColour_actionPerformed", \r
+function () {\r
+this.setDefaultMinMax ();\r
+this.minColour.repaint ();\r
+this.maxColour.repaint ();\r
+this.changeColour ();\r
+});\r
+Clazz.defineMethod (c$, "changeColour", \r
+function () {\r
+if (this.adjusting) {\r
+return;\r
+}this.currentAnnotation = this.av.getAlignment ().getAlignmentAnnotation ()[this.annotations.getSelectedIndex ()];\r
+var aboveThreshold = -1;\r
+if (this.threshold.getSelectedIndex () == 1) {\r
+aboveThreshold = 1;\r
+} else if (this.threshold.getSelectedIndex () == 2) {\r
+aboveThreshold = 0;\r
+}this.slider.setEnabled (true);\r
+this.thresholdValue.setEnabled (true);\r
+this.thresholdIsMin.setEnabled (true);\r
+if (aboveThreshold == -1) {\r
+this.slider.setEnabled (false);\r
+this.thresholdValue.setEnabled (false);\r
+this.thresholdIsMin.setEnabled (false);\r
+this.thresholdValue.setText ("");\r
+} else if (aboveThreshold != -1 && this.currentAnnotation.threshold == null) {\r
+this.currentAnnotation.setThreshold ( new jalview.datamodel.GraphLine ((this.currentAnnotation.graphMax - this.currentAnnotation.graphMin) / 2, "Threshold", java.awt.Color.black));\r
+}if (aboveThreshold != -1) {\r
+this.adjusting = true;\r
+this.slider.setMinimum (Clazz.floatToInt (this.currentAnnotation.graphMin * 1000));\r
+this.slider.setMaximum (Clazz.floatToInt (this.currentAnnotation.graphMax * 1000));\r
+this.slider.setValue (Clazz.floatToInt (this.currentAnnotation.threshold.value * 1000));\r
+this.thresholdValue.setText (this.currentAnnotation.threshold.value + "");\r
+this.slider.setEnabled (true);\r
+this.thresholdValue.setEnabled (true);\r
+this.adjusting = false;\r
+}var acg = null;\r
+if (this.currentColours.getState ()) {\r
+acg =  new jalview.schemes.AnnotationColourGradient (this.currentAnnotation, this.av.getGlobalColourScheme (), aboveThreshold);\r
+} else {\r
+acg =  new jalview.schemes.AnnotationColourGradient (this.currentAnnotation, this.minColour.getBackground (), this.maxColour.getBackground (), aboveThreshold);\r
+}if (this.currentAnnotation.graphMin == 0 && this.currentAnnotation.graphMax == 0) {\r
+acg.setPredefinedColours (true);\r
+}acg.thresholdIsMinMax = this.thresholdIsMin.getState ();\r
+this.av.setGlobalColourScheme (acg);\r
+if (this.av.getAlignment ().getGroups () != null) {\r
+for (var sg, $sg = this.ap.av.getAlignment ().getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {\r
+if (sg.cs == null) {\r
+continue;\r
+}if (this.currentColours.getState ()) {\r
+sg.cs =  new jalview.schemes.AnnotationColourGradient (this.currentAnnotation, sg.cs, aboveThreshold);\r
+} else {\r
+sg.cs =  new jalview.schemes.AnnotationColourGradient (this.currentAnnotation, this.minColour.getBackground (), this.maxColour.getBackground (), aboveThreshold);\r
+}}\r
+}this.ap.alignmentChanged ();\r
+this.ap.paintAlignment (true);\r
+});\r
+Clazz.defineMethod (c$, "reset", \r
+function () {\r
+this.av.setGlobalColourScheme (this.oldcs);\r
+if (this.av.getAlignment ().getGroups () != null) {\r
+for (var sg, $sg = this.ap.av.getAlignment ().getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {\r
+var cs = this.oldgroupColours.get (sg);\r
+if (Clazz.instanceOf (cs, jalview.schemes.ColourSchemeI)) {\r
+sg.cs = cs;\r
+} else {\r
+sg.cs = null;\r
+}}\r
+}this.ap.paintAlignment (true);\r
+});\r
+Clazz.overrideMethod (c$, "mouseClicked", \r
+function (evt) {\r
+}, "java.awt.event.MouseEvent");\r
+Clazz.overrideMethod (c$, "mousePressed", \r
+function (evt) {\r
+}, "java.awt.event.MouseEvent");\r
+Clazz.overrideMethod (c$, "mouseReleased", \r
+function (evt) {\r
+this.ap.paintAlignment (true);\r
+}, "java.awt.event.MouseEvent");\r
+Clazz.overrideMethod (c$, "mouseEntered", \r
+function (evt) {\r
+}, "java.awt.event.MouseEvent");\r
+Clazz.overrideMethod (c$, "mouseExited", \r
+function (evt) {\r
+}, "java.awt.event.MouseEvent");\r
+});\r