phylotastic hackathon at NESCENT 120606
[jalview.git] / forester / java / src / org / forester / archaeopteryx / ControlPanel.java
index ad88f3b..5bca398 100644 (file)
@@ -625,7 +625,8 @@ final class ControlPanel extends JPanel implements ActionListener {
     }
 
     void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
-        if ( ( _mainpanel != null ) && ( _mainpanel.getCurrentPhylogeny() != null ) ) {
+        if ( ( _mainpanel != null )
+                && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
             if ( getOptions().isShowOverview() ) {
                 _mainpanel.getCurrentTreePanel().updateOvSizes();
             }
@@ -1162,9 +1163,7 @@ final class ControlPanel extends JPanel implements ActionListener {
             setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
         }
         else if ( action == _blast_item ) {
-           
-                setActionWhenNodeClicked( NodeClickAction.BLAST );
-            
+            setActionWhenNodeClicked( NodeClickAction.BLAST );
         }
         else if ( action == _open_tax_web_item ) {
             setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
@@ -1376,7 +1375,6 @@ final class ControlPanel extends JPanel implements ActionListener {
             }
             cb_index++;
         }
-        
         if ( getOptions().isEditable() ) {
             if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
                 _cut_subtree_item = cb_index;
@@ -1431,9 +1429,6 @@ final class ControlPanel extends JPanel implements ActionListener {
                 }
                 cb_index++;
             }
-           
-                
-            
         }
         // Set default selection and its action
         _click_to_combobox.setSelectedIndex( selected_index );
@@ -1718,10 +1713,11 @@ final class ControlPanel extends JPanel implements ActionListener {
      * Fit entire tree into window.
      */
     void showWhole() {
-        if ( _mainpanel.getCurrentScrollPane() == null ) {
+        if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
             return;
         }
-        displayedPhylogenyMightHaveChanged( false );
+        getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
+        displayedPhylogenyMightHaveChanged( true );
         _mainpanel.getCurrentTreePanel().updateOvSettings();
         _mainpanel.getCurrentTreePanel().validate();
         _mainpanel.validate();
@@ -1821,7 +1817,7 @@ final class ControlPanel extends JPanel implements ActionListener {
                 node.setCollapse( false );
             }
             tp.resetNodeIdToDistToLeafMap();
-            tp.updateSetOfCollapsedExternalNodes( t );
+            tp.updateSetOfCollapsedExternalNodes();
             t.recalculateNumberOfExternalDescendants( false );
             tp.setNodeInPreorderToNull();
             t.hashIDs();