From fa7be237a552a2f3d413d6e3e81a51d22097743a Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Wed, 20 Aug 2014 19:59:25 +0000 Subject: [PATCH] in progress --- .../org/forester/archaeopteryx/ArchaeopteryxE.java | 14 +-- .../org/forester/archaeopteryx/ControlPanel.java | 110 +++++++++++++++++++- .../src/org/forester/archaeopteryx/MainFrame.java | 78 -------------- .../forester/archaeopteryx/MainFrameApplet.java | 14 +-- .../archaeopteryx/MainFrameApplication.java | 14 +-- 5 files changed, 129 insertions(+), 101 deletions(-) diff --git a/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java b/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java index 77355ea..fb37c4f 100644 --- a/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java +++ b/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java @@ -736,16 +736,16 @@ public class ArchaeopteryxE extends JApplet implements ActionListener { .setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() ); MainFrame.setTextForFontChooserMenuItem( _choose_font_mi, MainFrame .createCurrentFontDesc( getMainPanel().getTreeFontSet() ) ); - MainFrame.updateOptionsMenuDependingOnPhylogenyType( getMainPanel(), - _show_scale_cbmi, - _show_branch_length_values_cbmi, - _non_lined_up_cladograms_rbmi, - _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() ); + try { + getMainPanel().getControlPanel().setVisibilityOfDomainStrucureCB(); + getMainPanel().getControlPanel().setVisibilityOfX(); + } + catch ( final Exception ignore ) { + // do nothing, not important. + } } } ); _options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.DISPLAY_SUBHEADER ), diff --git a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java index 225a591..e8ba350 100644 --- a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java +++ b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java @@ -165,7 +165,6 @@ final class ControlPanel extends JPanel implements ActionListener { private JCheckBox _width_branches; private JCheckBox _write_confidence; private JButton _zoom_in_domain_structure; - // zooming and quick tree manipulation buttons: private JButton _zoom_in_x; private JButton _zoom_in_y; private JLabel _zoom_label; @@ -1297,7 +1296,7 @@ final class ControlPanel extends JPanel implements ActionListener { } void setUpControlsForDomainStrucures() { - _domain_display_label = new JLabel( "Domain Display:" ); + _domain_display_label = new JLabel( "Domain Architectures:" ); add( customizeLabel( _domain_display_label, getConfiguration() ) ); add( _domain_display_label ); _zoom_in_domain_structure = new JButton( "d+" ); @@ -2273,6 +2272,12 @@ final class ControlPanel extends JPanel implements ActionListener { _decr_domain_structure_evalue_thr.setVisible( true ); _incr_domain_structure_evalue_thr.setVisible( true ); _domain_structure_evalue_thr_tf.setVisible( true ); + if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) { + getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( true ); + } + if ( getMainPanel().getMainFrame()._show_domain_labels != null ) { + getMainPanel().getMainFrame()._show_domain_labels.setVisible( true ); + } } else { _domain_display_label.setVisible( false ); @@ -2281,8 +2286,109 @@ final class ControlPanel extends JPanel implements ActionListener { _decr_domain_structure_evalue_thr.setVisible( false ); _incr_domain_structure_evalue_thr.setVisible( false ); _domain_structure_evalue_thr_tf.setVisible( false ); + if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) { + getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false ); + } + if ( getMainPanel().getMainFrame()._show_domain_labels != null ) { + getMainPanel().getMainFrame()._show_domain_labels.setVisible( false ); + } + } + } + } + + void setVisibilityOfX() { + try { + if ( isDrawPhylogram() + || ( ( getCurrentTreePanel() != null ) && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel() + .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) ) { + if ( getMainPanel().getMainFrame()._non_lined_up_cladograms_rbmi != null ) { + getMainPanel().getMainFrame()._non_lined_up_cladograms_rbmi.setVisible( false ); + } + if ( getMainPanel().getMainFrame()._uniform_cladograms_rbmi != null ) { + getMainPanel().getMainFrame()._uniform_cladograms_rbmi.setVisible( false ); + } + if ( getMainPanel().getMainFrame()._ext_node_dependent_cladogram_rbmi != null ) { + getMainPanel().getMainFrame()._ext_node_dependent_cladogram_rbmi.setVisible( false ); + } + } + else { + if ( getMainPanel().getMainFrame()._non_lined_up_cladograms_rbmi != null ) { + getMainPanel().getMainFrame()._non_lined_up_cladograms_rbmi.setVisible( true ); + } + if ( getMainPanel().getMainFrame()._uniform_cladograms_rbmi != null ) { + getMainPanel().getMainFrame()._uniform_cladograms_rbmi.setVisible( true ); + } + if ( getMainPanel().getMainFrame()._ext_node_dependent_cladogram_rbmi != null ) { + getMainPanel().getMainFrame()._ext_node_dependent_cladogram_rbmi.setVisible( true ); + } + } + if ( isDrawPhylogram() ) { + if ( getMainPanel().getMainFrame()._show_scale_cbmi != null ) { + getMainPanel().getMainFrame()._show_scale_cbmi.setVisible( true ); + } + } + else { + if ( getMainPanel().getMainFrame()._show_scale_cbmi != null ) { + getMainPanel().getMainFrame()._show_scale_cbmi.setVisible( false ); + } + } + if ( getCurrentTreePanel() != null ) { + if ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) + || ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) { + if ( getMainPanel().getMainFrame()._label_direction_cbmi != null ) { + getMainPanel().getMainFrame()._label_direction_cbmi.setVisible( true ); + } + if ( getMainPanel().getMainFrame()._show_branch_length_values_cbmi != null ) { + getMainPanel().getMainFrame()._show_branch_length_values_cbmi.setVisible( false ); + } + } + else { + if ( getMainPanel().getMainFrame()._label_direction_cbmi != null ) { + getMainPanel().getMainFrame()._label_direction_cbmi.setVisible( false ); + } + if ( getMainPanel().getMainFrame()._show_branch_length_values_cbmi != null ) { + getMainPanel().getMainFrame()._show_branch_length_values_cbmi.setVisible( true ); + } + } } } + catch ( final Exception ignore ) { + //not important... + } + } + + void setVisibilityOfDomainStrucureCB() { + try { + if ( ( getCurrentTreePanel() != null ) + && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel() + .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) { + if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) { + getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false ); + } + if ( getMainPanel().getMainFrame()._show_domain_labels != null ) { + getMainPanel().getMainFrame()._show_domain_labels.setVisible( false ); + } + } + else if ( isShowDomainArchitectures() ) { + if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) { + getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( true ); + } + if ( getMainPanel().getMainFrame()._show_domain_labels != null ) { + getMainPanel().getMainFrame()._show_domain_labels.setVisible( true ); + } + } + else { + if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) { + getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false ); + } + if ( getMainPanel().getMainFrame()._show_domain_labels != null ) { + getMainPanel().getMainFrame()._show_domain_labels.setVisible( false ); + } + } + } + catch ( final Exception ignore ) { + //not important... + } } static JLabel customizeLabel( final JLabel label, final Configuration configuration ) { diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrame.java b/forester/java/src/org/forester/archaeopteryx/MainFrame.java index b64958b..1cf79b0 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrame.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrame.java @@ -1824,84 +1824,6 @@ public abstract class MainFrame extends JFrame implements ActionListener { mi.setText( "Enter Default Node Shape Size... (current: " + options.getDefaultNodeShapeSize() + ")" ); } - static void updateOptionsMenuDependingOnPhylogenyType( final MainPanel main_panel, - final JCheckBoxMenuItem scale, - final JCheckBoxMenuItem branch_lengths, - final JRadioButtonMenuItem non_lined_up, - final JRadioButtonMenuItem uniform_clado, - final JRadioButtonMenuItem nonuniform_clado, - final JCheckBoxMenuItem label_direction_cbmi ) { - final TreePanel tree_panel = main_panel.getCurrentTreePanel(); - final ControlPanel control = main_panel.getControlPanel(); - final Options options = main_panel.getOptions(); - scale.setSelected( options.isShowScale() ); - branch_lengths.setSelected( options.isShowBranchLengthValues() ); - // non_lined_up.setSelected( options.isNonLinedUpCladogram() ); - if ( ( tree_panel != null ) && ( !tree_panel.isPhyHasBranchLengths() ) ) { - scale.setSelected( false ); - scale.setEnabled( false ); - branch_lengths.setSelected( false ); - branch_lengths.setEnabled( false ); - } - else if ( ( tree_panel != null ) && !control.isDrawPhylogram() ) { - scale.setSelected( false ); - scale.setEnabled( false ); - branch_lengths.setEnabled( true ); - } - else { - scale.setEnabled( true ); - branch_lengths.setEnabled( true ); - } - if ( ( tree_panel != null ) - && ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.ROUNDED ) - && ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE ) && ( tree_panel - .getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR ) ) ) { - branch_lengths.setSelected( false ); - branch_lengths.setEnabled( false ); - } - if ( tree_panel != null ) { - if ( ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) - || ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) { - non_lined_up.setEnabled( false ); - uniform_clado.setEnabled( false ); - nonuniform_clado.setEnabled( false ); - } - else { - non_lined_up.setEnabled( true ); - uniform_clado.setEnabled( true ); - nonuniform_clado.setEnabled( true ); - } - } - else { - if ( ( tree_panel != null ) - && ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE ) && ( tree_panel - .getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR ) ) ) { - branch_lengths.setSelected( false ); - branch_lengths.setEnabled( false ); - } - if ( ( tree_panel != null ) - && ( ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( tree_panel - .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) { - non_lined_up.setEnabled( false ); - } - else { - // non_lined_up.setSelected( options.isNonLinedUpCladogram() ); - non_lined_up.setEnabled( true ); - } - } - label_direction_cbmi.setEnabled( true ); - if ( tree_panel != null ) { - if ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) - && ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) { - label_direction_cbmi.setEnabled( false ); - } - if ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) { - scale.setSelected( false ); - scale.setEnabled( false ); - } - } - } - static void updateScreenTextAntialias( final List treepanels ) { for( final TreePanel tree_panel : treepanels ) { tree_panel.setTextAntialias(); diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java index 389b626..9713b4f 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java @@ -186,16 +186,16 @@ public final class MainFrameApplet extends MainFrame { .setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() ); MainFrame.setTextForFontChooserMenuItem( _choose_font_mi, createCurrentFontDesc( getMainPanel() .getTreeFontSet() ) ); - MainFrame.updateOptionsMenuDependingOnPhylogenyType( getMainPanel(), - _show_scale_cbmi, - _show_branch_length_values_cbmi, - _non_lined_up_cladograms_rbmi, - _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() ); + try { + getMainPanel().getControlPanel().setVisibilityOfDomainStrucureCB(); + getMainPanel().getControlPanel().setVisibilityOfX(); + } + catch ( final Exception ignore ) { + // do nothing, not important. + } } } ); _options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.DISPLAY_SUBHEADER ), diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index 6ad71f3..30721ca 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -868,16 +868,16 @@ public final class MainFrameApplication extends MainFrame { .createCurrentFontDesc( getMainPanel().getTreeFontSet() ) ); setTextForGraphicsSizeChooserMenuItem( _print_size_mi, getOptions() ); setTextForPdfLineWidthChooserMenuItem( _choose_pdf_width_mi, getOptions() ); - MainFrame.updateOptionsMenuDependingOnPhylogenyType( getMainPanel(), - _show_scale_cbmi, - _show_branch_length_values_cbmi, - _non_lined_up_cladograms_rbmi, - _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() ); + try { + getMainPanel().getControlPanel().setVisibilityOfDomainStrucureCB(); + getMainPanel().getControlPanel().setVisibilityOfX(); + } + catch ( final Exception ignore ) { + // do nothing, not important. + } } } ); _options_jmenu.add( customizeMenuItemAsLabel( new JMenuItem( DISPLAY_SUBHEADER ), getConfiguration() ) ); -- 1.7.10.2