2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
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
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.
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.
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
26 // Contact: phylosoft @ gmail . com
27 // WWW: www.phylosoft.org/forester
29 package org.forester.archaeopteryx;
31 import java.awt.BorderLayout;
32 import java.awt.Container;
33 import java.awt.event.WindowAdapter;
34 import java.awt.event.WindowEvent;
36 import org.forester.phylogeny.Phylogeny;
37 import org.forester.phylogeny.PhylogenyNode;
38 import org.forester.util.ForesterUtil;
40 final class NodeFrame extends javax.swing.JFrame {
42 private static final long serialVersionUID = -6943510233968557246L;
43 private final TreePanel _reepanel;
44 private int _index = -1;
46 NodeFrame( final PhylogenyNode n, final Phylogeny tree, final TreePanel tp, final int x ) {
47 super( "Node " + ( ForesterUtil.isEmpty( n.getName() ) ? n.getId() : n.getName() ) );
49 setSize( Constants.NODE_FRAME_SIZE );
51 final Container contentPane = getContentPane();
52 final NodePanel nodepanel = new NodePanel( n );
53 contentPane.add( nodepanel, BorderLayout.CENTER );
54 addWindowListener( new WindowAdapter() {
57 public void windowClosing( final WindowEvent e ) {
58 remove(); // to release slot in array
62 setResizable( false );
63 nodepanel.setVisible( true );
67 NodeFrame( final PhylogenyNode n, final Phylogeny tree, final TreePanel tp, final int x, final String dummy ) {
68 super( "Editable Node " + ( ForesterUtil.isEmpty( n.getName() ) ? n.getId() : n.getName() ) );
70 setSize( Constants.NODE_FRAME_SIZE );
72 final Container contentPane = getContentPane();
73 final NodeEditPanel nodepanel = new NodeEditPanel( n, tp );
74 contentPane.add( nodepanel, BorderLayout.CENTER );
75 addWindowListener( new WindowAdapter() {
78 public void windowClosing( final WindowEvent e ) {
82 catch ( final Exception ex ) {
85 remove(); // to release slot in array
89 setResizable( false );
90 nodepanel.setVisible( true );
94 TreePanel getTreePanel() {
100 _reepanel.removeEditNodeFrame( _index ); // to release slot in array