1 Clazz.declarePackage ("jalview.appletgui");
2 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 () {
3 c$ = Clazz.decorateAsClass (function () {
5 this.bottomFrame = null;
7 Clazz.instantialize (this, arguments);
8 }, jalview.appletgui, "SplitFrame", jalview.appletgui.EmbmenuFrame);
9 Clazz.makeConstructor (c$,
11 Clazz.superConstructor (this, jalview.appletgui.SplitFrame, []);
13 this.bottomFrame = af2;
15 }, "jalview.appletgui.AlignFrame,jalview.appletgui.AlignFrame");
16 Clazz.defineMethod (c$, "init",
18 var $private = Clazz.checkPrivateMethod (arguments);
19 if ($private != null) {
20 return $private.apply (this, arguments);
22 this.constructSplit ();
23 var topViewport = this.topFrame.viewport;
24 var bottomViewport = this.bottomFrame.viewport;
25 var topAlignment = topViewport.getAlignment ();
26 var bottomAlignment = bottomViewport.getAlignment ();
27 var cdna = topAlignment.isNucleotide () ? topViewport : (bottomAlignment.isNucleotide () ? bottomViewport : null);
28 var protein = !topAlignment.isNucleotide () ? topViewport : (!bottomAlignment.isNucleotide () ? bottomViewport : null);
29 var mapped = jalview.analysis.AlignmentUtils.mapProteinToCdna (protein.getAlignment (), cdna.getAlignment ());
31 var ssm = jalview.structure.StructureSelectionManager.getStructureSelectionManager (topViewport.applet);
32 ssm.addMappings (protein.getAlignment ().getCodonFrames ());
33 topViewport.setCodingComplement (bottomViewport);
34 ssm.addCommandListener (cdna);
35 ssm.addCommandListener (protein);
36 }protein.initComplementConsensus ();
37 var ap = topAlignment.isNucleotide () ? this.bottomFrame.alignPanel : this.topFrame.alignPanel;
38 protein.updateConsensus (ap);
41 Clazz.defineMethod (c$, "constructSplit",
44 this.outermost = new awt2swing.Panel ( new java.awt.GridLayout (2, 1));
45 var topPanel = new awt2swing.Panel ();
46 var bottomPanel = new awt2swing.Panel ();
47 this.outermost.add (topPanel);
48 this.outermost.add (bottomPanel);
49 this.addAlignFrameComponents (this.topFrame, topPanel);
50 this.addAlignFrameComponents (this.bottomFrame, bottomPanel);
52 Clazz.defineMethod (c$, "adjustLayout",
54 var cdna = this.topFrame.getAlignViewport ().getAlignment ().isNucleotide () ? this.topFrame.viewport : this.bottomFrame.viewport;
55 var protein = cdna === this.topFrame.viewport ? this.bottomFrame.viewport : this.topFrame.viewport;
56 var w1 = this.topFrame.alignPanel.idPanel.idCanvas.getWidth ();
57 var w2 = this.bottomFrame.alignPanel.idPanel.idCanvas.getWidth ();
58 var w3 = Math.max (w1, w2);
60 var d = this.topFrame.alignPanel.idPanel.idCanvas.getSize ();
61 this.topFrame.alignPanel.idPanel.idCanvas.setSize ( new java.awt.Dimension (w3, d.height));
63 var d = this.bottomFrame.alignPanel.idPanel.idCanvas.getSize ();
64 this.bottomFrame.alignPanel.idPanel.idCanvas.setSize ( new java.awt.Dimension (w3, d.height));
65 }if (protein != null && cdna != null) {
66 var vs = protein.getViewStyle ();
67 var scale = vs.isScaleProteinAsCdna () ? 3 : 1;
68 vs.setCharWidth (scale * cdna.getViewStyle ().getCharWidth ());
69 protein.setViewStyle (vs);
71 Clazz.defineMethod (c$, "addAlignFrameComponents",
72 ($fz = function (af, panel) {
73 panel.setLayout ( new java.awt.BorderLayout ());
74 var menuPanel = af.makeEmbeddedPopupMenu (af.getJMenuBar (), true, false);
75 panel.add (menuPanel, "North");
76 panel.add (af.statusBar, "South");
77 panel.add (af.alignPanel, "Center");
78 af.setSplitFrame (this);
79 }, $fz.isPrivate = true, $fz), "jalview.appletgui.AlignFrame,awt2swing.Panel");
80 Clazz.defineMethod (c$, "addToDisplay",
81 function (embedded, applet) {
82 this.createSplitFrameWindow (embedded, applet);
84 this.topFrame.alignPanel.adjustAnnotationHeight ();
85 this.topFrame.alignPanel.paintAlignment (true);
86 this.bottomFrame.alignPanel.adjustAnnotationHeight ();
87 this.bottomFrame.alignPanel.paintAlignment (true);
88 }, "~B,jalview.bin.JalviewLite");
89 Clazz.defineMethod (c$, "createSplitFrameWindow",
90 function (embed, applet) {
92 applet.add (this.outermost);
95 this.add (this.outermost);
96 var width = Math.max (this.topFrame.frameWidth, this.bottomFrame.frameWidth);
97 var height = this.topFrame.frameHeight + this.bottomFrame.frameHeight;
98 jalview.bin.JalviewLite.addFrame (this, this.getTitle (), width, height);
99 }}, "~B,jalview.bin.JalviewLite");
100 Clazz.defineMethod (c$, "getComplement",
102 if (this.topFrame === af) {
103 return this.bottomFrame;
104 } else if (this.bottomFrame === af) {
105 return this.topFrame;
107 }, "jalview.appletgui.AlignFrame");