in progress
[jalview.git] / forester / java / src / org / forester / archaeopteryx / Configuration.java
index 4b14d16..5ae230f 100644 (file)
@@ -57,9 +57,10 @@ public final class Configuration {
 
     final static String                     clickto_options[][]                                    = {
             { "Display Node Data", "display" }, { "Collapse/Uncollapse", "display" }, { "Root/Reroot", "display" },
-            { "Sub/Super Tree", "display" }, { "Swap Descendants", "display" }, { "Colorize Subtree(s)", "display" },
-            { "Colorize Node Font", "display" }, { "Open Sequence DB", "display" }, { "Open PDB", "display" },
-            { "Open Taxonomy DB", "display" }, { "Blast", "display" }, { "Cut Subtree", "display" },
+            { "Go to Sub-/Super-Tree", "display" }, { "Swap Descendants", "display" },
+            { "Colorize Node(s)", "display" }, { "Change Node Font(s)", "display" },
+            { "Colorize Subtree(s)", "display" }, { "Open Sequence DB", "display" }, { "Open PDB", "display" },
+            { "Open Taxonomy DB", "display" }, { "Launch BLAST", "display" }, { "Cut Subtree", "display" },
             { "Copy Subtree", "display" }, { "Paste Subtree", "display" }, { "Delete Subtree/Node", "display" },
             { "Add New Node", "display" }, { "Edit Node Data", "display" }, { "Sort Descendants", "display" },
             { "Return", "display" }, { "Select Node(s)", "display" }                              };
@@ -68,38 +69,40 @@ public final class Configuration {
     final static int                        reroot                                                 = 2;
     final static int                        subtree                                                = 3;
     final static int                        swap                                                   = 4;
-    final static int                        color_subtree                                          = 5;
-    final static int                        color_node_font                                        = 6;
-    final static int                        open_seq_web                                           = 7;
-    final static int                        open_pdb_web                                           = 8;
-    final static int                        open_tax_web                                           = 9;
-    final static int                        blast                                                  = 10;
-    final static int                        cut_subtree                                            = 11;
-    final static int                        copy_subtree                                           = 12;
-    final static int                        paste_subtree                                          = 13;
-    final static int                        delete_subtree_or_node                                 = 14;
-    final static int                        add_new_node                                           = 15;
-    final static int                        edit_node_data                                         = 16;
-    final static int                        sort_descendents                                       = 17;
-    final static int                        get_ext_desc_data                                      = 18;
-    final static int                        select_nodes                                           = 19;
+    final static int                        color_node_font                                        = 5;
+    final static int                        change_node_font                                       = 6;
+    final static int                        color_subtree                                          = 7;
+    final static int                        open_seq_web                                           = 8;
+    final static int                        open_pdb_web                                           = 9;
+    final static int                        open_tax_web                                           = 10;
+    final static int                        blast                                                  = 11;
+    final static int                        cut_subtree                                            = 12;
+    final static int                        copy_subtree                                           = 13;
+    final static int                        paste_subtree                                          = 14;
+    final static int                        delete_subtree_or_node                                 = 15;
+    final static int                        add_new_node                                           = 16;
+    final static int                        edit_node_data                                         = 17;
+    final static int                        sort_descendents                                       = 18;
+    final static int                        get_ext_desc_data                                      = 19;
+    final static int                        select_nodes                                           = 20;
     // ------------------
     // Click-to options
     // ------------------
     final static String                     display_options[][]                                    = {
             { "Phylogram", "display", "?" }, { "Node Name", "display", "yes" }, { "Taxonomy Code", "display", "yes" },
-            { "Seq Annotations", "nodisplay", "no" }, { "Confidence Values", "display", "?" },
+            { "Seq Annotations", "display", "no" }, { "Confidence Values", "display", "?" },
             { "Node Events", "display", "?" }, { "Colorize by Taxonomy", "display", "no" },
-            { "Use Branch Colors", "display", "no" }, { "Use Branch Widths", "display", "no" },
-            { "Show Custom Nodes", "display", "yes" }, { "Protein Domains", "nodisplay", "no" },
-            { "Binary Characters", "nodisplay", "no" }, { "Binary Char Counts", "nodisplay", "no" },
-            { "Seq Name", "display", "yes" }, { "Seq Accession", "display", "no" },
-            { "Show Internal Data", "display", "yes" }, { "Dyna Hide", "display", "yes" },
-            { "Taxonomy Scientific", "display", "yes" }, { "Taxonomy Common", "display", "no" },
-            { "Colorize by Annotation", "nodisplay", "no" }, { "Seq Symbol", "display", "yes" },
-            { "Rollover", "display", "yes" }, { "Relation Confidence", "nodisplay", "no" },
-            { "Vector Data", "nodisplay", "no" }, { "Taxonomy Images", "display", "no" },
-            { "Properties", "nodisplay", "no" }, { "Gene Name", "display", "yes" }                };
+            { "Colorize by Sequence", "display", "no" },
+            { "Visual Styles/Branch Colors", "display", "no" }, { "Branch Widths", "display", "no" },
+            { "Protein Domains", "display", "no" }, { "Binary Characters", "nodisplay", "no" },
+            { "Binary Char Counts", "nodisplay", "no" }, { "Seq Name", "display", "yes" },
+            { "Seq Accession", "display", "no" }, { "Show Internal Data", "display", "yes" },
+            { "Dyna Hide", "display", "yes" }, { "Taxonomy Scientific", "display", "yes" },
+            { "Taxonomy Common", "display", "no" }, { "Colorize by Annotation", "display", "no" },
+            { "Seq Symbol", "display", "yes" }, { "Rollover", "display", "yes" },
+            { "Relation Confidence", "nodisplay", "no" }, { "Vector Data", "nodisplay", "no" },
+            { "Taxonomy Images", "display", "no" }, { "Properties", "display", "no" },
+            { "Gene Name", "display", "yes" }                                                     };
     final static int                        display_as_phylogram                                   = 0;
     final static int                        show_node_names                                        = 1;
     final static int                        show_tax_code                                          = 2;
@@ -107,9 +110,9 @@ public final class Configuration {
     final static int                        write_confidence_values                                = 4;
     final static int                        write_events                                           = 5;
     final static int                        color_according_to_species                             = 6;
-    final static int                        color_branches                                         = 7;
-    final static int                        width_branches                                         = 8;
-    final static int                        show_custom_node_shapes                                = 9;
+    final static int                        color_according_to_sequence                            = 7;
+    final static int                        use_style                                              = 8;
+    final static int                        width_branches                                         = 9;
     final static int                        show_domain_architectures                              = 10;
     final static int                        show_binary_characters                                 = 11;
     final static int                        show_binary_character_counts                           = 12;
@@ -128,17 +131,11 @@ public final class Configuration {
     final static int                        show_properties                                        = 25;
     final static int                        show_gene_names                                        = 26;
     static final String                     VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA                   = "validate_against_phyloxml_xsd_schema";
-    // ----------------
-    // Function colors
-    // ----------------
+     private static Hashtable<String, Color> _sequence_colors;
+    
+    
     private static Hashtable<String, Color> _annotation_colors;
-    // ----------------
-    // Domain colors
-    // ----------------
     private static Hashtable<String, Color> _domain_colors;
-    // ----------------
-    // Species colors
-    // ----------------
     private static Hashtable<String, Color> _species_colors;
     private static String                   DEFAULT_FONT_FAMILY                                    = "";
     private static final int                DEPRECATED                                             = -2;
@@ -399,6 +396,10 @@ public final class Configuration {
         getDisplayColors().put( key, color );
     }
 
+    public void setAddTaxonomyImagesCB( final boolean b ) {
+        display_options[ show_taxonomy_images ][ 1 ] = b ? "yes" : "no";
+    }
+
     public void setAbbreviateScientificTaxonNames( final boolean abbreviate_scientific_names ) {
         _abbreviate_scientific_names = abbreviate_scientific_names;
     }
@@ -416,7 +417,7 @@ public final class Configuration {
     }
 
     public void setColorizeBranches( final boolean b ) {
-        display_options[ color_branches ][ 2 ] = b ? "yes" : "no";
+        display_options[ use_style ][ 2 ] = b ? "yes" : "no";
     }
 
     public void setColorLabelsSameAsParentBranch( final boolean color_labels_same_as_parent_branch ) {
@@ -439,6 +440,10 @@ public final class Configuration {
         display_options[ display_as_phylogram ][ 2 ] = b ? "yes" : "no";
     }
 
+    public void setUseStyle( final boolean b ) {
+        display_options[ use_style ][ 2 ] = b ? "yes" : "no";
+    }
+
     public void setDisplayColors( final SortedMap<String, Color> display_colors ) {
         _display_colors = display_colors;
     }
@@ -463,6 +468,10 @@ public final class Configuration {
         display_options[ show_seq_names ][ 2 ] = b ? "yes" : "no";
     }
 
+    public void setDisplayGeneNames( final boolean b ) {
+        display_options[ show_gene_names ][ 2 ] = b ? "yes" : "no";
+    }
+
     public void setDisplaySequenceRelations( final boolean display_sequence_relations ) {
         _display_sequence_relations = display_sequence_relations;
     }
@@ -554,15 +563,7 @@ public final class Configuration {
     public void setShowScale( final boolean show_scale ) {
         _show_scale = show_scale;
     }
-
-    public void setTaxonomyColorize( final boolean b ) {
-        display_options[ color_according_to_species ][ 2 ] = b ? "yes" : "no";
-    }
-
-    public void setUseBranchesWidths( final boolean b ) {
-        display_options[ width_branches ][ 2 ] = b ? "yes" : "no";
-    }
-
+  
     boolean displaySequenceRelations() {
         return _display_sequence_relations;
     }
@@ -721,6 +722,13 @@ public final class Configuration {
         }
         return _species_colors;
     }
+    
+    Hashtable<String, Color> getSequenceColors() {
+        if ( _sequence_colors == null ) {
+            _sequence_colors = new Hashtable<String, Color>();
+        }
+        return _sequence_colors;
+    }
 
     final TAXONOMY_EXTRACTION getTaxonomyExtraction() {
         return _taxonomy_extraction;
@@ -877,6 +885,15 @@ public final class Configuration {
         else if ( name.equals( "color_subtree" ) ) {
             index = Configuration.color_subtree;
         }
+        else if ( name.equals( "change_node_font" ) ) {
+            index = Configuration.change_node_font;
+        }
+        else if ( name.equals( "color_node_font" ) ) {
+            index = Configuration.color_node_font;
+        }
+        else if ( name.equals( "color_subtree" ) ) {
+            index = Configuration.color_subtree;
+        }
         return index;
     }
 
@@ -1500,6 +1517,9 @@ public final class Configuration {
             else if ( key.equals( "color_according_to_species" ) ) {
                 key_index = Configuration.color_according_to_species;
             }
+            else if ( key.equals( "color_according_to_sequence" ) ) {
+                key_index = Configuration.color_according_to_sequence;
+            }
             else if ( key.equals( "show_node_names" ) ) {
                 key_index = Configuration.show_node_names;
             }
@@ -1512,8 +1532,14 @@ public final class Configuration {
             else if ( key.equals( "write_events" ) ) {
                 key_index = Configuration.write_events;
             }
+            else if ( key.equals( "use_visual_styles" ) ) {
+                key_index = Configuration.use_style;
+            }
             else if ( key.equals( "color_branches" ) ) {
-                key_index = Configuration.color_branches;
+                key_index = Configuration.use_style;
+                ForesterUtil
+                        .printWarningMessage( Constants.PRG_NAME,
+                                              "configuration key [color_branches] is deprecated, use [use_visual_styles] instead" );
             }
             else if ( key.equals( "width_branches" ) ) {
                 key_index = Configuration.width_branches;
@@ -1569,9 +1595,6 @@ public final class Configuration {
             else if ( key.equals( "show_relation_confidence" ) ) {
                 key_index = Configuration.show_relation_confidence;
             }
-            else if ( key.equals( "show_custom_node_shapes" ) ) {
-                key_index = Configuration.show_custom_node_shapes;
-            }
             // If we've found the key, set the values
             if ( key_index >= 0 ) {
                 display_options[ key_index ][ 1 ] = ( String ) st.nextElement();
@@ -1600,6 +1623,10 @@ public final class Configuration {
                     getSpeciesColors().put( ( ( String ) st.nextElement() ).replace( '_', ' ' ),
                                             Color.decode( ( String ) st.nextElement() ) );
                 }
+                else if ( key.equals( "sequence_color" ) ) {
+                    getSequenceColors().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() ) );
                 }