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