From: cmzmasek@gmail.com Date: Wed, 8 Jun 2011 03:32:20 +0000 (+0000) Subject: in progress... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=605b9b5326538a70a7afe353368b206516292575;p=jalview.git in progress... --- diff --git a/forester/java/src/org/forester/archaeopteryx/Configuration.java b/forester/java/src/org/forester/archaeopteryx/Configuration.java index 342fcdb..162ac79 100644 --- a/forester/java/src/org/forester/archaeopteryx/Configuration.java +++ b/forester/java/src/org/forester/archaeopteryx/Configuration.java @@ -93,10 +93,11 @@ public final class Configuration { private boolean _abbreviate_scientific_names = false; private boolean _color_labels_same_as_parent_branch = false; private int _default_bootstrap_samples = -1; + private boolean _show_default_node_shapes = false; private NodeShape _default_node_shape = NodeShape.NONE; private NodeFill _default_node_fill = NodeFill.GRADIENT; private short _default_node_shape_size = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT; - private boolean _taxonomy_colorize_node_shapes_instead_of_labels = false; + private boolean _taxonomy_colorize_node_shapes = false; final static int display_as_phylogram = 0; final static int show_node_names = 1; final static int show_tax_code = 2; @@ -106,22 +107,23 @@ public final class Configuration { final static int color_according_to_species = 6; final static int color_branches = 7; final static int width_branches = 8; - final static int show_domain_architectures = 9; - final static int show_binary_characters = 10; - final static int show_binary_character_counts = 11; - final static int show_gene_names = 12; - final static int show_sequence_acc = 13; - final static int display_internal_data = 14; - final static int dynamically_hide_data = 15; - final static int show_taxonomy_scientific_names = 16; - final static int show_taxonomy_common_names = 17; - final static int color_according_to_annotation = 18; - final static int show_property = 19; - final static int show_gene_symbols = 20; - final static int node_data_popup = 21; - final static int show_relation_confidence = 22; - final static int show_vector_data = 23; - final static int show_taxonomy_images = 24; + final static int show_custom_node_shapes = 9; + final static int show_domain_architectures = 10; + final static int show_binary_characters = 11; + final static int show_binary_character_counts = 12; + final static int show_gene_names = 13; + final static int show_sequence_acc = 14; + final static int display_internal_data = 15; + final static int dynamically_hide_data = 16; + final static int show_taxonomy_scientific_names = 17; + final static int show_taxonomy_common_names = 18; + final static int color_according_to_annotation = 19; + final static int show_property = 20; + final static int show_gene_symbols = 21; + final static int node_data_popup = 22; + final static int show_relation_confidence = 23; + final static int show_vector_data = 24; + final static int show_taxonomy_images = 25; // ------------------ // Click-to options // ------------------ @@ -153,7 +155,7 @@ public final class Configuration { { "Phylogram", "display", "?" }, { "Node Name", "display", "yes" }, { "Taxonomy Code", "display", "yes" }, { "Annotation", "nodisplay", "no" }, { "Confidence Value", "display", "?" }, { "Event", "display", "?" }, { "Taxonomy Colorize", "display", "yes" }, { "Colorize Branches", "display", "no" }, - { "Use Branch-Width", "nodisplay", "no" }, { "Domains", "nodisplay", "no" }, + { "Use Branch-Width", "nodisplay", "no" }, { "Show Custom Nodes", "display", "yes"}, { "Domains", "nodisplay", "no" }, { "Binary Characters", "nodisplay", "no" }, { "Binary Char Counts", "nodisplay", "no" }, { "Prot/Gene Name", "display", "no" }, { "Prot/Gene Acc", "display", "no" }, { "Show Internal Data", "display", "yes" }, { "Dyna Hide", "display", "yes" }, @@ -364,6 +366,7 @@ public final class Configuration { return _cladogram_type; } + private int getClickToIndex( final String name ) { int index = -1; if ( name.equals( "edit_info" ) ) { @@ -1063,6 +1066,9 @@ public final class Configuration { _domain_structure_base_color = Color.decode( ( String ) st.nextElement() ); } // + else if ( key.equals( "show_default_node_shapes" ) ) { + setShowDefaultNodeShapes( parseBoolean( ( ( String ) st.nextElement() ).trim() ) ); + } else if ( key.equals( "default_node_size" ) ) { final short i = parseShort( ( ( String ) st.nextElement() ).trim() ); setDefaultNodeShapeSize( i ); @@ -1100,7 +1106,7 @@ public final class Configuration { } } else if ( key.equals( "taxonomy_colorize_node_shapes" ) ) { - setTaxonomyColorizeNodeShapesInsteadOfLabels( parseBoolean( ( String ) st.nextElement() ) ); + setTaxonomyColorizeNodeShapes( parseBoolean( ( String ) st.nextElement() ) ); } else if ( st.countTokens() >= 2 ) { // counts the tokens that are not // yet retrieved! @@ -1232,6 +1238,9 @@ public final class Configuration { else if ( key.equals( "show_relation_confidence" ) ) { key_index = Configuration.show_relation_confidence; } + else if ( key.equals( "show_custom_node_shapes" ) ) { + key_index = Configuration.show_custom_node_shapes; + } // If we've found the key, set the values if ( key_index >= 0 ) { display_options[ key_index ][ 1 ] = ( String ) st.nextElement(); @@ -1408,11 +1417,19 @@ public final class Configuration { return _default_node_shape_size; } - private void setTaxonomyColorizeNodeShapesInsteadOfLabels( final boolean taxonomy_colorize_node_shapes_instead_of_labels ) { - _taxonomy_colorize_node_shapes_instead_of_labels = taxonomy_colorize_node_shapes_instead_of_labels; + private void setTaxonomyColorizeNodeShapes( final boolean taxonomy_colorize_node_shapes ) { + _taxonomy_colorize_node_shapes = taxonomy_colorize_node_shapes; } - public boolean isTaxonomyColorizeNodeShapesInsteadOfLabels() { - return _taxonomy_colorize_node_shapes_instead_of_labels; + public boolean isTaxonomyColorizeNodeShapes() { + return _taxonomy_colorize_node_shapes; } + + public boolean isShowDefaultNodeShapes() { + return _show_default_node_shapes; + } + private void setShowDefaultNodeShapes(boolean show_default_node_shapes) { + _show_default_node_shapes =show_default_node_shapes; + } + } diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrame.java b/forester/java/src/org/forester/archaeopteryx/MainFrame.java index 1fab617..0b5433b 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrame.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrame.java @@ -33,6 +33,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import javax.swing.Icon; import javax.swing.JApplet; import javax.swing.JCheckBoxMenuItem; import javax.swing.JFrame; @@ -82,13 +83,17 @@ public abstract class MainFrame extends JFrame implements ActionListener { static final String SCREEN_ANTIALIAS_LABEL = "Antialias"; static final String COLOR_LABELS_LABEL = "Colorize Labels Same as Parent Branch"; static final String BG_GRAD_LABEL = "Background Color Gradient"; - static final String DISPLAY_NODE_BOXES_LABEL = "Display Node Boxes"; + static final String DISPLAY_NODE_BOXES_LABEL = "Display Node Shapes"; static final String SHOW_OVERVIEW_LABEL = "Show Overview"; static final String FONT_SIZE_MENU_LABEL = "Font Size"; static final String NONUNIFORM_CLADOGRAMS_LABEL = "External Node Sum Dependent Cladograms"; static final String SHOW_DOMAIN_LABELS_LABEL = "Show Domain Labels"; static final String COLOR_LABELS_TIP = "To use parent branch colors for node labels as well, need to turn off taxonomy dependent colorization and turn on branch colorization for this to become apparent"; static final String ABBREV_SN_LABEL = "Abbreviate Scientific Taxonomic Names"; + static final String TAXONOMY_COLORIZE_NODE_SHAPES_LABEL = "Colorize Node Shapes According to Taxonomy"; + static final String CYCLE_NODE_SHAPE_LABEL = "Cycle Node Shapes"; + static final String CYCLE_NODE_FILL_LABEL = "Cycle Node Fill Type"; + static final String CHOOSE_NODE_SIZE_LABEL = "Choose Node Shape Size"; JMenuBar _jmenubar; JMenu _file_jmenu; JMenu _tools_menu; @@ -131,7 +136,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { // _ screen display JCheckBoxMenuItem _screen_antialias_cbmi; JCheckBoxMenuItem _background_gradient_cbmi; - JCheckBoxMenuItem _show_node_boxes_cbmi; + JRadioButtonMenuItem _non_lined_up_cladograms_rbmi; JRadioButtonMenuItem _uniform_cladograms_rbmi; JRadioButtonMenuItem _ext_node_dependent_cladogram_rbmi; @@ -143,6 +148,12 @@ public abstract class MainFrame extends JFrame implements ActionListener { JCheckBoxMenuItem _color_labels_same_as_parent_branch; JMenuItem _overview_placment_mi; JMenuItem _choose_minimal_confidence_mi; + + JCheckBoxMenuItem _show_default_node_shapes_cbmi; + JMenuItem _cycle_node_shape_mi; + JMenuItem _cycle_node_fill_mi; + JMenuItem _choose_node_size_mi; + JCheckBoxMenuItem _taxonomy_colorize_node_shapes_cbmi; // _ print JCheckBoxMenuItem _graphics_export_visible_only_cbmi; JCheckBoxMenuItem _antialias_print_cbmi; @@ -320,9 +331,13 @@ public abstract class MainFrame extends JFrame implements ActionListener { else if ( o == _color_labels_same_as_parent_branch ) { updateOptions( getOptions() ); } - else if ( o == _show_node_boxes_cbmi ) { + else if ( o == _show_default_node_shapes_cbmi ) { updateOptions( getOptions() ); } + else if ( o == _taxonomy_colorize_node_shapes_cbmi ) { + updateOptions( getOptions() ); + } + else if ( o == _non_lined_up_cladograms_rbmi ) { updateOptions( getOptions() ); showWhole(); @@ -851,7 +866,9 @@ public abstract class MainFrame extends JFrame implements ActionListener { options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null ) && _color_labels_same_as_parent_branch.isSelected() ); //TODO FIXME ~~ - //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() ); + //TODO FIXME ~~ if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) { options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP ); diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java index 6a63002..ec01faf 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java @@ -178,7 +178,7 @@ public final class MainFrameApplet extends MainFrame { _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( _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 ) ); @@ -208,7 +208,7 @@ public final class MainFrameApplet extends MainFrame { customizeJMenuItem( _switch_colors_mi ); customizeJMenuItem( _choose_minimal_confidence_mi ); customizeJMenuItem( _overview_placment_mi ); - customizeCheckBoxMenuItem( _show_node_boxes_cbmi, getOptions().getDefaultNodeShape() ); + customizeCheckBoxMenuItem( _show_default_node_shapes_cbmi, getOptions().getDefaultNodeShape() ); customizeCheckBoxMenuItem( _color_labels_same_as_parent_branch, getOptions().isColorLabelsSameAsParentBranch() ); customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() ); customizeCheckBoxMenuItem( _background_gradient_cbmi, getOptions().isBackgroundColorGradient() ); diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index 186a567..4ef0472 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -44,6 +44,7 @@ import java.util.List; import java.util.Set; import javax.swing.ButtonGroup; +import javax.swing.Icon; import javax.swing.JCheckBoxMenuItem; import javax.swing.JFileChooser; import javax.swing.JMenu; @@ -187,6 +188,7 @@ public final class MainFrameApplication extends MainFrame { private final static SequencesFileFilter seqsfilter = new SequencesFileFilter(); private final static DefaultFilter defaultfilter = new DefaultFilter(); private static final long serialVersionUID = -799735726778865234L; + private final JFileChooser _values_filechooser; private final JFileChooser _open_filechooser; private final JFileChooser _msa_filechooser; @@ -711,7 +713,17 @@ public final class MainFrameApplication extends MainFrame { _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( DISPLAY_NODE_BOXES_LABEL ) ); + + // + _options_jmenu.add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( 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( DISPLAY_SCALE_LABEL ) ); _options_jmenu .add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) ); @@ -763,7 +775,11 @@ public final class MainFrameApplication extends MainFrame { customizeJMenuItem( _choose_pdf_width_mi ); customizeJMenuItem( _overview_placment_mi ); //TODO FIXME ~~ - //customizeCheckBoxMenuItem( _show_node_boxes_cbmi, getOptions().getDefaultNodeShape() ); + 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 ); //TODO FIXME ~~ customizeCheckBoxMenuItem( _color_labels_same_as_parent_branch, getOptions().isColorLabelsSameAsParentBranch() ); customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() ); diff --git a/forester/java/src/org/forester/archaeopteryx/Options.java b/forester/java/src/org/forester/archaeopteryx/Options.java index 31c9873..294afdc 100644 --- a/forester/java/src/org/forester/archaeopteryx/Options.java +++ b/forester/java/src/org/forester/archaeopteryx/Options.java @@ -70,7 +70,8 @@ final public class Options { private NodeShape _default_node_shape; private NodeFill _default_node_fill; private short _default_node_shape_size; - private boolean _taxonomy_colorize_node_shapes_instead_of_labels; + private boolean _taxonomy_colorize_node_shapes; + private boolean _show_default_node_shapes; private Options() { init(); @@ -84,11 +85,6 @@ final public class Options { return _cladogram_type; } - int getDefaultNodeBoxSize() { - // TODO make variable ~~ - return 8; - } - final NodeFill getDefaultNodeFill() { return _default_node_fill; } @@ -145,7 +141,7 @@ final public class Options { _default_node_shape = NodeShape.NONE; _default_node_fill = NodeFill.GRADIENT; _default_node_shape_size = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT; - _taxonomy_colorize_node_shapes_instead_of_labels = false; + _taxonomy_colorize_node_shapes = false; _show_branch_length_values = false; _internal_number_are_confidence_for_nh_parsing = false; _show_scale = false; @@ -154,6 +150,7 @@ final public class Options { _graphics_export_visible_only = false; _editable = true; _background_color_gradient = false; + _show_default_node_shapes = false; if ( Util.isUsOrCanada() ) { _print_size_x = Constants.US_LETTER_SIZE_X; _print_size_y = Constants.US_LETTER_SIZE_Y; @@ -270,8 +267,8 @@ final public class Options { return _show_scale; } - boolean isTaxonomyColorizeNodeShapesInsteadOfLabels() { - return _taxonomy_colorize_node_shapes_instead_of_labels; + boolean isTaxonomyColorizeNodeShapes() { + return _taxonomy_colorize_node_shapes; } final void setAbbreviateScientificTaxonNames( final boolean abbreviate_scientific_names ) { @@ -420,14 +417,20 @@ final public class Options { _show_scale = show_scale; } - void setTaxonomyColorizeNodeShapesInsteadOfLabels( final boolean taxonomy_colorize_node_shapes_instead_of_labels ) { - _taxonomy_colorize_node_shapes_instead_of_labels = taxonomy_colorize_node_shapes_instead_of_labels; + void setTaxonomyColorizeNodeShapes( final boolean taxonomy_colorize_node_shapes ) { + _taxonomy_colorize_node_shapes = taxonomy_colorize_node_shapes; } final static Options createDefaultInstance() { return new Options(); } + boolean isShowDefaultNodeShapes() { + return _show_default_node_shapes; + } + void setShowDefaultNodeShapes(boolean show_default_node_shapes) { + _show_default_node_shapes = show_default_node_shapes; + } final static Options createInstance( final Configuration configuration ) { final Options instance = createDefaultInstance(); if ( configuration != null ) { @@ -484,8 +487,9 @@ final public class Options { if ( configuration.getDefaultNodeShapeSize() >= 0 ) { instance.setDefaultNodeShapeSize( configuration.getDefaultNodeShapeSize() ); } - instance.setTaxonomyColorizeNodeShapesInsteadOfLabels( configuration - .isTaxonomyColorizeNodeShapesInsteadOfLabels() ); + instance.setTaxonomyColorizeNodeShapes( configuration + .isTaxonomyColorizeNodeShapes() ); + instance.setShowDefaultNodeShapes( configuration.isShowDefaultNodeShapes() ); } return instance; } diff --git a/forester/java/src/org/forester/archaeopteryx/TreePanel.java b/forester/java/src/org/forester/archaeopteryx/TreePanel.java index a37c5dc..8e94a08 100644 --- a/forester/java/src/org/forester/archaeopteryx/TreePanel.java +++ b/forester/java/src/org/forester/archaeopteryx/TreePanel.java @@ -268,8 +268,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee _configuration = configuration; _phylogeny = t; _phy_has_branch_lengths = ForesterUtil.isHasAtLeastOneBranchLengthLargerThanZero( _phylogeny ); - _box_size = tjp.getOptions().getDefaultNodeBoxSize(); - _half_box_size = tjp.getOptions().getDefaultNodeBoxSize() / 2; + _box_size = tjp.getOptions().getDefaultNodeShapeSize(); + _half_box_size = tjp.getOptions().getDefaultNodeShapeSize() / 2; _half_box_size_plus_wiggle = _half_box_size + WIGGLE; init(); // if ( !_phylogeny.isEmpty() ) {