X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2Fjalview%2Fappletgui%2FUserDefinedColours.js;h=a1b23f6cead36ba90c43239d8512f98d595416a9;hp=2cc0d9b87a1d8d44b5620eb730a352549e638c41;hb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/jalview/appletgui/UserDefinedColours.js b/bin/jalview/appletgui/UserDefinedColours.js index 2cc0d9b..a1b23f6 100644 --- a/bin/jalview/appletgui/UserDefinedColours.js +++ b/bin/jalview/appletgui/UserDefinedColours.js @@ -1,481 +1,481 @@ -Clazz.declarePackage ("jalview.appletgui"); -Clazz.load (["awt2swing.Panel", "java.awt.event.ActionListener", "$.AdjustmentListener", "$.FocusListener", "awt2swing.Button", "$.Label", "$.Scrollbar", "$.TextField", "java.awt.GridLayout", "java.util.Vector"], "jalview.appletgui.UserDefinedColours", ["awt2swing.Frame", "jalview.appletgui.AnnotationColourChooser", "$.FeatureColourChooser", "$.FeatureRenderer", "$.FeatureSettings", "jalview.bin.JalviewLite", "jalview.schemes.ResidueProperties", "$.UserColourScheme", "jalview.util.MessageManager", "java.awt.Color", "$.Dialog", "$.Font", "$.Rectangle", "java.awt.event.MouseAdapter", "java.lang.Error"], function () { -c$ = Clazz.decorateAsClass (function () { -this.ap = null; -this.seqGroup = null; -this.selectedButton = null; -this.oldColours = null; -this.oldColourScheme = null; -this.frame = null; -this.jmol = null; -this.dialog = null; -this.caller = null; -this.originalLabel = null; -this.originalColour = null; -this.R = 0; -this.G = 0; -this.B = 0; -this.buttonPanel = null; -this.gridLayout = null; -this.okcancelPanel = null; -this.okButton = null; -this.applyButton = null; -this.cancelButton = null; -this.rScroller = null; -this.label1 = null; -this.rText = null; -this.label4 = null; -this.gScroller = null; -this.gText = null; -this.label5 = null; -this.bScroller = null; -this.bText = null; -this.target = null; -Clazz.instantialize (this, arguments); -}, jalview.appletgui, "UserDefinedColours", awt2swing.Panel, [java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.event.FocusListener]); -Clazz.prepareFields (c$, function () { -this.oldColours = new java.util.Vector (); -this.buttonPanel = new awt2swing.Panel (); -this.gridLayout = new java.awt.GridLayout (); -this.okcancelPanel = new awt2swing.Panel (); -this.okButton = new awt2swing.Button (); -this.applyButton = new awt2swing.Button (); -this.cancelButton = new awt2swing.Button (); -this.rScroller = new awt2swing.Scrollbar (); -this.label1 = new awt2swing.Label (); -this.rText = new awt2swing.TextField (); -this.label4 = new awt2swing.Label (); -this.gScroller = new awt2swing.Scrollbar (); -this.gText = new awt2swing.TextField (); -this.label5 = new awt2swing.Label (); -this.bScroller = new awt2swing.Scrollbar (); -this.bText = new awt2swing.TextField (); -this.target = new awt2swing.Panel (); -}); -Clazz.defineMethod (c$, "loadDefaultColours", -function () { -return null; -}); -Clazz.makeConstructor (c$, -function (ap, sg) { -Clazz.superConstructor (this, jalview.appletgui.UserDefinedColours, []); -this.ap = ap; -this.seqGroup = sg; -if (this.seqGroup != null) { -this.oldColourScheme = this.seqGroup.cs; -} else { -this.oldColourScheme = ap.av.getGlobalColourScheme (); -}this.init (); -}, "jalview.appletgui.AlignmentPanel,jalview.datamodel.SequenceGroup"); -Clazz.makeConstructor (c$, -function (jmol) { -Clazz.superConstructor (this, jalview.appletgui.UserDefinedColours, []); -this.jmol = jmol; -this.init (); -}, "jalview.appletgui.AppletJmol"); -Clazz.makeConstructor (c$, -function (fr, alignframe) { -Clazz.superConstructor (this, jalview.appletgui.UserDefinedColours, []); -this.caller = fr; -this.originalColour = fr.colourPanel.getBackground (); -this.originalLabel = "Feature Colour"; -this.setForDialog ("Select Feature Colour", alignframe); -this.setTargetColour (fr.colourPanel.getBackground ()); -this.dialog.setVisible (true); -}, "jalview.appletgui.FeatureRenderer,awt2swing.Frame"); -Clazz.makeConstructor (c$, -function (caller, col1, alignframe) { -this.construct (caller, col1, alignframe, "Select Colour"); -}, "java.awt.Component,java.awt.Color,awt2swing.Frame"); -Clazz.makeConstructor (c$, -function (caller, col1, alignframe, title) { -Clazz.superConstructor (this, jalview.appletgui.UserDefinedColours, []); -this.caller = caller; -this.originalColour = col1; -this.originalLabel = title; -this.setForDialog (title, alignframe); -this.setTargetColour (col1); -this.dialog.setVisible (true); -}, "java.awt.Component,java.awt.Color,awt2swing.Frame,~S"); -Clazz.makeConstructor (c$, -function (caller, label, colour) { -this.construct (caller, label, colour, colour); -}, "~O,~S,java.awt.Color"); -Clazz.makeConstructor (c$, -function (me, type, graduatedColor) { -this.construct (me, type, graduatedColor, graduatedColor.getMaxColor ()); -}, "jalview.appletgui.FeatureSettings,~S,jalview.schemes.GraduatedColor"); -Clazz.makeConstructor (c$, -($fz = function (caller, label, ocolour, colour) { -Clazz.superConstructor (this, jalview.appletgui.UserDefinedColours, []); -this.caller = caller; -this.originalColour = ocolour; -this.originalLabel = label; -this.init (); -this.remove (this.buttonPanel); -this.setTargetColour (colour); -this.okcancelPanel.setBounds ( new java.awt.Rectangle (0, 113, 400, 35)); -this.frame.setTitle (jalview.util.MessageManager.getString ("label.user_defined_colours") + " - " + label); -this.frame.setSize (420, 200); -}, $fz.isPrivate = true, $fz), "~O,~S,~O,java.awt.Color"); -Clazz.defineMethod (c$, "setForDialog", -function (title, alignframe) { -this.init (); -this.frame.setVisible (false); -this.remove (this.buttonPanel); -if (Clazz.instanceOf (alignframe, awt2swing.Frame)) { -this.dialog = new java.awt.Dialog (alignframe, title, true); -} else { -throw new Error (jalview.util.MessageManager.getString ("label.error_unsupported_owwner_user_colour_scheme")); -}this.dialog.add (this); -this.setSize (400, 123); -this.okcancelPanel.setBounds ( new java.awt.Rectangle (0, 123, 400, 35)); -var height = 160 + alignframe.getInsets ().top + this.getInsets ().bottom; -var width = 400; -this.dialog.setBounds (alignframe.getBounds ().x + Clazz.doubleToInt ((alignframe.getSize ().width - width) / 2), alignframe.getBounds ().y + Clazz.doubleToInt ((alignframe.getSize ().height - height) / 2), width, height); -}, "~S,java.awt.Container"); -Clazz.overrideMethod (c$, "actionPerformed", -function (evt) { -var source = evt.getSource (); -if (source === this.okButton) { -this.okButton_actionPerformed (); -} else if (source === this.applyButton) { -this.applyButton_actionPerformed (); -} else if (source === this.cancelButton) { -this.cancelButton_actionPerformed (); -} else if (source === this.rText) { -this.rText_actionPerformed (); -} else if (source === this.gText) { -this.gText_actionPerformed (); -} else if (source === this.bText) { -this.bText_actionPerformed (); -}}, "java.awt.event.ActionEvent"); -Clazz.overrideMethod (c$, "adjustmentValueChanged", -function (evt) { -if (evt.getSource () === this.rScroller) { -this.rScroller_adjustmentValueChanged (); -} else if (evt.getSource () === this.gScroller) { -this.gScroller_adjustmentValueChanged (); -} else if (evt.getSource () === this.bScroller) { -this.bScroller_adjustmentValueChanged (); -}}, "java.awt.event.AdjustmentEvent"); -Clazz.defineMethod (c$, "init", -function () { -try { -this.jbInit (); -} catch (e) { -if (Clazz.exceptionOf (e, Exception)) { -e.printStackTrace (); -} else { -throw e; -} -} -this.frame = new awt2swing.Frame (); -this.frame.add (this); -jalview.bin.JalviewLite.addFrame (this.frame, jalview.util.MessageManager.getString ("label.user_defined_colours"), 420, 345); -if (this.seqGroup != null) { -this.frame.setTitle (this.frame.getTitle () + " (" + this.seqGroup.getName () + ")"); -}for (var i = 0; i < 20; i++) { -this.makeButton (jalview.schemes.ResidueProperties.aa2Triplet.get (jalview.schemes.ResidueProperties.aa[i]) + "", jalview.schemes.ResidueProperties.aa[i]); -} -this.makeButton ("B", "B"); -this.makeButton ("Z", "Z"); -this.makeButton ("X", "X"); -this.makeButton ("Gap", "'.','-',' '"); -this.validate (); -}); -Clazz.defineMethod (c$, "rText_actionPerformed", -function () { -try { -var i = Integer.parseInt (this.rText.getText ()); -this.rScroller.setValue (i); -this.rScroller_adjustmentValueChanged (); -} catch (ex) { -if (Clazz.exceptionOf (ex, NumberFormatException)) { -} else { -throw ex; -} -} -}); -Clazz.defineMethod (c$, "gText_actionPerformed", -function () { -try { -var i = Integer.parseInt (this.gText.getText ()); -this.gScroller.setValue (i); -this.gScroller_adjustmentValueChanged (); -} catch (ex) { -if (Clazz.exceptionOf (ex, NumberFormatException)) { -} else { -throw ex; -} -} -}); -Clazz.defineMethod (c$, "bText_actionPerformed", -function () { -try { -var i = Integer.parseInt (this.bText.getText ()); -this.bScroller.setValue (i); -this.bScroller_adjustmentValueChanged (); -} catch (ex) { -if (Clazz.exceptionOf (ex, NumberFormatException)) { -} else { -throw ex; -} -} -}); -Clazz.defineMethod (c$, "rScroller_adjustmentValueChanged", -function () { -this.R = this.rScroller.getValue (); -this.rText.setText (this.R + ""); -this.colourChanged (); -}); -Clazz.defineMethod (c$, "gScroller_adjustmentValueChanged", -function () { -this.G = this.gScroller.getValue (); -this.gText.setText (this.G + ""); -this.colourChanged (); -}); -Clazz.defineMethod (c$, "bScroller_adjustmentValueChanged", -function () { -this.B = this.bScroller.getValue (); -this.bText.setText (this.B + ""); -this.colourChanged (); -}); -Clazz.defineMethod (c$, "colourChanged", -function () { -var col = new java.awt.Color (this.R, this.G, this.B); -this.target.setBackground (col); -this.target.repaint (); -if (this.selectedButton != null) { -this.selectedButton.setBackground (col); -this.selectedButton.repaint (); -}}); -Clazz.defineMethod (c$, "setTargetColour", -function (col) { -this.R = col.getRed (); -this.G = col.getGreen (); -this.B = col.getBlue (); -this.rScroller.setValue (this.R); -this.gScroller.setValue (this.G); -this.bScroller.setValue (this.B); -this.rText.setText (this.R + ""); -this.gText.setText (this.G + ""); -this.bText.setText (this.B + ""); -this.colourChanged (); -}, "java.awt.Color"); -Clazz.defineMethod (c$, "colourButtonPressed", -function (e) { -this.selectedButton = e.getSource (); -this.setTargetColour (this.selectedButton.getBackground ()); -}, "java.awt.event.MouseEvent"); -Clazz.defineMethod (c$, "makeButton", -function (label, aa) { -var button = new awt2swing.Button (); -var col = java.awt.Color.white; -if (this.oldColourScheme != null) { -try { -col = this.oldColourScheme.findColour (aa.charAt (0), -1, null); -} catch (ex) { -if (Clazz.exceptionOf (ex, Exception)) { -} else { -throw ex; -} -} -}button.setBackground (col); -this.oldColours.addElement (col); -button.setLabel (label); -button.setForeground (col.darker ().darker ().darker ()); -button.setFont ( new java.awt.Font ("Verdana", 1, 10)); -button.addMouseListener (((Clazz.isClassDefined ("jalview.appletgui.UserDefinedColours$1") ? 0 : jalview.appletgui.UserDefinedColours.$UserDefinedColours$1$ ()), Clazz.innerTypeInstance (jalview.appletgui.UserDefinedColours$1, this, null))); -this.buttonPanel.add (button, null); -}, "~S,~S"); -Clazz.defineMethod (c$, "okButton_actionPerformed", -function () { -this.applyButton_actionPerformed (); -if (this.dialog != null) { -this.dialog.setVisible (false); -}this.frame.setVisible (false); -}); -Clazz.defineMethod (c$, "getColor", -function () { -return new java.awt.Color (this.R, this.G, this.B); -}); -Clazz.defineMethod (c$, "applyButton_actionPerformed", -function () { -if (this.caller != null) { -if (Clazz.instanceOf (this.caller, jalview.appletgui.FeatureSettings)) { -(this.caller).setUserColour (this.originalLabel, this.getColor ()); -} else if (Clazz.instanceOf (this.caller, jalview.appletgui.AnnotationColourChooser)) { -if (this.originalLabel.equals ("Min Colour")) { -(this.caller).minColour_actionPerformed (this.getColor ()); -} else { -(this.caller).maxColour_actionPerformed (this.getColor ()); -}} else if (Clazz.instanceOf (this.caller, jalview.appletgui.FeatureRenderer)) { -(this.caller).colourPanel.updateColor (this.getColor ()); -} else if (Clazz.instanceOf (this.caller, jalview.appletgui.FeatureColourChooser)) { -if (this.originalLabel.indexOf ("inimum") > -1) { -(this.caller).minColour_actionPerformed (this.getColor ()); -} else { -(this.caller).maxColour_actionPerformed (this.getColor ()); -}}return; -}var newColours = new Array (24); -for (var i = 0; i < 24; i++) { -var button = this.buttonPanel.getComponent (i); -newColours[i] = button.getBackground (); -} -var ucs = new jalview.schemes.UserColourScheme (newColours); -if (this.ap != null) { -ucs.setThreshold (0, this.ap.av.isIgnoreGapsConsensus ()); -}if (this.ap != null) { -if (this.seqGroup != null) { -this.seqGroup.cs = ucs; -} else { -this.ap.av.setGlobalColourScheme (ucs); -}this.ap.seqPanel.seqCanvas.img = null; -this.ap.paintAlignment (true); -} else if (this.jmol != null) { -this.jmol.setJalviewColourScheme (ucs); -}}); -Clazz.defineMethod (c$, "cancelButton_actionPerformed", -function () { -if (this.caller != null) { -if (Clazz.instanceOf (this.caller, jalview.appletgui.FeatureSettings)) { -(this.caller).setUserColour (this.originalLabel, this.originalColour); -} else if (Clazz.instanceOf (this.caller, jalview.appletgui.AnnotationColourChooser)) { -if (this.originalLabel.equals ("Min Colour")) { -(this.caller).minColour_actionPerformed (this.originalColour); -} else { -(this.caller).maxColour_actionPerformed (this.originalColour); -}} else if (Clazz.instanceOf (this.caller, jalview.appletgui.FeatureRenderer)) { -(this.caller).colourPanel.updateColor (this.originalColour); -} else if (Clazz.instanceOf (this.caller, jalview.appletgui.FeatureColourChooser)) { -if (this.originalLabel.indexOf ("inimum") > -1) { -(this.caller).minColour_actionPerformed (this.originalColour); -} else { -(this.caller).maxColour_actionPerformed (this.originalColour); -}}if (this.dialog != null) { -this.dialog.setVisible (false); -}this.frame.setVisible (false); -return; -}var newColours = new Array (24); -for (var i = 0; i < 24; i++) { -newColours[i] = this.oldColours.elementAt (i); -this.buttonPanel.getComponent (i).setBackground (newColours[i]); -} -var ucs = new jalview.schemes.UserColourScheme (newColours); -if (this.ap != null) { -if (this.seqGroup != null) { -this.seqGroup.cs = ucs; -} else { -this.ap.av.setGlobalColourScheme (ucs); -}this.ap.paintAlignment (true); -} else if (this.jmol != null) { -this.jmol.setJalviewColourScheme (ucs); -}this.frame.setVisible (false); -}); -Clazz.defineMethod (c$, "jbInit", -($fz = function () { -this.setLayout (null); -this.buttonPanel.setLayout (this.gridLayout); -this.gridLayout.setColumns (6); -this.gridLayout.setRows (4); -this.okButton.setFont ( new java.awt.Font ("Verdana", 0, 11)); -this.okButton.setLabel (jalview.util.MessageManager.getString ("action.ok")); -this.okButton.addActionListener (this); -this.applyButton.setFont ( new java.awt.Font ("Verdana", 0, 11)); -this.applyButton.setLabel (jalview.util.MessageManager.getString ("action.apply")); -this.applyButton.addActionListener (this); -this.cancelButton.setFont ( new java.awt.Font ("Verdana", 0, 11)); -this.cancelButton.setLabel (jalview.util.MessageManager.getString ("action.cancel")); -this.cancelButton.addActionListener (this); -this.setBackground ( new java.awt.Color (212, 208, 223)); -this.okcancelPanel.setBounds ( new java.awt.Rectangle (0, 265, 400, 35)); -this.buttonPanel.setBounds ( new java.awt.Rectangle (0, 123, 400, 142)); -this.rScroller.setMaximum (256); -this.rScroller.setMinimum (0); -this.rScroller.setOrientation (0); -this.rScroller.setUnitIncrement (1); -this.rScroller.setVisibleAmount (1); -this.rScroller.setBounds ( new java.awt.Rectangle (36, 27, 119, 19)); -this.rScroller.addAdjustmentListener (this); -this.label1.setAlignment (4); -this.label1.setText ("R"); -this.label1.setBounds ( new java.awt.Rectangle (19, 30, 16, 15)); -this.rText.setFont ( new java.awt.Font ("Dialog", 0, 10)); -this.rText.setText ("0 "); -this.rText.setBounds ( new java.awt.Rectangle (156, 27, 53, 19)); -this.rText.addActionListener (this); -this.rText.addFocusListener (this); -this.label4.setAlignment (4); -this.label4.setText ("G"); -this.label4.setBounds ( new java.awt.Rectangle (15, 56, 20, 15)); -this.gScroller.setMaximum (256); -this.gScroller.setMinimum (0); -this.gScroller.setOrientation (0); -this.gScroller.setUnitIncrement (1); -this.gScroller.setVisibleAmount (1); -this.gScroller.setBounds ( new java.awt.Rectangle (35, 52, 120, 20)); -this.gScroller.addAdjustmentListener (this); -this.gText.setFont ( new java.awt.Font ("Dialog", 0, 10)); -this.gText.setText ("0 "); -this.gText.setBounds ( new java.awt.Rectangle (156, 52, 53, 20)); -this.gText.addActionListener (this); -this.gText.addFocusListener (this); -this.label5.setAlignment (4); -this.label5.setText ("B"); -this.label5.setBounds ( new java.awt.Rectangle (14, 82, 20, 15)); -this.bScroller.setMaximum (256); -this.bScroller.setMinimum (0); -this.bScroller.setOrientation (0); -this.bScroller.setUnitIncrement (1); -this.bScroller.setVisibleAmount (1); -this.bScroller.setBounds ( new java.awt.Rectangle (35, 78, 120, 20)); -this.bScroller.addAdjustmentListener (this); -this.bText.setFont ( new java.awt.Font ("Dialog", 0, 10)); -this.bText.setText ("0 "); -this.bText.setBounds ( new java.awt.Rectangle (157, 78, 52, 20)); -this.bText.addActionListener (this); -this.bText.addFocusListener (this); -this.target.setBackground (java.awt.Color.black); -this.target.setBounds ( new java.awt.Rectangle (229, 26, 134, 79)); -this.add (this.okcancelPanel, null); -this.okcancelPanel.add (this.okButton, null); -this.okcancelPanel.add (this.applyButton, null); -this.okcancelPanel.add (this.cancelButton, null); -this.add (this.rText); -this.add (this.gText); -this.add (this.bText); -this.add (this.buttonPanel, null); -this.add (this.target, null); -this.add (this.gScroller); -this.add (this.rScroller); -this.add (this.bScroller); -this.add (this.label5); -this.add (this.label4); -this.add (this.label1); -}, $fz.isPrivate = true, $fz)); -Clazz.overrideMethod (c$, "focusGained", -function (e) { -}, "java.awt.event.FocusEvent"); -Clazz.overrideMethod (c$, "focusLost", -function (e) { -var c = e.getComponent (); -if (c === this.rText) { -this.rText_actionPerformed (); -} else { -if (c === this.gText) { -this.gText_actionPerformed (); -} else { -if (c === this.bText) { -this.bText_actionPerformed (); -}}}}, "java.awt.event.FocusEvent"); -c$.$UserDefinedColours$1$ = function () { -Clazz.pu$h (); -c$ = Clazz.declareAnonymous (jalview.appletgui, "UserDefinedColours$1", java.awt.event.MouseAdapter); -Clazz.overrideMethod (c$, "mousePressed", -function (e) { -this.b$["jalview.appletgui.UserDefinedColours"].colourButtonPressed (e); -}, "java.awt.event.MouseEvent"); -c$ = Clazz.p0p (); -}; -}); +Clazz.declarePackage ("jalview.appletgui"); +Clazz.load (["awt2swing.Panel", "java.awt.event.ActionListener", "$.AdjustmentListener", "$.FocusListener", "awt2swing.Button", "$.Label", "$.Scrollbar", "$.TextField", "java.awt.GridLayout", "java.util.Vector"], "jalview.appletgui.UserDefinedColours", ["awt2swing.Frame", "jalview.appletgui.AnnotationColourChooser", "$.FeatureColourChooser", "$.FeatureRenderer", "$.FeatureSettings", "jalview.bin.JalviewLite", "jalview.schemes.ResidueProperties", "$.UserColourScheme", "jalview.util.MessageManager", "java.awt.Color", "$.Dialog", "$.Font", "$.Rectangle", "java.awt.event.MouseAdapter", "java.lang.Error"], function () { +c$ = Clazz.decorateAsClass (function () { +this.ap = null; +this.seqGroup = null; +this.selectedButton = null; +this.oldColours = null; +this.oldColourScheme = null; +this.frame = null; +this.jmol = null; +this.dialog = null; +this.caller = null; +this.originalLabel = null; +this.originalColour = null; +this.R = 0; +this.G = 0; +this.B = 0; +this.buttonPanel = null; +this.gridLayout = null; +this.okcancelPanel = null; +this.okButton = null; +this.applyButton = null; +this.cancelButton = null; +this.rScroller = null; +this.label1 = null; +this.rText = null; +this.label4 = null; +this.gScroller = null; +this.gText = null; +this.label5 = null; +this.bScroller = null; +this.bText = null; +this.target = null; +Clazz.instantialize (this, arguments); +}, jalview.appletgui, "UserDefinedColours", awt2swing.Panel, [java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.event.FocusListener]); +Clazz.prepareFields (c$, function () { +this.oldColours = new java.util.Vector (); +this.buttonPanel = new awt2swing.Panel (); +this.gridLayout = new java.awt.GridLayout (); +this.okcancelPanel = new awt2swing.Panel (); +this.okButton = new awt2swing.Button (); +this.applyButton = new awt2swing.Button (); +this.cancelButton = new awt2swing.Button (); +this.rScroller = new awt2swing.Scrollbar (); +this.label1 = new awt2swing.Label (); +this.rText = new awt2swing.TextField (); +this.label4 = new awt2swing.Label (); +this.gScroller = new awt2swing.Scrollbar (); +this.gText = new awt2swing.TextField (); +this.label5 = new awt2swing.Label (); +this.bScroller = new awt2swing.Scrollbar (); +this.bText = new awt2swing.TextField (); +this.target = new awt2swing.Panel (); +}); +Clazz.defineMethod (c$, "loadDefaultColours", +function () { +return null; +}); +Clazz.makeConstructor (c$, +function (ap, sg) { +Clazz.superConstructor (this, jalview.appletgui.UserDefinedColours, []); +this.ap = ap; +this.seqGroup = sg; +if (this.seqGroup != null) { +this.oldColourScheme = this.seqGroup.cs; +} else { +this.oldColourScheme = ap.av.getGlobalColourScheme (); +}this.init (); +}, "jalview.appletgui.AlignmentPanel,jalview.datamodel.SequenceGroup"); +Clazz.makeConstructor (c$, +function (jmol) { +Clazz.superConstructor (this, jalview.appletgui.UserDefinedColours, []); +this.jmol = jmol; +this.init (); +}, "jalview.appletgui.AppletJmol"); +Clazz.makeConstructor (c$, +function (fr, alignframe) { +Clazz.superConstructor (this, jalview.appletgui.UserDefinedColours, []); +this.caller = fr; +this.originalColour = fr.colourPanel.getBackground (); +this.originalLabel = "Feature Colour"; +this.setForDialog ("Select Feature Colour", alignframe); +this.setTargetColour (fr.colourPanel.getBackground ()); +this.dialog.setVisible (true); +}, "jalview.appletgui.FeatureRenderer,awt2swing.Frame"); +Clazz.makeConstructor (c$, +function (caller, col1, alignframe) { +this.construct (caller, col1, alignframe, "Select Colour"); +}, "java.awt.Component,java.awt.Color,awt2swing.Frame"); +Clazz.makeConstructor (c$, +function (caller, col1, alignframe, title) { +Clazz.superConstructor (this, jalview.appletgui.UserDefinedColours, []); +this.caller = caller; +this.originalColour = col1; +this.originalLabel = title; +this.setForDialog (title, alignframe); +this.setTargetColour (col1); +this.dialog.setVisible (true); +}, "java.awt.Component,java.awt.Color,awt2swing.Frame,~S"); +Clazz.makeConstructor (c$, +function (caller, label, colour) { +this.construct (caller, label, colour, colour); +}, "~O,~S,java.awt.Color"); +Clazz.makeConstructor (c$, +function (me, type, graduatedColor) { +this.construct (me, type, graduatedColor, graduatedColor.getMaxColor ()); +}, "jalview.appletgui.FeatureSettings,~S,jalview.schemes.GraduatedColor"); +Clazz.makeConstructor (c$, +($fz = function (caller, label, ocolour, colour) { +Clazz.superConstructor (this, jalview.appletgui.UserDefinedColours, []); +this.caller = caller; +this.originalColour = ocolour; +this.originalLabel = label; +this.init (); +this.remove (this.buttonPanel); +this.setTargetColour (colour); +this.okcancelPanel.setBounds ( new java.awt.Rectangle (0, 113, 400, 35)); +this.frame.setTitle (jalview.util.MessageManager.getString ("label.user_defined_colours") + " - " + label); +this.frame.setSize (420, 200); +}, $fz.isPrivate = true, $fz), "~O,~S,~O,java.awt.Color"); +Clazz.defineMethod (c$, "setForDialog", +function (title, alignframe) { +this.init (); +this.frame.setVisible (false); +this.remove (this.buttonPanel); +if (Clazz.instanceOf (alignframe, awt2swing.Frame)) { +this.dialog = new java.awt.Dialog (alignframe, title, true); +} else { +throw new Error (jalview.util.MessageManager.getString ("label.error_unsupported_owwner_user_colour_scheme")); +}this.dialog.add (this); +this.setSize (400, 123); +this.okcancelPanel.setBounds ( new java.awt.Rectangle (0, 123, 400, 35)); +var height = 160 + alignframe.getInsets ().top + this.getInsets ().bottom; +var width = 400; +this.dialog.setBounds (alignframe.getBounds ().x + Clazz.doubleToInt ((alignframe.getSize ().width - width) / 2), alignframe.getBounds ().y + Clazz.doubleToInt ((alignframe.getSize ().height - height) / 2), width, height); +}, "~S,java.awt.Container"); +Clazz.overrideMethod (c$, "actionPerformed", +function (evt) { +var source = evt.getSource (); +if (source === this.okButton) { +this.okButton_actionPerformed (); +} else if (source === this.applyButton) { +this.applyButton_actionPerformed (); +} else if (source === this.cancelButton) { +this.cancelButton_actionPerformed (); +} else if (source === this.rText) { +this.rText_actionPerformed (); +} else if (source === this.gText) { +this.gText_actionPerformed (); +} else if (source === this.bText) { +this.bText_actionPerformed (); +}}, "java.awt.event.ActionEvent"); +Clazz.overrideMethod (c$, "adjustmentValueChanged", +function (evt) { +if (evt.getSource () === this.rScroller) { +this.rScroller_adjustmentValueChanged (); +} else if (evt.getSource () === this.gScroller) { +this.gScroller_adjustmentValueChanged (); +} else if (evt.getSource () === this.bScroller) { +this.bScroller_adjustmentValueChanged (); +}}, "java.awt.event.AdjustmentEvent"); +Clazz.defineMethod (c$, "init", +function () { +try { +this.jbInit (); +} catch (e) { +if (Clazz.exceptionOf (e, Exception)) { +e.printStackTrace (); +} else { +throw e; +} +} +this.frame = new awt2swing.Frame (); +this.frame.add (this); +jalview.bin.JalviewLite.addFrame (this.frame, jalview.util.MessageManager.getString ("label.user_defined_colours"), 420, 345); +if (this.seqGroup != null) { +this.frame.setTitle (this.frame.getTitle () + " (" + this.seqGroup.getName () + ")"); +}for (var i = 0; i < 20; i++) { +this.makeButton (jalview.schemes.ResidueProperties.aa2Triplet.get (jalview.schemes.ResidueProperties.aa[i]) + "", jalview.schemes.ResidueProperties.aa[i]); +} +this.makeButton ("B", "B"); +this.makeButton ("Z", "Z"); +this.makeButton ("X", "X"); +this.makeButton ("Gap", "'.','-',' '"); +this.validate (); +}); +Clazz.defineMethod (c$, "rText_actionPerformed", +function () { +try { +var i = Integer.parseInt (this.rText.getText ()); +this.rScroller.setValue (i); +this.rScroller_adjustmentValueChanged (); +} catch (ex) { +if (Clazz.exceptionOf (ex, NumberFormatException)) { +} else { +throw ex; +} +} +}); +Clazz.defineMethod (c$, "gText_actionPerformed", +function () { +try { +var i = Integer.parseInt (this.gText.getText ()); +this.gScroller.setValue (i); +this.gScroller_adjustmentValueChanged (); +} catch (ex) { +if (Clazz.exceptionOf (ex, NumberFormatException)) { +} else { +throw ex; +} +} +}); +Clazz.defineMethod (c$, "bText_actionPerformed", +function () { +try { +var i = Integer.parseInt (this.bText.getText ()); +this.bScroller.setValue (i); +this.bScroller_adjustmentValueChanged (); +} catch (ex) { +if (Clazz.exceptionOf (ex, NumberFormatException)) { +} else { +throw ex; +} +} +}); +Clazz.defineMethod (c$, "rScroller_adjustmentValueChanged", +function () { +this.R = this.rScroller.getValue (); +this.rText.setText (this.R + ""); +this.colourChanged (); +}); +Clazz.defineMethod (c$, "gScroller_adjustmentValueChanged", +function () { +this.G = this.gScroller.getValue (); +this.gText.setText (this.G + ""); +this.colourChanged (); +}); +Clazz.defineMethod (c$, "bScroller_adjustmentValueChanged", +function () { +this.B = this.bScroller.getValue (); +this.bText.setText (this.B + ""); +this.colourChanged (); +}); +Clazz.defineMethod (c$, "colourChanged", +function () { +var col = new java.awt.Color (this.R, this.G, this.B); +this.target.setBackground (col); +this.target.repaint (); +if (this.selectedButton != null) { +this.selectedButton.setBackground (col); +this.selectedButton.repaint (); +}}); +Clazz.defineMethod (c$, "setTargetColour", +function (col) { +this.R = col.getRed (); +this.G = col.getGreen (); +this.B = col.getBlue (); +this.rScroller.setValue (this.R); +this.gScroller.setValue (this.G); +this.bScroller.setValue (this.B); +this.rText.setText (this.R + ""); +this.gText.setText (this.G + ""); +this.bText.setText (this.B + ""); +this.colourChanged (); +}, "java.awt.Color"); +Clazz.defineMethod (c$, "colourButtonPressed", +function (e) { +this.selectedButton = e.getSource (); +this.setTargetColour (this.selectedButton.getBackground ()); +}, "java.awt.event.MouseEvent"); +Clazz.defineMethod (c$, "makeButton", +function (label, aa) { +var button = new awt2swing.Button (); +var col = java.awt.Color.white; +if (this.oldColourScheme != null) { +try { +col = this.oldColourScheme.findColour (aa.charAt (0), -1, null); +} catch (ex) { +if (Clazz.exceptionOf (ex, Exception)) { +} else { +throw ex; +} +} +}button.setBackground (col); +this.oldColours.addElement (col); +button.setLabel (label); +button.setForeground (col.darker ().darker ().darker ()); +button.setFont ( new java.awt.Font ("Verdana", 1, 10)); +button.addMouseListener (((Clazz.isClassDefined ("jalview.appletgui.UserDefinedColours$1") ? 0 : jalview.appletgui.UserDefinedColours.$UserDefinedColours$1$ ()), Clazz.innerTypeInstance (jalview.appletgui.UserDefinedColours$1, this, null))); +this.buttonPanel.add (button, null); +}, "~S,~S"); +Clazz.defineMethod (c$, "okButton_actionPerformed", +function () { +this.applyButton_actionPerformed (); +if (this.dialog != null) { +this.dialog.setVisible (false); +}this.frame.setVisible (false); +}); +Clazz.defineMethod (c$, "getColor", +function () { +return new java.awt.Color (this.R, this.G, this.B); +}); +Clazz.defineMethod (c$, "applyButton_actionPerformed", +function () { +if (this.caller != null) { +if (Clazz.instanceOf (this.caller, jalview.appletgui.FeatureSettings)) { +(this.caller).setUserColour (this.originalLabel, this.getColor ()); +} else if (Clazz.instanceOf (this.caller, jalview.appletgui.AnnotationColourChooser)) { +if (this.originalLabel.equals ("Min Colour")) { +(this.caller).minColour_actionPerformed (this.getColor ()); +} else { +(this.caller).maxColour_actionPerformed (this.getColor ()); +}} else if (Clazz.instanceOf (this.caller, jalview.appletgui.FeatureRenderer)) { +(this.caller).colourPanel.updateColor (this.getColor ()); +} else if (Clazz.instanceOf (this.caller, jalview.appletgui.FeatureColourChooser)) { +if (this.originalLabel.indexOf ("inimum") > -1) { +(this.caller).minColour_actionPerformed (this.getColor ()); +} else { +(this.caller).maxColour_actionPerformed (this.getColor ()); +}}return; +}var newColours = new Array (24); +for (var i = 0; i < 24; i++) { +var button = this.buttonPanel.getComponent (i); +newColours[i] = button.getBackground (); +} +var ucs = new jalview.schemes.UserColourScheme (newColours); +if (this.ap != null) { +ucs.setThreshold (0, this.ap.av.isIgnoreGapsConsensus ()); +}if (this.ap != null) { +if (this.seqGroup != null) { +this.seqGroup.cs = ucs; +} else { +this.ap.av.setGlobalColourScheme (ucs); +}this.ap.seqPanel.seqCanvas.img = null; +this.ap.paintAlignment (true); +} else if (this.jmol != null) { +this.jmol.setJalviewColourScheme (ucs); +}}); +Clazz.defineMethod (c$, "cancelButton_actionPerformed", +function () { +if (this.caller != null) { +if (Clazz.instanceOf (this.caller, jalview.appletgui.FeatureSettings)) { +(this.caller).setUserColour (this.originalLabel, this.originalColour); +} else if (Clazz.instanceOf (this.caller, jalview.appletgui.AnnotationColourChooser)) { +if (this.originalLabel.equals ("Min Colour")) { +(this.caller).minColour_actionPerformed (this.originalColour); +} else { +(this.caller).maxColour_actionPerformed (this.originalColour); +}} else if (Clazz.instanceOf (this.caller, jalview.appletgui.FeatureRenderer)) { +(this.caller).colourPanel.updateColor (this.originalColour); +} else if (Clazz.instanceOf (this.caller, jalview.appletgui.FeatureColourChooser)) { +if (this.originalLabel.indexOf ("inimum") > -1) { +(this.caller).minColour_actionPerformed (this.originalColour); +} else { +(this.caller).maxColour_actionPerformed (this.originalColour); +}}if (this.dialog != null) { +this.dialog.setVisible (false); +}this.frame.setVisible (false); +return; +}var newColours = new Array (24); +for (var i = 0; i < 24; i++) { +newColours[i] = this.oldColours.elementAt (i); +this.buttonPanel.getComponent (i).setBackground (newColours[i]); +} +var ucs = new jalview.schemes.UserColourScheme (newColours); +if (this.ap != null) { +if (this.seqGroup != null) { +this.seqGroup.cs = ucs; +} else { +this.ap.av.setGlobalColourScheme (ucs); +}this.ap.paintAlignment (true); +} else if (this.jmol != null) { +this.jmol.setJalviewColourScheme (ucs); +}this.frame.setVisible (false); +}); +Clazz.defineMethod (c$, "jbInit", +($fz = function () { +this.setLayout (null); +this.buttonPanel.setLayout (this.gridLayout); +this.gridLayout.setColumns (6); +this.gridLayout.setRows (4); +this.okButton.setFont ( new java.awt.Font ("Verdana", 0, 11)); +this.okButton.setLabel (jalview.util.MessageManager.getString ("action.ok")); +this.okButton.addActionListener (this); +this.applyButton.setFont ( new java.awt.Font ("Verdana", 0, 11)); +this.applyButton.setLabel (jalview.util.MessageManager.getString ("action.apply")); +this.applyButton.addActionListener (this); +this.cancelButton.setFont ( new java.awt.Font ("Verdana", 0, 11)); +this.cancelButton.setLabel (jalview.util.MessageManager.getString ("action.cancel")); +this.cancelButton.addActionListener (this); +this.setBackground ( new java.awt.Color (212, 208, 223)); +this.okcancelPanel.setBounds ( new java.awt.Rectangle (0, 265, 400, 35)); +this.buttonPanel.setBounds ( new java.awt.Rectangle (0, 123, 400, 142)); +this.rScroller.setMaximum (256); +this.rScroller.setMinimum (0); +this.rScroller.setOrientation (0); +this.rScroller.setUnitIncrement (1); +this.rScroller.setVisibleAmount (1); +this.rScroller.setBounds ( new java.awt.Rectangle (36, 27, 119, 19)); +this.rScroller.addAdjustmentListener (this); +this.label1.setAlignment (4); +this.label1.setText ("R"); +this.label1.setBounds ( new java.awt.Rectangle (19, 30, 16, 15)); +this.rText.setFont ( new java.awt.Font ("Dialog", 0, 10)); +this.rText.setText ("0 "); +this.rText.setBounds ( new java.awt.Rectangle (156, 27, 53, 19)); +this.rText.addActionListener (this); +this.rText.addFocusListener (this); +this.label4.setAlignment (4); +this.label4.setText ("G"); +this.label4.setBounds ( new java.awt.Rectangle (15, 56, 20, 15)); +this.gScroller.setMaximum (256); +this.gScroller.setMinimum (0); +this.gScroller.setOrientation (0); +this.gScroller.setUnitIncrement (1); +this.gScroller.setVisibleAmount (1); +this.gScroller.setBounds ( new java.awt.Rectangle (35, 52, 120, 20)); +this.gScroller.addAdjustmentListener (this); +this.gText.setFont ( new java.awt.Font ("Dialog", 0, 10)); +this.gText.setText ("0 "); +this.gText.setBounds ( new java.awt.Rectangle (156, 52, 53, 20)); +this.gText.addActionListener (this); +this.gText.addFocusListener (this); +this.label5.setAlignment (4); +this.label5.setText ("B"); +this.label5.setBounds ( new java.awt.Rectangle (14, 82, 20, 15)); +this.bScroller.setMaximum (256); +this.bScroller.setMinimum (0); +this.bScroller.setOrientation (0); +this.bScroller.setUnitIncrement (1); +this.bScroller.setVisibleAmount (1); +this.bScroller.setBounds ( new java.awt.Rectangle (35, 78, 120, 20)); +this.bScroller.addAdjustmentListener (this); +this.bText.setFont ( new java.awt.Font ("Dialog", 0, 10)); +this.bText.setText ("0 "); +this.bText.setBounds ( new java.awt.Rectangle (157, 78, 52, 20)); +this.bText.addActionListener (this); +this.bText.addFocusListener (this); +this.target.setBackground (java.awt.Color.black); +this.target.setBounds ( new java.awt.Rectangle (229, 26, 134, 79)); +this.add (this.okcancelPanel, null); +this.okcancelPanel.add (this.okButton, null); +this.okcancelPanel.add (this.applyButton, null); +this.okcancelPanel.add (this.cancelButton, null); +this.add (this.rText); +this.add (this.gText); +this.add (this.bText); +this.add (this.buttonPanel, null); +this.add (this.target, null); +this.add (this.gScroller); +this.add (this.rScroller); +this.add (this.bScroller); +this.add (this.label5); +this.add (this.label4); +this.add (this.label1); +}, $fz.isPrivate = true, $fz)); +Clazz.overrideMethod (c$, "focusGained", +function (e) { +}, "java.awt.event.FocusEvent"); +Clazz.overrideMethod (c$, "focusLost", +function (e) { +var c = e.getComponent (); +if (c === this.rText) { +this.rText_actionPerformed (); +} else { +if (c === this.gText) { +this.gText_actionPerformed (); +} else { +if (c === this.bText) { +this.bText_actionPerformed (); +}}}}, "java.awt.event.FocusEvent"); +c$.$UserDefinedColours$1$ = function () { +Clazz.pu$h (); +c$ = Clazz.declareAnonymous (jalview.appletgui, "UserDefinedColours$1", java.awt.event.MouseAdapter); +Clazz.overrideMethod (c$, "mousePressed", +function (e) { +this.b$["jalview.appletgui.UserDefinedColours"].colourButtonPressed (e); +}, "java.awt.event.MouseEvent"); +c$ = Clazz.p0p (); +}; +});