import java.net.URL;
import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
import java.util.NoSuchElementException;
import javax.swing.ButtonGroup;
// </applet>
public class ArchaeopteryxE extends JApplet implements ActionListener {
- private final static String NAME = "ArchaeopteryxE";
- private static final long serialVersionUID = -1220055577935759443L;
+ private final static String NAME = "ArchaeopteryxE";
+ private static final long serialVersionUID = -1220055577935759443L;
private Configuration _configuration;
private MainPanelApplets _main_panel;
private JMenuBar _jmenubar;
private JMenu _view_jmenu;
private JMenuItem _view_as_XML_item;
private JMenuItem _view_as_NH_item;
- private JMenuItem _view_as_NHX_item;
private JMenuItem _view_as_nexus_item;
private JMenuItem _display_basic_information_item;
private JMenu _type_menu;
private JMenuItem _phyloxml_ref_item;
private JMenuItem _aptx_ref_item;
private JMenuItem _remove_branch_color_item;
- private JMenuItem _infer_common_sn_names_item;
private JCheckBoxMenuItem _show_domain_labels;
private JCheckBoxMenuItem _color_labels_same_as_parent_branch;
private JCheckBoxMenuItem _abbreviate_scientific_names;
private JMenuItem _collapse_species_specific_subtrees;
private JMenuItem _overview_placment_mi;
private ButtonGroup _radio_group_1;
- private JCheckBoxMenuItem _show_default_node_shapes_cbmi;
+ private JCheckBoxMenuItem _show_default_node_shapes_internal_cbmi;
+ private JCheckBoxMenuItem _show_default_node_shapes_external_cbmi;
private JMenuItem _cycle_node_shape_mi;
private JMenuItem _cycle_node_fill_mi;
private JMenuItem _choose_node_size_mi;
private JCheckBoxMenuItem _taxonomy_colorize_node_shapes_cbmi;
private JCheckBoxMenuItem _show_confidence_stddev_cbmi;
- private final LinkedList<TextFrame> _textframes = new LinkedList<TextFrame>();
- private String _ext_node_data_buffer = "";
+ private final LinkedList<TextFrame> _textframes = new LinkedList<TextFrame>();
+ // private String _ext_node_data_buffer = "";
+ // private int _ext_node_data_buffer_change_counter = 0;
@Override
public void actionPerformed( final ActionEvent e ) {
final Object o = e.getSource();
else if ( o == _view_as_NH_item ) {
viewAsNH();
}
- else if ( o == _view_as_NHX_item ) {
- viewAsNHX();
- }
else if ( o == _view_as_XML_item ) {
viewAsXML();
}
else if ( o == _color_labels_same_as_parent_branch ) {
updateOptions( getOptions() );
}
- else if ( o == _show_default_node_shapes_cbmi ) {
+ else if ( o == _show_default_node_shapes_internal_cbmi ) {
+ updateOptions( getOptions() );
+ }
+ else if ( o == _show_default_node_shapes_external_cbmi ) {
updateOptions( getOptions() );
}
else if ( o == _taxonomy_colorize_node_shapes_cbmi ) {
MainFrame.about();
}
else if ( o == _help_item ) {
- help( getConfiguration().getWebLinks() );
+ help();
}
else if ( o == _website_item ) {
try {
* @return current external node data as String
*/
public String getCurrentExternalNodesDataBuffer() {
- return _ext_node_data_buffer;
+ return getCurrentTreePanel().getCurrentExternalNodesDataBufferAsString();
+ }
+
+ public int getCurrentExternalNodesDataBufferChangeCounter() {
+ return getCurrentTreePanel().getCurrentExternalNodesDataBufferChangeCounter();
+ }
+
+ public int getCurrentExternalNodesDataBufferLength() {
+ return getCurrentTreePanel().getCurrentExternalNodesDataBufferAsString().length();
}
/**
setupUI();
URL phys_url = null;
Phylogeny[] phys = null;
- final String phys_url_string = getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
- AptxUtil.printAppletMessage( NAME, "URL for phylogenies is " + phys_url_string );
+ final String tree_url_str = getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
+ AptxUtil.printAppletMessage( NAME, "URL for phylogenies is " + tree_url_str );
// Get URL to tree file
- if ( phys_url_string != null ) {
+ if ( tree_url_str != null ) {
try {
- phys_url = new URL( phys_url_string );
+ phys_url = new URL( tree_url_str );
}
catch ( final Exception e ) {
ForesterUtil.printErrorMessage( NAME, "error: " + e );
e.printStackTrace();
- JOptionPane.showMessageDialog( this, NAME + ": Could not create URL from: \"" + phys_url_string
+ JOptionPane.showMessageDialog( this, NAME + ": Could not create URL from: \"" + tree_url_str
+ "\"\nException: " + e, "Failed to create URL", JOptionPane.ERROR_MESSAGE );
}
}
@Override
public void componentResized( final ComponentEvent e ) {
if ( getMainPanel().getCurrentTreePanel() != null ) {
- getMainPanel().getCurrentTreePanel().setParametersForPainting( getMainPanel().getCurrentTreePanel()
- .getWidth(),
- getMainPanel().getCurrentTreePanel()
- .getHeight(),
- false );
+ getMainPanel().getCurrentTreePanel().calcParametersForPainting( getMainPanel()
+ .getCurrentTreePanel()
+ .getWidth(),
+ getMainPanel()
+ .getCurrentTreePanel()
+ .getHeight(),
+ getOptions()
+ .isAllowFontSizeChange() );
}
}
} );
.add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
_options_jmenu.add( _show_confidence_stddev_cbmi = new JCheckBoxMenuItem( MainFrame.SHOW_CONF_STDDEV_LABEL ) );
_options_jmenu
- .add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL ) );
+ .add( _show_default_node_shapes_internal_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL_INT ) );
+ _options_jmenu
+ .add( _show_default_node_shapes_external_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL_EXT ) );
_options_jmenu
.add( _taxonomy_colorize_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.TAXONOMY_COLORIZE_NODE_SHAPES_LABEL ) );
_options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
customizeCheckBoxMenuItem( _background_gradient_cbmi, getOptions().isBackgroundColorGradient() );
customizeCheckBoxMenuItem( _show_domain_labels, getOptions().isShowDomainLabels() );
customizeCheckBoxMenuItem( _abbreviate_scientific_names, getOptions().isAbbreviateScientificTaxonNames() );
- customizeCheckBoxMenuItem( _show_default_node_shapes_cbmi, getOptions().isShowDefaultNodeShapes() );
+ customizeCheckBoxMenuItem( _show_default_node_shapes_external_cbmi, getOptions()
+ .isShowDefaultNodeShapesExternal() );
+ customizeCheckBoxMenuItem( _show_default_node_shapes_internal_cbmi, getOptions()
+ .isShowDefaultNodeShapesInternal() );
customizeCheckBoxMenuItem( _taxonomy_colorize_node_shapes_cbmi, getOptions().isTaxonomyColorizeNodeShapes() );
customizeJMenuItem( _cycle_node_shape_mi );
customizeJMenuItem( _cycle_node_fill_mi );
_tools_menu.add( _midpoint_root_item = new JMenuItem( "Midpoint-Root" ) );
customizeJMenuItem( _midpoint_root_item );
_tools_menu.addSeparator();
- _tools_menu
- .add( _infer_common_sn_names_item = new JMenuItem( "Infer Common Parts of Internal Scientific Names" ) );
- customizeJMenuItem( _infer_common_sn_names_item );
_tools_menu.add( _collapse_species_specific_subtrees = new JMenuItem( "Collapse Species-Specific Subtrees" ) );
customizeJMenuItem( _collapse_species_specific_subtrees );
_jmenubar.add( _tools_menu );
_view_jmenu.addSeparator();
_view_jmenu.add( _view_as_XML_item = new JMenuItem( "View as phyloXML" ) );
_view_jmenu.add( _view_as_NH_item = new JMenuItem( "View as Newick" ) );
- _view_jmenu.add( _view_as_NHX_item = new JMenuItem( "View as NHX" ) );
_view_jmenu.add( _view_as_nexus_item = new JMenuItem( "View as Nexus" ) );
customizeJMenuItem( _display_basic_information_item );
customizeJMenuItem( _view_as_NH_item );
- customizeJMenuItem( _view_as_NHX_item );
customizeJMenuItem( _view_as_XML_item );
customizeJMenuItem( _view_as_nexus_item );
_jmenubar.add( _view_jmenu );
}
}
+ void clearCurrentExternalNodesDataBuffer() {
+ getCurrentTreePanel().clearCurrentExternalNodesDataBuffer();
+ }
+
void customizeCheckBoxMenuItem( final JCheckBoxMenuItem item, final boolean is_selected ) {
if ( item != null ) {
item.setFont( MainFrame.menu_font );
return _options;
}
- void help( final Map<String, WebLink> weblinks ) {
+ void help() {
final StringBuilder sb = new StringBuilder();
sb.append( "Display options\n" );
sb.append( "-------------------\n" );
sb.append( "Since the Java default memory allocation is quite small, it might by necessary (for trees\n" );
sb.append( "with more than approximately 5000 external nodes) to increase the memory which Java can use, with\n" );
sb.append( "the '-Xmx' Java command line option. For example:\n" );
- sb.append( "java -Xms32m -Xmx256m -cp path\\to\\forester.jar org.forester.archaeopteryx.Archaeopteryx\n\n" );
- if ( ( weblinks != null ) && ( weblinks.size() > 0 ) ) {
- sb.append( "Active web links\n" );
- sb.append( "--------------------\n" );
- for( final String key : weblinks.keySet() ) {
- sb.append( " " + weblinks.get( key ).toString() + "\n" );
- }
- }
- sb.append( "\n" );
+ sb.append( "java -Xmx1024m -cp path\\to\\forester.jar org.forester.archaeopteryx.Archaeopteryx\n\n" );
sb.append( "phyloXML\n" );
sb.append( "-------------------\n" );
sb.append( "Reference: " + Constants.PHYLOXML_REFERENCE + "\n" );
_configuration = configuration;
}
- void setCurrentExternalNodesDataBuffer( final String s ) {
- if ( !ForesterUtil.isEmpty( s ) ) {
- _ext_node_data_buffer = s.trim();
- }
- else {
- _ext_node_data_buffer = "";
- }
- }
-
void setOptions( final Options options ) {
_options = options;
}
&& _abbreviate_scientific_names.isSelected() );
options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )
&& _color_labels_same_as_parent_branch.isSelected() );
- options.setShowDefaultNodeShapes( ( _show_default_node_shapes_cbmi != null )
- && _show_default_node_shapes_cbmi.isSelected() );
+ options.setShowDefaultNodeShapesInternal( ( _show_default_node_shapes_internal_cbmi != null )
+ && _show_default_node_shapes_internal_cbmi.isSelected() );
+ options.setShowDefaultNodeShapesExternal( ( _show_default_node_shapes_external_cbmi != null )
+ && _show_default_node_shapes_external_cbmi.isSelected() );
options.setTaxonomyColorizeNodeShapes( ( _taxonomy_colorize_node_shapes_cbmi != null )
&& _taxonomy_colorize_node_shapes_cbmi.isSelected() );
if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {
}
}
- void viewAsNHX() {
- if ( ( getMainPanel().getCurrentPhylogeny() != null ) && !getMainPanel().getCurrentPhylogeny().isEmpty() ) {
- String title = "NHX";
- if ( !ForesterUtil.isEmpty( getMainPanel().getCurrentPhylogeny().getName() ) ) {
- title = getMainPanel().getCurrentPhylogeny().getName() + " " + title;
- }
- showTextFrame( getMainPanel().getCurrentPhylogeny().toNewHampshireX(), title );
- }
- }
-
void viewAsXML() {
if ( ( getMainPanel().getCurrentPhylogeny() != null ) && !getMainPanel().getCurrentPhylogeny().isEmpty() ) {
String title = "phyloXML";