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