package org.forester.archaeopteryx;
+
import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.util.List;
import java.util.Map;
-import java.util.SortedMap;
import java.util.SortedSet;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import org.forester.phylogeny.data.PhylogenyData;
import org.forester.phylogeny.data.PhylogenyDataUtil;
import org.forester.phylogeny.data.Point;
-import org.forester.phylogeny.data.PropertiesMap;
+import org.forester.phylogeny.data.PropertiesList;
import org.forester.phylogeny.data.Property;
import org.forester.phylogeny.data.Reference;
import org.forester.phylogeny.data.Sequence;
private final JEditorPane _pane;
private final JTree _tree;
- public NodePanel( final PhylogenyNode phylogeny_node ) {
+ public NodePanel( final PhylogenyNode phylogeny_node, final NodeFrame parent ) {
String node_name = "";
if ( !ForesterUtil.isEmpty( phylogeny_node.getName() ) ) {
node_name = phylogeny_node.getName() + " ";
expandPath( SEQUENCE );
expandPath( EVENTS );
final JScrollPane tree_view = new JScrollPane( getJTree() );
+
+ final JButton close_button = new JButton( "Close" );
+ close_button.setEnabled( true );
+
_pane = new JEditorPane();
_pane.setEditable( false );
+
final JScrollPane data_view = new JScrollPane( _pane );
final JSplitPane split_pane = new JSplitPane( JSplitPane.VERTICAL_SPLIT );
split_pane.setTopComponent( tree_view );
+ data_view.add( close_button );
split_pane.setBottomComponent( data_view );
- data_view.setMinimumSize( Constants.NODE_PANEL_SPLIT_MINIMUM_SIZE );
- tree_view.setMinimumSize( Constants.NODE_PANEL_SPLIT_MINIMUM_SIZE );
- split_pane.setDividerLocation( 400 );
- split_pane.setPreferredSize( Constants.NODE_PANEL_SIZE );
- add( split_pane );
+ data_view.setMinimumSize( AptxConstants.NODE_PANEL_SPLIT_MINIMUM_SIZE );
+ tree_view.setMinimumSize( AptxConstants.NODE_PANEL_SPLIT_MINIMUM_SIZE );
+ split_pane.setDividerLocation( 300 );
+ split_pane.setPreferredSize( AptxConstants.NODE_PANEL_SIZE );
+
+
+ close_button.addActionListener( new ActionListener() {
+ public void actionPerformed( final ActionEvent e ) {
+ parent.close();
+ }
+ } );
+
+
+ close_button.setAlignmentX( Component.CENTER_ALIGNMENT );
+ split_pane.setAlignmentX( Component.CENTER_ALIGNMENT );
+ final JPanel panel = new JPanel();
+ panel.setLayout( new BoxLayout( panel, BoxLayout.Y_AXIS ) );
+ panel.add( split_pane );
+ panel.add( close_button );
+ add( panel );
}
@Override
}
private static void addProperties( final DefaultMutableTreeNode top,
- final PropertiesMap properties,
+ final PropertiesList properties,
final String string ) {
- final SortedMap<String, Property> properties_map = properties.getProperties();
+ final List<Property> properties_map = properties.getProperties();
final DefaultMutableTreeNode category = new DefaultMutableTreeNode( "Properties " );
top.add( category );
- for( final String key : properties_map.keySet() ) {
- final Property prop = properties_map.get( key );
+ for( final Property prop : properties_map ) {
+
category.add( new DefaultMutableTreeNode( prop.getRef() + "=" + prop.getValue() + " " + prop.getUnit()
+ " [" + prop.getAppliesTo().toString() + "]" ) );
}