Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / jalview / appletgui / SplitFrame.js
index c6f492f..46f513f 100644 (file)
-Clazz.declarePackage ("jalview.appletgui");\r
-Clazz.load (["jalview.appletgui.EmbmenuFrame"], "jalview.appletgui.SplitFrame", ["awt2swing.Panel", "jalview.analysis.AlignmentUtils", "jalview.bin.JalviewLite", "jalview.structure.StructureSelectionManager", "java.awt.BorderLayout", "$.Dimension", "$.GridLayout"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.topFrame = null;\r
-this.bottomFrame = null;\r
-this.outermost = null;\r
-Clazz.instantialize (this, arguments);\r
-}, jalview.appletgui, "SplitFrame", jalview.appletgui.EmbmenuFrame);\r
-Clazz.makeConstructor (c$, \r
-function (af1, af2) {\r
-Clazz.superConstructor (this, jalview.appletgui.SplitFrame, []);\r
-this.topFrame = af1;\r
-this.bottomFrame = af2;\r
-this.init ();\r
-}, "jalview.appletgui.AlignFrame,jalview.appletgui.AlignFrame");\r
-Clazz.defineMethod (c$, "init", \r
-function () {\r
-var $private = Clazz.checkPrivateMethod (arguments);\r
-if ($private != null) {\r
-return $private.apply (this, arguments);\r
-}\r
-this.constructSplit ();\r
-var topViewport = this.topFrame.viewport;\r
-var bottomViewport = this.bottomFrame.viewport;\r
-var topAlignment = topViewport.getAlignment ();\r
-var bottomAlignment = bottomViewport.getAlignment ();\r
-var cdna = topAlignment.isNucleotide () ? topViewport : (bottomAlignment.isNucleotide () ? bottomViewport : null);\r
-var protein = !topAlignment.isNucleotide () ? topViewport : (!bottomAlignment.isNucleotide () ? bottomViewport : null);\r
-var mapped = jalview.analysis.AlignmentUtils.mapProteinToCdna (protein.getAlignment (), cdna.getAlignment ());\r
-if (mapped) {\r
-var ssm = jalview.structure.StructureSelectionManager.getStructureSelectionManager (topViewport.applet);\r
-ssm.addMappings (protein.getAlignment ().getCodonFrames ());\r
-topViewport.setCodingComplement (bottomViewport);\r
-ssm.addCommandListener (cdna);\r
-ssm.addCommandListener (protein);\r
-}protein.initComplementConsensus ();\r
-var ap = topAlignment.isNucleotide () ? this.bottomFrame.alignPanel : this.topFrame.alignPanel;\r
-protein.updateConsensus (ap);\r
-this.adjustLayout ();\r
-});\r
-Clazz.defineMethod (c$, "constructSplit", \r
-function () {\r
-this.unsetMenuBar ();\r
-this.outermost =  new awt2swing.Panel ( new java.awt.GridLayout (2, 1));\r
-var topPanel =  new awt2swing.Panel ();\r
-var bottomPanel =  new awt2swing.Panel ();\r
-this.outermost.add (topPanel);\r
-this.outermost.add (bottomPanel);\r
-this.addAlignFrameComponents (this.topFrame, topPanel);\r
-this.addAlignFrameComponents (this.bottomFrame, bottomPanel);\r
-});\r
-Clazz.defineMethod (c$, "adjustLayout", \r
-function () {\r
-var cdna = this.topFrame.getAlignViewport ().getAlignment ().isNucleotide () ? this.topFrame.viewport : this.bottomFrame.viewport;\r
-var protein = cdna === this.topFrame.viewport ? this.bottomFrame.viewport : this.topFrame.viewport;\r
-var w1 = this.topFrame.alignPanel.idPanel.idCanvas.getWidth ();\r
-var w2 = this.bottomFrame.alignPanel.idPanel.idCanvas.getWidth ();\r
-var w3 = Math.max (w1, w2);\r
-if (w1 != w3) {\r
-var d = this.topFrame.alignPanel.idPanel.idCanvas.getSize ();\r
-this.topFrame.alignPanel.idPanel.idCanvas.setSize ( new java.awt.Dimension (w3, d.height));\r
-}if (w2 != w3) {\r
-var d = this.bottomFrame.alignPanel.idPanel.idCanvas.getSize ();\r
-this.bottomFrame.alignPanel.idPanel.idCanvas.setSize ( new java.awt.Dimension (w3, d.height));\r
-}if (protein != null && cdna != null) {\r
-var vs = protein.getViewStyle ();\r
-var scale = vs.isScaleProteinAsCdna () ? 3 : 1;\r
-vs.setCharWidth (scale * cdna.getViewStyle ().getCharWidth ());\r
-protein.setViewStyle (vs);\r
-}});\r
-Clazz.defineMethod (c$, "addAlignFrameComponents", \r
- function (af, panel) {\r
-panel.setLayout ( new java.awt.BorderLayout ());\r
-var menuPanel = af.makeEmbeddedPopupMenu (af.getJMenuBar (), true, false);\r
-panel.add (menuPanel, "North");\r
-panel.add (af.statusBar, "South");\r
-panel.add (af.alignPanel, "Center");\r
-af.setSplitFrame (this);\r
-}, "jalview.appletgui.AlignFrame,awt2swing.Panel");\r
-Clazz.defineMethod (c$, "addToDisplay", \r
-function (embedded, applet) {\r
-this.createSplitFrameWindow (embedded, applet);\r
-this.validate ();\r
-this.topFrame.alignPanel.adjustAnnotationHeight ();\r
-this.topFrame.alignPanel.paintAlignment (true);\r
-this.bottomFrame.alignPanel.adjustAnnotationHeight ();\r
-this.bottomFrame.alignPanel.paintAlignment (true);\r
-}, "~B,jalview.bin.JalviewLite");\r
-Clazz.defineMethod (c$, "createSplitFrameWindow", \r
-function (embed, applet) {\r
-if (embed) {\r
-applet.add (this.outermost);\r
-applet.validate ();\r
-} else {\r
-this.add (this.outermost);\r
-var width = Math.max (this.topFrame.frameWidth, this.bottomFrame.frameWidth);\r
-var height = this.topFrame.frameHeight + this.bottomFrame.frameHeight;\r
-jalview.bin.JalviewLite.addFrame (this, this.getTitle (), width, height);\r
-}}, "~B,jalview.bin.JalviewLite");\r
-Clazz.defineMethod (c$, "getComplement", \r
-function (af) {\r
-if (this.topFrame === af) {\r
-return this.bottomFrame;\r
-} else if (this.bottomFrame === af) {\r
-return this.topFrame;\r
-}return null;\r
-}, "jalview.appletgui.AlignFrame");\r
-});\r
+Clazz.declarePackage ("jalview.appletgui");
+Clazz.load (["jalview.appletgui.EmbmenuFrame"], "jalview.appletgui.SplitFrame", ["awt2swing.Panel", "jalview.analysis.AlignmentUtils", "jalview.bin.JalviewLite", "jalview.structure.StructureSelectionManager", "java.awt.BorderLayout", "$.Dimension", "$.GridLayout"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.topFrame = null;
+this.bottomFrame = null;
+this.outermost = null;
+Clazz.instantialize (this, arguments);
+}, jalview.appletgui, "SplitFrame", jalview.appletgui.EmbmenuFrame);
+Clazz.makeConstructor (c$, 
+function (af1, af2) {
+Clazz.superConstructor (this, jalview.appletgui.SplitFrame, []);
+this.topFrame = af1;
+this.bottomFrame = af2;
+this.init ();
+}, "jalview.appletgui.AlignFrame,jalview.appletgui.AlignFrame");
+Clazz.defineMethod (c$, "init", 
+function () {
+var $private = Clazz.checkPrivateMethod (arguments);
+if ($private != null) {
+return $private.apply (this, arguments);
+}
+this.constructSplit ();
+var topViewport = this.topFrame.viewport;
+var bottomViewport = this.bottomFrame.viewport;
+var topAlignment = topViewport.getAlignment ();
+var bottomAlignment = bottomViewport.getAlignment ();
+var cdna = topAlignment.isNucleotide () ? topViewport : (bottomAlignment.isNucleotide () ? bottomViewport : null);
+var protein = !topAlignment.isNucleotide () ? topViewport : (!bottomAlignment.isNucleotide () ? bottomViewport : null);
+var mapped = jalview.analysis.AlignmentUtils.mapProteinToCdna (protein.getAlignment (), cdna.getAlignment ());
+if (mapped) {
+var ssm = jalview.structure.StructureSelectionManager.getStructureSelectionManager (topViewport.applet);
+ssm.addMappings (protein.getAlignment ().getCodonFrames ());
+topViewport.setCodingComplement (bottomViewport);
+ssm.addCommandListener (cdna);
+ssm.addCommandListener (protein);
+}protein.initComplementConsensus ();
+var ap = topAlignment.isNucleotide () ? this.bottomFrame.alignPanel : this.topFrame.alignPanel;
+protein.updateConsensus (ap);
+this.adjustLayout ();
+});
+Clazz.defineMethod (c$, "constructSplit", 
+function () {
+this.unsetMenuBar ();
+this.outermost =  new awt2swing.Panel ( new java.awt.GridLayout (2, 1));
+var topPanel =  new awt2swing.Panel ();
+var bottomPanel =  new awt2swing.Panel ();
+this.outermost.add (topPanel);
+this.outermost.add (bottomPanel);
+this.addAlignFrameComponents (this.topFrame, topPanel);
+this.addAlignFrameComponents (this.bottomFrame, bottomPanel);
+});
+Clazz.defineMethod (c$, "adjustLayout", 
+function () {
+var cdna = this.topFrame.getAlignViewport ().getAlignment ().isNucleotide () ? this.topFrame.viewport : this.bottomFrame.viewport;
+var protein = cdna === this.topFrame.viewport ? this.bottomFrame.viewport : this.topFrame.viewport;
+var w1 = this.topFrame.alignPanel.idPanel.idCanvas.getWidth ();
+var w2 = this.bottomFrame.alignPanel.idPanel.idCanvas.getWidth ();
+var w3 = Math.max (w1, w2);
+if (w1 != w3) {
+var d = this.topFrame.alignPanel.idPanel.idCanvas.getSize ();
+this.topFrame.alignPanel.idPanel.idCanvas.setSize ( new java.awt.Dimension (w3, d.height));
+}if (w2 != w3) {
+var d = this.bottomFrame.alignPanel.idPanel.idCanvas.getSize ();
+this.bottomFrame.alignPanel.idPanel.idCanvas.setSize ( new java.awt.Dimension (w3, d.height));
+}if (protein != null && cdna != null) {
+var vs = protein.getViewStyle ();
+var scale = vs.isScaleProteinAsCdna () ? 3 : 1;
+vs.setCharWidth (scale * cdna.getViewStyle ().getCharWidth ());
+protein.setViewStyle (vs);
+}});
+Clazz.defineMethod (c$, "addAlignFrameComponents", 
+ function (af, panel) {
+panel.setLayout ( new java.awt.BorderLayout ());
+var menuPanel = af.makeEmbeddedPopupMenu (af.getJMenuBar (), true, false);
+panel.add (menuPanel, "North");
+panel.add (af.statusBar, "South");
+panel.add (af.alignPanel, "Center");
+af.setSplitFrame (this);
+}, "jalview.appletgui.AlignFrame,awt2swing.Panel");
+Clazz.defineMethod (c$, "addToDisplay", 
+function (embedded, applet) {
+this.createSplitFrameWindow (embedded, applet);
+this.validate ();
+this.topFrame.alignPanel.adjustAnnotationHeight ();
+this.topFrame.alignPanel.paintAlignment (true);
+this.bottomFrame.alignPanel.adjustAnnotationHeight ();
+this.bottomFrame.alignPanel.paintAlignment (true);
+}, "~B,jalview.bin.JalviewLite");
+Clazz.defineMethod (c$, "createSplitFrameWindow", 
+function (embed, applet) {
+if (embed) {
+applet.add (this.outermost);
+applet.validate ();
+} else {
+this.add (this.outermost);
+var width = Math.max (this.topFrame.frameWidth, this.bottomFrame.frameWidth);
+var height = this.topFrame.frameHeight + this.bottomFrame.frameHeight;
+jalview.bin.JalviewLite.addFrame (this, this.getTitle (), width, height);
+}}, "~B,jalview.bin.JalviewLite");
+Clazz.defineMethod (c$, "getComplement", 
+function (af) {
+if (this.topFrame === af) {
+return this.bottomFrame;
+} else if (this.bottomFrame === af) {
+return this.topFrame;
+}return null;
+}, "jalview.appletgui.AlignFrame");
+});