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