JAL-1807 still testing
[jalviewjs.git] / bin / jalview / appletgui / AlignViewport.js
index 1d890fc..8ea8971 100644 (file)
-Clazz.declarePackage ("jalview.appletgui");
-Clazz.load (["jalview.structure.CommandListener", "$.SelectionSource", "$.VamsasSource", "jalview.viewmodel.AlignmentViewport", "java.awt.Font"], "jalview.appletgui.AlignViewport", ["awt2swing.Frame", "jalview.api.AlignViewportI", "jalview.bin.JalviewLite", "jalview.datamodel.ColumnSelection", "$.SearchResults", "$.Sequence", "$.SequenceGroup", "jalview.schemes.ColourSchemeProperty", "jalview.structure.StructureSelectionManager", "jalview.util.Platform", "jalview.workers.AlignCalcManager", "java.lang.Float", "$.StringBuilder"], function () {
-c$ = Clazz.decorateAsClass (function () {
-this.cursorMode = false;
-this.font = null;
-this.validCharWidth = true;
-this.currentTree = null;
-this.applet = null;
-this.MAC = false;
-this.annotationColumnSelectionState = null;
-this.nullFrame = null;
-this.featureSettings = null;
-this.heightScale = 1;
-this.widthScale = 1;
-this.centreColumnLabels = false;
-this.followSelection = true;
-Clazz.instantialize (this, arguments);
-}, jalview.appletgui, "AlignViewport", jalview.viewmodel.AlignmentViewport, [jalview.structure.SelectionSource, jalview.structure.VamsasSource, jalview.structure.CommandListener]);
-Clazz.prepareFields (c$, function () {
-this.font =  new java.awt.Font ("SansSerif", 0, 10);
-});
-Clazz.overrideMethod (c$, "finalize", 
-function () {
-this.applet = null;
-this.quality = null;
-this.alignment = null;
-this.colSel = null;
-});
-Clazz.makeConstructor (c$, 
-function (al, applet) {
-Clazz.superConstructor (this, jalview.appletgui.AlignViewport);
-this.calculator =  new jalview.workers.AlignCalcManager ();
-this.applet = applet;
-this.alignment = al;
-this.setPadGaps (true);
-this.startRes = 0;
-this.endRes = al.getWidth () - 1;
-this.startSeq = 0;
-this.endSeq = al.getHeight () - 1;
-if (applet != null) {
-var param = applet.widthScale;
-if (param != null) {
-try {
-this.widthScale =  new Float (param).floatValue ();
-} catch (e) {
-if (Clazz.exceptionOf (e, Exception)) {
-} else {
-throw e;
-}
-}
-if (this.widthScale <= 1.0) {
-System.err.println ("Invalid alignment character width scaling factor (" + this.widthScale + "). Ignoring.");
-this.widthScale = 1;
-}if (jalview.bin.JalviewLite.debug) {
-System.err.println ("Alignment character width scaling factor is now " + this.widthScale);
-}}param = applet.heightScale;
-if (param != null) {
-try {
-this.heightScale =  new Float (param).floatValue ();
-} catch (e) {
-if (Clazz.exceptionOf (e, Exception)) {
-} else {
-throw e;
-}
-}
-if (this.heightScale <= 1.0) {
-System.err.println ("Invalid alignment character height scaling factor (" + this.heightScale + "). Ignoring.");
-this.heightScale = 1;
-}if (jalview.bin.JalviewLite.debug) {
-System.err.println ("Alignment character height scaling factor is now " + this.heightScale);
-}}}this.setFont (this.font);
-this.MAC = jalview.util.Platform.isAMac ();
-if (applet != null) {
-this.setShowJVSuffix (applet.getDefaultParameter ("showFullId", this.getShowJVSuffix ()));
-this.setShowAnnotation (applet.getDefaultParameter ("showAnnotation", this.isShowAnnotation ()));
-this.showConservation = applet.getDefaultParameter ("showConservation", this.showConservation);
-this.showQuality = applet.getDefaultParameter ("showQuality", this.showQuality);
-this.showConsensus = applet.getDefaultParameter ("showConsensus", this.showConsensus);
-this.setShowUnconserved (applet.getDefaultParameter ("showUnconserved", this.getShowUnconserved ()));
-this.setScaleProteinAsCdna (applet.getDefaultParameter ("scaleProteinAsCdna", this.isScaleProteinAsCdna ()));
-var param = applet.upperCase;
-if (param != null) {
-if (param.equalsIgnoreCase ("bold")) {
-this.setUpperCasebold (true);
-}}this.sortByTree = applet.getDefaultParameter ("sortByTree", this.sortByTree);
-this.setFollowHighlight (applet.getDefaultParameter ("automaticScrolling", this.isFollowHighlight ()));
-this.followSelection = this.isFollowHighlight ();
-this.showSequenceLogo = applet.getDefaultParameter ("showSequenceLogo", this.showSequenceLogo);
-this.normaliseSequenceLogo = applet.getDefaultParameter ("normaliseSequenceLogo", applet.getDefaultParameter ("normaliseLogo", this.normaliseSequenceLogo));
-this.showGroupConsensus = applet.getDefaultParameter ("showGroupConsensus", this.showGroupConsensus);
-this.showGroupConservation = applet.getDefaultParameter ("showGroupConservation", this.showGroupConservation);
-this.showConsensusHistogram = applet.getDefaultParameter ("showConsensusHistogram", this.showConsensusHistogram);
-}if (applet != null) {
-var colour = applet.defaultColour;
-if (colour == null) {
-colour = applet.userDefinedColour;
-if (colour != null) {
-colour = "User Defined";
-}}if (colour != null) {
-this.globalColourScheme = jalview.schemes.ColourSchemeProperty.getColour (this.alignment, colour);
-if (this.globalColourScheme != null) {
-this.globalColourScheme.setConsensus (this.hconsensus);
-}}if (applet.userDefinedColour != null) {
-(this.globalColourScheme).parseAppletParameter (applet.userDefinedColour);
-}}this.initAutoAnnotation ();
-}, "jalview.datamodel.AlignmentI,jalview.bin.JalviewLite");
-Clazz.defineMethod (c$, "getConsensusSeq", 
-function () {
-if (this.consensus == null) {
-this.updateConsensus (null);
-}if (this.consensus == null) {
-return null;
-}var seqs =  new StringBuilder (this.consensus.annotations.length);
-for (var i = 0; i < this.consensus.annotations.length; i++) {
-if (this.consensus.annotations[i] != null) {
-if (this.consensus.annotations[i].description.charAt (0) == '[') {
-seqs.append (this.consensus.annotations[i].description.charAt (1));
-} else {
-seqs.append (this.consensus.annotations[i].displayCharacter);
-}}}
-var sq =  new jalview.datamodel.Sequence ("Consensus", seqs.toString ());
-sq.setDescription ("Percentage Identity Consensus " + ((this.ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
-return sq;
-});
-Clazz.defineMethod (c$, "setFont", 
-function (f) {
-this.font = f;
-if (this.nullFrame == null) {
-this.nullFrame =  new awt2swing.Frame ();
-this.nullFrame.addNotify ();
-this.nullFrame.setFont (this.font);
-}var fm = this.nullFrame.getGraphics ().getFontMetrics (this.font);
-this.setCharHeight (Clazz.floatToInt (this.heightScale * fm.getHeight ()));
-this.setCharWidth (Clazz.floatToInt (this.widthScale * fm.charWidth ('M')));
-if (this.isUpperCasebold ()) {
-var f2 =  new java.awt.Font (f.getName (), 1, f.getSize ());
-fm = this.nullFrame.getGraphics ().getFontMetrics (f2);
-this.setCharWidth (Clazz.floatToInt (this.widthScale * (Clazz.doubleToInt (fm.stringWidth ("MMMMMMMMMMM") / 10))));
-}}, "java.awt.Font");
-Clazz.defineMethod (c$, "getFont", 
-function () {
-return this.font;
-});
-Clazz.defineMethod (c$, "resetSeqLimits", 
-function (height) {
-this.setEndSeq (Clazz.doubleToInt (height / this.getCharHeight ()));
-}, "~N");
-Clazz.defineMethod (c$, "setCurrentTree", 
-function (tree) {
-this.currentTree = tree;
-}, "jalview.analysis.NJTree");
-Clazz.defineMethod (c$, "getCurrentTree", 
-function () {
-return this.currentTree;
-});
-Clazz.defineMethod (c$, "getCentreColumnLabels", 
-function () {
-return this.centreColumnLabels;
-});
-Clazz.defineMethod (c$, "getFollowSelection", 
-function () {
-return this.followSelection;
-});
-Clazz.overrideMethod (c$, "sendSelection", 
-function () {
-this.getStructureSelectionManager ().sendSelection ( new jalview.datamodel.SequenceGroup (this.getSelectionGroup ()),  new jalview.datamodel.ColumnSelection (this.getColumnSelection ()), this);
-});
-Clazz.overrideMethod (c$, "getStructureSelectionManager", 
-function () {
-return jalview.structure.StructureSelectionManager.getStructureSelectionManager (this.applet);
-});
-Clazz.defineMethod (c$, "expandColSelection", 
-function (sg, wholewidth) {
-var sgs;
-var sge;
-if (sg != null && (sgs = sg.getStartRes ()) >= 0 && sg.getStartRes () <= (sge = sg.getEndRes ()) && (this.colSel == null || this.colSel.getSelected () == null || this.colSel.getSelected ().size () == 0)) {
-if (!wholewidth && this.alignment.getWidth () == (1 + sge - sgs)) {
-return;
-}if (this.colSel == null) {
-this.colSel =  new jalview.datamodel.ColumnSelection ();
-}for (var cspos = sg.getStartRes (); cspos <= sg.getEndRes (); cspos++) {
-this.colSel.addElement (cspos);
-}
-}}, "jalview.datamodel.SequenceGroup,~B");
-Clazz.overrideMethod (c$, "isNormaliseSequenceLogo", 
-function () {
-return this.normaliseSequenceLogo;
-});
-Clazz.defineMethod (c$, "setNormaliseSequenceLogo", 
-function (state) {
-this.normaliseSequenceLogo = state;
-}, "~B");
-Clazz.overrideMethod (c$, "isValidCharWidth", 
-function () {
-return this.validCharWidth;
-});
-Clazz.defineMethod (c$, "getAnnotationColumnSelectionState", 
-function () {
-return this.annotationColumnSelectionState;
-});
-Clazz.defineMethod (c$, "setAnnotationColumnSelectionState", 
-function (annotationColumnSelectionState) {
-this.annotationColumnSelectionState = annotationColumnSelectionState;
-}, "jalview.appletgui.AnnotationColumnChooser");
-Clazz.overrideMethod (c$, "mirrorCommand", 
-function (command, undo, ssm, source) {
-if (Clazz.instanceOf (source, jalview.api.AlignViewportI) && (source).getCodingComplement () === this) {
-} else {
-return;
-}var mappedCommand = ssm.mapCommand (command, undo, this.getAlignment (), this.getGapCharacter ());
-if (mappedCommand != null) {
-mappedCommand.doCommand (null);
-this.firePropertyChange ("alignment", null, this.getAlignment ().getSequences ());
-}}, "jalview.commands.CommandI,~B,jalview.structure.StructureSelectionManager,jalview.structure.VamsasSource");
-Clazz.overrideMethod (c$, "getVamsasSource", 
-function () {
-return this;
-});
-Clazz.defineMethod (c$, "scrollComplementaryAlignment", 
-function (complementPanel) {
-if (complementPanel == null) {
-return;
-}var sr =  new jalview.datamodel.SearchResults ();
-var seqOffset = this.findComplementScrollTarget (sr);
-if (!sr.isEmpty ()) {
-complementPanel.setFollowingComplementScroll (true);
-complementPanel.scrollToCentre (sr, seqOffset);
-}}, "jalview.appletgui.AlignmentPanel");
-});
+Clazz.declarePackage ("jalview.appletgui");\r
+Clazz.load (["jalview.structure.CommandListener", "$.SelectionSource", "$.VamsasSource", "jalview.viewmodel.AlignmentViewport", "java.awt.Font"], "jalview.appletgui.AlignViewport", ["awt2swing.Frame", "jalview.api.AlignViewportI", "jalview.bin.JalviewLite", "jalview.datamodel.ColumnSelection", "$.SearchResults", "$.Sequence", "$.SequenceGroup", "jalview.schemes.ColourSchemeProperty", "jalview.structure.StructureSelectionManager", "jalview.util.Platform", "jalview.workers.AlignCalcManager", "java.lang.Float", "$.StringBuilder"], function () {\r
+c$ = Clazz.decorateAsClass (function () {\r
+this.cursorMode = false;\r
+this.font = null;\r
+this.validCharWidth = true;\r
+this.currentTree = null;\r
+this.applet = null;\r
+this.MAC = false;\r
+this.annotationColumnSelectionState = null;\r
+this.nullFrame = null;\r
+this.featureSettings = null;\r
+this.heightScale = 1;\r
+this.widthScale = 1;\r
+this.centreColumnLabels = false;\r
+this.followSelection = true;\r
+Clazz.instantialize (this, arguments);\r
+}, jalview.appletgui, "AlignViewport", jalview.viewmodel.AlignmentViewport, [jalview.structure.SelectionSource, jalview.structure.VamsasSource, jalview.structure.CommandListener]);\r
+Clazz.prepareFields (c$, function () {\r
+this.font =  new java.awt.Font ("SansSerif", 0, 10);\r
+});\r
+Clazz.overrideMethod (c$, "finalize", \r
+function () {\r
+this.applet = null;\r
+this.quality = null;\r
+this.alignment = null;\r
+this.colSel = null;\r
+});\r
+Clazz.makeConstructor (c$, \r
+function (al, applet) {\r
+Clazz.superConstructor (this, jalview.appletgui.AlignViewport);\r
+this.calculator =  new jalview.workers.AlignCalcManager ();\r
+this.applet = applet;\r
+this.alignment = al;\r
+this.setPadGaps (true);\r
+this.startRes = 0;\r
+this.endRes = al.getWidth () - 1;\r
+this.startSeq = 0;\r
+this.endSeq = al.getHeight () - 1;\r
+if (applet != null) {\r
+var param = applet.widthScale;\r
+if (param != null) {\r
+try {\r
+this.widthScale =  new Float (param).floatValue ();\r
+} catch (e) {\r
+if (Clazz.exceptionOf (e, Exception)) {\r
+} else {\r
+throw e;\r
+}\r
+}\r
+if (this.widthScale <= 1.0) {\r
+System.err.println ("Invalid alignment character width scaling factor (" + this.widthScale + "). Ignoring.");\r
+this.widthScale = 1;\r
+}if (jalview.bin.JalviewLite.debug) {\r
+System.err.println ("Alignment character width scaling factor is now " + this.widthScale);\r
+}}param = applet.heightScale;\r
+if (param != null) {\r
+try {\r
+this.heightScale =  new Float (param).floatValue ();\r
+} catch (e) {\r
+if (Clazz.exceptionOf (e, Exception)) {\r
+} else {\r
+throw e;\r
+}\r
+}\r
+if (this.heightScale <= 1.0) {\r
+System.err.println ("Invalid alignment character height scaling factor (" + this.heightScale + "). Ignoring.");\r
+this.heightScale = 1;\r
+}if (jalview.bin.JalviewLite.debug) {\r
+System.err.println ("Alignment character height scaling factor is now " + this.heightScale);\r
+}}}this.setFont (this.font);\r
+this.MAC = jalview.util.Platform.isAMac ();\r
+if (applet != null) {\r
+this.setShowJVSuffix (applet.getDefaultParameter ("showFullId", this.getShowJVSuffix ()));\r
+this.setShowAnnotation (applet.getDefaultParameter ("showAnnotation", this.isShowAnnotation ()));\r
+this.showConservation = applet.getDefaultParameter ("showConservation", this.showConservation);\r
+this.showQuality = applet.getDefaultParameter ("showQuality", this.showQuality);\r
+this.showConsensus = applet.getDefaultParameter ("showConsensus", this.showConsensus);\r
+this.setShowUnconserved (applet.getDefaultParameter ("showUnconserved", this.getShowUnconserved ()));\r
+this.setScaleProteinAsCdna (applet.getDefaultParameter ("scaleProteinAsCdna", this.isScaleProteinAsCdna ()));\r
+var param = applet.upperCase;\r
+if (param != null) {\r
+if (param.equalsIgnoreCase ("bold")) {\r
+this.setUpperCasebold (true);\r
+}}this.sortByTree = applet.getDefaultParameter ("sortByTree", this.sortByTree);\r
+this.setFollowHighlight (applet.getDefaultParameter ("automaticScrolling", this.isFollowHighlight ()));\r
+this.followSelection = this.isFollowHighlight ();\r
+this.showSequenceLogo = applet.getDefaultParameter ("showSequenceLogo", this.showSequenceLogo);\r
+this.normaliseSequenceLogo = applet.getDefaultParameter ("normaliseSequenceLogo", applet.getDefaultParameter ("normaliseLogo", this.normaliseSequenceLogo));\r
+this.showGroupConsensus = applet.getDefaultParameter ("showGroupConsensus", this.showGroupConsensus);\r
+this.showGroupConservation = applet.getDefaultParameter ("showGroupConservation", this.showGroupConservation);\r
+this.showConsensusHistogram = applet.getDefaultParameter ("showConsensusHistogram", this.showConsensusHistogram);\r
+}if (applet != null) {\r
+var colour = applet.defaultColour;\r
+if (colour == null) {\r
+colour = applet.userDefinedColour;\r
+if (colour != null) {\r
+colour = "User Defined";\r
+}}if (colour != null) {\r
+this.globalColourScheme = jalview.schemes.ColourSchemeProperty.getColour (this.alignment, colour);\r
+if (this.globalColourScheme != null) {\r
+this.globalColourScheme.setConsensus (this.hconsensus);\r
+}}if (applet.userDefinedColour != null) {\r
+(this.globalColourScheme).parseAppletParameter (applet.userDefinedColour);\r
+}}this.initAutoAnnotation ();\r
+}, "jalview.datamodel.AlignmentI,jalview.bin.JalviewLite");\r
+Clazz.defineMethod (c$, "getConsensusSeq", \r
+function () {\r
+if (this.consensus == null) {\r
+this.updateConsensus (null);\r
+}if (this.consensus == null) {\r
+return null;\r
+}var seqs =  new StringBuilder (this.consensus.annotations.length);\r
+for (var i = 0; i < this.consensus.annotations.length; i++) {\r
+if (this.consensus.annotations[i] != null) {\r
+if (this.consensus.annotations[i].description.charAt (0) == '[') {\r
+seqs.append (this.consensus.annotations[i].description.charAt (1));\r
+} else {\r
+seqs.append (this.consensus.annotations[i].displayCharacter);\r
+}}}\r
+var sq =  new jalview.datamodel.Sequence ("Consensus", seqs.toString ());\r
+sq.setDescription ("Percentage Identity Consensus " + ((this.ignoreGapsInConsensusCalculation) ? " without gaps" : ""));\r
+return sq;\r
+});\r
+Clazz.defineMethod (c$, "setFont", \r
+function (f) {\r
+this.font = f;\r
+if (this.nullFrame == null) {\r
+this.nullFrame =  new awt2swing.Frame ();\r
+this.nullFrame.addNotify ();\r
+this.nullFrame.setFont (this.font);\r
+}var fm = this.nullFrame.getGraphics ().getFontMetrics (this.font);\r
+this.setCharHeight (Clazz.floatToInt (this.heightScale * fm.getHeight ()));\r
+this.setCharWidth (Clazz.floatToInt (this.widthScale * fm.charWidth ('M')));\r
+if (this.isUpperCasebold ()) {\r
+var f2 =  new java.awt.Font (f.getName (), 1, f.getSize ());\r
+fm = this.nullFrame.getGraphics ().getFontMetrics (f2);\r
+this.setCharWidth (Clazz.floatToInt (this.widthScale * (Clazz.doubleToInt (fm.stringWidth ("MMMMMMMMMMM") / 10))));\r
+}}, "java.awt.Font");\r
+Clazz.defineMethod (c$, "getFont", \r
+function () {\r
+return this.font;\r
+});\r
+Clazz.defineMethod (c$, "resetSeqLimits", \r
+function (height) {\r
+this.setEndSeq (Clazz.doubleToInt (height / this.getCharHeight ()));\r
+}, "~N");\r
+Clazz.defineMethod (c$, "setCurrentTree", \r
+function (tree) {\r
+this.currentTree = tree;\r
+}, "jalview.analysis.NJTree");\r
+Clazz.defineMethod (c$, "getCurrentTree", \r
+function () {\r
+return this.currentTree;\r
+});\r
+Clazz.defineMethod (c$, "getCentreColumnLabels", \r
+function () {\r
+return this.centreColumnLabels;\r
+});\r
+Clazz.defineMethod (c$, "getFollowSelection", \r
+function () {\r
+return this.followSelection;\r
+});\r
+Clazz.overrideMethod (c$, "sendSelection", \r
+function () {\r
+this.getStructureSelectionManager ().sendSelection ( new jalview.datamodel.SequenceGroup (this.getSelectionGroup ()),  new jalview.datamodel.ColumnSelection (this.getColumnSelection ()), this);\r
+});\r
+Clazz.overrideMethod (c$, "getStructureSelectionManager", \r
+function () {\r
+return jalview.structure.StructureSelectionManager.getStructureSelectionManager (this.applet);\r
+});\r
+Clazz.defineMethod (c$, "expandColSelection", \r
+function (sg, wholewidth) {\r
+var sgs;\r
+var sge;\r
+if (sg != null && (sgs = sg.getStartRes ()) >= 0 && sg.getStartRes () <= (sge = sg.getEndRes ()) && (this.colSel == null || this.colSel.getSelected () == null || this.colSel.getSelected ().size () == 0)) {\r
+if (!wholewidth && this.alignment.getWidth () == (1 + sge - sgs)) {\r
+return;\r
+}if (this.colSel == null) {\r
+this.colSel =  new jalview.datamodel.ColumnSelection ();\r
+}for (var cspos = sg.getStartRes (); cspos <= sg.getEndRes (); cspos++) {\r
+this.colSel.addElement (cspos);\r
+}\r
+}}, "jalview.datamodel.SequenceGroup,~B");\r
+Clazz.overrideMethod (c$, "isNormaliseSequenceLogo", \r
+function () {\r
+return this.normaliseSequenceLogo;\r
+});\r
+Clazz.defineMethod (c$, "setNormaliseSequenceLogo", \r
+function (state) {\r
+this.normaliseSequenceLogo = state;\r
+}, "~B");\r
+Clazz.overrideMethod (c$, "isValidCharWidth", \r
+function () {\r
+return this.validCharWidth;\r
+});\r
+Clazz.defineMethod (c$, "getAnnotationColumnSelectionState", \r
+function () {\r
+return this.annotationColumnSelectionState;\r
+});\r
+Clazz.defineMethod (c$, "setAnnotationColumnSelectionState", \r
+function (annotationColumnSelectionState) {\r
+this.annotationColumnSelectionState = annotationColumnSelectionState;\r
+}, "jalview.appletgui.AnnotationColumnChooser");\r
+Clazz.overrideMethod (c$, "mirrorCommand", \r
+function (command, undo, ssm, source) {\r
+if (Clazz.instanceOf (source, jalview.api.AlignViewportI) && (source).getCodingComplement () === this) {\r
+} else {\r
+return;\r
+}var mappedCommand = ssm.mapCommand (command, undo, this.getAlignment (), this.getGapCharacter ());\r
+if (mappedCommand != null) {\r
+mappedCommand.doCommand (null);\r
+this.firePropertyChange ("alignment", null, this.getAlignment ().getSequences ());\r
+}}, "jalview.commands.CommandI,~B,jalview.structure.StructureSelectionManager,jalview.structure.VamsasSource");\r
+Clazz.overrideMethod (c$, "getVamsasSource", \r
+function () {\r
+return this;\r
+});\r
+Clazz.defineMethod (c$, "scrollComplementaryAlignment", \r
+function (complementPanel) {\r
+if (complementPanel == null) {\r
+return;\r
+}var sr =  new jalview.datamodel.SearchResults ();\r
+var seqOffset = this.findComplementScrollTarget (sr);\r
+if (!sr.isEmpty ()) {\r
+complementPanel.setFollowingComplementScroll (true);\r
+complementPanel.scrollToCentre (sr, seqOffset);\r
+}}, "jalview.appletgui.AlignmentPanel");\r
+});\r