X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fjalview%2Fappletgui%2FSplitFrame.js;fp=site%2Fj2s%2Fjalview%2Fappletgui%2FSplitFrame.js;h=46f513f075204780a32c21c0bf1f72444c1fe3cd;hp=c6f492fae13c379d7796342fd9c272cc2c2a3255;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/j2s/jalview/appletgui/SplitFrame.js b/site/j2s/jalview/appletgui/SplitFrame.js index c6f492f..46f513f 100644 --- a/site/j2s/jalview/appletgui/SplitFrame.js +++ b/site/j2s/jalview/appletgui/SplitFrame.js @@ -1,108 +1,108 @@ -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"); -}); +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"); +});