inprogress
[jalview.git] / forester / java / src / org / forester / archaeopteryx / Configuration.java
1 // $Id:
2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
4 //
5 // Copyright (C) 2008-2009 Christian M. Zmasek
6 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
7 // Copyright (C) 2000-2001 Washington University School of Medicine
8 // and Howard Hughes Medical Institute
9 // Copyright (C) 2003-2007 Ethalinda K.S. Cannon
10 // All rights reserved
11 //
12 // This library is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU Lesser General Public
14 // License as published by the Free Software Foundation; either
15 // version 2.1 of the License, or (at your option) any later version.
16 //
17 // This library is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 // Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public
23 // License along with this library; if not, write to the Free Software
24 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 //
26 // Contact: phylosoft @ gmail . com
27 // WWW: https://sites.google.com/site/cmzmasek/home/software/forester
28
29 package org.forester.archaeopteryx;
30
31 import java.awt.Color;
32 import java.io.BufferedReader;
33 import java.io.File;
34 import java.io.FileReader;
35 import java.io.IOException;
36 import java.io.InputStreamReader;
37 import java.net.URL;
38 import java.util.Arrays;
39 import java.util.Hashtable;
40 import java.util.Map;
41 import java.util.SortedMap;
42 import java.util.StringTokenizer;
43 import java.util.TreeMap;
44
45 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
46 import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
47 import org.forester.archaeopteryx.Options.OVERVIEW_PLACEMENT_TYPE;
48 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
49 import org.forester.io.parsers.nhx.NHXParser.TAXONOMY_EXTRACTION;
50 import org.forester.phylogeny.data.NodeData.NODE_DATA;
51 import org.forester.phylogeny.data.NodeVisualization;
52 import org.forester.phylogeny.data.NodeVisualization.NodeFill;
53 import org.forester.phylogeny.data.NodeVisualization.NodeShape;
54 import org.forester.util.ForesterUtil;
55
56 public final class Configuration {
57
58     static final String                     VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA                   = "validate_against_phyloxml_xsd_schema";
59     private static final String             DISPLAY_COLOR_KEY                                      = "display_color";
60     private static final int                DEPRECATED                                             = -2;
61     private UI                              _ui                                                    = UI.UNKNOWN;
62     private boolean                         _use_tabbed_display                                    = false;
63     private boolean                         _hide_controls_and_menus                               = false;
64     private CLADOGRAM_TYPE                  _cladogram_type                                        = Constants.CLADOGRAM_TYPE_DEFAULT;
65     private SortedMap<String, Color>        _display_colors                                        = null;
66     private boolean                         _antialias_screen                                      = true;
67     private PHYLOGENY_GRAPHICS_TYPE         _phylogeny_graphics_type                               = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR;
68     private String                          _base_font_family_name                                 = "";
69     private int                             _base_font_size                                        = -1;
70     private int                             _min_base_font_size                                    = 2;
71     private int                             _max_base_font_size                                    = 20;
72     private int                             _graphics_export_x                                     = -1;
73     private int                             _graphics_export_y                                     = -1;
74     private short                           _ov_max_width                                          = 80;
75     private short                           _ov_max_height                                         = 80;
76     private OVERVIEW_PLACEMENT_TYPE         _ov_placement                                          = OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT;
77     private double                          _min_confidence_value                                  = Options.MIN_CONFIDENCE_DEFAULT;
78     private float                           _print_line_width                                      = Constants.PDF_LINE_WIDTH_DEFAULT;
79     private boolean                         _show_scale                                            = false;
80     private boolean                         _show_branch_length_values                             = false;
81     private boolean                         _show_overview                                         = true;
82     private short                           _number_of_digits_after_comma_for_confidence_values    = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_CONFIDENCE_VALUES_DEFAULT;
83     private short                           _number_of_digits_after_comma_for_branch_length_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_BRANCH_LENGTH_VALUES_DEFAULT;
84     private boolean                         _editable                                              = true;
85     private boolean                         _nh_parsing_replace_underscores                        = false;
86     private TAXONOMY_EXTRACTION             _taxonomy_extraction                                   = TAXONOMY_EXTRACTION.NO;
87     private boolean                         _internal_number_are_confidence_for_nh_parsing         = false;
88     private boolean                         _display_sequence_relations                            = false;
89     private boolean                         _validate_against_phyloxml_xsd_schema                  = Constants.VALIDATE_AGAINST_PHYLOXML_XSD_SCJEMA_DEFAULT;
90     private boolean                         _background_color_gradient                             = false;
91     private boolean                         _show_domain_labels                                    = true;
92     private boolean                         _show_annotation_ref_source                            = true;
93     private boolean                         _abbreviate_scientific_names                           = false;
94     private boolean                         _color_labels_same_as_parent_branch                    = false;
95     private boolean                         _show_default_node_shapes_internal                     = false;
96     private boolean                         _show_default_node_shapes_external                     = false;
97     private NodeShape                       _default_node_shape                                    = NodeShape.RECTANGLE;
98     private NodeFill                        _default_node_fill                                     = NodeFill.SOLID;
99     private short                           _default_node_shape_size                               = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
100     private boolean                         _taxonomy_colorize_node_shapes                         = false;
101     private int                             _default_bootstrap_samples                             = -1;
102     private File                            _path_to_local_mafft                                   = null;
103     private File                            _path_to_local_fastme                                  = null;
104     private File                            _path_to_local_raxml                                   = null;
105     final static int                        display_as_phylogram                                   = 0;
106     final static int                        show_node_names                                        = 1;
107     final static int                        show_tax_code                                          = 2;
108     final static int                        show_annotation                                        = 3;
109     final static int                        write_confidence_values                                = 4;
110     final static int                        write_events                                           = 5;
111     final static int                        color_according_to_species                             = 6;
112     final static int                        color_branches                                         = 7;
113     final static int                        width_branches                                         = 8;
114     final static int                        show_custom_node_shapes                                = 9;
115     final static int                        show_domain_architectures                              = 10;
116     final static int                        show_binary_characters                                 = 11;
117     final static int                        show_binary_character_counts                           = 12;
118     final static int                        show_gene_names                                        = 13;
119     final static int                        show_sequence_acc                                      = 14;
120     final static int                        display_internal_data                                  = 15;
121     final static int                        dynamically_hide_data                                  = 16;
122     final static int                        show_taxonomy_scientific_names                         = 17;
123     final static int                        show_taxonomy_common_names                             = 18;
124     final static int                        color_according_to_annotation                          = 19;
125     final static int                        show_gene_symbols                                      = 20;
126     final static int                        node_data_popup                                        = 21;
127     final static int                        show_relation_confidence                               = 22;
128     final static int                        show_vector_data                                       = 23;
129     final static int                        show_taxonomy_images                                   = 24;
130     final static int                        show_properties                                        = 25;
131     // ------------------
132     // Click-to options
133     // ------------------
134     final static int                        display_node_data                                      = 0;
135     final static int                        collapse_uncollapse                                    = 1;
136     final static int                        reroot                                                 = 2;
137     final static int                        subtree                                                = 3;
138     final static int                        swap                                                   = 4;
139     final static int                        color_subtree                                          = 5;
140     final static int                        open_seq_web                                           = 6;
141     final static int                        open_tax_web                                           = 7;
142     final static int                        blast                                                  = 8;
143     final static int                        cut_subtree                                            = 9;
144     final static int                        copy_subtree                                           = 10;
145     final static int                        paste_subtree                                          = 11;
146     final static int                        delete_subtree_or_node                                 = 12;
147     final static int                        add_new_node                                           = 13;
148     final static int                        edit_node_data                                         = 14;
149     final static int                        sort_descendents                                       = 15;
150     final static int                        get_ext_desc_data                                      = 16;
151     final static int                        select_nodes                                           = 17;
152     // ---------------------------
153     // Display options for trees
154     // ---------------------------
155     // ---------------------------------
156     // Pertaining to the config itself
157     // ---------------------------------
158     // Full path to config (may be URL)
159     String                                  config_filename;
160     String                                  default_config_filename                                = Constants.DEFAULT_CONFIGURATION_FILE_NAME;
161     final static String                     display_options[][]                                    = {
162             { "Phylogram", "display", "?" }, { "Node Name", "display", "yes" }, { "Taxonomy Code", "display", "yes" },
163             { "Seq Annotations", "nodisplay", "no" }, { "Confidence Values", "display", "?" },
164             { "Node Events", "display", "?" }, { "Taxonomy Colorize", "display", "yes" },
165             { "Colorize Branches", "display", "no" }, { "Use Branch-Widths", "display", "no" },
166             { "Show Custom Nodes", "display", "yes" }, { "Domains", "nodisplay", "no" },
167             { "Binary Characters", "nodisplay", "no" }, { "Binary Char Counts", "nodisplay", "no" },
168             { "Seq Name", "display", "yes" }, { "Seq Acc", "display", "no" },
169             { "Show Internal Data", "display", "yes" }, { "Dyna Hide", "display", "yes" },
170             { "Taxonomy Scientific", "display", "yes" }, { "Taxonomy Common", "display", "no" },
171             { "Annotation Colorize", "nodisplay", "no" }, { "Seq Symbol", "display", "yes" },
172             { "Rollover", "display", "yes" }, { "Relation Confidence", "nodisplay", "no" },
173             { "Vector Data", "nodisplay", "no" }, { "Taxonomy Images", "display", "no" },
174             { "Properties", "nodisplay", "no" }                                                   };
175     final static String                     clickto_options[][]                                    = {
176             { "Display Node Data", "display" }, { "Collapse/Uncollapse", "display" }, { "Root/Reroot", "display" },
177             { "Sub/Super Tree", "display" }, { "Swap Descendants", "display" }, { "Colorize Subtree", "display" },
178             { "Open Sequence Web", "display" }, { "Open Taxonomy Web", "display" }, { "Blast", "display" },
179             { "Cut Subtree", "display" }, { "Copy Subtree", "display" }, { "Paste Subtree", "display" },
180             { "Delete Subtree/Node", "display" }, { "Add New Node", "display" }, { "Edit Node Data", "display" },
181             { "Sort Descendants", "display" }, { "Return", "display" }, { "Select Node(s)", "display" } };
182     // This option is selected in the dropdown
183     int                                     default_clickto                                        = Configuration.display_node_data;
184     // --------------
185     // Color set
186     // --------------
187     TreeColorSet                            tree_color_set;
188     // -------
189     // Fonts
190     // -------
191     TreeFontSet                             tree_font_set;
192     // ----------------
193     // Species colors
194     // ----------------
195     private static Hashtable<String, Color> _species_colors;
196     // ----------------
197     // Domain colors
198     // ----------------
199     private static Hashtable<String, Color> _domain_colors;
200     // ----------------
201     // Function colors
202     // ----------------
203     private static Hashtable<String, Color> _annotation_colors;
204     boolean                                 verbose                                                = Constants.VERBOSE_DEFAULT;
205     private NODE_LABEL_DIRECTION            _node_label_direction                                  = NODE_LABEL_DIRECTION.HORIZONTAL;
206     private Color                           _gui_background_color                                  = Constants.GUI_BACKGROUND_DEFAULT;
207     private Color                           _gui_checkbox_text_color                               = Constants.CHECKBOX_TEXT_COLOR_DEFAULT;
208     private Color                           _gui_checkbox_and_button_active_color                  = Constants.CHECKBOX_AND_BUTTON_ACTIVE_COLOR_DEFAULT;
209     private Color                           _gui_button_text_color                                 = Constants.BUTTON_TEXT_COLOR_DEFAULT;
210     private Color                           _gui_button_background_color                           = Constants.BUTTON_BACKGROUND_COLOR_DEFAULT;
211     private Color                           _gui_menu_background_color                             = Constants.MENU_BACKGROUND_COLOR_DEFAULT;
212     private Color                           _gui_menu_text_color                                   = Constants.MENU_TEXT_COLOR_DEFAULT;
213     private Color                           _gui_button_border_color                               = Constants.BUTTON_BORDER_COLOR_DEFAULT;
214     private Color                           _domain_structure_font_color                           = Constants.DOMAIN_STRUCTURE_FONT_COLOR_DEFAULT;
215     private Color                           _domain_structure_base_color                           = Constants.DOMAIN_STRUCTURE_BASE_COLOR_DEFAULT;
216     private NODE_DATA                       _ext_desc_data_to_return                               = NODE_DATA.UNKNOWN;
217     private String                          _label_for_get_ext_descendents_data                    = "";
218     private EXT_NODE_DATA_RETURN_ON         _ext_node_data_return_on                               = EXT_NODE_DATA_RETURN_ON.WINODW;
219     private int                             _frame_x_size;
220     private int                             _frame_y_size;
221     private boolean                         _midpoint_root                                         = false;
222     private static String                   DEFAULT_FONT_FAMILY                                    = "";
223     static {
224         for( final String font_name : Constants.DEFAULT_FONT_CHOICES ) {
225             if ( Arrays.binarySearch( AptxUtil.getAvailableFontFamiliesSorted(), font_name ) >= 0 ) {
226                 DEFAULT_FONT_FAMILY = font_name;
227                 break;
228             }
229         }
230         if ( ForesterUtil.isEmpty( DEFAULT_FONT_FAMILY ) ) {
231             DEFAULT_FONT_FAMILY = Constants.DEFAULT_FONT_CHOICES[ Constants.DEFAULT_FONT_CHOICES.length - 1 ];
232         }
233     }
234
235     public Configuration() {
236         this( null, false, false, false );
237     }
238
239     public Configuration( final String cf, final boolean is_url, final boolean is_applet, final boolean verbose ) {
240         if ( ForesterUtil.isEmpty( cf ) ) {
241             config_filename = default_config_filename;
242         }
243         else {
244             config_filename = cf;
245         }
246         setDisplayColors( new TreeMap<String, Color>() );
247         config_filename = config_filename.trim();
248         URL u = null;
249         if ( is_url ) {
250             // If URL, open accordingly
251             try {
252                 u = new URL( config_filename );
253                 try {
254                     final InputStreamReader isr = new InputStreamReader( u.openStream() );
255                     final BufferedReader bf = new BufferedReader( isr );
256                     readConfig( bf );
257                     bf.close();
258                     ForesterUtil.programMessage( Constants.PRG_NAME, "successfully read from configuration url ["
259                             + config_filename + "]" );
260                 }
261                 catch ( final Exception e ) {
262                     ForesterUtil.printWarningMessage( Constants.PRG_NAME, "failed to read configuration from ["
263                             + config_filename + "]: " + e.getLocalizedMessage() );
264                 }
265             }
266             catch ( final Exception e ) {
267                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "cannot find or open configuration url ["
268                         + config_filename + "]" );
269             }
270         }
271         else {
272             // Otherwise, open as a file
273             File f = new File( config_filename );
274             if ( !f.exists() ) {
275                 f = new File( config_filename + ".txt" );
276             }
277             if ( f.exists() && f.canRead() ) {
278                 try {
279                     final BufferedReader bf = new BufferedReader( new FileReader( f ) );
280                     readConfig( bf );
281                     bf.close();
282                 }
283                 catch ( final Exception e ) {
284                     if ( verbose ) {
285                         ForesterUtil.printWarningMessage( Constants.PRG_NAME, "failed to read configuration from ["
286                                 + config_filename + "]: " + e );
287                     }
288                 }
289             }
290             else {
291                 if ( verbose ) {
292                     ForesterUtil.printWarningMessage( Constants.PRG_NAME, "cannot find or open configuration file ["
293                             + config_filename + "]" );
294                 }
295             }
296         }
297     }
298
299     public String getBaseFontFamilyName() {
300         return _base_font_family_name;
301     }
302
303     public int getDefaultBootstrapSamples() {
304         return _default_bootstrap_samples;
305     }
306
307     public NodeFill getDefaultNodeFill() {
308         return _default_node_fill;
309     }
310
311     public NodeShape getDefaultNodeShape() {
312         return _default_node_shape;
313     }
314
315     public short getDefaultNodeShapeSize() {
316         return _default_node_shape_size;
317     }
318
319     public Color getDomainStructureBaseColor() {
320         return _domain_structure_base_color;
321     }
322
323     public Color getDomainStructureFontColor() {
324         return _domain_structure_font_color;
325     }
326
327     public NODE_DATA getExtDescNodeDataToReturn() {
328         return _ext_desc_data_to_return;
329     }
330
331     public EXT_NODE_DATA_RETURN_ON getExtNodeDataReturnOn() {
332         return _ext_node_data_return_on;
333     }
334
335     public int getFrameXSize() {
336         return _frame_x_size;
337     }
338
339     public int getFrameYSize() {
340         return _frame_y_size;
341     }
342
343     public String getLabelForGetExtDescendentsData() {
344         return _label_for_get_ext_descendents_data;
345     }
346
347     public File getPathToLocalFastme() {
348         return _path_to_local_fastme;
349     }
350
351     public File getpathToLocalMafft() {
352         return _path_to_local_mafft;
353     }
354
355     public File getPathToLocalRaxml() {
356         return _path_to_local_raxml;
357     }
358
359     public boolean isAbbreviateScientificTaxonNames() {
360         return _abbreviate_scientific_names;
361     }
362
363     public boolean isBackgroundColorGradient() {
364         return _background_color_gradient;
365     }
366
367     public boolean isColorLabelsSameAsParentBranch() {
368         return _color_labels_same_as_parent_branch;
369     }
370
371     public boolean isShowDefaultNodeShapesExternal() {
372         return _show_default_node_shapes_external;
373     }
374
375     public boolean isShowDefaultNodeShapesInternal() {
376         return _show_default_node_shapes_internal;
377     }
378
379     public boolean isShowDomainLabels() {
380         return _show_domain_labels;
381     }
382
383     public boolean isTaxonomyColorizeNodeShapes() {
384         return _taxonomy_colorize_node_shapes;
385     }
386
387     public void putDisplayColors( final String key, final Color color ) {
388         getDisplayColors().put( key, color );
389     }
390
391     public void setAbbreviateScientificTaxonNames( final boolean abbreviate_scientific_names ) {
392         _abbreviate_scientific_names = abbreviate_scientific_names;
393     }
394
395     public void setBackgroundColorGradient( final boolean background_color_gradient ) {
396         _background_color_gradient = background_color_gradient;
397     }
398
399     public void setBaseFontFamilyName( final String base_font_family_name ) {
400         _base_font_family_name = base_font_family_name;
401     }
402
403     public void setBaseFontSize( final int base_font_size ) {
404         _base_font_size = base_font_size;
405     }
406
407     private void setMaxBaseFontSize( final int max_base_font_size ) {
408         _max_base_font_size = max_base_font_size;
409     }
410
411     private void setMinBaseFontSize( final int min_base_font_size ) {
412         _min_base_font_size = min_base_font_size;
413     }
414
415     public void setColorizeBranches( final boolean b ) {
416         display_options[ color_branches ][ 2 ] = b ? "yes" : "no";
417     }
418
419     public void setColorLabelsSameAsParentBranch( final boolean color_labels_same_as_parent_branch ) {
420         _color_labels_same_as_parent_branch = color_labels_same_as_parent_branch;
421     }
422
423     public void setDefaultNodeFill( final NodeFill default_node_fill ) {
424         _default_node_fill = default_node_fill;
425     }
426
427     public void setDefaultNodeShape( final NodeShape default_node_shape ) {
428         _default_node_shape = default_node_shape;
429     }
430
431     public void setDefaultNodeShapeSize( final short default_node_shape_size ) {
432         _default_node_shape_size = default_node_shape_size;
433     }
434
435     public void setDisplayAsPhylogram( final boolean b ) {
436         display_options[ display_as_phylogram ][ 2 ] = b ? "yes" : "no";
437     }
438
439     public void setDisplayColors( final SortedMap<String, Color> display_colors ) {
440         _display_colors = display_colors;
441     }
442
443     public void setDisplayConfidenceValues( final boolean b ) {
444         display_options[ write_confidence_values ][ 2 ] = b ? "yes" : "no";
445     }
446
447     public void setDisplayInternalData( final boolean b ) {
448         display_options[ display_internal_data ][ 2 ] = b ? "yes" : "no";
449     }
450
451     public void setDisplayNodeNames( final boolean b ) {
452         display_options[ show_node_names ][ 2 ] = b ? "yes" : "no";
453     }
454
455     public void setDisplaySequenceAcc( final boolean b ) {
456         display_options[ show_sequence_acc ][ 2 ] = b ? "yes" : "no";
457     }
458
459     public void setDisplaySequenceNames( final boolean b ) {
460         display_options[ show_gene_names ][ 2 ] = b ? "yes" : "no";
461     }
462
463     public void setDisplaySequenceRelations( final boolean display_sequence_relations ) {
464         _display_sequence_relations = display_sequence_relations;
465     }
466
467     public void setDisplaySequenceSymbols( final boolean b ) {
468         display_options[ show_gene_symbols ][ 2 ] = b ? "yes" : "no";
469     }
470
471     public void setDisplayTaxonomyCode( final boolean b ) {
472         display_options[ show_tax_code ][ 2 ] = b ? "yes" : "no";
473     }
474
475     public void setDisplayTaxonomyCommonNames( final boolean b ) {
476         display_options[ show_taxonomy_common_names ][ 2 ] = b ? "yes" : "no";
477     }
478
479     public void setDisplayTaxonomyImages( final boolean b ) {
480         display_options[ show_taxonomy_images ][ 2 ] = b ? "yes" : "no";
481     }
482
483     public void setDisplayTaxonomyScientificNames( final boolean b ) {
484         display_options[ show_taxonomy_scientific_names ][ 2 ] = b ? "yes" : "no";
485     }
486
487     public void setDynamicallyHideData( final boolean b ) {
488         display_options[ dynamically_hide_data ][ 2 ] = b ? "yes" : "no";
489     }
490
491     public void setExtDescNodeDataToReturn( final NODE_DATA ext_desc_data_to_return ) {
492         _ext_desc_data_to_return = ext_desc_data_to_return;
493     }
494
495     public void setFrameXSize( final int frame_x_size ) {
496         _frame_x_size = frame_x_size;
497     }
498
499     public void setFrameYSize( final int frame_y_size ) {
500         _frame_y_size = frame_y_size;
501     }
502
503     public void setMinConfidenceValue( final double min_confidence_value ) {
504         _min_confidence_value = min_confidence_value;
505     }
506
507     public void setNodeLabelDirection( final NODE_LABEL_DIRECTION node_label_direction ) {
508         _node_label_direction = node_label_direction;
509     }
510
511     public void setNumberOfDigitsAfterCommaForBranchLengthValue( final short number_of_digits_after_comma_for_branch_length_values ) {
512         _number_of_digits_after_comma_for_branch_length_values = number_of_digits_after_comma_for_branch_length_values;
513     }
514
515     public void setNumberOfDigitsAfterCommaForConfidenceValues( final short number_of_digits_after_comma_for_confidence_values ) {
516         _number_of_digits_after_comma_for_confidence_values = number_of_digits_after_comma_for_confidence_values;
517     }
518
519     public void setPhylogenyGraphicsType( final PHYLOGENY_GRAPHICS_TYPE phylogeny_graphics_type ) {
520         _phylogeny_graphics_type = phylogeny_graphics_type;
521     }
522
523     public void setPrintLineWidth( final float print_line_width ) {
524         _print_line_width = print_line_width;
525     }
526
527     public void setReplaceUnderscoresInNhParsing( final boolean nh_parsing_replace_underscores ) {
528         _nh_parsing_replace_underscores = nh_parsing_replace_underscores;
529     }
530
531     public void setShowBranchLengthValues( final boolean show_branch_length_values ) {
532         _show_branch_length_values = show_branch_length_values;
533     }
534
535     public void setShowDefaultNodeShapesExternal( final boolean show_default_node_shapes_external ) {
536         _show_default_node_shapes_external = show_default_node_shapes_external;
537     }
538
539     public void setShowDefaultNodeShapesInternal( final boolean show_default_node_shapes_internal ) {
540         _show_default_node_shapes_internal = show_default_node_shapes_internal;
541     }
542
543     public void setShowDomainLabels( final boolean show_domain_labels ) {
544         _show_domain_labels = show_domain_labels;
545     }
546
547     public void setShowScale( final boolean show_scale ) {
548         _show_scale = show_scale;
549     }
550
551     public void setTaxonomyColorize( final boolean b ) {
552         display_options[ color_according_to_species ][ 2 ] = b ? "yes" : "no";
553     }
554
555     public void setTaxonomyColorizeNodeShapes( final boolean taxonomy_colorize_node_shapes ) {
556         _taxonomy_colorize_node_shapes = taxonomy_colorize_node_shapes;
557     }
558
559     public void setUseBranchesWidths( final boolean b ) {
560         display_options[ width_branches ][ 2 ] = b ? "yes" : "no";
561     }
562
563     boolean displaySequenceRelations() {
564         return _display_sequence_relations;
565     }
566
567     boolean doCheckOption( final int which ) {
568         return ( display_options[ which ][ 2 ].equalsIgnoreCase( "yes" ) )
569                 || ( display_options[ which ][ 2 ].equalsIgnoreCase( "true" ) );
570     }
571
572     boolean doDisplayClickToOption( final int which ) {
573         return clickto_options[ which ][ 1 ].equalsIgnoreCase( "display" );
574     }
575
576     boolean doDisplayOption( final int which ) {
577         return display_options[ which ][ 1 ].equalsIgnoreCase( "display" );
578     }
579
580     /**
581      * Will attempt to use the phylogeny to determine whether to check
582      * this or not (e.g. phylogram)
583      * 
584      */
585     boolean doGuessCheckOption( final int which ) {
586         return display_options[ which ][ 2 ].equals( "?" );
587     }
588
589     Map<String, Color> getAnnotationColors() {
590         if ( _annotation_colors == null ) {
591             _annotation_colors = new Hashtable<String, Color>();
592         }
593         return _annotation_colors;
594     }
595
596     int getBaseFontSize() {
597         return _base_font_size;
598     }
599
600     int getMinBaseFontSize() {
601         return _min_base_font_size;
602     }
603
604     int getMaxBaseFontSize() {
605         return _max_base_font_size;
606     }
607
608     CLADOGRAM_TYPE getCladogramType() {
609         return _cladogram_type;
610     }
611
612     int getClickToOptionsCount() {
613         return clickto_options.length;
614     }
615
616     String getClickToTitle( final int which ) {
617         return clickto_options[ which ][ 0 ];
618     }
619
620     int getDefaultDisplayClicktoOption() {
621         return default_clickto;
622     }
623
624     SortedMap<String, Color> getDisplayColors() {
625         return _display_colors;
626     }
627
628     String getDisplayTitle( final int which ) {
629         return display_options[ which ][ 0 ];
630     }
631
632     Map<String, Color> getDomainColors() {
633         if ( _domain_colors == null ) {
634             _domain_colors = new Hashtable<String, Color>();
635         }
636         return _domain_colors;
637     }
638
639     int getGraphicsExportX() {
640         return _graphics_export_x;
641     }
642
643     int getGraphicsExportY() {
644         return _graphics_export_y;
645     }
646
647     Color getGuiBackgroundColor() {
648         return _gui_background_color;
649     }
650
651     Color getGuiButtonBackgroundColor() {
652         return _gui_button_background_color;
653     }
654
655     Color getGuiButtonBorderColor() {
656         return _gui_button_border_color;
657     }
658
659     Color getGuiButtonTextColor() {
660         return _gui_button_text_color;
661     }
662
663     Color getGuiCheckboxAndButtonActiveColor() {
664         return _gui_checkbox_and_button_active_color;
665     }
666
667     Color getGuiCheckboxTextColor() {
668         return _gui_checkbox_text_color;
669     }
670
671     Color getGuiMenuBackgroundColor() {
672         return _gui_menu_background_color;
673     }
674
675     Color getGuiMenuTextColor() {
676         return _gui_menu_text_color;
677     }
678
679     double getMinConfidenceValue() {
680         return _min_confidence_value;
681     }
682
683     NODE_LABEL_DIRECTION getNodeLabelDirection() {
684         return _node_label_direction;
685     }
686
687     short getNumberOfDigitsAfterCommaForBranchLengthValues() {
688         return _number_of_digits_after_comma_for_branch_length_values;
689     }
690
691     short getNumberOfDigitsAfterCommaForConfidenceValues() {
692         return _number_of_digits_after_comma_for_confidence_values;
693     }
694
695     short getOvMaxHeight() {
696         return _ov_max_height;
697     }
698
699     short getOvMaxWidth() {
700         return _ov_max_width;
701     }
702
703     OVERVIEW_PLACEMENT_TYPE getOvPlacement() {
704         return _ov_placement;
705     }
706
707     PHYLOGENY_GRAPHICS_TYPE getPhylogenyGraphicsType() {
708         return _phylogeny_graphics_type;
709     }
710
711     float getPrintLineWidth() {
712         return _print_line_width;
713     }
714
715     Hashtable<String, Color> getSpeciesColors() {
716         if ( _species_colors == null ) {
717             _species_colors = new Hashtable<String, Color>();
718         }
719         return _species_colors;
720     }
721
722     final TAXONOMY_EXTRACTION getTaxonomyExtraction() {
723         return _taxonomy_extraction;
724     }
725
726     boolean isAntialiasScreen() {
727         if ( ForesterUtil.isMac() ) {
728             //Apple Macintosh graphics are slow, turn off anti-alias.
729             return false;
730         }
731         return _antialias_screen;
732     }
733
734     /**
735      * Convenience method.
736      * 
737      * @return true if value in configuration file was 'yes'
738      */
739     boolean isDrawAsPhylogram() {
740         return doCheckOption( display_as_phylogram );
741     }
742
743     boolean isEditable() {
744         return _editable;
745     }
746
747     /**
748      * Only used by ArchaeoptryxE.
749      *
750      */
751     boolean isHideControlPanelAndMenubar() {
752         return _hide_controls_and_menus;
753     }
754
755     boolean isInternalNumberAreConfidenceForNhParsing() {
756         return _internal_number_are_confidence_for_nh_parsing;
757     }
758
759     boolean isReplaceUnderscoresInNhParsing() {
760         return _nh_parsing_replace_underscores;
761     }
762
763     boolean isShowBranchLengthValues() {
764         return _show_branch_length_values;
765     }
766
767     boolean isShowOverview() {
768         return _show_overview;
769     }
770
771     boolean isShowScale() {
772         return _show_scale;
773     }
774
775     final boolean isUseNativeUI() {
776         if ( ( _ui == UI.UNKNOWN ) && ForesterUtil.isMac() ) {
777             _ui = UI.NATIVE;
778         }
779         return _ui == UI.NATIVE;
780     }
781
782     /**
783      * Only used by ArchaeoptryxE.
784      *
785      */
786     boolean isUseTabbedDisplay() {
787         return _use_tabbed_display;
788     }
789
790     boolean isValidatePhyloXmlAgainstSchema() {
791         return _validate_against_phyloxml_xsd_schema;
792     }
793
794     final void setTaxonomyExtraction( final TAXONOMY_EXTRACTION taxonomy_extraction ) {
795         _taxonomy_extraction = taxonomy_extraction;
796     }
797
798     private int getClickToIndex( final String name ) {
799         int index = -1;
800         if ( name.equals( "edit_info" ) ) {
801             index = Configuration.display_node_data;
802             ForesterUtil
803                     .printWarningMessage( Constants.PRG_NAME,
804                                           "configuration key [edit_info] is deprecated, use [display node data] instead" );
805         }
806         else if ( name.equals( "display_node_data" ) ) {
807             index = Configuration.display_node_data;
808         }
809         else if ( name.equals( "collapse_uncollapse" ) ) {
810             index = Configuration.collapse_uncollapse;
811         }
812         else if ( name.equals( "reroot" ) ) {
813             index = Configuration.reroot;
814         }
815         else if ( name.equals( "subtree" ) ) {
816             index = Configuration.subtree;
817         }
818         else if ( name.equals( "swap" ) ) {
819             index = Configuration.swap;
820         }
821         else if ( name.equals( "sort_descendants" ) ) {
822             index = Configuration.sort_descendents;
823         }
824         else if ( name.equals( "get_ext_descendents_data" ) ) {
825             index = Configuration.get_ext_desc_data;
826         }
827         else if ( name.equals( "display_sequences" ) ) {
828             ForesterUtil
829                     .printWarningMessage( Constants.PRG_NAME, "configuration key [display_sequences] is deprecated" );
830             return DEPRECATED;
831         }
832         else if ( name.equals( "open_seq_web" ) ) {
833             index = Configuration.open_seq_web;
834         }
835         else if ( name.equals( "open_tax_web" ) ) {
836             index = Configuration.open_tax_web;
837         }
838         else if ( name.equals( "blast" ) ) {
839             index = Configuration.blast;
840         }
841         else if ( name.equals( "cut_subtree" ) ) {
842             index = Configuration.cut_subtree;
843         }
844         else if ( name.equals( "copy_subtree" ) ) {
845             index = Configuration.copy_subtree;
846         }
847         else if ( name.equals( "paste_subtree" ) ) {
848             index = Configuration.paste_subtree;
849         }
850         else if ( name.equals( "delete" ) ) {
851             index = Configuration.delete_subtree_or_node;
852         }
853         else if ( name.equals( "add_new_node" ) ) {
854             index = Configuration.add_new_node;
855         }
856         else if ( name.equals( "edit_node_data" ) ) {
857             index = Configuration.edit_node_data;
858         }
859         else if ( name.equals( "select_nodes" ) ) {
860             index = Configuration.select_nodes;
861         }
862         else if ( name.equals( "display_node_popup" ) ) {
863             ForesterUtil.printWarningMessage( Constants.PRG_NAME,
864                                               "configuration key [display_node_popup] is deprecated" );
865             return DEPRECATED;
866         }
867         else if ( name.equals( "custom_option" ) ) {
868             ForesterUtil.printWarningMessage( Constants.PRG_NAME, "configuration key [custom_option] is deprecated" );
869             return DEPRECATED;
870         }
871         else if ( name.equals( "color_subtree" ) ) {
872             index = Configuration.color_subtree;
873         }
874         return index;
875     }
876
877     private boolean parseBoolean( final String str ) {
878         final String my_str = str.trim().toLowerCase();
879         if ( my_str.equals( "yes" ) || my_str.equals( "true" ) ) {
880             return true;
881         }
882         else if ( my_str.equals( "no" ) || my_str.equals( "false" ) ) {
883             return false;
884         }
885         else {
886             ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse boolean value from [" + str + "]" );
887             return false;
888         }
889     }
890
891     private double parseDouble( final String str ) {
892         double d = 0.0;
893         try {
894             d = Double.parseDouble( str.trim() );
895         }
896         catch ( final Exception e ) {
897             ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse double from [" + str + "]" );
898             d = 0.0;
899         }
900         return d;
901     }
902
903     private float parseFloat( final String str ) {
904         float f = 0.0f;
905         try {
906             f = Float.parseFloat( str.trim() );
907         }
908         catch ( final Exception e ) {
909             ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse float from [" + str + "]" );
910             f = 0.0f;
911         }
912         return f;
913     }
914
915     private int parseInt( final String str ) {
916         int i = -1;
917         try {
918             i = Integer.parseInt( str.trim() );
919         }
920         catch ( final Exception e ) {
921             ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse integer from [" + str + "]" );
922             i = -1;
923         }
924         return i;
925     }
926
927     private short parseShort( final String str ) {
928         short i = -1;
929         try {
930             i = Short.parseShort( str.trim() );
931         }
932         catch ( final Exception e ) {
933             ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse short from [" + str + "]" );
934             i = -1;
935         }
936         return i;
937     }
938
939     private void processFontFamily( final StringTokenizer st ) {
940         setBaseFontFamilyName( "" );
941         final String font_str = ( ( String ) st.nextElement() ).trim();
942         final String[] fonts = font_str.split( ",+" );
943         for( String font : fonts ) {
944             font = font.replace( '_', ' ' ).trim();
945             if ( Arrays.binarySearch( AptxUtil.getAvailableFontFamiliesSorted(), font ) >= 0 ) {
946                 setBaseFontFamilyName( font );
947                 break;
948             }
949         }
950     }
951
952     /**
953      * read each line of config file, process non-comment lines
954      * @throws IOException 
955      */
956     private void readConfig( final BufferedReader conf_in ) throws IOException {
957         String line;
958         do {
959             line = conf_in.readLine();
960             if ( line != null ) {
961                 line = line.trim();
962                 // skip comments and blank lines
963                 if ( !line.startsWith( "#" ) && ( !ForesterUtil.isEmpty( line ) ) ) {
964                     // convert runs of spaces to tabs
965                     line = line.replaceAll( "\\s+", "\t" );
966                     final StringTokenizer st = new StringTokenizer( line, "\t" );
967                     setKeyValue( st );
968                 }
969             }
970         } while ( line != null );
971     }
972
973     private void setAntialiasScreen( final boolean antialias_screen ) {
974         _antialias_screen = antialias_screen;
975     }
976
977     private void setCladogramType( final CLADOGRAM_TYPE cladogram_type ) {
978         _cladogram_type = cladogram_type;
979     }
980
981     private void setDefaultBootstrapSamples( final int default_bootstrap_samples ) {
982         _default_bootstrap_samples = default_bootstrap_samples;
983     }
984
985     private void setEditable( final boolean editable ) {
986         _editable = editable;
987     }
988
989     private void setExtNodeDataReturnOn( final EXT_NODE_DATA_RETURN_ON ext_node_data_return_on ) {
990         _ext_node_data_return_on = ext_node_data_return_on;
991     }
992
993     private void setGraphicsExportX( final int graphics_export_x ) {
994         _graphics_export_x = graphics_export_x;
995     }
996
997     private void setGraphicsExportY( final int graphics_export_y ) {
998         _graphics_export_y = graphics_export_y;
999     }
1000
1001     private void setInternalNumberAreConfidenceForNhParsing( final boolean internal_number_are_confidence_for_nh_parsing ) {
1002         _internal_number_are_confidence_for_nh_parsing = internal_number_are_confidence_for_nh_parsing;
1003     }
1004
1005     /**
1006      * Set a key-value(s) tuple
1007      */
1008     private void setKeyValue( final StringTokenizer st ) {
1009         final String key = ( ( String ) st.nextElement() ).replace( ':', ' ' ).trim().toLowerCase();
1010         if ( !st.hasMoreElements() ) {
1011             return;
1012         }
1013         // Handle single value settings first:
1014         if ( key.equals( "default_click_to" ) ) {
1015             final String clickto_name = ( String ) st.nextElement();
1016             default_clickto = getClickToIndex( clickto_name );
1017             if ( default_clickto == -1 ) {
1018                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "invalid value [" + clickto_name
1019                         + "] for [default_click_to]" );
1020                 default_clickto = 0;
1021             }
1022             else if ( default_clickto == DEPRECATED ) {
1023                 // Deprecated.
1024             }
1025         }
1026         else if ( key.equals( "native_ui" ) ) {
1027             final String my_str = ( ( String ) st.nextElement() ).trim().toLowerCase();
1028             if ( my_str.equals( "yes" ) || my_str.equals( "true" ) ) {
1029                 _ui = UI.NATIVE;
1030             }
1031             else if ( my_str.equals( "no" ) || my_str.equals( "false" ) ) {
1032                 _ui = UI.CROSSPLATFORM;
1033             }
1034             else if ( my_str.equals( "?" ) ) {
1035                 _ui = UI.UNKNOWN;
1036             }
1037             else {
1038                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse yes/no/? value from [" + my_str
1039                         + "]" );
1040                 _ui = UI.UNKNOWN;
1041             }
1042         }
1043         else if ( key.equals( VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA ) ) {
1044             setValidatePhyloXmlAgainstSchema( parseBoolean( ( String ) st.nextElement() ) );
1045         }
1046         else if ( key.equals( "antialias_screen" ) ) {
1047             setAntialiasScreen( parseBoolean( ( String ) st.nextElement() ) );
1048         }
1049         else if ( key.equals( "phylogeny_graphics_type" ) ) {
1050             final String type_str = ( ( String ) st.nextElement() ).trim();
1051             if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CONVEX.toString() ) ) {
1052                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CONVEX );
1053             }
1054             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CURVED.toString() ) ) {
1055                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CURVED );
1056             }
1057             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE.toString() ) ) {
1058                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE );
1059             }
1060             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.ROUNDED.toString() ) ) {
1061                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.ROUNDED );
1062             }
1063             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR.toString() ) ) {
1064                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
1065             }
1066             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR.toString() ) ) {
1067                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR );
1068             }
1069             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.UNROOTED.toString() ) ) {
1070                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.UNROOTED );
1071             }
1072             else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR.toString() ) ) {
1073                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR );
1074             }
1075             else {
1076                 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
1077                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
1078                         + "] for [phylogeny_graphics_type]" );
1079             }
1080         }
1081         else if ( key.equals( "min_confidence_value" ) ) {
1082             final String mcv_str = ( ( String ) st.nextElement() ).trim();
1083             final double d = parseDouble( mcv_str );
1084             setMinConfidenceValue( d );
1085         }
1086         else if ( key.equals( "font_family" ) ) {
1087             processFontFamily( st );
1088         }
1089         else if ( key.equals( "font_size" ) ) {
1090             final String size_str = ( ( String ) st.nextElement() ).trim();
1091             final int i = parseInt( size_str );
1092             if ( i > 0 ) {
1093                 setBaseFontSize( i );
1094             }
1095         }
1096         else if ( key.equals( "font_size_min" ) ) {
1097             final String size_str = ( ( String ) st.nextElement() ).trim();
1098             final int i = parseInt( size_str );
1099             if ( i > 0 ) {
1100                 setMinBaseFontSize( i );
1101             }
1102         }
1103         else if ( key.equals( "font_size_max" ) ) {
1104             final String size_str = ( ( String ) st.nextElement() ).trim();
1105             final int i = parseInt( size_str );
1106             if ( i > 1 ) {
1107                 setMaxBaseFontSize( i );
1108             }
1109         }
1110         else if ( key.equals( "graphics_export_x" ) ) {
1111             final String str = ( ( String ) st.nextElement() ).trim();
1112             final int i = parseInt( str );
1113             if ( i > 0 ) {
1114                 setGraphicsExportX( i );
1115             }
1116         }
1117         else if ( key.equals( "graphics_export_y" ) ) {
1118             final String str = ( ( String ) st.nextElement() ).trim();
1119             final int i = parseInt( str );
1120             if ( i > 0 ) {
1121                 setGraphicsExportY( i );
1122             }
1123         }
1124         else if ( key.equals( "pdf_export_line_width" ) ) {
1125             final String str = ( ( String ) st.nextElement() ).trim();
1126             final float f = parseFloat( str );
1127             if ( f > 0 ) {
1128                 setPrintLineWidth( f );
1129             }
1130             else {
1131                 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1132                                                   "value for [pdf_export_line_width] cannot be zero or negative" );
1133             }
1134         }
1135         else if ( key.equals( "window_initial_size_x" ) ) {
1136             final String str = ( ( String ) st.nextElement() ).trim();
1137             final int i = parseInt( str );
1138             if ( i > 0 ) {
1139                 setFrameXSize( i );
1140             }
1141         }
1142         else if ( key.equals( "window_initial_size_y" ) ) {
1143             final String str = ( ( String ) st.nextElement() ).trim();
1144             final int i = parseInt( str );
1145             if ( i > 0 ) {
1146                 setFrameYSize( i );
1147             }
1148         }
1149         else if ( key.equals( "default_number_of_bootstrap_resamples" ) ) {
1150             final String str = ( ( String ) st.nextElement() ).trim();
1151             final int i = parseInt( str );
1152             if ( i >= 0 ) {
1153                 setDefaultBootstrapSamples( i );
1154             }
1155             else {
1156                 ForesterUtil
1157                         .printWarningMessage( Constants.PRG_NAME,
1158                                               "value for [default_number_of_bootstrap_resamples] cannot be negative" );
1159             }
1160         }
1161         else if ( key.equals( "mafft_local" ) ) {
1162             final String str = ( ( String ) st.nextElement() ).trim();
1163             if ( !ForesterUtil.isEmpty( str ) ) {
1164                 setPathToLocalMafft( new File( str ) );
1165             }
1166         }
1167         else if ( key.equals( "fastme_local" ) ) {
1168             final String str = ( ( String ) st.nextElement() ).trim();
1169             if ( !ForesterUtil.isEmpty( str ) ) {
1170                 setPathToLocalFastme( new File( str ) );
1171             }
1172         }
1173         else if ( key.equals( "raxml_local" ) ) {
1174             final String str = ( ( String ) st.nextElement() ).trim();
1175             if ( !ForesterUtil.isEmpty( str ) ) {
1176                 setPathToLocalRaxml( new File( str ) );
1177             }
1178         }
1179         else if ( key.equals( "show_scale" ) ) {
1180             setShowScale( parseBoolean( ( String ) st.nextElement() ) );
1181         }
1182         else if ( key.equals( "show_overview" ) ) {
1183             setShowOverview( parseBoolean( ( String ) st.nextElement() ) );
1184         }
1185         else if ( key.equals( "show_branch_length_values" ) ) {
1186             setShowBranchLengthValues( parseBoolean( ( String ) st.nextElement() ) );
1187         }
1188         else if ( key.equals( "background_gradient" ) ) {
1189             setBackgroundColorGradient( parseBoolean( ( String ) st.nextElement() ) );
1190         }
1191         else if ( key.equals( "color_labels_same_as_branch_length_values" ) ) {
1192             setColorLabelsSameAsParentBranch( parseBoolean( ( String ) st.nextElement() ) );
1193         }
1194         else if ( key.equals( "show_domain_labels" ) ) {
1195             setShowDomainLabels( parseBoolean( ( String ) st.nextElement() ) );
1196         }
1197         else if ( key.equals( "show_seq_annotation_ref_sources" ) ) {
1198             setShowAnnotationRefSource( parseBoolean( ( String ) st.nextElement() ) );
1199         }
1200         else if ( key.equals( "abbreviate_scientific_names" ) ) {
1201             setAbbreviateScientificTaxonNames( parseBoolean( ( String ) st.nextElement() ) );
1202         }
1203         else if ( key.equals( "cladogram_type" ) ) {
1204             final String type_str = ( ( String ) st.nextElement() ).trim();
1205             if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.NON_LINED_UP.toString() ) ) {
1206                 setCladogramType( Options.CLADOGRAM_TYPE.NON_LINED_UP );
1207             }
1208             else if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.EXT_NODE_SUM_DEP.toString() ) ) {
1209                 setCladogramType( Options.CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
1210             }
1211             else if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP.toString() ) ) {
1212                 setCladogramType( Options.CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
1213             }
1214             else {
1215                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
1216                         + "] for [cladogram_type]" );
1217             }
1218         }
1219         else if ( key.equals( "non_lined_up_cladogram" ) ) {
1220             ForesterUtil
1221                     .printWarningMessage( Constants.PRG_NAME,
1222                                           "configuration key [non_lined_up_cladogram] is deprecated, use [cladogram_type] instead" );
1223         }
1224         else if ( key.equals( "hide_controls_and_menus" ) ) {
1225             _hide_controls_and_menus = parseBoolean( ( String ) st.nextElement() );
1226         }
1227         else if ( key.equals( "use_tabbed_display" ) ) {
1228             _use_tabbed_display = parseBoolean( ( String ) st.nextElement() );
1229         }
1230         else if ( key.equals( "overview_width" ) ) {
1231             final short i = parseShort( ( ( String ) st.nextElement() ) );
1232             setOvMaxWidth( i );
1233         }
1234         else if ( key.equals( "overview_height" ) ) {
1235             final short i = parseShort( ( ( String ) st.nextElement() ) );
1236             setOvMaxHeight( i );
1237         }
1238         else if ( key.equals( "overview_placement_type" ) ) {
1239             final String type_str = ( ( String ) st.nextElement() ).trim();
1240             if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT.toTag() ) ) {
1241                 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
1242             }
1243             else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.UPPER_RIGHT.toTag() ) ) {
1244                 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_RIGHT );
1245             }
1246             else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.LOWER_LEFT.toTag() ) ) {
1247                 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.LOWER_LEFT );
1248             }
1249             else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.LOWER_RIGHT.toTag() ) ) {
1250                 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.LOWER_RIGHT );
1251             }
1252             else {
1253                 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
1254                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
1255                         + "] for [overview_placement_type]" );
1256             }
1257         }
1258         else if ( key.equals( "node_label_direction" ) ) {
1259             final String type_str = ( ( String ) st.nextElement() ).trim();
1260             if ( type_str.equalsIgnoreCase( NODE_LABEL_DIRECTION.HORIZONTAL.toString() ) ) {
1261                 setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
1262             }
1263             else if ( type_str.equalsIgnoreCase( NODE_LABEL_DIRECTION.RADIAL.toString() ) ) {
1264                 setNodeLabelDirection( NODE_LABEL_DIRECTION.RADIAL );
1265             }
1266             else {
1267                 setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
1268                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
1269                         + "] for [node_label_direction]" );
1270             }
1271         }
1272         else if ( key.equals( "branch_length_value_digits" ) ) {
1273             final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
1274             if ( i >= 0 ) {
1275                 setNumberOfDigitsAfterCommaForBranchLengthValue( i );
1276             }
1277             else {
1278                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "illegal value [" + i
1279                         + "] for [branch_length_value_digits]" );
1280             }
1281         }
1282         else if ( key.equals( "confidence_value_digits" ) ) {
1283             final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
1284             if ( i >= 0 ) {
1285                 setNumberOfDigitsAfterCommaForConfidenceValues( i );
1286             }
1287             else {
1288                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "illegal value [" + i
1289                         + "] for [confidence_value_digits]" );
1290             }
1291         }
1292         else if ( key.equals( "allow_editing" ) ) {
1293             setEditable( parseBoolean( ( String ) st.nextElement() ) );
1294         }
1295         else if ( key.equals( "display_sequence_relations" ) ) {
1296             setDisplaySequenceRelations( parseBoolean( ( String ) st.nextElement() ) );
1297         }
1298         else if ( key.equals( "replace_underscores_in_nh_parsing" ) ) {
1299             final boolean r = parseBoolean( ( String ) st.nextElement() );
1300             if ( r && ( getTaxonomyExtraction() != TAXONOMY_EXTRACTION.NO ) ) {
1301                 ForesterUtil
1302                         .printWarningMessage( Constants.PRG_NAME,
1303                                               "attempt to extract taxonomies and replace underscores at the same time" );
1304             }
1305             else {
1306                 setReplaceUnderscoresInNhParsing( r );
1307             }
1308         }
1309         else if ( key.equals( "taxonomy_extraction_in_nh_parsing" ) ) {
1310             final String s = ( String ) st.nextElement();
1311             if ( s.equalsIgnoreCase( "no" ) ) {
1312                 setTaxonomyExtraction( TAXONOMY_EXTRACTION.NO );
1313             }
1314             else if ( s.equalsIgnoreCase( "pfam_relaxed" ) ) {
1315                 setTaxonomyExtraction( TAXONOMY_EXTRACTION.PFAM_STYLE_RELAXED );
1316             }
1317             else if ( s.equalsIgnoreCase( "pfam_strict" ) ) {
1318                 setTaxonomyExtraction( TAXONOMY_EXTRACTION.PFAM_STYLE_STRICT );
1319             }
1320             else if ( s.equalsIgnoreCase( "aggressive" ) ) {
1321                 setTaxonomyExtraction( TAXONOMY_EXTRACTION.AGGRESSIVE );
1322             }
1323             else {
1324                 ForesterUtil
1325                         .printWarningMessage( Constants.PRG_NAME,
1326                                               "unknown value for \"taxonomy_extraction_in_nh_parsing\": "
1327                                                       + s
1328                                                       + " (must be either: no, pfam_relaxed, pfam_strict, or aggressive)" );
1329             }
1330             if ( ( getTaxonomyExtraction() != TAXONOMY_EXTRACTION.NO ) && isReplaceUnderscoresInNhParsing() ) {
1331                 ForesterUtil
1332                         .printWarningMessage( Constants.PRG_NAME,
1333                                               "attempt to extract taxonomies and replace underscores at the same time" );
1334             }
1335         }
1336         else if ( key.equals( "internal_labels_are_confidence_values" ) ) {
1337             setInternalNumberAreConfidenceForNhParsing( parseBoolean( ( String ) st.nextElement() ) );
1338         }
1339         else if ( key.equals( "gui_background_color" ) ) {
1340             _gui_background_color = Color.decode( ( String ) st.nextElement() );
1341         }
1342         else if ( key.equals( "gui_checkbox_text_color" ) ) {
1343             _gui_checkbox_text_color = Color.decode( ( String ) st.nextElement() );
1344         }
1345         else if ( key.equals( "gui_checkbox_and_button_active_color" ) ) {
1346             _gui_checkbox_and_button_active_color = Color.decode( ( String ) st.nextElement() );
1347         }
1348         else if ( key.equals( "gui_button_text_color" ) ) {
1349             _gui_button_text_color = Color.decode( ( String ) st.nextElement() );
1350         }
1351         else if ( key.equals( "gui_button_background_color" ) ) {
1352             _gui_button_background_color = Color.decode( ( String ) st.nextElement() );
1353         }
1354         else if ( key.equals( "gui_menu_background_color" ) ) {
1355             _gui_menu_background_color = Color.decode( ( String ) st.nextElement() );
1356         }
1357         else if ( key.equals( "gui_menu_text_color" ) ) {
1358             _gui_menu_text_color = Color.decode( ( String ) st.nextElement() );
1359         }
1360         else if ( key.equals( "gui_button_border_color" ) ) {
1361             _gui_button_border_color = Color.decode( ( String ) st.nextElement() );
1362         }
1363         else if ( key.equals( "domain_structure_font_color" ) ) {
1364             _domain_structure_font_color = Color.decode( ( String ) st.nextElement() );
1365         }
1366         else if ( key.equals( "domain_structure_base_color" ) ) {
1367             _domain_structure_base_color = Color.decode( ( String ) st.nextElement() );
1368         }
1369         else if ( key.equals( "show_default_node_shapes" ) ) {
1370             ForesterUtil
1371                     .printWarningMessage( Constants.PRG_NAME,
1372                                           "configuration key [show_default_node_shapes] is deprecated, use [show_default_node_shapes_internal] and [show_default_node_shapes_external] instead" );
1373             final boolean b = parseBoolean( ( ( String ) st.nextElement() ).trim() );
1374             setShowDefaultNodeShapesInternal( b );
1375             setShowDefaultNodeShapesExternal( b );
1376         }
1377         else if ( key.equals( "show_default_node_shapes_internal" ) ) {
1378             setShowDefaultNodeShapesInternal( parseBoolean( ( ( String ) st.nextElement() ).trim() ) );
1379         }
1380         else if ( key.equals( "show_default_node_shapes_external" ) ) {
1381             setShowDefaultNodeShapesExternal( parseBoolean( ( ( String ) st.nextElement() ).trim() ) );
1382         }
1383         else if ( key.equals( "default_node_size" ) ) {
1384             final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
1385             setDefaultNodeShapeSize( i );
1386         }
1387         else if ( key.equals( "default_node_fill" ) ) {
1388             final String fill_str = ( ( String ) st.nextElement() ).trim();
1389             if ( fill_str.equalsIgnoreCase( NodeVisualization.NodeFill.NONE.toString() ) ) {
1390                 setDefaultNodeFill( NodeFill.NONE );
1391             }
1392             else if ( fill_str.equalsIgnoreCase( NodeVisualization.NodeFill.GRADIENT.toString() ) ) {
1393                 setDefaultNodeFill( NodeFill.GRADIENT );
1394             }
1395             else if ( fill_str.equalsIgnoreCase( NodeVisualization.NodeFill.SOLID.toString() ) ) {
1396                 setDefaultNodeFill( NodeFill.SOLID );
1397             }
1398             else {
1399                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + fill_str
1400                         + "] for [default_node_fill]" );
1401             }
1402         }
1403         else if ( key.equals( "default_node_shape" ) ) {
1404             final String shape_str = ( ( String ) st.nextElement() ).trim();
1405             if ( shape_str.equalsIgnoreCase( NodeVisualization.NodeShape.CIRCLE.toString() ) ) {
1406                 setDefaultNodeShape( NodeShape.CIRCLE );
1407             }
1408             else if ( shape_str.equalsIgnoreCase( NodeVisualization.NodeShape.RECTANGLE.toString() ) ) {
1409                 setDefaultNodeShape( NodeShape.RECTANGLE );
1410             }
1411             else {
1412                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + shape_str
1413                         + "] for [default_node_shape]" );
1414             }
1415         }
1416         else if ( key.equals( "taxonomy_colorize_node_shapes" ) ) {
1417             setTaxonomyColorizeNodeShapes( parseBoolean( ( String ) st.nextElement() ) );
1418         }
1419         else if ( key.equals( "midpoint_reroot" ) ) {
1420             setMidpointReroot( parseBoolean( ( String ) st.nextElement() ) );
1421         }
1422         else if ( key.equals( "ext_descendents_data_to_return" ) ) {
1423             final String s = ( ( String ) st.nextElement() ).trim();
1424             if ( s.equalsIgnoreCase( "node_name" ) ) {
1425                 setExtDescNodeDataToReturn( NODE_DATA.NODE_NAME );
1426             }
1427             else if ( s.equalsIgnoreCase( "sequence_acc" ) ) {
1428                 setExtDescNodeDataToReturn( NODE_DATA.SEQUENCE_ACC );
1429             }
1430             else if ( s.equalsIgnoreCase( "sequence_mol_seq_fasta" ) ) {
1431                 setExtDescNodeDataToReturn( NODE_DATA.SEQUENCE_MOL_SEQ_FASTA );
1432             }
1433             else if ( s.equalsIgnoreCase( "sequence_mol_seq" ) ) {
1434                 setExtDescNodeDataToReturn( NODE_DATA.SEQUENCE_MOL_SEQ );
1435             }
1436             else if ( s.equalsIgnoreCase( "sequence_name" ) ) {
1437                 setExtDescNodeDataToReturn( NODE_DATA.SEQUENCE_NAME );
1438             }
1439             else if ( s.equalsIgnoreCase( "sequence_symbol" ) ) {
1440                 setExtDescNodeDataToReturn( NODE_DATA.SEQUENCE_SYMBOL );
1441             }
1442             else if ( s.equalsIgnoreCase( "taxonomy_scientific_name" ) ) {
1443                 setExtDescNodeDataToReturn( NODE_DATA.TAXONOMY_SCIENTIFIC_NAME );
1444             }
1445             else if ( s.equalsIgnoreCase( "taxonomy_code" ) ) {
1446                 setExtDescNodeDataToReturn( NODE_DATA.TAXONOMY_CODE );
1447             }
1448             else if ( s.equalsIgnoreCase( "taxonomy_common_name" ) ) {
1449                 setExtDescNodeDataToReturn( NODE_DATA.TAXONOMY_COMM0N_NAME );
1450             }
1451             else if ( s.equalsIgnoreCase( "user_selected" ) ) {
1452                 setExtDescNodeDataToReturn( NODE_DATA.UNKNOWN );
1453             }
1454             else {
1455                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + s
1456                         + "] for [ext_descendents_data_to_return]" );
1457             }
1458         }
1459         else if ( key.equals( "label_for_get_ext_descendents_data" ) ) {
1460             final String s = ( ( String ) st.nextElement() ).trim();
1461             if ( ForesterUtil.isEmpty( s ) || ( s.length() < 2 ) ) {
1462                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "illegal value [" + s
1463                         + "] for [label_for_get_ext_descendents_data]" );
1464             }
1465             else {
1466                 setLabelForGetExtDescendentsData( s.replaceAll( "_", " " ) );
1467             }
1468         }
1469         else if ( key.equals( "ext_descendents_data_to_return_on" ) ) {
1470             final String s = ( ( String ) st.nextElement() ).trim().toLowerCase();
1471             if ( s.equals( "console" ) ) {
1472                 setExtNodeDataReturnOn( EXT_NODE_DATA_RETURN_ON.CONSOLE );
1473             }
1474             else if ( s.equals( "window" ) ) {
1475                 setExtNodeDataReturnOn( EXT_NODE_DATA_RETURN_ON.WINODW );
1476             }
1477             else if ( s.equals( "buffer_only" ) ) {
1478                 setExtNodeDataReturnOn( EXT_NODE_DATA_RETURN_ON.BUFFER_ONLY );
1479             }
1480             else {
1481                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + s
1482                         + "] for [ext_descendents_data_to_return_on]" );
1483             }
1484         }
1485         else if ( st.countTokens() >= 2 ) { // counts the tokens that are not
1486             // yet retrieved!
1487             int key_index = -1;
1488             if ( key.equals( "use_real_br_lengths" ) || key.equals( "phylogram" ) ) {
1489                 key_index = Configuration.display_as_phylogram;
1490                 if ( key.equals( "use_real_br_lengths" ) ) {
1491                     ForesterUtil
1492                             .printWarningMessage( Constants.PRG_NAME,
1493                                                   "configuration key [use_real_br_lengths] is deprecated, use [phylogram] instead" );
1494                 }
1495             }
1496             else if ( key.equals( "rollover" ) ) {
1497                 key_index = Configuration.node_data_popup;
1498             }
1499             else if ( key.equals( "color_according_to_species" ) ) {
1500                 key_index = Configuration.color_according_to_species;
1501             }
1502             else if ( key.equals( "show_node_names" ) ) {
1503                 key_index = Configuration.show_node_names;
1504             }
1505             else if ( key.equals( "show_taxonomy" ) || key.equals( "show_taxonomy_code" ) ) {
1506                 key_index = Configuration.show_tax_code;
1507                 if ( key.equals( "show_taxonomy" ) ) {
1508                     ForesterUtil
1509                             .printWarningMessage( Constants.PRG_NAME,
1510                                                   "configuration key [show_taxonomy] is deprecated, use [show_taxonomy_code] instead" );
1511                 }
1512             }
1513             else if ( key.equals( "write_br_length_values" ) ) {
1514                 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1515                                                   "configuration key [write_br_length_values] is deprecated" );
1516                 key_index = DEPRECATED;
1517             }
1518             else if ( key.equals( "write_bootstrap_values" ) || key.equals( "write_confidence_values" ) ) {
1519                 key_index = Configuration.write_confidence_values;
1520                 if ( key.equals( "write_bootstrap_values" ) ) {
1521                     ForesterUtil
1522                             .printWarningMessage( Constants.PRG_NAME,
1523                                                   "configuration key [write_bootstrap_values] is deprecated, use [write_confidence_values] instead" );
1524                 }
1525             }
1526             else if ( key.equals( "write_events" ) || key.equals( "write_dup_spec" ) ) {
1527                 key_index = Configuration.write_events;
1528                 if ( key.equals( "write_dup_spec" ) ) {
1529                     ForesterUtil
1530                             .printWarningMessage( Constants.PRG_NAME,
1531                                                   "configuration key [write_dup_spec] is deprecated, use [write_events] instead" );
1532                 }
1533             }
1534             else if ( key.equals( "color_branches" ) ) {
1535                 key_index = Configuration.color_branches;
1536             }
1537             else if ( key.equals( "width_branches" ) ) {
1538                 key_index = Configuration.width_branches;
1539             }
1540             else if ( key.equals( "mark_nodes_with_box" ) ) {
1541                 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1542                                                   "configuration key [mark_nodes_with_box] is deprecated" );
1543                 key_index = DEPRECATED;
1544             }
1545             else if ( key.equals( "show_domain_architectures" ) ) {
1546                 key_index = Configuration.show_domain_architectures;
1547             }
1548             else if ( key.equals( "show_annotations" ) ) {
1549                 key_index = Configuration.show_annotation;
1550             }
1551             else if ( key.equals( "show_binary_characters" ) ) {
1552                 key_index = Configuration.show_binary_characters;
1553             }
1554             else if ( key.equals( "show_binary_character_counts" ) ) {
1555                 key_index = Configuration.show_binary_character_counts;
1556             }
1557             else if ( key.equals( "show_gene_names" ) ) {
1558                 key_index = Configuration.show_gene_names;
1559             }
1560             else if ( key.equals( "show_gene_symbols" ) ) {
1561                 key_index = Configuration.show_gene_symbols;
1562             }
1563             else if ( key.equals( "show_sequence_acc" ) ) {
1564                 key_index = Configuration.show_sequence_acc;
1565             }
1566             else if ( key.equals( "show_node_ids" ) ) {
1567                 ForesterUtil
1568                         .printWarningMessage( Constants.PRG_NAME, "configuration key [show_node_ids] is deprecated" );
1569                 key_index = DEPRECATED;
1570             }
1571             else if ( key.equals( "display_internal_data" ) ) {
1572                 key_index = Configuration.display_internal_data;
1573             }
1574             else if ( key.equals( "dynamically_hide_data" ) ) {
1575                 key_index = Configuration.dynamically_hide_data;
1576             }
1577             else if ( key.equals( "show_taxonomy_names" ) ) {
1578                 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1579                                                   "configuration key [show_taxonomy_names] is deprecated" );
1580                 key_index = DEPRECATED;
1581             }
1582             else if ( key.equals( "show_taxonomy_scientific_names" ) ) {
1583                 key_index = Configuration.show_taxonomy_scientific_names;
1584             }
1585             else if ( key.equals( "show_taxonomy_common_names" ) ) {
1586                 key_index = Configuration.show_taxonomy_common_names;
1587             }
1588             else if ( key.equals( "show_taxonomy_images" ) ) {
1589                 key_index = Configuration.show_taxonomy_images;
1590             }
1591             else if ( key.equals( "color_according_to_annotation" ) ) {
1592                 key_index = Configuration.color_according_to_annotation;
1593             }
1594             else if ( key.equals( "show_vector_data" ) ) {
1595                 key_index = Configuration.show_vector_data;
1596             }
1597             else if ( key.equals( "show_properties" ) ) {
1598                 key_index = Configuration.show_properties;
1599             }
1600             else if ( key.equals( "show_relation_confidence" ) ) {
1601                 key_index = Configuration.show_relation_confidence;
1602             }
1603             else if ( key.equals( "show_custom_node_shapes" ) ) {
1604                 key_index = Configuration.show_custom_node_shapes;
1605             }
1606             // If we've found the key, set the values
1607             if ( key_index >= 0 ) {
1608                 display_options[ key_index ][ 1 ] = ( String ) st.nextElement();
1609                 display_options[ key_index ][ 2 ] = ( String ) st.nextElement();
1610                 // otherwise, keep looking
1611             }
1612             else {
1613                 if ( key_index == DEPRECATED ) {
1614                     // Deprecated.
1615                 }
1616                 else if ( key.equals( "click_to" ) ) {
1617                     final String click_to_name = ( String ) st.nextElement();
1618                     key_index = getClickToIndex( click_to_name );
1619                     if ( key_index >= 0 ) {
1620                         clickto_options[ key_index ][ 1 ] = ( String ) st.nextElement();
1621                     }
1622                     else if ( key_index == DEPRECATED ) {
1623                         // Deprecated.
1624                     }
1625                     else {
1626                         ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown click-to option: "
1627                                 + click_to_name );
1628                     }
1629                 }
1630                 else if ( key.equals( "species_color" ) ) {
1631                     getSpeciesColors().put( ( ( String ) st.nextElement() ).replace( '_', ' ' ),
1632                                             Color.decode( ( String ) st.nextElement() ) );
1633                 }
1634                 else if ( key.equals( "domain_color" ) ) {
1635                     getDomainColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1636                 }
1637                 else if ( key.equals( "annotation_color" ) ) {
1638                     getAnnotationColors()
1639                             .put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1640                 }
1641                 else if ( key.equals( "function_color" ) ) {
1642                     ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1643                                                       "configuration key [function_color] is deprecated" );
1644                 }
1645                 else if ( key.equals( DISPLAY_COLOR_KEY ) ) {
1646                     putDisplayColors( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1647                 }
1648                 else {
1649                     ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown configuration key [" + key
1650                             + "] in: " + config_filename );
1651                 }
1652             }
1653         }
1654         else {
1655             ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown configuration key [" + key + "] in: "
1656                     + config_filename );
1657         }
1658     }
1659
1660     private void setShowAnnotationRefSource( final boolean b ) {
1661         _show_annotation_ref_source = b;
1662     }
1663
1664     private void setLabelForGetExtDescendentsData( final String label_for_get_ext_descendents_data ) {
1665         _label_for_get_ext_descendents_data = label_for_get_ext_descendents_data;
1666     }
1667
1668     private void setOvMaxHeight( final short ov_max_height ) {
1669         _ov_max_height = ov_max_height;
1670     }
1671
1672     private void setOvMaxWidth( final short ov_max_width ) {
1673         _ov_max_width = ov_max_width;
1674     }
1675
1676     private void setOvPlacement( final OVERVIEW_PLACEMENT_TYPE ov_placement ) {
1677         _ov_placement = ov_placement;
1678     }
1679
1680     private void setPathToLocalFastme( final File path_to_local_fastme ) {
1681         _path_to_local_fastme = path_to_local_fastme;
1682     }
1683
1684     private void setPathToLocalMafft( final File path_to_local_mafft ) {
1685         _path_to_local_mafft = path_to_local_mafft;
1686     }
1687
1688     private void setPathToLocalRaxml( final File path_to_local_raxml ) {
1689         _path_to_local_raxml = path_to_local_raxml;
1690     }
1691
1692     private void setShowOverview( final boolean show_overview ) {
1693         _show_overview = show_overview;
1694     }
1695
1696     private void setValidatePhyloXmlAgainstSchema( final boolean validate_against_phyloxml_xsd_schema ) {
1697         _validate_against_phyloxml_xsd_schema = validate_against_phyloxml_xsd_schema;
1698     }
1699
1700     static String getDefaultFontFamilyName() {
1701         return DEFAULT_FONT_FAMILY;
1702     }
1703
1704     public enum EXT_NODE_DATA_RETURN_ON {
1705         CONSOLE, WINODW, BUFFER_ONLY;
1706     }
1707
1708     public enum UI {
1709         NATIVE, CROSSPLATFORM, NIMBUS, UNKNOWN
1710     }
1711
1712     static enum TRIPLET {
1713         TRUE, FALSE, UNKNOWN
1714     }
1715
1716     public boolean isMidpointReroot() {
1717         return _midpoint_root;
1718     }
1719
1720     public void setMidpointReroot( final boolean midpoint_root ) {
1721         _midpoint_root = midpoint_root;
1722     }
1723
1724     public boolean isShowAnnotationRefSource() {
1725         return _show_annotation_ref_source;
1726     }
1727 }