in progress
[jalview.git] / forester / java / src / org / forester / archaeopteryx / ControlPanel.java
index 9729cb8..27930ec 100644 (file)
@@ -64,6 +64,7 @@ import org.forester.phylogeny.PhylogenyMethods;
 import org.forester.phylogeny.PhylogenyNode;
 import org.forester.phylogeny.data.Sequence;
 import org.forester.phylogeny.data.SequenceRelation;
+import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
 import org.forester.util.ForesterUtil;
 
 final class ControlPanel extends JPanel implements ActionListener {
@@ -109,6 +110,7 @@ final class ControlPanel extends JPanel implements ActionListener {
     private JComboBox            _show_sequence_relations;
     private JComboBox            _sequence_relation_type_box;
     private JCheckBox            _show_vector_data_cb;
+    private JCheckBox            _show_properties_cb;
     private JLabel               _click_to_label;
     private JLabel               _zoom_label;
     private JLabel               _domain_display_label;
@@ -274,10 +276,10 @@ final class ControlPanel extends JPanel implements ActionListener {
             tp.requestFocus();
         }
         catch ( final Exception ex ) {
-            Util.unexpectedException( ex );
+            AptxUtil.unexpectedException( ex );
         }
         catch ( final Error err ) {
-            Util.unexpectedError( err );
+            AptxUtil.unexpectedError( err );
         }
     }
 
@@ -329,7 +331,7 @@ final class ControlPanel extends JPanel implements ActionListener {
         _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+Up]" );
         _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+Left]" );
         _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+Down]" );
-        if ( getConfiguration().isUseNativeUI() && Util.isMac() ) {
+        if ( getConfiguration().isUseNativeUI() && AptxUtil.isMac() ) {
             _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
             _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
         }
@@ -396,11 +398,6 @@ final class ControlPanel extends JPanel implements ActionListener {
                 addJCheckBox( _show_node_names, ch_panel );
                 add( ch_panel );
                 break;
-            case Configuration.show_tax_code:
-                _show_taxo_code = new JCheckBox( title );
-                addJCheckBox( _show_taxo_code, ch_panel );
-                add( ch_panel );
-                break;
             case Configuration.show_taxonomy_scientific_names:
                 _show_taxo_scientific_names = new JCheckBox( title );
                 addJCheckBox( _show_taxo_scientific_names, ch_panel );
@@ -411,6 +408,11 @@ final class ControlPanel extends JPanel implements ActionListener {
                 addJCheckBox( _show_taxo_common_names, ch_panel );
                 add( ch_panel );
                 break;
+            case Configuration.show_tax_code:
+                _show_taxo_code = new JCheckBox( title );
+                addJCheckBox( _show_taxo_code, ch_panel );
+                add( ch_panel );
+                break;
             case Configuration.show_taxonomy_images:
                 _show_taxo_images_cb = new JCheckBox( title );
                 addJCheckBox( _show_taxo_images_cb, ch_panel );
@@ -495,6 +497,11 @@ final class ControlPanel extends JPanel implements ActionListener {
                 addJCheckBox( _show_vector_data_cb, ch_panel );
                 add( ch_panel );
                 break;
+            case Configuration.show_properties:
+                _show_properties_cb = new JCheckBox( title );
+                addJCheckBox( _show_properties_cb, ch_panel );
+                add( ch_panel );
+                break;
             default:
                 throw new RuntimeException( "unknown checkbox: " + which );
         }
@@ -645,6 +652,10 @@ final class ControlPanel extends JPanel implements ActionListener {
         return _color_branches_cb;
     }
 
+    public JCheckBox getColorAccSpeciesCb() {
+        return _color_acc_species;
+    }
+
     Configuration getConfiguration() {
         return _configuration;
     }
@@ -800,7 +811,7 @@ final class ControlPanel extends JPanel implements ActionListener {
         return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
     }
 
-    boolean isShowBootstrapValues() {
+    boolean isShowConfidenceValues() {
         return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
     }
 
@@ -816,6 +827,10 @@ final class ControlPanel extends JPanel implements ActionListener {
         return ( ( _show_vector_data_cb != null ) && _show_vector_data_cb.isSelected() );
     }
 
+    public boolean isShowProperties() {
+        return ( ( _show_properties_cb != null ) && _show_properties_cb.isSelected() );
+    }
+
     boolean isShowGeneSymbols() {
         return ( ( _show_gene_symbols != null ) && _show_gene_symbols.isSelected() );
     }
@@ -828,10 +843,6 @@ final class ControlPanel extends JPanel implements ActionListener {
         return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
     }
 
-    boolean isShowProperty() {
-        return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
-    }
-
     boolean isShowSequenceAcc() {
         return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
     }
@@ -990,11 +1001,6 @@ final class ControlPanel extends JPanel implements ActionListener {
                     _show_node_names.setSelected( state );
                 }
                 break;
-            case Configuration.show_tax_code:
-                if ( _show_taxo_code != null ) {
-                    _show_taxo_code.setSelected( state );
-                }
-                break;
             case Configuration.show_taxonomy_scientific_names:
                 if ( _show_taxo_scientific_names != null ) {
                     _show_taxo_scientific_names.setSelected( state );
@@ -1005,6 +1011,11 @@ final class ControlPanel extends JPanel implements ActionListener {
                     _show_taxo_common_names.setSelected( state );
                 }
                 break;
+            case Configuration.show_tax_code:
+                if ( _show_taxo_code != null ) {
+                    _show_taxo_code.setSelected( state );
+                }
+                break;
             case Configuration.show_taxonomy_images:
                 if ( _show_taxo_images_cb != null ) {
                     _show_taxo_images_cb.setSelected( state );
@@ -1065,6 +1076,11 @@ final class ControlPanel extends JPanel implements ActionListener {
                     _show_vector_data_cb.setSelected( state );
                 }
                 break;
+            case Configuration.show_properties:
+                if ( _show_properties_cb != null ) {
+                    _show_properties_cb.setSelected( state );
+                }
+                break;
             case Configuration.show_sequence_acc:
                 if ( _show_sequence_acc != null ) {
                     _show_sequence_acc.setSelected( state );
@@ -1579,6 +1595,10 @@ final class ControlPanel extends JPanel implements ActionListener {
                          _configuration.getDisplayTitle( Configuration.show_vector_data ) );
             setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
         }
+        if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
+            addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
+            setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
+        }
     }
 
     void setupSearchTools() {
@@ -1765,8 +1785,15 @@ final class ControlPanel extends JPanel implements ActionListener {
     void uncollapseAll( final TreePanel tp ) {
         final Phylogeny t = tp.getPhylogeny();
         if ( ( t != null ) && !t.isEmpty() ) {
-            t.setAllNodesToNotCollapse();
+            for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
+                final PhylogenyNode node = iter.next();
+                node.setCollapse( false );
+            }
+            tp.resetNodeIdToDistToLeafMap();
+            tp.updateSetOfCollapsedExternalNodes( t );
             t.recalculateNumberOfExternalDescendants( false );
+            tp.setNodeInPreorderToNull();
+            t.hashIDs();
             showWhole();
         }
     }