1 package jalview.appletgui;
3 import jalview.bin.JalviewLite;
5 import java.awt.BorderLayout;
6 import java.awt.GridLayout;
9 public class SplitFrame extends EmbmenuFrame
11 private static final long serialVersionUID = 1L;
13 private AlignFrame topFrame;
15 private AlignFrame bottomFrame;
17 private Panel outermost;
22 public SplitFrame(AlignFrame af1, AlignFrame af2)
30 * Creates a Panel containing two Panels, and adds the first and second
31 * AlignFrame's components to each. At this stage we have not yet committed to
32 * whether the enclosing panel will be added to this frame, for display as a
33 * separate frame, or added to the applet (embedded mode).
38 outermost = new Panel();
39 outermost.setLayout(new GridLayout(2, 1));
41 Panel topPanel = new Panel();
42 Panel bottomPanel = new Panel();
43 outermost.add(topPanel);
44 outermost.add(bottomPanel);
46 addAlignFrameComponents(topFrame, topPanel);
47 addAlignFrameComponents(bottomFrame, bottomPanel);
51 * Add the menu bar, alignment panel and status bar from the AlignFrame to the
52 * panel. The menu bar is a panel 'reconstructed' from the AlignFrame's frame
53 * menu bar. This allows each half of the SplitFrame to have its own menu bar.
58 private void addAlignFrameComponents(AlignFrame af, Panel panel)
60 panel.setLayout(new BorderLayout());
61 Panel menuPanel = makeEmbeddedPopupMenu(af.getMenuBar(), FONT_ARIAL_PLAIN_11, true, false);
62 panel.add(menuPanel, BorderLayout.NORTH);
63 panel.add(af.statusBar, BorderLayout.SOUTH);
64 panel.add(af.alignPanel, BorderLayout.CENTER);
68 * Display the content panel either as a new frame or embedded in the applet.
73 public void addToDisplay(boolean embedded, JalviewLite applet)
75 createAlignFrameWindow(embedded, applet);
77 topFrame.alignPanel.adjustAnnotationHeight();
78 topFrame.alignPanel.paintAlignment(true);
79 bottomFrame.alignPanel.adjustAnnotationHeight();
80 bottomFrame.alignPanel.paintAlignment(true);
84 * Either show the content panel in this frame as a new frame, or (if
85 * embed=true) add it to the applet container instead.
90 public void createAlignFrameWindow(boolean embed, JalviewLite applet)
94 applet.add(outermost);
100 int width = Math.max(topFrame.DEFAULT_WIDTH,
101 bottomFrame.DEFAULT_WIDTH);
102 int height = topFrame.DEFAULT_HEIGHT + bottomFrame.DEFAULT_HEIGHT;
103 jalview.bin.JalviewLite
104 .addFrame(this, this.getTitle(), width, height);