X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fjalview%2Fappletgui%2FFeatureSettings.js;h=3a5880c8afedf5f4de182a661f4498a98875296b;hp=1ece8453aa94f9e60cc1290dd2d9e7d942416f2d;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6 diff --git a/site/j2s/jalview/appletgui/FeatureSettings.js b/site/j2s/jalview/appletgui/FeatureSettings.js index 1ece845..3a5880c 100644 --- a/site/j2s/jalview/appletgui/FeatureSettings.js +++ b/site/j2s/jalview/appletgui/FeatureSettings.js @@ -1,444 +1,444 @@ -Clazz.declarePackage ("jalview.appletgui"); -Clazz.load (["awt2swing.Checkbox", "$.Panel", "jalview.api.FeatureSettingsControllerI", "java.awt.event.ActionListener", "$.AdjustmentListener", "$.ItemListener", "$.MouseListener", "$.MouseMotionListener"], "jalview.appletgui.FeatureSettings", ["awt2swing.Button", "$.Frame", "$.Label", "$.MenuItem", "$.PopupMenu", "$.ScrollPane", "$.Scrollbar", "jalview.appletgui.FeatureColourChooser", "$.UserDefinedColours", "jalview.bin.JalviewLite", "jalview.schemes.GraduatedColor", "jalview.util.MessageManager", "java.awt.BorderLayout", "$.Color", "$.Font", "$.GridLayout", "$.Toolkit", "java.awt.event.WindowAdapter", "java.lang.Boolean", "$.Error", "java.util.Vector"], function () { -c$ = Clazz.decorateAsClass (function () { -this.fr = null; -this.ap = null; -this.av = null; -this.frame = null; -this.groupPanel = null; -this.featurePanel = null; -this.scrollPane = null; -this.linkImage = null; -this.transparency = null; -this.groupItemListener = null; -this.selectedCheck = null; -this.dragging = false; -if (!Clazz.isClassDefined ("jalview.appletgui.FeatureSettings.MyCheckbox")) { -jalview.appletgui.FeatureSettings.$FeatureSettings$MyCheckbox$ (); -} -Clazz.instantialize (this, arguments); -}, jalview.appletgui, "FeatureSettings", awt2swing.Panel, [java.awt.event.ItemListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.ActionListener, java.awt.event.AdjustmentListener, jalview.api.FeatureSettingsControllerI]); -Clazz.prepareFields (c$, function () { -this.featurePanel = new awt2swing.Panel (); -this.groupItemListener = ((Clazz.isClassDefined ("jalview.appletgui.FeatureSettings$1") ? 0 : jalview.appletgui.FeatureSettings.$FeatureSettings$1$ ()), Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings$1, this, null)); -}); -Clazz.makeConstructor (c$, -function (ap) { -Clazz.superConstructor (this, jalview.appletgui.FeatureSettings, []); -this.ap = ap; -this.av = ap.av; -ap.av.featureSettings = this; -this.fr = ap.seqPanel.seqCanvas.getFeatureRenderer (); -this.transparency = new awt2swing.Scrollbar (0, 100 - Clazz.floatToInt (this.fr.getTransparency () * 100), 1, 1, 100); -if (this.fr.isTransparencyAvailable ()) { -this.transparency.addAdjustmentListener (this); -} else { -this.transparency.setEnabled (false); -}var url = this.getClass ().getResource ("/images/link.gif"); -if (url != null) { -this.linkImage = java.awt.Toolkit.getDefaultToolkit ().getImage (url); -}if (this.av.isShowSequenceFeatures () || !this.fr.hasRenderOrder ()) { -this.fr.findAllFeatures (true); -}this.discoverAllFeatureData (); -this.setLayout ( new java.awt.BorderLayout ()); -this.scrollPane = new awt2swing.ScrollPane (); -this.scrollPane.add (this.featurePanel); -if (this.fr.getAllFeatureColours () != null && this.fr.getAllFeatureColours ().size () > 0) { -this.add (this.scrollPane, "Center"); -}var invert = new awt2swing.Button ("Invert Selection"); -invert.addActionListener (this); -var lowerPanel = new awt2swing.Panel ( new java.awt.GridLayout (2, 1, 5, 10)); -lowerPanel.add (invert); -var tPanel = new awt2swing.Panel ( new java.awt.BorderLayout ()); -if (this.fr.isTransparencyAvailable ()) { -tPanel.add (this.transparency, "Center"); -tPanel.add ( new awt2swing.Label ("Transparency"), "East"); -} else { -tPanel.add ( new awt2swing.Label ("Transparency not available in this web browser"), "Center"); -}lowerPanel.add (tPanel, "South"); -this.add (lowerPanel, "South"); -if (this.groupPanel != null) { -this.groupPanel.setLayout ( new java.awt.GridLayout (Clazz.doubleToInt ((this.fr.getFeatureGroupsSize ()) / 4) + 1, 4)); -this.groupPanel.validate (); -this.add (this.groupPanel, "North"); -}this.frame = new awt2swing.Frame (); -this.frame.add (this); -var me = this; -this.frame.addWindowListener (((Clazz.isClassDefined ("jalview.appletgui.FeatureSettings$2") ? 0 : jalview.appletgui.FeatureSettings.$FeatureSettings$2$ ()), Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings$2, this, Clazz.cloneFinals ("me", me)))); -var height = this.featurePanel.getComponentCount () * 50 + 60; -height = Math.max (200, height); -height = Math.min (400, height); -var width = 300; -jalview.bin.JalviewLite.addFrame (this.frame, jalview.util.MessageManager.getString ("label.feature_settings"), width, height); -}, "jalview.appletgui.AlignmentPanel"); -Clazz.defineMethod (c$, "PaintComponent", -function (g) { -g.setColor (java.awt.Color.black); -g.drawString (jalview.util.MessageManager.getString ("label.no_features_added_to_this_alignment"), 10, 20); -g.drawString (jalview.util.MessageManager.getString ("label.features_can_be_added_from_searches_1"), 10, 40); -g.drawString (jalview.util.MessageManager.getString ("label.features_can_be_added_from_searches_2"), 10, 60); -}, "java.awt.Graphics"); -Clazz.defineMethod (c$, "popupSort", -function (check, minmax, x, y) { -var type = check.type; -var typeCol = this.fr.getFeatureStyle (type); -var men = new awt2swing.PopupMenu (jalview.util.MessageManager.formatMessage ("label.settings_for_type", Clazz.newArray (-1, [type]))); -var scr = new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.sort_by_score")); -men.add (scr); -var me = this; -scr.addActionListener (((Clazz.isClassDefined ("jalview.appletgui.FeatureSettings$3") ? 0 : jalview.appletgui.FeatureSettings.$FeatureSettings$3$ ()), Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings$3, this, Clazz.cloneFinals ("me", me, "type", type)))); -var dens = new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.sort_by_density")); -dens.addActionListener (((Clazz.isClassDefined ("jalview.appletgui.FeatureSettings$4") ? 0 : jalview.appletgui.FeatureSettings.$FeatureSettings$4$ ()), Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings$4, this, Clazz.cloneFinals ("me", me, "type", type)))); -men.add (dens); -if (minmax != null) { -var typeMinMax = minmax.get (type); -if (typeMinMax != null && (typeMinMax)[0] != null) { -var mxcol = new awt2swing.MenuItem ((Clazz.instanceOf (typeCol, java.awt.Color)) ? "Graduated Colour" : "Single Colour"); -men.add (mxcol); -mxcol.addActionListener (((Clazz.isClassDefined ("jalview.appletgui.FeatureSettings$5") ? 0 : jalview.appletgui.FeatureSettings.$FeatureSettings$5$ ()), Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings$5, this, Clazz.cloneFinals ("typeCol", typeCol, "me", me, "type", type, "check", check)))); -}}this.featurePanel.add (men); -men.show (this.featurePanel, x, y); -}, "jalview.appletgui.FeatureSettings.MyCheckbox,java.util.Hashtable,~N,~N"); -Clazz.overrideMethod (c$, "discoverAllFeatureData", -function () { -if (this.fr.getAllFeatureColours () != null && this.fr.getAllFeatureColours ().size () > 0) { -this.rebuildGroups (); -}this.resetTable (false); -}); -Clazz.defineMethod (c$, "rebuildGroups", -function () { -var rdrw = false; -if (this.groupPanel == null) { -this.groupPanel = new awt2swing.Panel (); -} else { -rdrw = true; -this.groupPanel.removeAll (); -}for (var group, $group = this.fr.getFeatureGroups ().iterator (); $group.hasNext () && ((group = $group.next ()) || true);) { -var vis = this.fr.checkGroupVisibility (group, false); -var check = Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings.MyCheckbox, this, null, group, vis, (this.fr.featureLinks != null && this.fr.featureLinks.containsKey (group))); -check.addMouseListener (this); -check.setFont ( new java.awt.Font ("Serif", 1, 12)); -check.addItemListener (this.groupItemListener); -check.setVisible (vis); -this.groupPanel.add (check); -} -if (rdrw) { -this.groupPanel.validate (); -}}); -Clazz.defineMethod (c$, "resetTable", -function (groupsChanged) { -var tmpfeatures; -var group = null; -var type; -var visibleChecks = new java.util.Vector (); -var alignment = this.av.getAlignment (); -for (var i = 0; i < alignment.getHeight (); i++) { -if (alignment.getSequenceAt (i).getSequenceFeatures () == null) { -continue; -}tmpfeatures = alignment.getSequenceAt (i).getSequenceFeatures (); -var index = 0; -while (index < tmpfeatures.length) { -group = tmpfeatures[index].featureGroup; -if (group == null || this.fr.checkGroupVisibility (group, true)) { -type = tmpfeatures[index].getType (); -if (!visibleChecks.contains (type)) { -visibleChecks.addElement (type); -}}index++; -} -} -var comps; -var cSize = this.featurePanel.getComponentCount (); -var check; -for (var i = 0; i < cSize; i++) { -comps = this.featurePanel.getComponents (); -check = comps[i]; -if (!visibleChecks.contains (check.type)) { -this.featurePanel.remove (i); -cSize--; -i--; -}} -if (this.fr.getRenderOrder () != null) { -var rol = this.fr.getRenderOrder (); -for (var ro = rol.size () - 1; ro > -1; ro--) { -var item = rol.get (ro); -if (!visibleChecks.contains (item)) { -continue; -}visibleChecks.removeElement (item); -this.addCheck (false, item); -} -}var en = visibleChecks.elements (); -while (en.hasMoreElements ()) { -this.addCheck (groupsChanged, en.nextElement ().toString ()); -} -this.featurePanel.setLayout ( new java.awt.GridLayout (this.featurePanel.getComponentCount (), 1, 10, 5)); -this.featurePanel.validate (); -if (this.scrollPane != null) { -this.scrollPane.validate (); -}this.itemStateChanged (null); -}, "~B"); -Clazz.defineMethod (c$, "addCheck", -function (groupsChanged, type) { -var addCheck; -var comps = this.featurePanel.getComponents (); -var check; -addCheck = true; -for (var i = 0; i < this.featurePanel.getComponentCount (); i++) { -check = comps[i]; -if (check.type.equals (type)) { -addCheck = false; -break; -}} -if (addCheck) { -var selected = false; -if (groupsChanged || this.av.getFeaturesDisplayed ().isVisible (type)) { -selected = true; -}check = Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings.MyCheckbox, this, null, type, selected, (this.fr.featureLinks != null && this.fr.featureLinks.containsKey (type)), this.fr.getFeatureStyle (type)); -check.addMouseListener (this); -check.addMouseMotionListener (this); -check.addItemListener (this); -if (groupsChanged) { -this.featurePanel.add (check, 0); -} else { -this.featurePanel.add (check); -}}}, "~B,~S"); -Clazz.overrideMethod (c$, "actionPerformed", -function (evt) { -for (var i = 0; i < this.featurePanel.getComponentCount (); i++) { -var check = this.featurePanel.getComponent (i); -check.setState (!check.getState ()); -} -this.selectionChanged (); -}, "java.awt.event.ActionEvent"); -Clazz.overrideMethod (c$, "itemStateChanged", -function (evt) { -this.selectionChanged (); -}, "java.awt.event.ItemEvent"); -Clazz.defineMethod (c$, "selectionChanged", -function () { -var comps = this.featurePanel.getComponents (); -var cSize = comps.length; -var tmp = Clazz.newArray (cSize, 3, null); -var tmpSize = 0; -for (var i = 0; i < cSize; i++) { -var check = comps[i]; -tmp[tmpSize][0] = check.type; -tmp[tmpSize][1] = this.fr.getFeatureStyle (check.type); -tmp[tmpSize][2] = new Boolean (check.getState ()); -tmpSize++; -} -var data = Clazz.newArray (tmpSize, 3, null); -System.arraycopy (tmp, 0, data, 0, tmpSize); -this.fr.setFeaturePriority (data); -this.ap.paintAlignment (true); -}); -Clazz.overrideMethod (c$, "mousePressed", -function (evt) { -this.selectedCheck = evt.getSource (); -if (this.fr.featureLinks != null && this.fr.featureLinks.containsKey (this.selectedCheck.type)) { -if (evt.getX () > this.selectedCheck.stringWidth + 20) { -evt.consume (); -}}}, "java.awt.event.MouseEvent"); -Clazz.overrideMethod (c$, "mouseDragged", -function (evt) { -if ((evt.getSource ()).getParent () !== this.featurePanel) { -return; -}this.dragging = true; -}, "java.awt.event.MouseEvent"); -Clazz.overrideMethod (c$, "mouseReleased", -function (evt) { -if ((evt.getSource ()).getParent () !== this.featurePanel) { -return; -}var comp = null; -var target = null; -var height = evt.getY () + evt.getComponent ().getLocation ().y; -if (height > this.featurePanel.getSize ().height) { -comp = this.featurePanel.getComponent (this.featurePanel.getComponentCount () - 1); -} else if (height < 0) { -comp = this.featurePanel.getComponent (0); -} else { -comp = this.featurePanel.getComponentAt (evt.getX (), evt.getY () + evt.getComponent ().getLocation ().y); -}if (comp != null && Clazz.instanceOf (comp, awt2swing.Checkbox)) { -target = comp; -}if (this.selectedCheck != null && target != null && this.selectedCheck !== target) { -var targetIndex = -1; -for (var i = 0; i < this.featurePanel.getComponentCount (); i++) { -if (target === this.featurePanel.getComponent (i)) { -targetIndex = i; -break; -}} -this.featurePanel.remove (this.selectedCheck); -this.featurePanel.add (this.selectedCheck, targetIndex); -this.featurePanel.validate (); -this.itemStateChanged (null); -}}, "java.awt.event.MouseEvent"); -Clazz.defineMethod (c$, "setUserColour", -function (feature, originalColour) { -if (Clazz.instanceOf (originalColour, java.awt.Color) || Clazz.instanceOf (originalColour, jalview.schemes.GraduatedColor)) { -this.fr.setColour (feature, originalColour); -} else { -throw new Error (jalview.util.MessageManager.getString ("error.implementation_error_unsupported_feature_colour_object")); -}this.refreshTable (); -}, "~S,~O"); -Clazz.defineMethod (c$, "refreshTable", -function () { -this.featurePanel.removeAll (); -this.resetTable (false); -this.ap.paintAlignment (true); -}); -Clazz.overrideMethod (c$, "mouseEntered", -function (evt) { -}, "java.awt.event.MouseEvent"); -Clazz.overrideMethod (c$, "mouseExited", -function (evt) { -}, "java.awt.event.MouseEvent"); -Clazz.overrideMethod (c$, "mouseClicked", -function (evt) { -var check = evt.getSource (); -if ((evt.getModifiers () & 4) != 0) { -this.popupSort (check, this.fr.getMinMax (), evt.getX (), evt.getY ()); -}if (this.fr.featureLinks != null && this.fr.featureLinks.containsKey (check.type)) { -if (evt.getX () > check.stringWidth + 20) { -evt.consume (); -var link = this.fr.featureLinks.get (check.type).toString (); -this.ap.alignFrame.showURL (link.substring (link.indexOf ("|") + 1), link.substring (0, link.indexOf ("|"))); -}}if (check.getParent () !== this.featurePanel) { -return; -}if (evt.getClickCount () > 1) { -var fcol = this.fr.getFeatureStyle (check.type); -if (Clazz.instanceOf (fcol, java.awt.Color)) { - new jalview.appletgui.UserDefinedColours (this, check.type, fcol); -} else { - new jalview.appletgui.FeatureColourChooser (this, check.type); -check.updateColor (this.fr.getFeatureStyle (check.type)); -}}}, "java.awt.event.MouseEvent"); -Clazz.overrideMethod (c$, "mouseMoved", -function (evt) { -}, "java.awt.event.MouseEvent"); -Clazz.overrideMethod (c$, "adjustmentValueChanged", -function (evt) { -this.fr.setTransparency ((100 - this.transparency.getValue ()) / 100); -this.ap.seqPanel.seqCanvas.repaint (); -}, "java.awt.event.AdjustmentEvent"); -c$.$FeatureSettings$MyCheckbox$ = function () { -Clazz.pu$h(self.c$); -c$ = Clazz.decorateAsClass (function () { -Clazz.prepareCallback (this, arguments); -this.type = null; -this.stringWidth = 0; -this.hasLink = false; -this.gcol = null; -this.col = null; -Clazz.instantialize (this, arguments); -}, jalview.appletgui.FeatureSettings, "MyCheckbox", awt2swing.Checkbox); -Clazz.defineMethod (c$, "updateColor", -function (a) { -if (Clazz.instanceOf (a, java.awt.Color)) { -this.col = a; -this.gcol = null; -} else if (Clazz.instanceOf (a, jalview.schemes.GraduatedColor)) { -this.gcol = a; -this.col = null; -} else { -throw new Error (jalview.util.MessageManager.getString ("error.invalid_colour_for_mycheckbox")); -}if (this.col != null) { -this.setBackground (this.col); -} else { -var b = this.type; -if (this.gcol.getThreshType () != -1) { -b += " " + ((this.gcol.getThreshType () == 1) ? "(>)" : "(<)"); -}if (this.gcol.isColourByLabel ()) { -this.setBackground (java.awt.Color.white); -b += " (by Label)"; -} else { -this.setBackground (this.gcol.getMinColor ()); -}this.setLabel (b); -}this.repaint (); -}, "~O"); -Clazz.makeConstructor (c$, -function (a, b, c) { -Clazz.superConstructor (this, jalview.appletgui.FeatureSettings.MyCheckbox, [a, b]); -this.type = a; -var d = this.b$["jalview.appletgui.FeatureSettings"].av.nullFrame.getFontMetrics (this.b$["jalview.appletgui.FeatureSettings"].av.nullFrame.getFont ()); -this.stringWidth = d.stringWidth (a); -this.hasLink = c; -}, "~S,~B,~B"); -Clazz.makeConstructor (c$, -function (a, b, c, d) { -this.construct (a, b, c); -this.updateColor (d); -}, "~S,~B,~B,~O"); -Clazz.defineMethod (c$, "PaintComponent", -function (a) { -var b = this.getSize (); -if (this.gcol != null) { -if (this.gcol.isColourByLabel ()) { -a.setColor (java.awt.Color.white); -a.fillRect (Clazz.doubleToInt (b.width / 2), 0, Clazz.doubleToInt (b.width / 2), b.height); -} else { -var c = this.gcol.getMaxColor (); -a.setColor (c); -a.fillRect (Clazz.doubleToInt (b.width / 2), 0, Clazz.doubleToInt (b.width / 2), b.height); -}}if (this.hasLink) { -a.drawImage (this.b$["jalview.appletgui.FeatureSettings"].linkImage, this.stringWidth + 25, Clazz.doubleToInt ((this.getSize ().height - this.b$["jalview.appletgui.FeatureSettings"].linkImage.getHeight (this)) / 2), this); -}}, "java.awt.Graphics"); -c$ = Clazz.p0p (); -}; -c$.$FeatureSettings$1$ = function () { -Clazz.pu$h(self.c$); -c$ = Clazz.declareAnonymous (jalview.appletgui, "FeatureSettings$1", null, java.awt.event.ItemListener); -Clazz.overrideMethod (c$, "itemStateChanged", -function (evt) { -var source = evt.getSource (); -this.b$["jalview.appletgui.FeatureSettings"].fr.setGroupVisibility (source.getLabel (), source.getState ()); -this.b$["jalview.appletgui.FeatureSettings"].ap.seqPanel.seqCanvas.repaint (); -if (this.b$["jalview.appletgui.FeatureSettings"].ap.overviewPanel != null) { -this.b$["jalview.appletgui.FeatureSettings"].ap.overviewPanel.updateOverviewImage (); -}this.b$["jalview.appletgui.FeatureSettings"].resetTable (true); -return; -}, "java.awt.event.ItemEvent"); -c$ = Clazz.p0p (); -}; -c$.$FeatureSettings$2$ = function () { -Clazz.pu$h(self.c$); -c$ = Clazz.declareAnonymous (jalview.appletgui, "FeatureSettings$2", java.awt.event.WindowAdapter); -Clazz.overrideMethod (c$, "windowClosing", -function (e) { -if (this.f$.me.av.featureSettings === this.f$.me) { -this.f$.me.av.featureSettings = null; -this.f$.me.ap = null; -this.f$.me.av = null; -}}, "java.awt.event.WindowEvent"); -c$ = Clazz.p0p (); -}; -c$.$FeatureSettings$3$ = function () { -Clazz.pu$h(self.c$); -c$ = Clazz.declareAnonymous (jalview.appletgui, "FeatureSettings$3", null, java.awt.event.ActionListener); -Clazz.overrideMethod (c$, "actionPerformed", -function (e) { -this.f$.me.ap.alignFrame.avc.sortAlignmentByFeatureScore ( Clazz.newArray (-1, [this.f$.type])); -}, "java.awt.event.ActionEvent"); -c$ = Clazz.p0p (); -}; -c$.$FeatureSettings$4$ = function () { -Clazz.pu$h(self.c$); -c$ = Clazz.declareAnonymous (jalview.appletgui, "FeatureSettings$4", null, java.awt.event.ActionListener); -Clazz.overrideMethod (c$, "actionPerformed", -function (e) { -this.f$.me.ap.alignFrame.avc.sortAlignmentByFeatureDensity ( Clazz.newArray (-1, [this.f$.type])); -}, "java.awt.event.ActionEvent"); -c$ = Clazz.p0p (); -}; -c$.$FeatureSettings$5$ = function () { -Clazz.pu$h(self.c$); -c$ = Clazz.declareAnonymous (jalview.appletgui, "FeatureSettings$5", null, java.awt.event.ActionListener); -Clazz.overrideMethod (c$, "actionPerformed", -function (e) { -if (Clazz.instanceOf (this.f$.typeCol, java.awt.Color)) { - new jalview.appletgui.FeatureColourChooser (this.f$.me, this.f$.type); -this.f$.check.updateColor (this.b$["jalview.appletgui.FeatureSettings"].fr.getFeatureStyle (this.f$.type)); -} else { - new jalview.appletgui.UserDefinedColours (this.f$.me, this.f$.check.type, (this.f$.typeCol)); -}}, "java.awt.event.ActionEvent"); -c$ = Clazz.p0p (); -}; -}); +Clazz.declarePackage ("jalview.appletgui"); +Clazz.load (["awt2swing.Checkbox", "$.Panel", "jalview.api.FeatureSettingsControllerI", "java.awt.event.ActionListener", "$.AdjustmentListener", "$.ItemListener", "$.MouseListener", "$.MouseMotionListener"], "jalview.appletgui.FeatureSettings", ["awt2swing.Button", "$.Frame", "$.Label", "$.MenuItem", "$.PopupMenu", "$.ScrollPane", "$.Scrollbar", "jalview.appletgui.FeatureColourChooser", "$.UserDefinedColours", "jalview.bin.JalviewLite", "jalview.schemes.GraduatedColor", "jalview.util.MessageManager", "java.awt.BorderLayout", "$.Color", "$.Font", "$.GridLayout", "$.Toolkit", "java.awt.event.WindowAdapter", "java.lang.Boolean", "$.Error", "java.util.Vector"], function () { +c$ = Clazz.decorateAsClass (function () { +this.fr = null; +this.ap = null; +this.av = null; +this.frame = null; +this.groupPanel = null; +this.featurePanel = null; +this.scrollPane = null; +this.linkImage = null; +this.transparency = null; +this.groupItemListener = null; +this.selectedCheck = null; +this.dragging = false; +if (!Clazz.isClassDefined ("jalview.appletgui.FeatureSettings.MyCheckbox")) { +jalview.appletgui.FeatureSettings.$FeatureSettings$MyCheckbox$ (); +} +Clazz.instantialize (this, arguments); +}, jalview.appletgui, "FeatureSettings", awt2swing.Panel, [java.awt.event.ItemListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.ActionListener, java.awt.event.AdjustmentListener, jalview.api.FeatureSettingsControllerI]); +Clazz.prepareFields (c$, function () { +this.featurePanel = new awt2swing.Panel (); +this.groupItemListener = ((Clazz.isClassDefined ("jalview.appletgui.FeatureSettings$1") ? 0 : jalview.appletgui.FeatureSettings.$FeatureSettings$1$ ()), Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings$1, this, null)); +}); +Clazz.makeConstructor (c$, +function (ap) { +Clazz.superConstructor (this, jalview.appletgui.FeatureSettings, []); +this.ap = ap; +this.av = ap.av; +ap.av.featureSettings = this; +this.fr = ap.seqPanel.seqCanvas.getFeatureRenderer (); +this.transparency = new awt2swing.Scrollbar (0, 100 - Clazz.floatToInt (this.fr.getTransparency () * 100), 1, 1, 100); +if (this.fr.isTransparencyAvailable ()) { +this.transparency.addAdjustmentListener (this); +} else { +this.transparency.setEnabled (false); +}var url = this.getClass ().getResource ("/images/link.gif"); +if (url != null) { +this.linkImage = java.awt.Toolkit.getDefaultToolkit ().getImage (url); +}if (this.av.isShowSequenceFeatures () || !this.fr.hasRenderOrder ()) { +this.fr.findAllFeatures (true); +}this.discoverAllFeatureData (); +this.setLayout ( new java.awt.BorderLayout ()); +this.scrollPane = new awt2swing.ScrollPane (); +this.scrollPane.add (this.featurePanel); +if (this.fr.getAllFeatureColours () != null && this.fr.getAllFeatureColours ().size () > 0) { +this.add (this.scrollPane, "Center"); +}var invert = new awt2swing.Button ("Invert Selection"); +invert.addActionListener (this); +var lowerPanel = new awt2swing.Panel ( new java.awt.GridLayout (2, 1, 5, 10)); +lowerPanel.add (invert); +var tPanel = new awt2swing.Panel ( new java.awt.BorderLayout ()); +if (this.fr.isTransparencyAvailable ()) { +tPanel.add (this.transparency, "Center"); +tPanel.add ( new awt2swing.Label ("Transparency"), "East"); +} else { +tPanel.add ( new awt2swing.Label ("Transparency not available in this web browser"), "Center"); +}lowerPanel.add (tPanel, "South"); +this.add (lowerPanel, "South"); +if (this.groupPanel != null) { +this.groupPanel.setLayout ( new java.awt.GridLayout (Clazz.doubleToInt ((this.fr.getFeatureGroupsSize ()) / 4) + 1, 4)); +this.groupPanel.validate (); +this.add (this.groupPanel, "North"); +}this.frame = new awt2swing.Frame (); +this.frame.add (this); +var me = this; +this.frame.addWindowListener (((Clazz.isClassDefined ("jalview.appletgui.FeatureSettings$2") ? 0 : jalview.appletgui.FeatureSettings.$FeatureSettings$2$ ()), Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings$2, this, Clazz.cloneFinals ("me", me)))); +var height = this.featurePanel.getComponentCount () * 50 + 60; +height = Math.max (200, height); +height = Math.min (400, height); +var width = 300; +jalview.bin.JalviewLite.addFrame (this.frame, jalview.util.MessageManager.getString ("label.feature_settings"), width, height); +}, "jalview.appletgui.AlignmentPanel"); +Clazz.defineMethod (c$, "PaintComponent", +function (g) { +g.setColor (java.awt.Color.black); +g.drawString (jalview.util.MessageManager.getString ("label.no_features_added_to_this_alignment"), 10, 20); +g.drawString (jalview.util.MessageManager.getString ("label.features_can_be_added_from_searches_1"), 10, 40); +g.drawString (jalview.util.MessageManager.getString ("label.features_can_be_added_from_searches_2"), 10, 60); +}, "java.awt.Graphics"); +Clazz.defineMethod (c$, "popupSort", +function (check, minmax, x, y) { +var type = check.type; +var typeCol = this.fr.getFeatureStyle (type); +var men = new awt2swing.PopupMenu (jalview.util.MessageManager.formatMessage ("label.settings_for_type", Clazz.newArray (-1, [type]))); +var scr = new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.sort_by_score")); +men.add (scr); +var me = this; +scr.addActionListener (((Clazz.isClassDefined ("jalview.appletgui.FeatureSettings$3") ? 0 : jalview.appletgui.FeatureSettings.$FeatureSettings$3$ ()), Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings$3, this, Clazz.cloneFinals ("me", me, "type", type)))); +var dens = new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.sort_by_density")); +dens.addActionListener (((Clazz.isClassDefined ("jalview.appletgui.FeatureSettings$4") ? 0 : jalview.appletgui.FeatureSettings.$FeatureSettings$4$ ()), Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings$4, this, Clazz.cloneFinals ("me", me, "type", type)))); +men.add (dens); +if (minmax != null) { +var typeMinMax = minmax.get (type); +if (typeMinMax != null && (typeMinMax)[0] != null) { +var mxcol = new awt2swing.MenuItem ((Clazz.instanceOf (typeCol, java.awt.Color)) ? "Graduated Colour" : "Single Colour"); +men.add (mxcol); +mxcol.addActionListener (((Clazz.isClassDefined ("jalview.appletgui.FeatureSettings$5") ? 0 : jalview.appletgui.FeatureSettings.$FeatureSettings$5$ ()), Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings$5, this, Clazz.cloneFinals ("typeCol", typeCol, "me", me, "type", type, "check", check)))); +}}this.featurePanel.add (men); +men.show (this.featurePanel, x, y); +}, "jalview.appletgui.FeatureSettings.MyCheckbox,java.util.Hashtable,~N,~N"); +Clazz.overrideMethod (c$, "discoverAllFeatureData", +function () { +if (this.fr.getAllFeatureColours () != null && this.fr.getAllFeatureColours ().size () > 0) { +this.rebuildGroups (); +}this.resetTable (false); +}); +Clazz.defineMethod (c$, "rebuildGroups", +function () { +var rdrw = false; +if (this.groupPanel == null) { +this.groupPanel = new awt2swing.Panel (); +} else { +rdrw = true; +this.groupPanel.removeAll (); +}for (var group, $group = this.fr.getFeatureGroups ().iterator (); $group.hasNext () && ((group = $group.next ()) || true);) { +var vis = this.fr.checkGroupVisibility (group, false); +var check = Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings.MyCheckbox, this, null, group, vis, (this.fr.featureLinks != null && this.fr.featureLinks.containsKey (group))); +check.addMouseListener (this); +check.setFont ( new java.awt.Font ("Serif", 1, 12)); +check.addItemListener (this.groupItemListener); +check.setVisible (vis); +this.groupPanel.add (check); +} +if (rdrw) { +this.groupPanel.validate (); +}}); +Clazz.defineMethod (c$, "resetTable", +function (groupsChanged) { +var tmpfeatures; +var group = null; +var type; +var visibleChecks = new java.util.Vector (); +var alignment = this.av.getAlignment (); +for (var i = 0; i < alignment.getHeight (); i++) { +if (alignment.getSequenceAt (i).getSequenceFeatures () == null) { +continue; +}tmpfeatures = alignment.getSequenceAt (i).getSequenceFeatures (); +var index = 0; +while (index < tmpfeatures.length) { +group = tmpfeatures[index].featureGroup; +if (group == null || this.fr.checkGroupVisibility (group, true)) { +type = tmpfeatures[index].getType (); +if (!visibleChecks.contains (type)) { +visibleChecks.addElement (type); +}}index++; +} +} +var comps; +var cSize = this.featurePanel.getComponentCount (); +var check; +for (var i = 0; i < cSize; i++) { +comps = this.featurePanel.getComponents (); +check = comps[i]; +if (!visibleChecks.contains (check.type)) { +this.featurePanel.remove (i); +cSize--; +i--; +}} +if (this.fr.getRenderOrder () != null) { +var rol = this.fr.getRenderOrder (); +for (var ro = rol.size () - 1; ro > -1; ro--) { +var item = rol.get (ro); +if (!visibleChecks.contains (item)) { +continue; +}visibleChecks.removeElement (item); +this.addCheck (false, item); +} +}var en = visibleChecks.elements (); +while (en.hasMoreElements ()) { +this.addCheck (groupsChanged, en.nextElement ().toString ()); +} +this.featurePanel.setLayout ( new java.awt.GridLayout (this.featurePanel.getComponentCount (), 1, 10, 5)); +this.featurePanel.validate (); +if (this.scrollPane != null) { +this.scrollPane.validate (); +}this.itemStateChanged (null); +}, "~B"); +Clazz.defineMethod (c$, "addCheck", +function (groupsChanged, type) { +var addCheck; +var comps = this.featurePanel.getComponents (); +var check; +addCheck = true; +for (var i = 0; i < this.featurePanel.getComponentCount (); i++) { +check = comps[i]; +if (check.type.equals (type)) { +addCheck = false; +break; +}} +if (addCheck) { +var selected = false; +if (groupsChanged || this.av.getFeaturesDisplayed ().isVisible (type)) { +selected = true; +}check = Clazz.innerTypeInstance (jalview.appletgui.FeatureSettings.MyCheckbox, this, null, type, selected, (this.fr.featureLinks != null && this.fr.featureLinks.containsKey (type)), this.fr.getFeatureStyle (type)); +check.addMouseListener (this); +check.addMouseMotionListener (this); +check.addItemListener (this); +if (groupsChanged) { +this.featurePanel.add (check, 0); +} else { +this.featurePanel.add (check); +}}}, "~B,~S"); +Clazz.overrideMethod (c$, "actionPerformed", +function (evt) { +for (var i = 0; i < this.featurePanel.getComponentCount (); i++) { +var check = this.featurePanel.getComponent (i); +check.setState (!check.getState ()); +} +this.selectionChanged (); +}, "java.awt.event.ActionEvent"); +Clazz.overrideMethod (c$, "itemStateChanged", +function (evt) { +this.selectionChanged (); +}, "java.awt.event.ItemEvent"); +Clazz.defineMethod (c$, "selectionChanged", +function () { +var comps = this.featurePanel.getComponents (); +var cSize = comps.length; +var tmp = Clazz.newArray (cSize, 3, null); +var tmpSize = 0; +for (var i = 0; i < cSize; i++) { +var check = comps[i]; +tmp[tmpSize][0] = check.type; +tmp[tmpSize][1] = this.fr.getFeatureStyle (check.type); +tmp[tmpSize][2] = new Boolean (check.getState ()); +tmpSize++; +} +var data = Clazz.newArray (tmpSize, 3, null); +System.arraycopy (tmp, 0, data, 0, tmpSize); +this.fr.setFeaturePriority (data); +this.ap.paintAlignment (true); +}); +Clazz.overrideMethod (c$, "mousePressed", +function (evt) { +this.selectedCheck = evt.getSource (); +if (this.fr.featureLinks != null && this.fr.featureLinks.containsKey (this.selectedCheck.type)) { +if (evt.getX () > this.selectedCheck.stringWidth + 20) { +evt.consume (); +}}}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod (c$, "mouseDragged", +function (evt) { +if ((evt.getSource ()).getParent () !== this.featurePanel) { +return; +}this.dragging = true; +}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod (c$, "mouseReleased", +function (evt) { +if ((evt.getSource ()).getParent () !== this.featurePanel) { +return; +}var comp = null; +var target = null; +var height = evt.getY () + evt.getComponent ().getLocation ().y; +if (height > this.featurePanel.getSize ().height) { +comp = this.featurePanel.getComponent (this.featurePanel.getComponentCount () - 1); +} else if (height < 0) { +comp = this.featurePanel.getComponent (0); +} else { +comp = this.featurePanel.getComponentAt (evt.getX (), evt.getY () + evt.getComponent ().getLocation ().y); +}if (comp != null && Clazz.instanceOf (comp, awt2swing.Checkbox)) { +target = comp; +}if (this.selectedCheck != null && target != null && this.selectedCheck !== target) { +var targetIndex = -1; +for (var i = 0; i < this.featurePanel.getComponentCount (); i++) { +if (target === this.featurePanel.getComponent (i)) { +targetIndex = i; +break; +}} +this.featurePanel.remove (this.selectedCheck); +this.featurePanel.add (this.selectedCheck, targetIndex); +this.featurePanel.validate (); +this.itemStateChanged (null); +}}, "java.awt.event.MouseEvent"); +Clazz.defineMethod (c$, "setUserColour", +function (feature, originalColour) { +if (Clazz.instanceOf (originalColour, java.awt.Color) || Clazz.instanceOf (originalColour, jalview.schemes.GraduatedColor)) { +this.fr.setColour (feature, originalColour); +} else { +throw new Error (jalview.util.MessageManager.getString ("error.implementation_error_unsupported_feature_colour_object")); +}this.refreshTable (); +}, "~S,~O"); +Clazz.defineMethod (c$, "refreshTable", +function () { +this.featurePanel.removeAll (); +this.resetTable (false); +this.ap.paintAlignment (true); +}); +Clazz.overrideMethod (c$, "mouseEntered", +function (evt) { +}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod (c$, "mouseExited", +function (evt) { +}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod (c$, "mouseClicked", +function (evt) { +var check = evt.getSource (); +if ((evt.getModifiers () & 4) != 0) { +this.popupSort (check, this.fr.getMinMax (), evt.getX (), evt.getY ()); +}if (this.fr.featureLinks != null && this.fr.featureLinks.containsKey (check.type)) { +if (evt.getX () > check.stringWidth + 20) { +evt.consume (); +var link = this.fr.featureLinks.get (check.type).toString (); +this.ap.alignFrame.showURL (link.substring (link.indexOf ("|") + 1), link.substring (0, link.indexOf ("|"))); +}}if (check.getParent () !== this.featurePanel) { +return; +}if (evt.getClickCount () > 1) { +var fcol = this.fr.getFeatureStyle (check.type); +if (Clazz.instanceOf (fcol, java.awt.Color)) { + new jalview.appletgui.UserDefinedColours (this, check.type, fcol); +} else { + new jalview.appletgui.FeatureColourChooser (this, check.type); +check.updateColor (this.fr.getFeatureStyle (check.type)); +}}}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod (c$, "mouseMoved", +function (evt) { +}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod (c$, "adjustmentValueChanged", +function (evt) { +this.fr.setTransparency ((100 - this.transparency.getValue ()) / 100); +this.ap.seqPanel.seqCanvas.repaint (); +}, "java.awt.event.AdjustmentEvent"); +c$.$FeatureSettings$MyCheckbox$ = function () { +Clazz.pu$h(self.c$); +c$ = Clazz.decorateAsClass (function () { +Clazz.prepareCallback (this, arguments); +this.type = null; +this.stringWidth = 0; +this.hasLink = false; +this.gcol = null; +this.col = null; +Clazz.instantialize (this, arguments); +}, jalview.appletgui.FeatureSettings, "MyCheckbox", awt2swing.Checkbox); +Clazz.defineMethod (c$, "updateColor", +function (a) { +if (Clazz.instanceOf (a, java.awt.Color)) { +this.col = a; +this.gcol = null; +} else if (Clazz.instanceOf (a, jalview.schemes.GraduatedColor)) { +this.gcol = a; +this.col = null; +} else { +throw new Error (jalview.util.MessageManager.getString ("error.invalid_colour_for_mycheckbox")); +}if (this.col != null) { +this.setBackground (this.col); +} else { +var b = this.type; +if (this.gcol.getThreshType () != -1) { +b += " " + ((this.gcol.getThreshType () == 1) ? "(>)" : "(<)"); +}if (this.gcol.isColourByLabel ()) { +this.setBackground (java.awt.Color.white); +b += " (by Label)"; +} else { +this.setBackground (this.gcol.getMinColor ()); +}this.setLabel (b); +}this.repaint (); +}, "~O"); +Clazz.makeConstructor (c$, +function (a, b, c) { +Clazz.superConstructor (this, jalview.appletgui.FeatureSettings.MyCheckbox, [a, b]); +this.type = a; +var d = this.b$["jalview.appletgui.FeatureSettings"].av.nullFrame.getFontMetrics (this.b$["jalview.appletgui.FeatureSettings"].av.nullFrame.getFont ()); +this.stringWidth = d.stringWidth (a); +this.hasLink = c; +}, "~S,~B,~B"); +Clazz.makeConstructor (c$, +function (a, b, c, d) { +this.construct (a, b, c); +this.updateColor (d); +}, "~S,~B,~B,~O"); +Clazz.defineMethod (c$, "PaintComponent", +function (a) { +var b = this.getSize (); +if (this.gcol != null) { +if (this.gcol.isColourByLabel ()) { +a.setColor (java.awt.Color.white); +a.fillRect (Clazz.doubleToInt (b.width / 2), 0, Clazz.doubleToInt (b.width / 2), b.height); +} else { +var c = this.gcol.getMaxColor (); +a.setColor (c); +a.fillRect (Clazz.doubleToInt (b.width / 2), 0, Clazz.doubleToInt (b.width / 2), b.height); +}}if (this.hasLink) { +a.drawImage (this.b$["jalview.appletgui.FeatureSettings"].linkImage, this.stringWidth + 25, Clazz.doubleToInt ((this.getSize ().height - this.b$["jalview.appletgui.FeatureSettings"].linkImage.getHeight (this)) / 2), this); +}}, "java.awt.Graphics"); +c$ = Clazz.p0p (); +}; +c$.$FeatureSettings$1$ = function () { +Clazz.pu$h(self.c$); +c$ = Clazz.declareAnonymous (jalview.appletgui, "FeatureSettings$1", null, java.awt.event.ItemListener); +Clazz.overrideMethod (c$, "itemStateChanged", +function (evt) { +var source = evt.getSource (); +this.b$["jalview.appletgui.FeatureSettings"].fr.setGroupVisibility (source.getLabel (), source.getState ()); +this.b$["jalview.appletgui.FeatureSettings"].ap.seqPanel.seqCanvas.repaint (); +if (this.b$["jalview.appletgui.FeatureSettings"].ap.overviewPanel != null) { +this.b$["jalview.appletgui.FeatureSettings"].ap.overviewPanel.updateOverviewImage (); +}this.b$["jalview.appletgui.FeatureSettings"].resetTable (true); +return; +}, "java.awt.event.ItemEvent"); +c$ = Clazz.p0p (); +}; +c$.$FeatureSettings$2$ = function () { +Clazz.pu$h(self.c$); +c$ = Clazz.declareAnonymous (jalview.appletgui, "FeatureSettings$2", java.awt.event.WindowAdapter); +Clazz.overrideMethod (c$, "windowClosing", +function (e) { +if (this.f$.me.av.featureSettings === this.f$.me) { +this.f$.me.av.featureSettings = null; +this.f$.me.ap = null; +this.f$.me.av = null; +}}, "java.awt.event.WindowEvent"); +c$ = Clazz.p0p (); +}; +c$.$FeatureSettings$3$ = function () { +Clazz.pu$h(self.c$); +c$ = Clazz.declareAnonymous (jalview.appletgui, "FeatureSettings$3", null, java.awt.event.ActionListener); +Clazz.overrideMethod (c$, "actionPerformed", +function (e) { +this.f$.me.ap.alignFrame.avc.sortAlignmentByFeatureScore ( Clazz.newArray (-1, [this.f$.type])); +}, "java.awt.event.ActionEvent"); +c$ = Clazz.p0p (); +}; +c$.$FeatureSettings$4$ = function () { +Clazz.pu$h(self.c$); +c$ = Clazz.declareAnonymous (jalview.appletgui, "FeatureSettings$4", null, java.awt.event.ActionListener); +Clazz.overrideMethod (c$, "actionPerformed", +function (e) { +this.f$.me.ap.alignFrame.avc.sortAlignmentByFeatureDensity ( Clazz.newArray (-1, [this.f$.type])); +}, "java.awt.event.ActionEvent"); +c$ = Clazz.p0p (); +}; +c$.$FeatureSettings$5$ = function () { +Clazz.pu$h(self.c$); +c$ = Clazz.declareAnonymous (jalview.appletgui, "FeatureSettings$5", null, java.awt.event.ActionListener); +Clazz.overrideMethod (c$, "actionPerformed", +function (e) { +if (Clazz.instanceOf (this.f$.typeCol, java.awt.Color)) { + new jalview.appletgui.FeatureColourChooser (this.f$.me, this.f$.type); +this.f$.check.updateColor (this.b$["jalview.appletgui.FeatureSettings"].fr.getFeatureStyle (this.f$.type)); +} else { + new jalview.appletgui.UserDefinedColours (this.f$.me, this.f$.check.type, (this.f$.typeCol)); +}}, "java.awt.event.ActionEvent"); +c$ = Clazz.p0p (); +}; +});