X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FControlPanel.java;h=a8bd50019cd6780dd8ab402ed8503055cbc23ff9;hb=814c97be10a4c55b0bb642668f9ef8e1f80d5a6c;hp=03f55908e3e03b5e43753c9697d19d6765a232ef;hpb=6035dd06c322b649ac5a0c4df39abbf4503d3ad1;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java index 03f5590..a8bd500 100644 --- a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java +++ b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java @@ -47,6 +47,7 @@ import java.util.Map; import java.util.Set; import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; import javax.swing.DefaultListCellRenderer; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -54,6 +55,7 @@ import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; +import javax.swing.JRadioButton; import javax.swing.JScrollBar; import javax.swing.JTextField; import javax.swing.ListCellRenderer; @@ -98,116 +100,120 @@ final class ControlPanel extends JPanel implements ActionListener { UNCOLLAPSE_ALL, ORDER_SUBTREE; } - final static Font jcb_bold_font = new Font( Configuration - .getDefaultFontFamilyName(), Font.BOLD, 9 ); - final static Font jcb_font = new Font( Configuration - .getDefaultFontFamilyName(), Font.PLAIN, 9 ); - final static Font js_font = new Font( Configuration - .getDefaultFontFamilyName(), Font.PLAIN, 9 ); - private static final String RETURN_TO_SUPER_TREE_TEXT = "R"; - private static final String SEARCH_TIP_TEXT = "Enter text to search for. Use ',' for logical OR and '+' for logical AND (not used in this manner for regular expression searches)."; - private static final long serialVersionUID = -8463483932821545633L; - private NodeClickAction _action_when_node_clicked; - private int _add_new_node_item; - private Map _all_click_to_names; - private Map _annotation_colors; - private int _blast_item; - private JComboBox _click_to_combobox; - private JLabel _click_to_label; - private List _click_to_names; - private int _collapse_cb_item; - private int _uncollapse_all_cb_item; - private int _order_subtree_cb_item; - private JCheckBox _color_acc_species; - private JCheckBox _color_acc_sequence; - private JCheckBox _color_according_to_annotation; - private boolean _color_branches; - private JCheckBox _use_visual_styles_cb; - private int _color_subtree_cb_item; - private int _change_node_font_item; + final static Font jcb_bold_font = new Font( Configuration + .getDefaultFontFamilyName(), Font.BOLD, Configuration.getGuiFontSize() ); + final static Font jcb_font = new Font( Configuration + .getDefaultFontFamilyName(), Font.PLAIN, Configuration.getGuiFontSize() ); + final static Font js_font = new Font( Configuration + .getDefaultFontFamilyName(), Font.PLAIN, Configuration.getGuiFontSize() ); + private static final String RETURN_TO_SUPER_TREE_TEXT = "R"; + private static final String SEARCH_TIP_TEXT = "Enter text to search for. Use ',' for logical OR and '+' for logical AND (not used in this manner for regular expression searches)."; + private static final long serialVersionUID = -8463483932821545633L; + private NodeClickAction _action_when_node_clicked; + private int _add_new_node_item; + private Map _all_click_to_names; + private Map _annotation_colors; + private int _blast_item; + private JComboBox _click_to_combobox; + private JLabel _click_to_label; + private List _click_to_names; + private int _collapse_cb_item; + private int _uncollapse_all_cb_item; + private int _order_subtree_cb_item; + private JCheckBox _color_acc_species; + private JCheckBox _color_acc_sequence; + private JCheckBox _color_according_to_annotation; + private boolean _color_branches; + private JCheckBox _use_visual_styles_cb; + private int _color_subtree_cb_item; + private int _change_node_font_item; // The settings from the conf file - private final Configuration _configuration; - private int _copy_subtree_item; - private int _cut_subtree_item; - private JButton _decr_domain_structure_evalue_thr; - private int _delete_node_or_subtree_item; - private JCheckBox _display_as_phylogram_cb; + private final Configuration _configuration; + private int _copy_subtree_item; + private int _cut_subtree_item; + private JButton _decr_domain_structure_evalue_thr; + private int _delete_node_or_subtree_item; + private JRadioButton _display_as_unaligned_phylogram_rb; + private JRadioButton _display_as_aligned_phylogram_rb; + private JRadioButton _display_as_cladogram_rb; + private ButtonGroup _display_as_buttongroup; // Tree checkboxes - private JCheckBox _display_internal_data; - private JLabel _domain_display_label; - private JTextField _domain_structure_evalue_thr_tf; - private JTextField _depth_collapse_depth_tf; - private JTextField _rank_collapse_depth_tf; - private List _draw_phylogram; - private JCheckBox _dynamically_hide_data; - private int _edit_node_data_item; - private int _get_ext_desc_data; - private JButton _incr_domain_structure_evalue_thr; - private final MainPanel _mainpanel; - private JCheckBox _node_desc_popup_cb; - private int _open_pdb_item; - private int _open_seq_web_item; - private int _open_tax_web_item; - private int _color_node_font_item; - private JButton _order; - private int _paste_subtree_item; - private int _reroot_cb_item; - private JButton _return_to_super_tree; + private JCheckBox _display_internal_data; + private JCheckBox _display_external_data; + private JLabel _domain_display_label; + private JTextField _domain_structure_evalue_thr_tf; + private JTextField _depth_collapse_depth_tf; + private JTextField _rank_collapse_depth_tf; + private List _tree_display_types; + private JCheckBox _dynamically_hide_data; + private int _edit_node_data_item; + private int _get_ext_desc_data; + private JButton _incr_domain_structure_evalue_thr; + private final MainPanel _mainpanel; + private JCheckBox _node_desc_popup_cb; + private int _open_pdb_item; + private int _open_seq_web_item; + private int _open_tax_web_item; + private int _color_node_font_item; + private JButton _order; + private int _paste_subtree_item; + private int _reroot_cb_item; + private JButton _return_to_super_tree; // Search - private JLabel _search_found_label_0; - private JLabel _search_found_label_1; - private JButton _search_reset_button_0; - private JButton _search_reset_button_1; - private JTextField _search_tf_0; - private JTextField _search_tf_1; - private int _select_nodes_item; - private Sequence _selected_query_seq; - private JCheckBox _seq_relation_confidence_switch; - private JComboBox _sequence_relation_type_box; - private JCheckBox _show_annotation; - private JCheckBox _show_binary_character_counts; - private JCheckBox _show_binary_characters; + private JLabel _search_found_label_0; + private JLabel _search_found_label_1; + private JButton _search_reset_button_0; + private JButton _search_reset_button_1; + private JTextField _search_tf_0; + private JTextField _search_tf_1; + private int _select_nodes_item; + private Sequence _selected_query_seq; + private JCheckBox _seq_relation_confidence_switch; + private JComboBox _sequence_relation_type_box; + private JCheckBox _show_annotation; + private JCheckBox _show_binary_character_counts; + private JCheckBox _show_binary_characters; // Indices for the click-to options in the combo box - private int _show_data_item; - private JCheckBox _show_domain_architectures; - private JCheckBox _show_mol_seqs; - private JCheckBox _write_branch_length_values; - private JCheckBox _show_events; - private JCheckBox _show_gene_names; - private JCheckBox _show_node_names; - private JCheckBox _show_properties_cb; - private JCheckBox _show_seq_names; - private JCheckBox _show_seq_symbols; - private JCheckBox _show_sequence_acc; - private JComboBox _show_sequence_relations; - private JCheckBox _show_taxo_code; - private JCheckBox _show_taxo_rank; - private JCheckBox _show_taxo_common_names; - private JCheckBox _show_taxo_images_cb; - private JCheckBox _show_taxo_scientific_names; - private JCheckBox _show_vector_data_cb; - private JButton _show_whole; - private int _sort_descendents_item; - private Map _species_colors; - private Map _sequence_colors; - private int _subtree_cb_item; - private int _swap_cb_item; - private JButton _uncollapse_all; - private JCheckBox _width_branches; - private JCheckBox _write_confidence; - private JButton _zoom_in_domain_structure; - private JButton _zoom_in_x; - private JButton _zoom_in_y; - private JLabel _zoom_label; - private JButton _zoom_out_domain_structure; - private JButton _zoom_out_x; - private JButton _zoom_out_y; - private JButton _decr_depth_collapse_level; - private JButton _incr_depth_collapse_level; - private JLabel _depth_collapse_label; - private JButton _decr_rank_collapse_level; - private JButton _incr_rank_collapse_level; - private JLabel _rank_collapse_label; + private int _show_data_item; + private JCheckBox _show_domain_architectures; + private JCheckBox _show_mol_seqs; + private JCheckBox _write_branch_length_values; + private JCheckBox _show_events; + private JCheckBox _show_gene_names; + private JCheckBox _show_node_names; + private JCheckBox _show_properties_cb; + private JCheckBox _show_seq_names; + private JCheckBox _show_seq_symbols; + private JCheckBox _show_sequence_acc; + private JComboBox _show_sequence_relations; + private JCheckBox _show_taxo_code; + private JCheckBox _show_taxo_rank; + private JCheckBox _show_taxo_common_names; + private JCheckBox _show_taxo_images_cb; + private JCheckBox _show_taxo_scientific_names; + private JCheckBox _show_vector_data_cb; + private JButton _show_whole; + private int _sort_descendents_item; + private Map _species_colors; + private Map _sequence_colors; + private int _subtree_cb_item; + private int _swap_cb_item; + private JButton _uncollapse_all; + private JCheckBox _width_branches; + private JCheckBox _write_confidence; + private JButton _zoom_in_domain_structure; + private JButton _zoom_in_x; + private JButton _zoom_in_y; + private JLabel _zoom_label; + private JButton _zoom_out_domain_structure; + private JButton _zoom_out_x; + private JButton _zoom_out_y; + private JButton _decr_depth_collapse_level; + private JButton _incr_depth_collapse_level; + private JLabel _depth_collapse_label; + private JButton _decr_rank_collapse_level; + private JButton _incr_rank_collapse_level; + private JLabel _rank_collapse_label; ControlPanel( final MainPanel ap, final Configuration configuration ) { init(); @@ -263,8 +269,16 @@ final class ControlPanel extends JPanel implements ActionListener { displayedPhylogenyMightHaveChanged( true ); } else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) { - if ( e.getSource() == getDisplayAsPhylogramCb() ) { - setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() ); + if ( e.getSource() == getDisplayAsUnalignedPhylogramRb() ) { + setTreeDisplayType( Options.PHYLOGENY_DISPLAY_TYPE.UNALIGNED_PHYLOGRAM ); + showWhole(); + } + if ( e.getSource() == getDisplayAsAlignedPhylogramRb() ) { + setTreeDisplayType( Options.PHYLOGENY_DISPLAY_TYPE.ALIGNED_PHYLOGRAM ); + showWhole(); + } + if ( e.getSource() == getDisplayAsCladogramRb() ) { + setTreeDisplayType( Options.PHYLOGENY_DISPLAY_TYPE.CLADOGRAM ); showWhole(); } // Zoom buttons @@ -289,25 +303,10 @@ final class ControlPanel extends JPanel implements ActionListener { showWhole(); } else if ( e.getSource() == _return_to_super_tree ) { - _mainpanel.getCurrentTreePanel().superTree(); - showWhole(); + returnedToSuperTreePressed(); } else if ( e.getSource() == _order ) { - DESCENDANT_SORT_PRIORITY pri = DESCENDANT_SORT_PRIORITY.NODE_NAME; - if ( isShowTaxonomyScientificNames() || isShowTaxonomyCode() ) { - pri = DESCENDANT_SORT_PRIORITY.TAXONOMY; - } - else if ( isShowSeqNames() || isShowSeqSymbols() || isShowGeneNames() ) { - pri = DESCENDANT_SORT_PRIORITY.SEQUENCE; - } - PhylogenyMethods.orderAppearanceX( tp.getPhylogeny().getRoot(), true, pri ); - tp.setNodeInPreorderToNull(); - tp.getPhylogeny().externalNodesHaveChanged(); - tp.getPhylogeny().clearHashIdToNodeMap(); - tp.getPhylogeny().recalculateNumberOfExternalDescendants( true ); - tp.resetNodeIdToDistToLeafMap(); - tp.setEdited( true ); - displayedPhylogenyMightHaveChanged( true ); + orderPressed( tp ); } else if ( e.getSource() == _uncollapse_all ) { uncollapseAll( tp ); @@ -406,6 +405,31 @@ final class ControlPanel extends JPanel implements ActionListener { } } + void orderPressed( final TreePanel tp ) { + DESCENDANT_SORT_PRIORITY pri = DESCENDANT_SORT_PRIORITY.NODE_NAME; + if ( isShowTaxonomyScientificNames() || isShowTaxonomyCode() ) { + pri = DESCENDANT_SORT_PRIORITY.TAXONOMY; + } + else if ( isShowSeqNames() || isShowSeqSymbols() || isShowGeneNames() ) { + pri = DESCENDANT_SORT_PRIORITY.SEQUENCE; + } + PhylogenyMethods.orderAppearanceX( tp.getPhylogeny().getRoot(), true, pri ); + tp.setNodeInPreorderToNull(); + tp.getPhylogeny().externalNodesHaveChanged(); + tp.getPhylogeny().clearHashIdToNodeMap(); + tp.getPhylogeny().recalculateNumberOfExternalDescendants( true ); + tp.resetNodeIdToDistToLeafMap(); + tp.setEdited( true ); + displayedPhylogenyMightHaveChanged( true ); + } + + void returnedToSuperTreePressed() { + if ( getCurrentTreePanel().isCurrentTreeIsSubtree() ) { + _mainpanel.getCurrentTreePanel().superTree(); + showWhole(); + } + } + public JCheckBox getColorAccSequenceCb() { return _color_acc_sequence; } @@ -414,8 +438,16 @@ final class ControlPanel extends JPanel implements ActionListener { return _color_acc_species; } - public JCheckBox getDisplayAsPhylogramCb() { - return _display_as_phylogram_cb; + public JRadioButton getDisplayAsCladogramRb() { + return _display_as_cladogram_rb; + } + + public JRadioButton getDisplayAsAlignedPhylogramRb() { + return _display_as_aligned_phylogram_rb; + } + + public JRadioButton getDisplayAsUnalignedPhylogramRb() { + return _display_as_unaligned_phylogram_rb; } public JCheckBox getDynamicallyHideData() { @@ -601,34 +633,23 @@ final class ControlPanel extends JPanel implements ActionListener { }// addSequenceRelationBlock /* GUILHEM_END */ - private List getIsDrawPhylogramList() { - return _draw_phylogram; + private List getTreeDisplayTypes() { + return _tree_display_types; } - // This takes care of ArchaeopteryxE-issue. - // Can, and will, return null prior to ArchaeopteryxE initialization completion. final private MainFrame getMainFrame() { - MainFrame mf = getMainPanel().getMainFrame(); - if ( mf == null ) { - // Must be "E" applet version. - final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet(); - if ( e.getMainPanel() == null ) { - return null; - } - mf = e.getMainPanel().getMainFrame(); - } - return mf; + return getMainPanel().getMainFrame(); } private void init() { - _draw_phylogram = new ArrayList(); + _tree_display_types = new ArrayList(); setSpeciesColors( new HashMap() ); setSequenceColors( new HashMap() ); setAnnotationColors( new HashMap() ); } - private boolean isDrawPhylogram( final int index ) { - return getIsDrawPhylogramList().get( index ); + private Options.PHYLOGENY_DISPLAY_TYPE getTreeDisplayType( final int index ) { + return getTreeDisplayTypes().get( index ); } private void search0( final MainPanel main_panel, final Phylogeny tree, String query_str ) { @@ -637,7 +658,7 @@ final class ControlPanel extends JPanel implements ActionListener { getSearchResetButton0().setVisible( true ); String[] queries = null; Set nodes = null; - query_str = query_str.replaceAll("\\s+", " " ); + query_str = query_str.replaceAll( "\\s+", " " ); if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) { queries = query_str.split( ",+" ); } @@ -705,7 +726,7 @@ final class ControlPanel extends JPanel implements ActionListener { getSearchResetButton1().setVisible( true ); String[] queries = null; Set nodes = null; - query_str = query_str.replaceAll("\\s+", " " ); + query_str = query_str.replaceAll( "\\s+", " " ); if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) { queries = query_str.split( ",+" ); } @@ -767,8 +788,8 @@ final class ControlPanel extends JPanel implements ActionListener { } } - private void setDrawPhylogram( final int index, final boolean b ) { - getIsDrawPhylogramList().set( index, b ); + private void setTreeDisplayType( final int index, final Options.PHYLOGENY_DISPLAY_TYPE t ) { + getTreeDisplayTypes().set( index, t ); } private void setupClickToOptions() { @@ -992,12 +1013,6 @@ final class ControlPanel extends JPanel implements ActionListener { } private void setupDisplayCheckboxes() { - if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) { - addCheckbox( Configuration.display_as_phylogram, - _configuration.getDisplayTitle( Configuration.display_as_phylogram ) ); - setCheckbox( Configuration.display_as_phylogram, - _configuration.doCheckOption( Configuration.display_as_phylogram ) ); - } if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) { addCheckbox( Configuration.dynamically_hide_data, _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) ); @@ -1015,6 +1030,12 @@ final class ControlPanel extends JPanel implements ActionListener { setCheckbox( Configuration.display_internal_data, _configuration.doCheckOption( Configuration.display_internal_data ) ); } + if ( _configuration.doDisplayOption( Configuration.display_external_data ) ) { + addCheckbox( Configuration.display_external_data, + _configuration.getDisplayTitle( Configuration.display_external_data ) ); + setCheckbox( Configuration.display_external_data, + _configuration.doCheckOption( Configuration.display_external_data ) ); + } if ( _configuration.doDisplayOption( Configuration.color_according_to_sequence ) ) { addCheckbox( Configuration.color_according_to_sequence, _configuration.getDisplayTitle( Configuration.color_according_to_sequence ) ); @@ -1202,12 +1223,11 @@ final class ControlPanel extends JPanel implements ActionListener { _return_to_super_tree.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() ); _return_to_super_tree.setEnabled( true ); } - + void activateButtonToUncollapseAll() { _uncollapse_all.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() ); _uncollapse_all.setEnabled( true ); } - /** * Add zoom and quick edit buttons. (Last modified 8/9/04) @@ -1242,11 +1262,11 @@ final class ControlPanel extends JPanel implements ActionListener { _zoom_in_y = new TypomaticJButton( "Y+" ); _zoom_out_y = new TypomaticJButton( "Y-" ); _show_whole = new JButton( "F" ); - _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" ); - _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" ); - _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" ); - _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" ); - _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" ); + _show_whole.setToolTipText( "fit and center tree display [Alt+C, Home, or Esc]" ); + _zoom_in_x.setToolTipText( "zoom in horizontally [Alt+Right or Shift+Alt+mousewheel]" ); + _zoom_in_y.setToolTipText( "zoom in vertically [Alt+Up or Shift+mousewheel]" ); + _zoom_out_x.setToolTipText( "zoom out horizontally [Alt+Left or Shift+Alt+mousewheel]" ); + _zoom_out_y.setToolTipText( "zoom out vertically [Alt+Down or Shift+mousewheel]" ); if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) { _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) ); _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) ); @@ -1259,25 +1279,23 @@ final class ControlPanel extends JPanel implements ActionListener { _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) ); _show_whole.setPreferredSize( new Dimension( 10, 10 ) ); _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT ); - _return_to_super_tree.setToolTipText( "return to the super-tree (if in sub-tree)" ); + _return_to_super_tree.setToolTipText( "return to the super-tree (if in sub-tree) [Alt+R]" ); _return_to_super_tree.setEnabled( false ); _order = new JButton( "O" ); - _order.setToolTipText( "order all" ); + _order.setToolTipText( "order all [Alt+O]" ); _uncollapse_all = new JButton( "U" ); - _uncollapse_all.setToolTipText( "uncollapse all" ); + _uncollapse_all.setToolTipText( "uncollapse all [Alt+U]" ); addJButton( _zoom_in_y, x_panel ); addJButton( _zoom_out_x, y_panel ); addJButton( _show_whole, y_panel ); addJButton( _zoom_in_x, y_panel ); addJButton( _zoom_out_y, z_panel ); - final JLabel spacer2 = new JLabel( "" ); add( spacer2 ); add( o_panel ); addJButton( _order, o_panel ); addJButton( _return_to_super_tree, o_panel ); addJButton( _uncollapse_all, o_panel ); - if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) { setUpControlsForDomainStrucures(); } @@ -1287,7 +1305,6 @@ final class ControlPanel extends JPanel implements ActionListener { if ( true ) { setUpControlsForRankCollapse(); } - final JLabel spacer3 = new JLabel( "" ); add( spacer3 ); setVisibilityOfDomainStrucureControls(); @@ -1296,18 +1313,18 @@ final class ControlPanel extends JPanel implements ActionListener { void addCheckbox( final int which, final String title ) { final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) ); switch ( which ) { - case Configuration.display_as_phylogram: - _display_as_phylogram_cb = new JCheckBox( title ); - getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" ); - addJCheckBox( getDisplayAsPhylogramCb(), ch_panel ); - add( ch_panel ); - break; case Configuration.display_internal_data: _display_internal_data = new JCheckBox( title ); _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" ); addJCheckBox( _display_internal_data, ch_panel ); add( ch_panel ); break; + case Configuration.display_external_data: + _display_external_data = new JCheckBox( title ); + _display_external_data.setToolTipText( "To allow or disallow display of external labels" ); + addJCheckBox( _display_external_data, ch_panel ); + add( ch_panel ); + break; case Configuration.color_according_to_species: _color_acc_species = new JCheckBox( title ); _color_acc_species.setToolTipText( "To colorize node labels as a function of taxonomy" ); @@ -1485,6 +1502,16 @@ final class ControlPanel extends JPanel implements ActionListener { jcb.addActionListener( this ); } + private final void setupJRadioButton( final JRadioButton rb ) { + rb.setFocusPainted( false ); + rb.setFont( ControlPanel.jcb_font ); + if ( !_configuration.isUseNativeUI() ) { + rb.setBackground( getConfiguration().getGuiBackgroundColor() ); + rb.setForeground( getConfiguration().getGuiCheckboxTextColor() ); + } + rb.addActionListener( this ); + } + void addJTextField( final JTextField tf, final JPanel p ) { if ( !_configuration.isUseNativeUI() ) { tf.setForeground( getConfiguration().getGuiBackgroundColor() ); @@ -1499,12 +1526,11 @@ final class ControlPanel extends JPanel implements ActionListener { _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() ); _return_to_super_tree.setEnabled( false ); } - - void deactivateButtonToUncollapseAll() { + + void deactivateButtonToUncollapseAll() { _uncollapse_all.setForeground( getConfiguration().getGuiButtonTextColor() ); _uncollapse_all.setEnabled( false ); } - void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) { if ( ( _mainpanel != null ) @@ -1621,7 +1647,9 @@ final class ControlPanel extends JPanel implements ActionListener { } boolean isDrawPhylogram() { - return isDrawPhylogram( getMainPanel().getCurrentTabIndex() ); + final Options.PHYLOGENY_DISPLAY_TYPE t = getTreeDisplayType( getMainPanel().getCurrentTabIndex() ); + return ( ( t == Options.PHYLOGENY_DISPLAY_TYPE.ALIGNED_PHYLOGRAM ) + || ( t == Options.PHYLOGENY_DISPLAY_TYPE.UNALIGNED_PHYLOGRAM ) ); } boolean isDynamicallyHideData() { @@ -1664,6 +1692,10 @@ final class ControlPanel extends JPanel implements ActionListener { return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() ); } + boolean isShowExternalData() { + return ( ( _display_external_data == null ) || _display_external_data.isSelected() ); + } + boolean isShowNodeNames() { return ( ( _show_node_names != null ) && _show_node_names.isSelected() ); } @@ -1718,11 +1750,16 @@ final class ControlPanel extends JPanel implements ActionListener { } void phylogenyAdded( final Configuration configuration ) { - getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() ); + if ( configuration.isDrawAsPhylogram() ) { + getTreeDisplayTypes().add( Options.PHYLOGENY_DISPLAY_TYPE.UNALIGNED_PHYLOGRAM ); + } + else { + getTreeDisplayTypes().add( Options.PHYLOGENY_DISPLAY_TYPE.CLADOGRAM ); + } } void phylogenyRemoved( final int index ) { - getIsDrawPhylogramList().remove( index ); + getTreeDisplayTypes().remove( index ); } void search0() { @@ -1790,8 +1827,10 @@ final class ControlPanel extends JPanel implements ActionListener { void setCheckbox( final int which, final boolean state ) { switch ( which ) { case Configuration.display_as_phylogram: - if ( getDisplayAsPhylogramCb() != null ) { - getDisplayAsPhylogramCb().setSelected( state ); + if ( getDisplayAsUnalignedPhylogramRb() != null ) { + getDisplayAsUnalignedPhylogramRb().setSelected( state ); + getDisplayAsAlignedPhylogramRb().setSelected( !state ); + getDisplayAsCladogramRb().setSelected( !state ); } break; case Configuration.display_internal_data: @@ -1799,6 +1838,11 @@ final class ControlPanel extends JPanel implements ActionListener { _display_internal_data.setSelected( state ); } break; + case Configuration.display_external_data: + if ( _display_external_data != null ) { + _display_external_data.setSelected( state ); + } + break; case Configuration.color_according_to_species: if ( _color_acc_species != null ) { _color_acc_species.setSelected( state ); @@ -2039,13 +2083,28 @@ final class ControlPanel extends JPanel implements ActionListener { _color_branches = color_branches; } - void setDrawPhylogram( final boolean b ) { - getDisplayAsPhylogramCb().setSelected( b ); - setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b ); + void setTreeDisplayType( final Options.PHYLOGENY_DISPLAY_TYPE t ) { + switch ( t ) { + case UNALIGNED_PHYLOGRAM: + getDisplayAsUnalignedPhylogramRb().setSelected( true ); + break; + case ALIGNED_PHYLOGRAM: + getDisplayAsAlignedPhylogramRb().setSelected( true ); + break; + case CLADOGRAM: + getDisplayAsCladogramRb().setSelected( true ); + break; + } + setTreeDisplayType( getMainPanel().getCurrentTabIndex(), t ); } void setDrawPhylogramEnabled( final boolean b ) { - getDisplayAsPhylogramCb().setEnabled( b ); + if ( getDisplayAsAlignedPhylogramRb() != null && getDisplayAsUnalignedPhylogramRb() != null + && getDisplayAsCladogramRb() != null ) { + getDisplayAsAlignedPhylogramRb().setEnabled( b ); + getDisplayAsUnalignedPhylogramRb().setEnabled( b ); + getDisplayAsCladogramRb().setEnabled( b ); + } } void setDynamicHidingIsOn( final boolean is_on ) { @@ -2086,7 +2145,7 @@ final class ControlPanel extends JPanel implements ActionListener { } void setupControls() { - // The tree display options: + setupTreeDisplayTypeOptions(); setupDisplayCheckboxes(); /* GUILHEM_BEG */ // The sequence relation query selection combo-box @@ -2104,6 +2163,32 @@ final class ControlPanel extends JPanel implements ActionListener { setupSearchTools1(); } + void setupTreeDisplayTypeOptions() { + _display_as_unaligned_phylogram_rb = new JRadioButton( "P" ); + _display_as_aligned_phylogram_rb = new JRadioButton( "A" ); + _display_as_cladogram_rb = new JRadioButton( "C" ); + _display_as_buttongroup = new ButtonGroup(); + _display_as_buttongroup.add( _display_as_unaligned_phylogram_rb ); + _display_as_buttongroup.add( _display_as_aligned_phylogram_rb ); + _display_as_buttongroup.add( _display_as_cladogram_rb ); + getDisplayAsUnalignedPhylogramRb().setToolTipText( "(unaligned) phylogram" ); + getDisplayAsAlignedPhylogramRb().setToolTipText( "aligned phylogram" ); + getDisplayAsCladogramRb().setToolTipText( "cladogram" ); + setupJRadioButton( getDisplayAsUnalignedPhylogramRb() ); + setupJRadioButton( getDisplayAsAlignedPhylogramRb() ); + setupJRadioButton( getDisplayAsCladogramRb() ); + final JPanel p = new JPanel( new GridLayout( 1, 3, 0, 0 ) ); + p.setFont( ControlPanel.jcb_font ); + if ( !_configuration.isUseNativeUI() ) { + p.setBackground( getConfiguration().getGuiBackgroundColor() ); + p.setForeground( getConfiguration().getGuiCheckboxTextColor() ); + } + p.add( _display_as_unaligned_phylogram_rb ); + p.add( _display_as_aligned_phylogram_rb ); + p.add( _display_as_cladogram_rb ); + add( p ); + } + void setUpControlsForDomainStrucures() { _domain_display_label = new JLabel( "Domain Architectures:" ); add( customizeLabel( _domain_display_label, getConfiguration() ) ); @@ -2517,21 +2602,14 @@ final class ControlPanel extends JPanel implements ActionListener { if ( getCurrentTreePanel().isPhyHasBranchLengths() && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) { setDrawPhylogramEnabled( true ); - setDrawPhylogram( isDrawPhylogram() ); + setTreeDisplayType( getTreeDisplayType( getMainPanel().getCurrentTabIndex() ) ); } else { setDrawPhylogramEnabled( false ); - setDrawPhylogram( false ); - } - if ( getMainPanel().getMainFrame() == null ) { - // Must be "E" applet version. - final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet(); - e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() ); - } - else { - getMainPanel().getMainFrame() - .setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel().getPhylogenyGraphicsType() ); + setTreeDisplayType( Options.PHYLOGENY_DISPLAY_TYPE.CLADOGRAM ); } + getMainPanel().getMainFrame() + .setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel().getPhylogenyGraphicsType() ); getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton(); getMainPanel().getCurrentTreePanel().updateButtonToUncollapseAll(); getMainPanel().getControlPanel().search0(); @@ -2629,8 +2707,6 @@ final class ControlPanel extends JPanel implements ActionListener { } final void updateRankCollapseRankDisplay() { - - if ( _rank_collapse_depth_tf != null ) { final String r = obtainRankCollapseDepthValue(); if ( r.equals( "off" ) ) { @@ -2732,6 +2808,12 @@ final class ControlPanel extends JPanel implements ActionListener { } } + private final boolean isDrawPhylogram( int currentTabIndex ) { + Options.PHYLOGENY_DISPLAY_TYPE t = getTreeDisplayType( currentTabIndex ); + return ( ( t == Options.PHYLOGENY_DISPLAY_TYPE.ALIGNED_PHYLOGRAM ) + | ( t == Options.PHYLOGENY_DISPLAY_TYPE.UNALIGNED_PHYLOGRAM ) ); + } + final void zoomOutY( final float factor ) { final TreePanel treepanel = getMainPanel().getCurrentTreePanel(); treepanel.multiplyUrtFactor( 0.9f ); @@ -2762,4 +2844,14 @@ final class ControlPanel extends JPanel implements ActionListener { final public JCheckBox getUseBranchWidthsCb() { return _width_branches; } + + public Options.PHYLOGENY_DISPLAY_TYPE getTreeDisplayType() { + if ( _display_as_unaligned_phylogram_rb.isSelected() ) { + return Options.PHYLOGENY_DISPLAY_TYPE.UNALIGNED_PHYLOGRAM; + } + else if ( _display_as_aligned_phylogram_rb.isSelected() ) { + return Options.PHYLOGENY_DISPLAY_TYPE.ALIGNED_PHYLOGRAM; + } + return Options.PHYLOGENY_DISPLAY_TYPE.CLADOGRAM; + } }