in progress
authorcmzmasek <cmzmasek@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Mon, 1 Apr 2013 06:20:40 +0000 (06:20 +0000)
committercmzmasek <cmzmasek@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Mon, 1 Apr 2013 06:20:40 +0000 (06:20 +0000)
forester/java/src/org/forester/archaeopteryx/Configuration.java
forester/java/src/org/forester/archaeopteryx/TreePanel.java

index 8cb5414..1f89033 100644 (file)
@@ -1524,18 +1524,6 @@ public final class Configuration {
             else if ( key.equals( "width_branches" ) ) {
                 key_index = Configuration.width_branches;
             }
-            else if ( key.equals( "color_orthologous" ) ) {
-                ForesterUtil.printWarningMessage( Constants.PRG_NAME,
-                                                  "configuration key [color_orthologous] is deprecated" );
-            }
-            else if ( key.equals( "color_subtree_neighbors" ) ) {
-                ForesterUtil.printWarningMessage( Constants.PRG_NAME,
-                                                  "configuration key [color_subtree_neighbors] is deprecated" );
-            }
-            else if ( key.equals( "color_super_orthologous" ) ) {
-                ForesterUtil.printWarningMessage( Constants.PRG_NAME,
-                                                  "configuration key [color_super_orthologous] is deprecated" );
-            }
             else if ( key.equals( "mark_nodes_with_box" ) ) {
                 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
                                                   "configuration key [mark_nodes_with_box] is deprecated" );
@@ -1627,7 +1615,7 @@ public final class Configuration {
                     }
                 }
                 else if ( key.equals( "species_color" ) ) {
-                    getSpeciesColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
+                    getSpeciesColors().put( ( ( String ) st.nextElement() ).replace( '_', ' ' ), Color.decode( ( String ) st.nextElement() ) );
                 }
                 else if ( key.equals( "domain_color" ) ) {
                     getDomainColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
index 8e78667..1a5fc6f 100644 (file)
@@ -689,21 +689,25 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
     }
 
     final Color calculateTaxonomyBasedColor( final Taxonomy tax ) {
-        String species = tax.getTaxonomyCode();
-        if ( ForesterUtil.isEmpty( species ) ) {
-            species = tax.getScientificName();
-            if ( ForesterUtil.isEmpty( species ) ) {
-                species = tax.getCommonName();
-            }
-        }
-        if ( ForesterUtil.isEmpty( species ) ) {
+        if ( ForesterUtil.isEmpty( tax.getTaxonomyCode() ) && ForesterUtil.isEmpty( tax.getScientificName() ) ) {
             return getTreeColorSet().getTaxonomyColor();
         }
-        // Look in species hash
-        Color c = getControlPanel().getSpeciesColors().get( species );
+        Color c = null;
+        if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) {
+            c = getControlPanel().getSpeciesColors().get( tax.getTaxonomyCode() );
+        }
+        if ( c == null && !ForesterUtil.isEmpty( tax.getScientificName() ) ) {
+            c = getControlPanel().getSpeciesColors().get( tax.getScientificName() );
+        }
         if ( c == null ) {
-            c = AptxUtil.calculateColorFromString( species );
-            getControlPanel().getSpeciesColors().put( species, c );
+            if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) {
+                c = AptxUtil.calculateColorFromString( tax.getTaxonomyCode() );
+                getControlPanel().getSpeciesColors().put( tax.getTaxonomyCode(), c );
+            }
+            else  {
+                c = AptxUtil.calculateColorFromString( tax.getScientificName() );
+                getControlPanel().getSpeciesColors().put( tax.getScientificName(), c );
+            }
         }
         return c;
     }