import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.data.SequenceRelation;
+import org.forester.util.ForesterConstants;
import org.forester.util.ForesterUtil;
// Use like this:
private JMenuItem _choose_font_mi;
private JMenuItem _switch_colors_mi;
JCheckBoxMenuItem _label_direction_cbmi;
- private JCheckBoxMenuItem _show_node_boxes_cbmi;
private JCheckBoxMenuItem _show_scale_cbmi;
private JCheckBoxMenuItem _search_case_senstive_cbmi;
private JCheckBoxMenuItem _search_whole_words_only_cbmi;
private JMenuItem _collapse_species_specific_subtrees;
private JMenuItem _overview_placment_mi;
private ButtonGroup _radio_group_1;
+ private JCheckBoxMenuItem _show_default_node_shapes_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;
@Override
public void actionPerformed( final ActionEvent e ) {
else if ( o == _choose_minimal_confidence_mi ) {
chooseMinimalConfidence();
}
+ else if ( o == _choose_node_size_mi ) {
+ MainFrame.chooseNodeSize( getOptions(), this );
+ }
else if ( o == _overview_placment_mi ) {
MainFrame.cycleOverview( getOptions(), getCurrentTreePanel() );
}
- else if ( o == _show_node_boxes_cbmi ) {
- updateOptions( getOptions() );
+ else if ( o == _cycle_node_fill_mi ) {
+ MainFrame.cycleNodeFill( getOptions(), getCurrentTreePanel() );
+ }
+ else if ( o == _cycle_node_shape_mi ) {
+ MainFrame.cycleNodeShape( getOptions(), getCurrentTreePanel() );
}
else if ( o == _non_lined_up_cladograms_rbmi ) {
updateOptions( getOptions() );
else if ( o == _color_labels_same_as_parent_branch ) {
updateOptions( getOptions() );
}
+ else if ( o == _show_default_node_shapes_cbmi ) {
+ updateOptions( getOptions() );
+ }
+ else if ( o == _taxonomy_colorize_node_shapes_cbmi ) {
+ updateOptions( getOptions() );
+ }
else if ( o == _about_item ) {
MainFrame.about();
}
repaint();
}
+ /**
+ * This method returns the current phylogeny as a string in the chosen format
+ *
+ * @param format must be NH, NHX, NEXUS or PHYLOXML
+ * @return the phylogeny string
+ * @author Herve Menager
+ */
+ public String getCurrentPhylogeny( final String format ) {
+ removeTextFrame();
+ if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
+ || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
+ return new String();
+ }
+ switch ( ForesterConstants.PhylogeneticTreeFormats.valueOf( format ) ) {
+ case NH:
+ return getMainPanel().getCurrentPhylogeny().toNewHampshire();
+ case NHX:
+ return getMainPanel().getCurrentPhylogeny().toNewHampshireX();
+ case NEXUS:
+ return getMainPanel().getCurrentPhylogeny().toNexus();
+ case PHYLOXML:
+ return getMainPanel().getCurrentPhylogeny().toPhyloXML( -1 );
+ default:
+ break;
+ }
+ return new String();
+ }
+
void buildFontSizeMenu() {
_font_size_menu = MainFrame.createMenu( MainFrame.FONT_SIZE_MENU_LABEL, getConfiguration() );
_font_size_menu.add( _super_tiny_fonts_mi = new JMenuItem( "Super tiny fonts" ) );
@Override
public void stateChanged( final ChangeEvent e ) {
- MainFrame.setOvPlacementColorChooseMenuItem( _overview_placment_mi, getCurrentTreePanel() );
+ MainFrame.setOvPlacementColorChooseMenuItem( _overview_placment_mi, getOptions() );
MainFrame.setTextColorChooseMenuItem( _switch_colors_mi, getCurrentTreePanel() );
MainFrame
.setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() );
_uniform_cladograms_rbmi,
_ext_node_dependent_cladogram_rbmi,
_label_direction_cbmi );
+ MainFrame.setCycleNodeFillMenuItem( _cycle_node_fill_mi, getOptions() );
+ MainFrame.setCycleNodeShapeMenuItem( _cycle_node_shape_mi, getOptions() );
+ MainFrame.setTextNodeSizeMenuItem( _choose_node_size_mi, getOptions() );
}
} );
_options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.DISPLAY_SUBHEADER ),
_radio_group_1.add( _ext_node_dependent_cladogram_rbmi );
_radio_group_1.add( _uniform_cladograms_rbmi );
_radio_group_1.add( _non_lined_up_cladograms_rbmi );
- _options_jmenu.add( _show_node_boxes_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL ) );
+ //
+ _options_jmenu
+ .add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL ) );
+ _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 ) );
+ _options_jmenu.add( _cycle_node_fill_mi = new JMenuItem( MainFrame.CYCLE_NODE_FILL_LABEL ) );
+ _options_jmenu.add( _choose_node_size_mi = new JMenuItem( MainFrame.CHOOSE_NODE_SIZE_LABEL ) );
+ //
_options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_SCALE_LABEL ) );
_options_jmenu
.add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
customizeJMenuItem( _choose_minimal_confidence_mi );
customizeJMenuItem( _switch_colors_mi );
customizeJMenuItem( _overview_placment_mi );
- customizeCheckBoxMenuItem( _show_node_boxes_cbmi, getOptions().getDefaultNodeShape() );
customizeCheckBoxMenuItem( _label_direction_cbmi,
getOptions().getNodeLabelDirection() == NODE_LABEL_DIRECTION.RADIAL );
customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() );
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( _taxonomy_colorize_node_shapes_cbmi, getOptions().isTaxonomyColorizeNodeShapes() );
+ customizeJMenuItem( _cycle_node_shape_mi );
+ customizeJMenuItem( _cycle_node_fill_mi );
+ customizeJMenuItem( _choose_node_size_mi );
customizeCheckBoxMenuItem( _color_labels_same_as_parent_branch, getOptions().isColorLabelsSameAsParentBranch() );
customizeCheckBoxMenuItem( _search_case_senstive_cbmi, getOptions().isSearchCaseSensitive() );
customizeCheckBoxMenuItem( _show_scale_cbmi, getOptions().isShowScale() );
&& _abbreviate_scientific_names.isSelected() );
options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )
&& _color_labels_same_as_parent_branch.isSelected() );
- options.setShowNodeBoxes( ( _show_node_boxes_cbmi != null ) && _show_node_boxes_cbmi.isSelected() );
+ options.setShowDefaultNodeShapes( ( _show_default_node_shapes_cbmi != null )
+ && _show_default_node_shapes_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() ) ) {
options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );
}