moved to: https://sites.google.com/site/cmzmasek/home/software/forester
[jalview.git] / forester / java / src / org / forester / archaeopteryx / MainPanelApplets.java
1 // $Id:
2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
4 //
5 // Copyright (C) 2008-2009 Christian M. Zmasek
6 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
7 // Copyright (C) 2000-2001 Washington University School of Medicine
8 // and Howard Hughes Medical Institute
9 // Copyright (C) 2003-2007 Ethalinda K.S. Cannon
10 // All rights reserved
11 //
12 // This library is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU Lesser General Public
14 // License as published by the Free Software Foundation; either
15 // version 2.1 of the License, or (at your option) any later version.
16 //
17 // This library is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 // Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public
23 // License along with this library; if not, write to the Free Software
24 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 //
26 // Contact: phylosoft @ gmail . com
27 // WWW: https://sites.google.com/site/cmzmasek/home/software/forester
28
29 package org.forester.archaeopteryx;
30
31 import java.awt.BorderLayout;
32 import java.util.ArrayList;
33
34 import javax.swing.JApplet;
35
36 final class MainPanelApplets extends MainPanel {
37
38     private static final long serialVersionUID = -7142615479464963140L;
39     private final JApplet     _applet;
40
41     public MainPanelApplets( final Configuration configuration, final ArchaeopteryxE em_applet ) {
42         if ( configuration == null ) {
43             throw new IllegalArgumentException( "configuration is null" );
44         }
45         addComponentListener( this );
46         _configuration = configuration;
47         _mainframe = null;
48         _treepanels = new ArrayList<TreePanel>();
49         _applet = em_applet;
50         initialize();
51         _control_panel = new ControlPanel( this, configuration );
52         if ( !configuration.isHideControlPanelAndMenubar() ) {
53             add( _control_panel, BorderLayout.WEST );
54         }
55         setupTreeGraphic( configuration, getControlPanel() );
56     }
57
58     public MainPanelApplets( final Configuration configuration, final MainFrameApplet aaf ) {
59         if ( configuration == null ) {
60             throw new IllegalArgumentException( "configuration is null" );
61         }
62         addComponentListener( this );
63         _configuration = configuration;
64         _mainframe = aaf;
65         _treepanels = new ArrayList<TreePanel>();
66         _applet = aaf.getApplet();
67         initialize();
68         _control_panel = new ControlPanel( this, configuration );
69         add( _control_panel, BorderLayout.WEST );
70         setupTreeGraphic( configuration, getControlPanel() );
71     }
72
73     JApplet getApplet() {
74         return _applet;
75     }
76
77     MainFrameApplet getAppletFrame() {
78         return ( MainFrameApplet ) _mainframe;
79     }
80
81     @Override
82     public Options getOptions() {
83         if ( _mainframe != null ) {
84             return _mainframe.getOptions();
85         }
86         else {
87             return ( ( ArchaeopteryxE ) _applet ).getOptions();
88         }
89     }
90 }