enable phylogram if positive bl edited
authorcmzmasek <cmzmasek@yahoo.com>
Wed, 29 Jun 2016 21:02:15 +0000 (14:02 -0700)
committercmzmasek <cmzmasek@yahoo.com>
Wed, 29 Jun 2016 21:02:15 +0000 (14:02 -0700)
forester/java/src/org/forester/archaeopteryx/AptxConstants.java
forester/java/src/org/forester/archaeopteryx/AptxUtil.java
forester/java/src/org/forester/archaeopteryx/ControlPanel.java
forester/java/src/org/forester/archaeopteryx/NodeEditPanel.java

index e658341..182c7fc 100644 (file)
@@ -41,8 +41,8 @@ public final class AptxConstants {
     public final static boolean __SNAPSHOT_RELEASE                                            = false;                                                                             // TODO remove me
     public final static boolean __SYNTH_LF                                                    = false;                                                                             // TODO remove me
     public final static String  PRG_NAME                                                      = "Archaeopteryx";
-    final static String         VERSION                                                       = "0.9911 beta";
-    final static String         PRG_DATE                                                      = "160623";
+    final static String         VERSION                                                       = "0.9912 beta";
+    final static String         PRG_DATE                                                      = "160629";
     final static String         DEFAULT_CONFIGURATION_FILE_NAME                               = "_aptx_configuration_file";
     final static String[]       DEFAULT_FONT_CHOICES                                          = { 
             "SansSerif", "Sans-serif", "Sans", "Dialog", "Lucida Sans", "Tahoma", "Helvetica", "Arial", "Verdana" };
index 8f7963f..5b3dafa 100644 (file)
@@ -766,18 +766,31 @@ public final class AptxUtil {
         }
         return false;
     }
-
+    final static void lookAtRealBranchLengthsForAptxControlSettings( final Phylogeny t,
+                                                                     final ControlPanel cp ) {
+        if ( ( t != null ) && !t.isEmpty() ) {
+            final boolean has_bl = AptxUtil.isHasAtLeastOneBranchLengthLargerThanZero( t );
+            if ( !has_bl ) {
+                cp.setDrawPhylogram( false );
+                cp.setDrawPhylogramEnabled( false );
+            }
+            else if ( cp.getDisplayAsPhylogramCb() != null ) {
+                cp.setDrawPhylogramEnabled( true );
+            }
+        }
+    }
     final static void lookAtSomeTreePropertiesForAptxControlSettings( final Phylogeny t,
                                                                       final ControlPanel atv_control,
                                                                       final Configuration configuration ) {
         if ( ( t != null ) && !t.isEmpty() ) {
-            if ( !AptxUtil.isHasAtLeastOneBranchLengthLargerThanZero( t ) ) {
+            final boolean has_bl = AptxUtil.isHasAtLeastOneBranchLengthLargerThanZero( t );
+            if ( !has_bl ) {
                 atv_control.setDrawPhylogram( false );
                 atv_control.setDrawPhylogramEnabled( false );
             }
             if ( configuration.doGuessCheckOption( Configuration.display_as_phylogram ) ) {
                 if ( atv_control.getDisplayAsPhylogramCb() != null ) {
-                    if ( AptxUtil.isHasAtLeastOneBranchLengthLargerThanZero( t ) ) {
+                    if ( has_bl ) {
                         atv_control.setDrawPhylogram( true );
                         atv_control.setDrawPhylogramEnabled( true );
                     }
index 6d7c316..fb0f3b3 100644 (file)
@@ -551,6 +551,7 @@ final class ControlPanel extends JPanel implements ActionListener {
     }// addSequenceRelationBlock
 
     /* GUILHEM_END */
+    
     private List<Boolean> getIsDrawPhylogramList() {
         return _draw_phylogram;
     }
index 85476b1..972f0e9 100644 (file)
@@ -210,8 +210,12 @@ class NodeEditPanel extends JPanel {
                 if ( old_path != null ) {
                     writeBack( ( DefaultMutableTreeNode ) old_path.getLastPathComponent() );
                 }
+                AptxUtil.lookAtRealBranchLengthsForAptxControlSettings( tree_panel.getPhylogeny(),
+                                                                        tree_panel.getControlPanel() );
+                getTreePanel().repaint();
             }
         } );
+       
     }
 
     private void addBasics( final DefaultMutableTreeNode top, final PhylogenyNode phylogeny_node, final String name ) {
@@ -1103,6 +1107,7 @@ class NodeEditPanel extends JPanel {
             default:
                 throw new IllegalArgumentException( "unknown: " + tag );
         }
+       
         getJTree().repaint();
         getTreePanel().setEdited( true );
         getTreePanel().repaint();