in progress
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Sat, 16 Aug 2014 00:02:22 +0000 (00:02 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Sat, 16 Aug 2014 00:02:22 +0000 (00:02 +0000)
12 files changed:
forester/java/src/org/forester/archaeopteryx/AptxUtil.java
forester/java/src/org/forester/archaeopteryx/Configuration.java
forester/java/src/org/forester/archaeopteryx/Constants.java
forester/java/src/org/forester/archaeopteryx/ControlPanel.java
forester/java/src/org/forester/archaeopteryx/MainFrame.java
forester/java/src/org/forester/archaeopteryx/Options.java
forester/java/src/org/forester/archaeopteryx/TreeColorSet.java
forester/java/src/org/forester/archaeopteryx/TreeFontSet.java
forester/java/src/org/forester/archaeopteryx/TreePanel.java
forester/java/src/org/forester/archaeopteryx/TreePanelUtil.java
forester/java/src/org/forester/archaeopteryx/phylogeny/data/RenderableDomainArchitecture.java
forester/java/src/org/forester/archaeopteryx/phylogeny/data/RenderablePhylogenyData.java

index 1a6b0a5..d6c980a 100644 (file)
@@ -25,6 +25,7 @@
 
 package org.forester.archaeopteryx;
 
+import java.awt.Color;
 import java.awt.Component;
 import java.awt.Graphics2D;
 import java.awt.GraphicsEnvironment;
@@ -984,4 +985,50 @@ public final class AptxUtil {
             return _suffix;
         }
     }
+
+    final public static Color calculateColorFromString( final String str, final boolean is_taxonomy ) {
+        final String my_str = str.toUpperCase();
+        char first = my_str.charAt( 0 );
+        char second = ' ';
+        char third = ' ';
+        if ( my_str.length() > 1 ) {
+            if ( is_taxonomy ) {
+                second = my_str.charAt( 1 );
+            }
+            else {
+                second = my_str.charAt( my_str.length() - 1 );
+            }
+            if ( is_taxonomy ) {
+                if ( my_str.length() > 2 ) {
+                    if ( my_str.indexOf( " " ) > 0 ) {
+                        third = my_str.charAt( my_str.indexOf( " " ) + 1 );
+                    }
+                    else {
+                        third = my_str.charAt( 2 );
+                    }
+                }
+            }
+            else if ( my_str.length() > 2 ) {
+                third = my_str.charAt( ( my_str.length() - 1 ) / 2 );
+            }
+        }
+        first = normalizeCharForRGB( first );
+        second = normalizeCharForRGB( second );
+        third = normalizeCharForRGB( third );
+        if ( ( first > 235 ) && ( second > 235 ) && ( third > 235 ) ) {
+            first = 0;
+        }
+        else if ( ( first < 60 ) && ( second < 60 ) && ( third < 60 ) ) {
+            second = 255;
+        }
+        return new Color( first, second, third );
+    }
+
+    final private static char normalizeCharForRGB( char c ) {
+        c -= 65;
+        c *= 10.2;
+        c = c > 255 ? 255 : c;
+        c = c < 0 ? 0 : c;
+        return c;
+    }
 }
index 2a4b7dd..271bdfa 100644 (file)
@@ -170,8 +170,6 @@ public final class Configuration {
     private short                           _default_node_shape_size                               = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
     private SortedMap<String, Color>        _display_colors                                        = null;
     private boolean                         _display_sequence_relations                            = false;
-    private Color                           _domain_structure_base_color                           = Constants.DOMAIN_STRUCTURE_BASE_COLOR_DEFAULT;
-    private Color                           _domain_structure_font_color                           = Constants.DOMAIN_STRUCTURE_FONT_COLOR_DEFAULT;
     private boolean                         _editable                                              = true;
     private NODE_DATA                       _ext_desc_data_to_return                               = NODE_DATA.UNKNOWN;
     private EXT_NODE_DATA_RETURN_ON         _ext_node_data_return_on                               = EXT_NODE_DATA_RETURN_ON.WINODW;
@@ -318,14 +316,6 @@ public final class Configuration {
         return _default_node_shape_size;
     }
 
-    public Color getDomainStructureBaseColor() {
-        return _domain_structure_base_color;
-    }
-
-    public Color getDomainStructureFontColor() {
-        return _domain_structure_font_color;
-    }
-
     public NODE_DATA getExtDescNodeDataToReturn() {
         return _ext_desc_data_to_return;
     }
@@ -1385,12 +1375,7 @@ public final class Configuration {
         else if ( key.equals( "gui_button_border_color" ) ) {
             _gui_button_border_color = Color.decode( ( String ) st.nextElement() );
         }
-        else if ( key.equals( "domain_structure_font_color" ) ) {
-            _domain_structure_font_color = Color.decode( ( String ) st.nextElement() );
-        }
-        else if ( key.equals( "domain_structure_base_color" ) ) {
-            _domain_structure_base_color = Color.decode( ( String ) st.nextElement() );
-        }
+      
         else if ( key.equals( "show_default_node_shapes" ) ) {
             ForesterUtil
                     .printWarningMessage( Constants.PRG_NAME,
index 54135ee..639e020 100644 (file)
@@ -43,7 +43,7 @@ public final class Constants {
     public final static boolean ALLOW_DDBJ_BLAST                                              = false;
     public final static String  PRG_NAME                                                      = "Archaeopteryx";
     final static String         VERSION                                                       = "0.9894 beta";
-    final static String         PRG_DATE                                                      = "140811";
+    final static String         PRG_DATE                                                      = "140815";
     final static String         DEFAULT_CONFIGURATION_FILE_NAME                               = "_aptx_configuration_file";
     final static String[]       DEFAULT_FONT_CHOICES                                          = { "Arial", "Helvetica",
             "Verdana", "Tahoma", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans"  };
@@ -104,10 +104,12 @@ public final class Constants {
                                                                                                            255 );
     final static Color          BUTTON_BORDER_COLOR_DEFAULT                                   = new Color( 0, 0, 0 );
     final static Color          TAB_LABEL_FOREGROUND_COLOR_SELECTED                           = new Color( 0, 0, 0 );
-    final static Color          DOMAIN_STRUCTURE_BASE_COLOR_DEFAULT                           = new Color( 32, 32, 32 );
-    final static Color          DOMAIN_STRUCTURE_FONT_COLOR_DEFAULT                           = new Color( 144,
-                                                                                                           144,
-                                                                                                           144 );
     final static String         NCBI_ALL_DATABASE_SEARCH                                      = "http://www.ncbi.nlm.nih.gov/gquery/?term=";
+    public final static Color   DOMAIN_BASE_COLOR_FOR_PDF                                     = new Color( 100,
+                                                                                                           100,
+                                                                                                           100 );
+    public final static Color   DOMAIN_LABEL_COLOR_FOR_PDF                                    = new Color( 150,
+                                                                                                           150,
+                                                                                                           150 );
     final static short          DEFAULT_NODE_SHAPE_SIZE_DEFAULT                               = 4;
 }
index 509e24d..2fe6429 100644 (file)
@@ -65,6 +65,7 @@ import org.forester.phylogeny.PhylogenyMethods.DESCENDANT_SORT_PRIORITY;
 import org.forester.phylogeny.PhylogenyNode;
 import org.forester.phylogeny.data.Sequence;
 import org.forester.phylogeny.data.SequenceRelation;
+import org.forester.phylogeny.data.SequenceRelation.SEQUENCE_RELATION_TYPE;
 import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
 import org.forester.util.ForesterUtil;
 
@@ -86,7 +87,7 @@ final class ControlPanel extends JPanel implements ActionListener {
     private Map<Integer, String> _all_click_to_names;
     private Map<String, Color>   _annotation_colors;
     private int                  _blast_item;
-    private JComboBox            _click_to_combobox;
+    private JComboBox<String>            _click_to_combobox;
     private JLabel               _click_to_label;
     private List<String>         _click_to_names;
     private int                  _collapse_cb_item;
@@ -134,7 +135,7 @@ final class ControlPanel extends JPanel implements ActionListener {
     private int                  _select_nodes_item;
     private Sequence             _selected_query_seq;
     private JCheckBox            _seq_relation_confidence_switch;
-    private JComboBox            _sequence_relation_type_box;
+    private JComboBox<SEQUENCE_RELATION_TYPE>            _sequence_relation_type_box;
     private JCheckBox            _show_annotation;
     private JCheckBox            _show_binary_character_counts;
     private JCheckBox            _show_binary_characters;
@@ -148,7 +149,7 @@ final class ControlPanel extends JPanel implements ActionListener {
     private JCheckBox            _show_seq_names;
     private JCheckBox            _show_seq_symbols;
     private JCheckBox            _show_sequence_acc;
-    private JComboBox            _show_sequence_relations;
+    private JComboBox<String>            _show_sequence_relations;
     private JCheckBox            _show_taxo_code;
     private JCheckBox            _show_taxo_common_names;
     private JCheckBox            _show_taxo_images_cb;
@@ -306,10 +307,10 @@ final class ControlPanel extends JPanel implements ActionListener {
                     search1();
                     displayedPhylogenyMightHaveChanged( true );
                 }
-                
-              
-                
-                
+                else if ( _dynamically_hide_data != null &&  e.getSource() == _dynamically_hide_data && !_dynamically_hide_data.isSelected() ) {
+                    setDynamicHidingIsOn( false );
+                    displayedPhylogenyMightHaveChanged( true );
+                }
                 else {
                     displayedPhylogenyMightHaveChanged( true );
                 }
@@ -354,9 +355,9 @@ final class ControlPanel extends JPanel implements ActionListener {
         return _selected_query_seq;
     }
 
-    public JComboBox getSequenceRelationBox() {
+    public JComboBox<String> getSequenceRelationBox() {
         if ( _show_sequence_relations == null ) {
-            _show_sequence_relations = new JComboBox();
+            _show_sequence_relations = new JComboBox<String>();
             _show_sequence_relations.setFocusable( false );
             _show_sequence_relations.setMaximumRowCount( 20 );
             _show_sequence_relations.setFont( ControlPanel.js_font );
@@ -371,9 +372,9 @@ final class ControlPanel extends JPanel implements ActionListener {
     }
 
     /* GUILHEM_BEG */
-    public JComboBox getSequenceRelationTypeBox() {
+    public JComboBox<SEQUENCE_RELATION_TYPE> getSequenceRelationTypeBox() {
         if ( _sequence_relation_type_box == null ) {
-            _sequence_relation_type_box = new JComboBox();
+            _sequence_relation_type_box = new JComboBox<SEQUENCE_RELATION_TYPE>();
             for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : SequenceRelation.SEQUENCE_RELATION_TYPE.values() ) {
                 _sequence_relation_type_box.addItem( type );
             }
@@ -411,7 +412,7 @@ final class ControlPanel extends JPanel implements ActionListener {
     }
 
     public void setSequenceRelationQueries( final Collection<Sequence> sequenceRelationQueries ) {
-        final JComboBox box = getSequenceRelationBox();
+        final JComboBox<String> box = getSequenceRelationBox();
         while ( box.getItemCount() > 1 ) {
             box.removeItemAt( 1 );
         }
@@ -663,7 +664,7 @@ final class ControlPanel extends JPanel implements ActionListener {
                 break;
             case Configuration.dynamically_hide_data:
                 _dynamically_hide_data = new JCheckBox( title );
-                getDynamicallyHideData().setToolTipText( "To hide labels depending on likely visibility" );
+                getDynamicallyHideData().setToolTipText( "To hide labels depending on expected visibility" );
                 addJCheckBox( getDynamicallyHideData(), ch_panel );
                 add( ch_panel );
                 break;
@@ -1240,7 +1241,6 @@ final class ControlPanel extends JPanel implements ActionListener {
     }
 
     void setDynamicHidingIsOn( final boolean is_on ) {
-        //  if ( !_configuration.isUseNativeUI() ) {
         if ( is_on ) {
             getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
         }
@@ -1252,7 +1252,6 @@ final class ControlPanel extends JPanel implements ActionListener {
                 getDynamicallyHideData().setForeground( Color.BLACK );
             }
         }
-        // }
     }
 
     void setSearchFoundCountsOnLabel0( final int counts ) {
@@ -1524,7 +1523,7 @@ final class ControlPanel extends JPanel implements ActionListener {
         add( spacer );
         _click_to_label = new JLabel( "Click on Node to:" );
         add( customizeLabel( _click_to_label, getConfiguration() ) );
-        _click_to_combobox = new JComboBox();
+        _click_to_combobox = new JComboBox<String>();
         _click_to_combobox.setFocusable( false );
         _click_to_combobox.setMaximumRowCount( 14 );
         _click_to_combobox.setFont( ControlPanel.js_font );
@@ -1725,10 +1724,10 @@ final class ControlPanel extends JPanel implements ActionListener {
             _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
             _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
         }
-        _sequence_relation_type_box.setRenderer( new ListCellRenderer() {
+        _sequence_relation_type_box.setRenderer( new ListCellRenderer<Object>() {
 
             @Override
-            public Component getListCellRendererComponent( final JList list,
+            public Component getListCellRendererComponent( final JList<?> list,
                                                            final Object value,
                                                            final int index,
                                                            final boolean isSelected,
@@ -2054,6 +2053,9 @@ final class ControlPanel extends JPanel implements ActionListener {
                     case UNKNOWN:
                         s = "User Selected Data";
                         break;
+                    default:
+                        throw new IllegalStateException( "dont know how to deal with " + getConfiguration().getExtDescNodeDataToReturn() );
+                        
                 }
                 final String label = _configuration.getClickToTitle( Configuration.get_ext_desc_data ) + " " + s;
                 addClickToOption( Configuration.get_ext_desc_data, label );
index e89f978..f9ed538 100644 (file)
@@ -493,6 +493,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
                 || ( o == _unrooted_type_cbmi ) || ( o == _circular_type_cbmi ) ) {\r
             typeChanged( o );\r
         }\r
+        \r
         else if ( o == _about_item ) {\r
             about();\r
         }\r
index fdaeacb..6e83bf1 100644 (file)
@@ -464,7 +464,7 @@ final public class Options {
         }
         _min_confidence_value = MIN_CONFIDENCE_DEFAULT;
         _print_black_and_white = false;
-        _print_using_actual_size = false;
+        _print_using_actual_size = true;
         _graphics_export_using_actual_size = true;
         _phylogeny_graphics_type = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR;
         _base_font = new Font( Configuration.getDefaultFontFamilyName(), Font.PLAIN, 10 );
index 44e050b..53650d5 100644 (file)
@@ -31,9 +31,7 @@ import java.util.Map;
 
 import org.forester.util.ForesterUtil;
 
-/*
- * Maintains the color schemes and a set of colors for drawing a tree.
- */
+
 public final class TreeColorSet {
 
     public static final String ANNOTATION                 = "Annotation";
@@ -44,7 +42,8 @@ public final class TreeColorSet {
     public static final String BRANCH_LENGTH              = "Branch Length";
     public static final String COLLAPSED                  = "Collapsed";
     public static final String CONFIDENCE                 = "Confidence";
-    public static final String DOMAINS                    = "Domains";
+    public static final String DOMAIN_LABEL               = "Domain Label";
+    public static final String DOMAIN_BASE                = "Domain Base";
     public static final String DUPLICATION                = "Duplication";
     public static final String DUPLICATION_OR_SPECATION   = "Duplication or Specation";
     public static final String MATCHING_NODES_A           = "Matching A";
@@ -57,18 +56,18 @@ public final class TreeColorSet {
     public static final String TAXONOMY                   = "Taxonomy";
     static final String[]      COLOR_FIELDS               = { BACKGROUND, BACKGROUND_GRADIENT_BOTTOM, SEQUENCE,
             TAXONOMY, CONFIDENCE, BRANCH_LENGTH, BRANCH, NODE_BOX, COLLAPSED, MATCHING_NODES_A, MATCHING_NODES_B,
-            MATCHING_NODES_A_AND_B, DUPLICATION, SPECIATION, DUPLICATION_OR_SPECATION, DOMAINS,
+            MATCHING_NODES_A_AND_B, DUPLICATION, SPECIATION, DUPLICATION_OR_SPECATION, DOMAIN_LABEL, DOMAIN_BASE,
             BINARY_DOMAIN_COMBINATIONS, ANNOTATION, OVERVIEW };
     static final String[]      SCHEME_NAMES               = { "Default", "Black", "Black & White", "Silver", "Green",
             "White & Blue", "Cyan", "Orange", "Blue", "Blue & White", "Neon" };
-    // Color schemes:
+   
     private int                _color_scheme;
-    // All the color sets; better be the same # of sets as there are names!
+   
     private final Color[][]    _color_schemes             = { { new Color( 0, 0, 0 ), // background_color
             new Color( 0, 100, 100 ), // background_color_gradient_bottom
             new Color( 230, 230, 230 ), // sequence  __ Default (same as Black)
             new Color( 180, 180, 180 ), // taxonomy
-            new Color( 56, 176, 255 ), // support  
+            new Color( 180, 180, 180 ), // support  
             new Color( 140, 140, 140 ), // branch_length_color
             new Color( 255, 255, 255 ), // branch_color
             new Color( 255, 255, 255 ), // box_color
@@ -79,7 +78,8 @@ public final class TreeColorSet {
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
-            new Color( 123, 104, 238 ), // domains_color  
+            new Color( 230, 230, 230 ), // domain_label  
+            new Color( 100, 100, 100 ), // domains_base  
             new Color( 65, 105, 255 ), // binary_domain_combinations_color  
             new Color( 173, 255, 47 ) // annotation
             , new Color( 130, 130, 130 )                 // overview
@@ -87,7 +87,7 @@ public final class TreeColorSet {
             new Color( 0, 255, 255 ), // background_color_gradient_bottom    
             new Color( 230, 230, 230 ), // sequence  __ Black
             new Color( 180, 180, 180 ), // taxonomy
-            new Color( 56, 176, 255 ), // support  
+            new Color( 180, 180, 180 ), // support  
             new Color( 140, 140, 140 ), // branch_length_color
             new Color( 255, 255, 255 ), // branch_color
             new Color( 255, 255, 255 ), // box_color
@@ -98,7 +98,8 @@ public final class TreeColorSet {
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
-            new Color( 123, 104, 238 ), // domains_color
+            new Color( 230, 230, 230 ), // domain_label  
+            new Color( 100, 100, 100 ), // domains_base  
             new Color( 65, 105, 255 ), // binary_domain_combinations_color
             new Color( 173, 255, 47 ) // annotation
             , new Color( 130, 130, 130 ) // ov
@@ -117,7 +118,8 @@ public final class TreeColorSet {
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
-            new Color( 0, 0, 0 ), // domains_color
+            new Color( 0, 0, 0 ), // domain_label  
+            new Color( 100, 100, 100 ), // domains_base  
             new Color( 0, 0, 0 ), // binary_domain_combinations_color
             new Color( 0, 0, 0 ) // annotation
             , new Color( 220, 220, 220 ) // ov
@@ -136,7 +138,8 @@ public final class TreeColorSet {
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
-            new Color( 180, 180, 180 ), // domains_color
+            new Color( 230, 230, 230 ), // domain_label  
+            new Color( 100, 100, 100 ), // domains_base  
             new Color( 180, 180, 180 ), // binary_domain_combinations_color
             new Color( 140, 140, 140 ) // annotation
             , new Color( 40, 40, 40 ) // ov
@@ -155,7 +158,8 @@ public final class TreeColorSet {
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
-            new Color( 0, 235, 0 ), // domains_color
+            new Color( 230, 230, 230 ), // domain_label  
+            new Color( 100, 100, 100 ), // domains_base  
             new Color( 0, 235, 0 ), // binary_domain_combinations_color
             new Color( 0, 235, 0 ) // annotation
             , new Color( 40, 40, 40 ) // ov
@@ -174,7 +178,8 @@ public final class TreeColorSet {
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
-            new Color( 123, 104, 238 ), // domains_color
+            new Color( 0, 0, 0 ), // domain_label  
+            new Color( 50, 50, 50 ), // domains_base  
             new Color( 65, 105, 225 ), // binary_domain_combinations_color
             new Color( 173, 255, 47 ) // annotation
             , new Color( 220, 220, 220 ) // ov
@@ -193,7 +198,8 @@ public final class TreeColorSet {
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
-            new Color( 123, 104, 238 ), // domains_color
+            new Color( 230, 230, 230 ), // domain_label  
+            new Color( 100, 100, 100 ), // domains_base  
             new Color( 65, 105, 225 ), // binary_domain_combinations_color
             new Color( 173, 255, 47 ) // annotation
             , new Color( 0, 120, 120 ) // ov
@@ -212,7 +218,8 @@ public final class TreeColorSet {
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
-            new Color( 150, 150, 150 ), // domains_color
+            new Color( 255, 200, 0  ), // domain_label  
+            new Color( 255, 200, 0  ), // domains_base  
             new Color( 150, 150, 150 ), // binary_domain_combinations_color
             new Color( 150, 150, 150 ) // annotation
             , new Color( 150, 150, 150 ) // ov
@@ -231,7 +238,8 @@ public final class TreeColorSet {
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
-            new Color( 255, 255, 255 ), // domains_color
+            new Color(255, 255, 255 ), // domain_label  
+            new Color( 100, 100, 100 ), // domains_base  
             new Color( 255, 255, 255 ), // binary_domain_combinations_color
             new Color( 255, 255, 255 ) // annotation
             , new Color( 77, 77, 255 ) // ov
@@ -250,7 +258,8 @@ public final class TreeColorSet {
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
-            new Color( 255, 255, 255 ), // domains_color
+            new Color( 255, 255, 255 ), // domain_label  
+            new Color( 150, 150, 150 ), // domains_base  
             new Color( 255, 255, 255 ), // binary_domain_combinations_color
             new Color( 255, 255, 255 ) // annotation
             , new Color( 170, 187, 204 ) // ov
@@ -269,7 +278,8 @@ public final class TreeColorSet {
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
-            new Color( 27, 255, 0 ), // domains_color
+            new Color( 127, 255, 0 ), // domain_label  
+            new Color(  234, 173, 234 ), // domains_base  
             new Color( 27, 255, 0 ), // binary_domain_combinations_color
             new Color( 27, 255, 0 ) // annotation
             , new Color( 77, 77, 255 ) // ov
@@ -283,7 +293,8 @@ public final class TreeColorSet {
     private Color              branch_color;
     private Color              branch_length_color;
     private Color              collapse_fill_color;
-    private Color              domains_color;
+    private Color              domain_label_color;
+    private Color              domain_base_color;
     private Color              dup_box_color;
     private Color              duplication_or_specation_color;
     private Color              found_color_0;
@@ -363,8 +374,12 @@ public final class TreeColorSet {
         return SCHEME_NAMES[ getCurrentColorScheme() ];
     }
 
-    Color getDomainsColor() {
-        return domains_color;
+    public Color getDomainBaseColor() {
+        return domain_base_color;
+    }
+    
+    public Color getDomainLabelColor() {
+        return domain_label_color;
     }
 
     Color getDuplicationBoxColor() {
@@ -448,10 +463,11 @@ public final class TreeColorSet {
         dup_box_color = _color_schemes[ scheme ][ 12 ];
         spec_box_color = _color_schemes[ scheme ][ 13 ];
         duplication_or_specation_color = _color_schemes[ scheme ][ 14 ];
-        domains_color = _color_schemes[ scheme ][ 15 ];
-        binary_domain_combinations_color = _color_schemes[ scheme ][ 16 ];
-        annotation_color = _color_schemes[ scheme ][ 17 ];
-        ov_color = _color_schemes[ scheme ][ 18 ];
+        domain_label_color = _color_schemes[ scheme ][ 15 ];
+        domain_base_color = _color_schemes[ scheme ][ 16 ];
+        binary_domain_combinations_color = _color_schemes[ scheme ][ 17 ];
+        annotation_color = _color_schemes[ scheme ][ 18 ];
+        ov_color = _color_schemes[ scheme ][ 19 ];
     }
 
     void setCurrentColorScheme( final int color_scheme ) {
index c278f1c..0a1c59d 100644 (file)
@@ -151,7 +151,7 @@ public final class TreeFontSet {
 
     void smallFonts() {
         setDecreasedSizeBySystem( false );
-        _small_font = _small_font.deriveFont( SMALL_FONTS_BASE - 1 );
+        _small_font = _small_font.deriveFont( SMALL_FONTS_BASE - 2 );
         _large_font = _large_font.deriveFont( SMALL_FONTS_BASE );
         setupFontMetrics();
     }
@@ -159,13 +159,13 @@ public final class TreeFontSet {
     void superTinyFonts() {
         setDecreasedSizeBySystem( false );
         _small_font = _small_font.deriveFont( 2f );
-        _large_font = _large_font.deriveFont( 3f );
+        _large_font = _large_font.deriveFont( 4f );
         setupFontMetrics();
     }
 
     void tinyFonts() {
         setDecreasedSizeBySystem( false );
-        _small_font = _small_font.deriveFont( 5f );
+        _small_font = _small_font.deriveFont( 4f );
         _large_font = _large_font.deriveFont( 6f );
         setupFontMetrics();
     }
@@ -175,7 +175,7 @@ public final class TreeFontSet {
     }
 
     private void intializeFonts() {
-        final int small_size = getBaseFont().getSize() - 1;
+        final int small_size = getBaseFont().getSize() - 2;
         int italic = Font.ITALIC;
         if ( getBaseFont().getStyle() == Font.BOLD ) {
             italic = italic + Font.BOLD;
index ab1a753..b4bd0ee 100644 (file)
@@ -731,11 +731,11 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             }
             if ( c == null ) {
                 if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) {
-                    c = TreePanelUtil.calculateColorFromString( tax.getTaxonomyCode(), true );
+                    c = AptxUtil.calculateColorFromString( tax.getTaxonomyCode(), true );
                     getControlPanel().getSpeciesColors().put( tax.getTaxonomyCode(), c );
                 }
                 else {
-                    c = TreePanelUtil.calculateColorFromString( tax.getScientificName(), true );
+                    c = AptxUtil.calculateColorFromString( tax.getScientificName(), true );
                     getControlPanel().getSpeciesColors().put( tax.getScientificName(), c );
                 }
             }
@@ -751,7 +751,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         final String seq_name = seq.getName();
         c = getControlPanel().getSequenceColors().get( seq_name );
         if ( c == null ) {
-            c = TreePanelUtil.calculateColorFromString( seq_name, false );
+            c = AptxUtil.calculateColorFromString( seq_name, false );
             getControlPanel().getSequenceColors().put( seq_name, c );
         }
         return c;
@@ -1043,10 +1043,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         return getTreeColorSet().getSequenceColor();
     }
 
-    /**
-     * @return pointer to colorset for tree drawing
-     */
-    final TreeColorSet getTreeColorSet() {
+   
+    public final TreeColorSet getTreeColorSet() {
         return getMainPanel().getTreeColorSet();
     }
 
@@ -1082,8 +1080,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                     && ( node.getNodeData().getSequence().getDomainArchitecture() != null ) ) {
                 RenderableDomainArchitecture rds = null;
                 if ( !( node.getNodeData().getSequence().getDomainArchitecture() instanceof RenderableDomainArchitecture ) ) {
-                    rds = new RenderableDomainArchitecture( node.getNodeData().getSequence().getDomainArchitecture(),
-                                                            getConfiguration() );
+                    rds = new RenderableDomainArchitecture( node.getNodeData().getSequence().getDomainArchitecture() );
                     node.getNodeData().getSequence().setDomainArchitecture( rds );
                 }
                 else {
@@ -2382,7 +2379,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             if ( !ForesterUtil.isEmpty( ann_str ) ) {
                 c = getControlPanel().getAnnotationColors().get( ann_str );
                 if ( c == null ) {
-                    c = TreePanelUtil.calculateColorFromString( ann_str, false );
+                    c = AptxUtil.calculateColorFromString( ann_str, false );
                     getControlPanel().getAnnotationColors().put( ann_str, c );
                 }
                 if ( c == null ) {
@@ -4695,7 +4692,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         final boolean disallow_shortcutting = ( dynamic_hiding_factor < 40 );
         float min_dist = 1.5f;
         if ( !disallow_shortcutting ) {
-            //   System.out.println( dynamic_hiding_factor );
             if ( dynamic_hiding_factor > 4000 ) {
                 min_dist = 4;
             }
@@ -4784,14 +4780,20 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                 cce.printStackTrace();
             }
             if ( rds != null ) {
-                rds.setRenderingHeight( 6 );
+                final int default_height = 7;
+                float y = getYdistance();
+                if ( getControlPanel().isDynamicallyHideData() ) {
+                    y = getTreeFontSet().getFontMetricsLarge().getHeight();
+                }
+                final int h = y < default_height ? ForesterUtil.roundToInt( y ) :default_height;
+                rds.setRenderingHeight( h > 1 ? h : 2 );
                 if ( getControlPanel().isDrawPhylogram() ) {
-                    rds.render( node.getXcoord() + x, node.getYcoord() - 3, g, this, to_pdf );
+                    rds.render( node.getXcoord() + x, node.getYcoord() - ( h / 2 ), g, this, to_pdf );
                 }
                 else {
                     length_of_longest_text = calcLengthOfLongestText();
                     rds.render( getPhylogeny().getFirstExternalNode().getXcoord() + length_of_longest_text,
-                                node.getYcoord() - 3,
+                                node.getYcoord() - ( h / 2 ),
                                 g,
                                 this,
                                 to_pdf );
@@ -4822,7 +4824,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                                 node.getYcoord() - 3,
                                 g,
                                 this,
-                                to_pdf );
+                                to_pdf);
                 }
             }
         }
index 5b5537c..e131214 100644 (file)
@@ -199,44 +199,6 @@ public class TreePanelUtil {
         JOptionPane.showMessageDialog( parent, msg, title, JOptionPane.INFORMATION_MESSAGE );
     }
 
-    final static Color calculateColorFromString( final String str, final boolean is_taxonomy ) {
-        final String my_str = str.toUpperCase();
-        char first = my_str.charAt( 0 );
-        char second = ' ';
-        char third = ' ';
-        if ( my_str.length() > 1 ) {
-            if ( is_taxonomy ) {
-                second = my_str.charAt( 1 );
-            }
-            else {
-                second = my_str.charAt( my_str.length() - 1 );
-            }
-            if ( is_taxonomy ) {
-                if ( my_str.length() > 2 ) {
-                    if ( my_str.indexOf( " " ) > 0 ) {
-                        third = my_str.charAt( my_str.indexOf( " " ) + 1 );
-                    }
-                    else {
-                        third = my_str.charAt( 2 );
-                    }
-                }
-            }
-            else if ( my_str.length() > 2 ) {
-                third = my_str.charAt( ( my_str.length() - 1 ) / 2 );
-            }
-        }
-        first = TreePanelUtil.normalizeCharForRGB( first );
-        second = TreePanelUtil.normalizeCharForRGB( second );
-        third = TreePanelUtil.normalizeCharForRGB( third );
-        if ( ( first > 235 ) && ( second > 235 ) && ( third > 235 ) ) {
-            first = 0;
-        }
-        else if ( ( first < 60 ) && ( second < 60 ) && ( third < 60 ) ) {
-            second = 255;
-        }
-        return new Color( first, second, third );
-    }
-
     final static void collapseSpeciesSpecificSubtrees( final Phylogeny phy ) {
         boolean inferred = false;
         for( final PhylogenyNodeIterator it = phy.iteratorPreorder(); it.hasNext(); ) {
@@ -515,14 +477,6 @@ public class TreePanelUtil {
         return size;
     }
 
-    final static char normalizeCharForRGB( char c ) {
-        c -= 65;
-        c *= 10.2;
-        c = c > 255 ? 255 : c;
-        c = c < 0 ? 0 : c;
-        return c;
-    }
-
     final static String pdbAccToString( final List<Accession> accs, final int i ) {
         if ( ForesterUtil.isEmpty( accs.get( i ).getComment() ) ) {
             return accs.get( i ).getValue();
index afeef25..05d5a5d 100644 (file)
@@ -38,7 +38,8 @@ import java.math.BigDecimal;
 import java.util.Map;
 import java.util.SortedMap;
 
-import org.forester.archaeopteryx.Configuration;
+import org.forester.archaeopteryx.AptxUtil;
+import org.forester.archaeopteryx.Constants;
 import org.forester.archaeopteryx.TreePanel;
 import org.forester.phylogeny.data.DomainArchitecture;
 import org.forester.phylogeny.data.PhylogenyData;
@@ -48,27 +49,22 @@ import org.forester.util.ForesterUtil;
 
 public final class RenderableDomainArchitecture extends DomainArchitecture implements RenderablePhylogenyData {
 
-    static private Map<String, Color> Domain_colors;
     final static private int          BRIGHTEN_COLOR_BY             = 200;
     final static private int          E_VALUE_THRESHOLD_EXP_DEFAULT = 0;
-    private static int                _Next_default_domain_color    = 0;
-    private final static String[]     DEFAULT_DOMAINS_COLORS        = { "0xFF0000", "0x0000FF", "0xAAAA00", "0xFF00FF",
-            "0x00FFFF", "0x800000", "0x000080", "0x808000", "0x800080", "0x008080", "0xE1B694" };
-    private int                       _e_value_threshold_exp        = RenderableDomainArchitecture.E_VALUE_THRESHOLD_EXP_DEFAULT;
-    private double                    _rendering_factor_width       = 1.0;
-    private double                    _rendering_height             = 0;
+    final static private BasicStroke  STROKE_1                      = new BasicStroke( 1f );
+    private static Map<String, Color> _domain_colors;
     private final DomainArchitecture  _domain_structure;
+    private int                       _e_value_threshold_exp        = E_VALUE_THRESHOLD_EXP_DEFAULT;
     private final Rectangle2D         _rectangle                    = new Rectangle2D.Float();
-    private final Configuration       _configuration;
-    private static final BasicStroke  STROKE_1                      = new BasicStroke( 1f );
+    private double                    _rendering_factor_width       = 1.0;
+    private double                    _rendering_height             = 0;
 
-    public RenderableDomainArchitecture( final DomainArchitecture domain_structure, final Configuration configuration ) {
+    public RenderableDomainArchitecture( final DomainArchitecture domain_structure ) {
         _domain_structure = domain_structure;
-        _configuration = configuration;
     }
 
-    private Configuration getConfiguration() {
-        return _configuration;
+    public static void setColorMap( final Map<String, Color> domain_colors ) {
+        _domain_colors = domain_colors;
     }
 
     @Override
@@ -98,7 +94,7 @@ public final class RenderableDomainArchitecture extends DomainArchitecture imple
         final Color color_two = getColorTwo( color_one );
         double step = 1;
         if ( to_pdf ) {
-            step = 0.1;
+            step = 0.05;
         }
         for( double i = 0; i < heigth; i += step ) {
             g.setColor( org.forester.util.ForesterUtil
@@ -108,20 +104,14 @@ public final class RenderableDomainArchitecture extends DomainArchitecture imple
         }
     }
 
-    private Color getColorOne( final String name ) {
-        Color c = getConfiguration().getDomainStructureBaseColor();
-        if ( RenderableDomainArchitecture.Domain_colors != null ) {
-            c = RenderableDomainArchitecture.Domain_colors.get( name );
+    private final Color getColorOne( final String name ) {
+        Color c = _domain_colors.get( name );
+        if ( c == null ) {
+            c = AptxUtil.calculateColorFromString( name, false );
             if ( c == null ) {
-                if ( RenderableDomainArchitecture._Next_default_domain_color < RenderableDomainArchitecture.DEFAULT_DOMAINS_COLORS.length ) {
-                    c = Color
-                            .decode( RenderableDomainArchitecture.DEFAULT_DOMAINS_COLORS[ RenderableDomainArchitecture._Next_default_domain_color++ ] );
-                    RenderableDomainArchitecture.Domain_colors.put( name, c );
-                }
-                else {
-                    c = getConfiguration().getDomainStructureBaseColor();
-                }
+                throw new IllegalStateException();
             }
+            _domain_colors.put( name, c );
         }
         return c;
     }
@@ -189,7 +179,12 @@ public final class RenderableDomainArchitecture extends DomainArchitecture imple
         final double start = x1 + 20.0;
         final Stroke s = g.getStroke();
         g.setStroke( STROKE_1 );
-        g.setColor( getConfiguration().getDomainStructureFontColor() );
+        if ( !to_pdf ) {
+            g.setColor( tree_panel.getTreeColorSet().getDomainBaseColor() );
+        }
+        else {
+            g.setColor( Constants.DOMAIN_BASE_COLOR_FOR_PDF );
+        }
         _rectangle.setFrame( start, y - 0.5, _domain_structure.getTotalLength() * f, 1 );
         g.fill( _rectangle );
         for( int i = 0; i < _domain_structure.getDomains().size(); ++i ) {
@@ -197,11 +192,18 @@ public final class RenderableDomainArchitecture extends DomainArchitecture imple
             if ( d.getConfidence() <= Math.pow( 10, _e_value_threshold_exp ) ) {
                 final double xa = start + ( d.getFrom() * f );
                 final double xb = xa + ( d.getLength() * f );
-                if ( tree_panel.getMainPanel().getOptions().isShowDomainLabels() ) {
+                if ( tree_panel.getMainPanel().getOptions().isShowDomainLabels()
+                        && ( tree_panel.getMainPanel().getTreeFontSet().getFontMetricsSmall().getHeight() > 4 ) ) {
                     g.setFont( tree_panel.getMainPanel().getTreeFontSet().getSmallFont() );
-                    g.setColor( getConfiguration().getDomainStructureFontColor() );
+                    if ( !to_pdf ) {
+                        g.setColor( tree_panel.getTreeColorSet().getDomainLabelColor() );
+                    }
+                    else {
+                        g.setColor( Constants.DOMAIN_LABEL_COLOR_FOR_PDF );
+                    }
                     PhylogenyDataUtil.drawString( d.getName(), xa, y1
-                            + tree_panel.getMainPanel().getTreeFontSet().getFontMetricsSmall().getAscent() + 6, g );
+                            + tree_panel.getMainPanel().getTreeFontSet().getFontMetricsSmall().getAscent()
+                            + _rendering_height, g );
                 }
                 drawDomain( xa, y1, xb - xa, _rendering_height, d.getName(), g, to_pdf );
             }
@@ -232,8 +234,4 @@ public final class RenderableDomainArchitecture extends DomainArchitecture imple
     public void toPhyloXML( final Writer writer, final int level, final String indentation ) throws IOException {
         _domain_structure.toPhyloXML( writer, level, indentation );
     }
-
-    public static void setColorMap( final Map<String, Color> domain_colors ) {
-        RenderableDomainArchitecture.Domain_colors = domain_colors;
-    }
 }
index 9536554..84de7d3 100644 (file)
@@ -47,7 +47,7 @@ public interface RenderablePhylogenyData extends PhylogenyData {
      * @param g
      *            the Graphics to render to
      */
-    public void render( final double x, final double y, final Graphics2D g, final TreePanel tree_panel, boolean to_pdf );
+    public void render( final double x, final double y, final Graphics2D g, final TreePanel tree_panel, boolean to_pdf  );
 
     public void setParameter( final double parameter );