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