2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
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
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.
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.
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
26 // Contact: phylosoft @ gmail . com
27 // WWW: www.phylosoft.org/forester
29 package org.forester.archaeopteryx;
31 import java.awt.Color;
32 import java.io.BufferedReader;
34 import java.io.FileReader;
35 import java.io.IOException;
36 import java.io.InputStreamReader;
37 import java.net.MalformedURLException;
39 import java.util.Arrays;
40 import java.util.Hashtable;
42 import java.util.SortedMap;
43 import java.util.StringTokenizer;
44 import java.util.TreeMap;
46 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
47 import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
48 import org.forester.archaeopteryx.Options.NodeFill;
49 import org.forester.archaeopteryx.Options.NodeShape;
50 import org.forester.archaeopteryx.Options.OVERVIEW_PLACEMENT_TYPE;
51 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
52 import org.forester.util.ForesterUtil;
54 public final class Configuration {
57 NATIVE, CROSSPLATFORM, NIMBUS, UNKNOWN
59 static final String VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA = "validate_against_phyloxml_xsd_schema";
60 private static final String WEB_LINK_KEY = "web_link";
61 private static final String DISPLAY_COLOR_KEY = "display_color";
62 private static final int DEPRECATED = -2;
63 private UI _ui = UI.UNKNOWN;
64 private boolean _use_tabbed_display = false;
65 private boolean _hide_controls_and_menus = false;
66 private CLADOGRAM_TYPE _cladogram_type = Constants.CLADOGRAM_TYPE_DEFAULT;
67 private SortedMap<String, WebLink> _weblinks = null;
68 private SortedMap<String, Color> _display_colors = null;
69 private boolean _antialias_screen = true;
70 private PHYLOGENY_GRAPHICS_TYPE _phylogeny_graphics_type = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR;
71 private String _base_font_family_name = "";
72 private int _base_font_size = -1;
73 private int _graphics_export_x = -1;
74 private int _graphics_export_y = -1;
75 private short _ov_max_width = 80;
76 private short _ov_max_height = 80;
77 private OVERVIEW_PLACEMENT_TYPE _ov_placement = OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT;
78 private double _min_confidence_value = Options.MIN_CONFIDENCE_DEFAULT;
79 private float _print_line_width = Constants.PDF_LINE_WIDTH_DEFAULT;
80 private boolean _show_scale = false;
81 private boolean _show_branch_length_values = false;
82 private boolean _show_overview = true;
83 private short _number_of_digits_after_comma_for_confidence_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_CONFIDENCE_VALUES_DEFAULT;
84 private short _number_of_digits_after_comma_for_branch_length_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_BRANCH_LENGTH_VALUES_DEFAULT;
85 private boolean _editable = true;
86 private boolean _nh_parsing_replace_underscores = false;
87 private boolean _nh_parsing_extract_pfam_taxonomy_codes = false;
88 private boolean _internal_number_are_confidence_for_nh_parsing = false;
89 private boolean _display_sequence_relations = false;
90 private boolean _validate_against_phyloxml_xsd_schema = Constants.VALIDATE_AGAINST_PHYLOXML_XSD_SCJEMA_DEFAULT;
91 private boolean _background_color_gradient = false;
92 private boolean _show_domain_labels = true;
93 private boolean _abbreviate_scientific_names = false;
94 private boolean _color_labels_same_as_parent_branch = false;
95 private int _default_bootstrap_samples = -1;
96 private NodeShape _default_node_shape = NodeShape.NONE;
97 private NodeFill _default_node_fill = NodeFill.GRADIENT;
98 private short _default_node_shape_size = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
99 private boolean _taxonomy_colorize_node_shapes_instead_of_labels = false;
100 final static int display_as_phylogram = 0;
101 final static int show_node_names = 1;
102 final static int show_tax_code = 2;
103 final static int show_annotation = 3;
104 final static int write_confidence_values = 4;
105 final static int write_events = 5;
106 final static int color_according_to_species = 6;
107 final static int color_branches = 7;
108 final static int width_branches = 8;
109 final static int show_domain_architectures = 9;
110 final static int show_binary_characters = 10;
111 final static int show_binary_character_counts = 11;
112 final static int show_gene_names = 12;
113 final static int show_sequence_acc = 13;
114 final static int display_internal_data = 14;
115 final static int dynamically_hide_data = 15;
116 final static int show_taxonomy_scientific_names = 16;
117 final static int show_taxonomy_common_names = 17;
118 final static int color_according_to_annotation = 18;
119 final static int show_property = 19;
120 final static int show_gene_symbols = 20;
121 final static int node_data_popup = 21;
122 final static int show_relation_confidence = 22;
123 final static int show_vector_data = 23;
124 final static int show_taxonomy_images = 24;
125 // ------------------
127 // ------------------
128 final static int display_node_data = 0;
129 final static int collapse_uncollapse = 1;
130 final static int reroot = 2;
131 final static int subtree = 3;
132 final static int swap = 4;
133 final static int color_subtree = 5;
134 final static int open_seq_web = 6;
135 final static int open_tax_web = 7;
136 final static int cut_subtree = 8;
137 final static int copy_subtree = 9;
138 final static int paste_subtree = 10;
139 final static int delete_subtree_or_node = 11;
140 final static int add_new_node = 12;
141 final static int edit_node_data = 13;
142 final static int blast = 14;
143 // ---------------------------
144 // Display options for trees
145 // ---------------------------
146 // ---------------------------------
147 // Pertaining to the config itself
148 // ---------------------------------
149 // Full path to config (may be URL)
150 String config_filename;
151 String default_config_filename = Constants.DEFAULT_CONFIGURATION_FILE_NAME;
152 final static String display_options[][] = {
153 { "Phylogram", "display", "?" }, { "Node Name", "display", "yes" }, { "Taxonomy Code", "display", "yes" },
154 { "Annotation", "nodisplay", "no" }, { "Confidence Value", "display", "?" }, { "Event", "display", "?" },
155 { "Taxonomy Colorize", "display", "yes" }, { "Colorize Branches", "display", "no" },
156 { "Use Branch-Width", "nodisplay", "no" }, { "Domains", "nodisplay", "no" },
157 { "Binary Characters", "nodisplay", "no" }, { "Binary Char Counts", "nodisplay", "no" },
158 { "Prot/Gene Name", "display", "no" }, { "Prot/Gene Acc", "display", "no" },
159 { "Show Internal Data", "display", "yes" }, { "Dyna Hide", "display", "yes" },
160 { "Taxonomy Scientific", "display", "yes" }, { "Taxonomy Common", "display", "no" },
161 { "Annotation Colorize", "nodisplay", "no" }, { "Property", "nodisplay", "no" },
162 { "Prot/Gene Symbol", "display", "no" }, { "Rollover", "display", "yes" },
163 { "Relation Confidence", "display", "no" }, { "Vector Data", "display", "no" },
164 { "Taxonomy Images", "display", "no" } };
165 final static String clickto_options[][] = {
166 { "Display Node Data", "display" }, { "Collapse/Uncollapse", "display" }, { "Root/Reroot", "display" },
167 { "Sub/Super Tree", "display" }, { "Swap Descendants", "display" }, { "Colorize Subtree", "display" },
168 { "Open Sequence Web", "nodisplay" }, { "Open Taxonomy Web", "nodisplay" }, { "Cut Subtree", "display" },
169 { "Copy Subtree", "display" }, { "Paste Subtree", "display" }, { "Delete Subtree/Node", "display" },
170 { "Add New Node", "display" }, { "Edit Node Data", "display" }, { "Blast", "display" } };
171 // This option is selected in the dropdown
172 int default_clickto = Configuration.display_node_data;
176 TreeColorSet tree_color_set;
180 TreeFontSet tree_font_set;
184 private static Hashtable<String, Color> _species_colors;
188 private static Hashtable<String, Color> _domain_colors;
192 private static Hashtable<String, Color> _annotation_colors;
193 boolean verbose = Constants.VERBOSE_DEFAULT;
194 private NODE_LABEL_DIRECTION _node_label_direction = NODE_LABEL_DIRECTION.HORIZONTAL;
195 private Color _gui_background_color = Constants.GUI_BACKGROUND_DEFAULT;
196 private Color _gui_checkbox_text_color = Constants.CHECKBOX_TEXT_COLOR_DEFAULT;
197 private Color _gui_checkbox_and_button_active_color = Constants.CHECKBOX_AND_BUTTON_ACTIVE_COLOR_DEFAULT;
198 private Color _gui_button_text_color = Constants.BUTTON_TEXT_COLOR_DEFAULT;
199 private Color _gui_button_background_color = Constants.BUTTON_BACKGROUND_COLOR_DEFAULT;
200 private Color _gui_menu_background_color = Constants.MENU_BACKGROUND_COLOR_DEFAULT;
201 private Color _gui_menu_text_color = Constants.MENU_TEXT_COLOR_DEFAULT;
202 private Color _gui_button_border_color = Constants.BUTTON_BORDER_COLOR_DEFAULT;
203 private Color _domain_structure_font_color = Constants.DOMAIN_STRUCTURE_FONT_COLOR_DEFAULT;
204 private Color _domain_structure_base_color = Constants.DOMAIN_STRUCTURE_BASE_COLOR_DEFAULT;
205 private static String DEFAULT_FONT_FAMILY = "";
207 for( final String font_name : Constants.DEFAULT_FONT_CHOICES ) {
208 if ( Arrays.binarySearch( Util.getAvailableFontFamiliesSorted(), font_name ) >= 0 ) {
209 DEFAULT_FONT_FAMILY = font_name;
213 if ( ForesterUtil.isEmpty( DEFAULT_FONT_FAMILY ) ) {
214 DEFAULT_FONT_FAMILY = Constants.DEFAULT_FONT_CHOICES[ Constants.DEFAULT_FONT_CHOICES.length - 1 ];
218 Configuration( final String cf, final boolean is_url, final boolean is_applet ) {
219 if ( ForesterUtil.isEmpty( cf ) ) {
220 config_filename = default_config_filename;
223 config_filename = cf;
225 setWebLinks( new TreeMap<String, WebLink>() );
226 setDisplayColors( new TreeMap<String, Color>() );
227 config_filename = config_filename.trim();
230 // If URL, open accordingly
232 u = new URL( config_filename );
234 final InputStreamReader isr = new InputStreamReader( u.openStream() );
235 final BufferedReader bf = new BufferedReader( isr );
238 ForesterUtil.programMessage( Constants.PRG_NAME, "successfully read from configuration url ["
239 + config_filename + "]" );
241 catch ( final Exception e ) {
242 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "failed to read configuration from ["
243 + config_filename + "]: " + e.getLocalizedMessage() );
246 catch ( final Exception e ) {
247 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "cannot find or open configuration url ["
248 + config_filename + "]" );
252 // Otherwise, open as a file
253 File f = new File( config_filename );
255 f = new File( config_filename + ".txt" );
257 if ( f.exists() && f.canRead() ) {
259 final BufferedReader bf = new BufferedReader( new FileReader( f ) );
263 catch ( final Exception e ) {
264 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "failed to read configuration from ["
265 + config_filename + "]: " + e );
269 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "cannot find or open configuration file ["
270 + config_filename + "]" );
275 private void createWebLink( final String url_str, final String desc, final String source_identifier ) {
276 WebLink weblink = null;
279 weblink = new WebLink( new URL( url_str.trim() ), desc.trim(), source_identifier.trim() );
281 catch ( final MalformedURLException e ) {
282 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not create URL from [" + url_str + "]" );
285 if ( !ex && ( weblink != null ) ) {
286 getWebLinks().put( weblink.getSourceIdentifier().toLowerCase(), weblink );
290 Color getGuiBackgroundColor() {
291 return _gui_background_color;
294 Color getGuiCheckboxTextColor() {
295 return _gui_checkbox_text_color;
298 Color getGuiCheckboxAndButtonActiveColor() {
299 return _gui_checkbox_and_button_active_color;
302 Color getGuiButtonTextColor() {
303 return _gui_button_text_color;
306 Color getGuiButtonBackgroundColor() {
307 return _gui_button_background_color;
310 Color getGuiMenuBackgroundColor() {
311 return _gui_menu_background_color;
314 Color getGuiMenuTextColor() {
315 return _gui_menu_text_color;
318 Color getGuiButtonBorderColor() {
319 return _gui_button_border_color;
322 boolean displaySequenceRelations() {
323 return _display_sequence_relations;
326 boolean doCheckOption( final int which ) {
327 return ( display_options[ which ][ 2 ].equalsIgnoreCase( "yes" ) )
328 || ( display_options[ which ][ 2 ].equalsIgnoreCase( "true" ) );
331 boolean doDisplayClickToOption( final int which ) {
332 return clickto_options[ which ][ 1 ].equalsIgnoreCase( "display" );
335 boolean doDisplayOption( final int which ) {
336 return display_options[ which ][ 1 ].equalsIgnoreCase( "display" );
340 * Will attempt to use the phylogeny to determine whether to check
341 * this or not (e.g. phylogram)
344 boolean doGuessCheckOption( final int which ) {
345 return display_options[ which ][ 2 ].equals( "?" );
348 Map<String, Color> getAnnotationColors() {
349 if ( _annotation_colors == null ) {
350 _annotation_colors = new Hashtable<String, Color>();
352 return _annotation_colors;
355 public String getBaseFontFamilyName() {
356 return _base_font_family_name;
359 int getBaseFontSize() {
360 return _base_font_size;
363 CLADOGRAM_TYPE getCladogramType() {
364 return _cladogram_type;
367 private int getClickToIndex( final String name ) {
369 if ( name.equals( "edit_info" ) ) {
370 index = Configuration.display_node_data;
372 .printWarningMessage( Constants.PRG_NAME,
373 "configuration key [edit_info] is deprecated, use [display node data] instead" );
375 else if ( name.equals( "display_node_data" ) ) {
376 index = Configuration.display_node_data;
378 else if ( name.equals( "collapse_uncollapse" ) ) {
379 index = Configuration.collapse_uncollapse;
381 else if ( name.equals( "reroot" ) ) {
382 index = Configuration.reroot;
384 else if ( name.equals( "subtree" ) ) {
385 index = Configuration.subtree;
387 else if ( name.equals( "swap" ) ) {
388 index = Configuration.swap;
390 else if ( name.equals( "display_sequences" ) ) {
392 .printWarningMessage( Constants.PRG_NAME, "configuration key [display_sequences] is deprecated" );
395 else if ( name.equals( "open_seq_web" ) ) {
396 index = Configuration.open_seq_web;
398 else if ( name.equals( "open_tax_web" ) ) {
399 index = Configuration.open_tax_web;
401 else if ( name.equals( "cut_subtree" ) ) {
402 index = Configuration.cut_subtree;
404 else if ( name.equals( "copy_subtree" ) ) {
405 index = Configuration.copy_subtree;
407 else if ( name.equals( "paste_subtree" ) ) {
408 index = Configuration.paste_subtree;
410 else if ( name.equals( "delete" ) ) {
411 index = Configuration.delete_subtree_or_node;
413 else if ( name.equals( "add_new_node" ) ) {
414 index = Configuration.add_new_node;
416 else if ( name.equals( "edit_node_data" ) ) {
417 index = Configuration.edit_node_data;
419 else if ( name.equals( "display_node_popup" ) ) {
420 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
421 "configuration key [display_node_popup] is deprecated" );
424 else if ( name.equals( "custom_option" ) ) {
425 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "configuration key [custom_option] is deprecated" );
428 else if ( name.equals( "color_subtree" ) ) {
429 index = Configuration.color_subtree;
431 else if ( name.equals( "go_to_swiss_prot" ) ) {
432 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "configuration key [go_to_swiss_prot] is deprecated" );
438 int getClickToOptionsCount() {
439 return clickto_options.length;
442 String getClickToTitle( final int which ) {
443 return clickto_options[ which ][ 0 ];
446 int getDefaultDisplayClicktoOption() {
447 return default_clickto;
450 SortedMap<String, Color> getDisplayColors() {
451 return _display_colors;
454 String getDisplayTitle( final int which ) {
455 return display_options[ which ][ 0 ];
458 Map<String, Color> getDomainColors() {
459 if ( _domain_colors == null ) {
460 _domain_colors = new Hashtable<String, Color>();
462 return _domain_colors;
465 int getGraphicsExportX() {
466 return _graphics_export_x;
469 int getGraphicsExportY() {
470 return _graphics_export_y;
473 public int getDefaultBootstrapSamples() {
474 return _default_bootstrap_samples;
477 double getMinConfidenceValue() {
478 return _min_confidence_value;
481 NODE_LABEL_DIRECTION getNodeLabelDirection() {
482 return _node_label_direction;
485 short getNumberOfDigitsAfterCommaForBranchLengthValues() {
486 return _number_of_digits_after_comma_for_branch_length_values;
489 short getNumberOfDigitsAfterCommaForConfidenceValues() {
490 return _number_of_digits_after_comma_for_confidence_values;
493 short getOvMaxHeight() {
494 return _ov_max_height;
497 short getOvMaxWidth() {
498 return _ov_max_width;
501 OVERVIEW_PLACEMENT_TYPE getOvPlacement() {
502 return _ov_placement;
505 PHYLOGENY_GRAPHICS_TYPE getPhylogenyGraphicsType() {
506 return _phylogeny_graphics_type;
509 float getPrintLineWidth() {
510 return _print_line_width;
513 Hashtable<String, Color> getSpeciesColors() {
514 if ( _species_colors == null ) {
515 _species_colors = new Hashtable<String, Color>();
517 return _species_colors;
520 TreeColorSet getTreeColorSet() {
524 TreeFontSet getTreeFontSet() {
528 WebLink getWebLink( final String source ) {
529 return getWebLinks().get( source );
532 Map<String, WebLink> getWebLinks() {
536 boolean isAntialiasScreen() {
537 return _antialias_screen;
540 public boolean isBackgroundColorGradient() {
541 return _background_color_gradient;
545 * Convenience method.
547 * @return true if value in configuration file was 'yes'
549 boolean isDrawAsPhylogram() {
550 return doCheckOption( display_as_phylogram );
553 boolean isEditable() {
557 boolean isExtractPfamTaxonomyCodesInNhParsing() {
558 return _nh_parsing_extract_pfam_taxonomy_codes;
561 boolean isHasWebLink( final String source ) {
562 return getWebLinks().containsKey( source );
566 * Only used by ArchaeoptryxE.
569 boolean isHideControlPanelAndMenubar() {
570 return _hide_controls_and_menus;
573 boolean isInternalNumberAreConfidenceForNhParsing() {
574 return _internal_number_are_confidence_for_nh_parsing;
577 boolean isReplaceUnderscoresInNhParsing() {
578 return _nh_parsing_replace_underscores;
581 boolean isShowBranchLengthValues() {
582 return _show_branch_length_values;
585 boolean isShowOverview() {
586 return _show_overview;
589 boolean isShowScale() {
593 final boolean isUseNativeUI() {
594 if ( ( _ui == UI.UNKNOWN ) && Util.isMac() && Util.isJava15() ) {
597 return _ui == UI.NATIVE;
601 * Only used by ArchaeoptryxE.
604 boolean isUseTabbedDisplay() {
605 return _use_tabbed_display;
608 boolean isValidatePhyloXmlAgainstSchema() {
609 return _validate_against_phyloxml_xsd_schema;
612 private boolean parseBoolean( final String str ) {
613 final String my_str = str.trim().toLowerCase();
614 if ( my_str.equals( "yes" ) || my_str.equals( "true" ) ) {
617 else if ( my_str.equals( "no" ) || my_str.equals( "false" ) ) {
621 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse boolean value from [" + str + "]" );
626 private double parseDouble( final String str ) {
629 d = Double.parseDouble( str );
631 catch ( final Exception e ) {
632 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse double from [" + str + "]" );
638 private float parseFloat( final String str ) {
641 f = Float.parseFloat( str );
643 catch ( final Exception e ) {
644 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse float from [" + str + "]" );
650 private int parseInt( final String str ) {
653 i = Integer.parseInt( str );
655 catch ( final Exception e ) {
656 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse integer from [" + str + "]" );
662 private short parseShort( final String str ) {
665 i = Short.parseShort( str );
667 catch ( final Exception e ) {
668 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse short from [" + str + "]" );
674 private void processFontFamily( final StringTokenizer st ) {
675 setBaseFontFamilyName( "" );
676 final String font_str = ( ( String ) st.nextElement() ).trim();
677 final String[] fonts = font_str.split( ",+" );
678 for( String font : fonts ) {
679 font = font.replace( '_', ' ' ).trim();
680 if ( Arrays.binarySearch( Util.getAvailableFontFamiliesSorted(), font ) >= 0 ) {
681 setBaseFontFamilyName( font );
688 * read each line of config file, process non-comment lines
689 * @throws IOException
691 private void readConfig( final BufferedReader conf_in ) throws IOException {
694 line = conf_in.readLine();
695 if ( line != null ) {
697 // skip comments and blank lines
698 if ( !line.startsWith( "#" ) && ( !ForesterUtil.isEmpty( line ) ) ) {
699 // convert runs of spaces to tabs
700 line = line.replaceAll( "\\s+", "\t" );
701 final StringTokenizer st = new StringTokenizer( line, "\t" );
705 } while ( line != null );
708 private void setAntialiasScreen( final boolean antialias_screen ) {
709 _antialias_screen = antialias_screen;
712 public void setBackgroundColorGradient( final boolean background_color_gradient ) {
713 _background_color_gradient = background_color_gradient;
716 private void setBaseFontFamilyName( final String base_font_family_name ) {
717 _base_font_family_name = base_font_family_name;
720 private void setBaseFontSize( final int base_font_size ) {
721 _base_font_size = base_font_size;
724 private void setShowDomainLabels( final boolean show_domain_labels ) {
725 _show_domain_labels = show_domain_labels;
728 private void setAbbreviateScientificTaxonNames( final boolean abbreviate_scientific_names ) {
729 _abbreviate_scientific_names = abbreviate_scientific_names;
732 private void setColorLabelsSameAsParentBranch( final boolean color_labels_same_as_parent_branch ) {
733 _color_labels_same_as_parent_branch = color_labels_same_as_parent_branch;
736 private void setCladogramType( final CLADOGRAM_TYPE cladogram_type ) {
737 _cladogram_type = cladogram_type;
740 void setDisplayColors( final SortedMap<String, Color> display_colors ) {
741 _display_colors = display_colors;
744 private void setDisplaySequenceRelations( final boolean display_sequence_relations ) {
745 _display_sequence_relations = display_sequence_relations;
748 private void setEditable( final boolean editable ) {
749 _editable = editable;
752 private void setExtractPfamTaxonomyCodesInNhParsing( final boolean nh_parsing_extract_pfam_taxonomy_codes ) {
753 _nh_parsing_extract_pfam_taxonomy_codes = nh_parsing_extract_pfam_taxonomy_codes;
756 private void setGraphicsExportX( final int graphics_export_x ) {
757 _graphics_export_x = graphics_export_x;
760 private void setGraphicsExportY( final int graphics_export_y ) {
761 _graphics_export_y = graphics_export_y;
764 private void setDefaultBootstrapSamples( final int default_bootstrap_samples ) {
765 _default_bootstrap_samples = default_bootstrap_samples;
768 private void setInternalNumberAreConfidenceForNhParsing( final boolean internal_number_are_confidence_for_nh_parsing ) {
769 _internal_number_are_confidence_for_nh_parsing = internal_number_are_confidence_for_nh_parsing;
773 * Set a key-value(s) tuple
775 private void setKeyValue( final StringTokenizer st ) {
776 String key = ( String ) st.nextElement();
777 key = key.replace( ':', ' ' );
779 key = key.toLowerCase();
780 // Handle single value settings first:
781 if ( key.equals( "default_click_to" ) ) {
782 final String clickto_name = ( String ) st.nextElement();
783 default_clickto = getClickToIndex( clickto_name );
784 if ( default_clickto == -1 ) {
785 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "invalid value [" + clickto_name
786 + "] for [default_click_to]" );
789 else if ( default_clickto == DEPRECATED ) {
793 else if ( key.equals( "native_ui" ) ) {
794 final String my_str = ( ( String ) st.nextElement() ).trim().toLowerCase();
795 if ( my_str.equals( "yes" ) || my_str.equals( "true" ) ) {
798 else if ( my_str.equals( "no" ) || my_str.equals( "false" ) ) {
799 _ui = UI.CROSSPLATFORM;
801 else if ( my_str.equals( "?" ) ) {
805 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse yes/no/? value from [" + my_str
810 else if ( key.equals( VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA ) ) {
811 setValidatePhyloXmlAgainstSchema( parseBoolean( ( String ) st.nextElement() ) );
813 else if ( key.equals( "antialias_screen" ) ) {
814 setAntialiasScreen( parseBoolean( ( String ) st.nextElement() ) );
816 else if ( key.equals( "phylogeny_graphics_type" ) ) {
817 final String type_str = ( ( String ) st.nextElement() ).trim();
818 if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CONVEX.toString() ) ) {
819 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CONVEX );
821 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CURVED.toString() ) ) {
822 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CURVED );
824 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE.toString() ) ) {
825 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE );
827 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.ROUNDED.toString() ) ) {
828 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.ROUNDED );
830 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR.toString() ) ) {
831 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
833 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR.toString() ) ) {
834 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR );
836 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.UNROOTED.toString() ) ) {
837 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.UNROOTED );
839 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR.toString() ) ) {
840 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR );
843 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
844 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
845 + "] for [phylogeny_graphics_type]" );
848 else if ( key.equals( "min_confidence_value" ) ) {
849 final String mcv_str = ( ( String ) st.nextElement() ).trim();
850 final double d = parseDouble( mcv_str );
851 setMinConfidenceValue( d );
853 else if ( key.equals( "font_family" ) ) {
854 processFontFamily( st );
856 else if ( key.equals( "font_size" ) ) {
857 final String size_str = ( ( String ) st.nextElement() ).trim();
858 final int i = parseInt( size_str );
859 setBaseFontSize( i );
861 else if ( key.equals( "graphics_export_x" ) ) {
862 final String str = ( ( String ) st.nextElement() ).trim();
863 final int i = parseInt( str );
864 setGraphicsExportX( i );
866 else if ( key.equals( "graphics_export_y" ) ) {
867 final String str = ( ( String ) st.nextElement() ).trim();
868 final int i = parseInt( str );
869 setGraphicsExportY( i );
871 else if ( key.equals( "pdf_export_line_width" ) ) {
872 final String str = ( ( String ) st.nextElement() ).trim();
873 final float f = parseFloat( str );
875 setPrintLineWidth( f );
878 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
879 "value for [pdf_export_line_width] cannot be zero or negative" );
882 else if ( key.equals( "default_number_of_bootstrap_resamples" ) ) {
883 final String str = ( ( String ) st.nextElement() ).trim();
884 final int i = parseInt( str );
886 setDefaultBootstrapSamples( i );
890 .printWarningMessage( Constants.PRG_NAME,
891 "value for [default_number_of_bootstrap_resamples] cannot be negative" );
894 else if ( key.equals( "show_scale" ) ) {
895 setShowScale( parseBoolean( ( String ) st.nextElement() ) );
897 else if ( key.equals( "show_overview" ) ) {
898 setShowOverview( parseBoolean( ( String ) st.nextElement() ) );
900 else if ( key.equals( "show_branch_length_values" ) ) {
901 setShowBranchLengthValues( parseBoolean( ( String ) st.nextElement() ) );
903 else if ( key.equals( "background_gradient" ) ) {
904 setBackgroundColorGradient( parseBoolean( ( String ) st.nextElement() ) );
906 else if ( key.equals( "color_labels_same_as_branch_length_values" ) ) {
907 setColorLabelsSameAsParentBranch( parseBoolean( ( String ) st.nextElement() ) );
909 else if ( key.equals( "show_domain_labels" ) ) {
910 setShowDomainLabels( parseBoolean( ( String ) st.nextElement() ) );
912 else if ( key.equals( "abbreviate_scientific_names" ) ) {
913 setAbbreviateScientificTaxonNames( parseBoolean( ( String ) st.nextElement() ) );
915 else if ( key.equals( "cladogram_type" ) ) {
916 final String type_str = ( ( String ) st.nextElement() ).trim();
917 if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.NON_LINED_UP.toString() ) ) {
918 setCladogramType( Options.CLADOGRAM_TYPE.NON_LINED_UP );
920 else if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.EXT_NODE_SUM_DEP.toString() ) ) {
921 setCladogramType( Options.CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
923 else if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP.toString() ) ) {
924 setCladogramType( Options.CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
927 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
928 + "] for [cladogram_type]" );
931 else if ( key.equals( "non_lined_up_cladogram" ) ) {
933 .printWarningMessage( Constants.PRG_NAME,
934 "configuration key [non_lined_up_cladogram] is deprecated, use [cladogram_type] instead" );
936 else if ( key.equals( "hide_controls_and_menus" ) ) {
937 _hide_controls_and_menus = parseBoolean( ( String ) st.nextElement() );
939 else if ( key.equals( "use_tabbed_display" ) ) {
940 _use_tabbed_display = parseBoolean( ( String ) st.nextElement() );
942 else if ( key.equals( "overview_width" ) ) {
943 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
946 else if ( key.equals( "overview_height" ) ) {
947 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
950 else if ( key.equals( "overview_placement_type" ) ) {
951 final String type_str = ( ( String ) st.nextElement() ).trim();
952 if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT.toTag() ) ) {
953 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
955 else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.UPPER_RIGHT.toTag() ) ) {
956 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_RIGHT );
958 else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.LOWER_LEFT.toTag() ) ) {
959 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.LOWER_LEFT );
961 else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.LOWER_RIGHT.toTag() ) ) {
962 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.LOWER_RIGHT );
965 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
966 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
967 + "] for [overview_placement_type]" );
970 else if ( key.equals( "node_label_direction" ) ) {
971 final String type_str = ( ( String ) st.nextElement() ).trim();
972 if ( type_str.equalsIgnoreCase( NODE_LABEL_DIRECTION.HORIZONTAL.toString() ) ) {
973 setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
975 else if ( type_str.equalsIgnoreCase( NODE_LABEL_DIRECTION.RADIAL.toString() ) ) {
976 setNodeLabelDirection( NODE_LABEL_DIRECTION.RADIAL );
979 setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
980 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
981 + "] for [node_label_direction]" );
984 else if ( key.equals( "branch_length_value_digits" ) ) {
985 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
987 setNumberOfDigitsAfterCommaForBranchLengthValue( i );
990 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "illegal value [" + i
991 + "] for [branch_length_value_digits]" );
994 else if ( key.equals( "confidence_value_digits" ) ) {
995 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
997 setNumberOfDigitsAfterCommaForConfidenceValues( i );
1000 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "illegal value [" + i
1001 + "] for [confidence_value_digits]" );
1004 else if ( key.equals( "allow_editing" ) ) {
1005 setEditable( parseBoolean( ( String ) st.nextElement() ) );
1007 else if ( key.equals( "display_sequence_relations" ) ) {
1008 setDisplaySequenceRelations( parseBoolean( ( String ) st.nextElement() ) );
1010 else if ( key.equals( "replace_underscores_in_nh_parsing" ) ) {
1011 final boolean r = parseBoolean( ( String ) st.nextElement() );
1012 if ( r && isExtractPfamTaxonomyCodesInNhParsing() ) {
1014 .printWarningMessage( Constants.PRG_NAME,
1015 "attempt to extract taxonomies and replace underscores at the same time" );
1018 setReplaceUnderscoresInNhParsing( r );
1021 else if ( key.equals( "extract_taxonomy_codes_in_nh_parsing" ) ) {
1022 final boolean e = parseBoolean( ( String ) st.nextElement() );
1023 if ( e && isReplaceUnderscoresInNhParsing() ) {
1025 .printWarningMessage( Constants.PRG_NAME,
1026 "attempt to extract taxonomies and replace underscores at the same time" );
1029 setExtractPfamTaxonomyCodesInNhParsing( e );
1032 else if ( key.equals( "internal_labels_are_confidence_values" ) ) {
1033 setInternalNumberAreConfidenceForNhParsing( parseBoolean( ( String ) st.nextElement() ) );
1035 else if ( key.equals( "gui_background_color" ) ) {
1036 _gui_background_color = Color.decode( ( String ) st.nextElement() );
1038 else if ( key.equals( "gui_checkbox_text_color" ) ) {
1039 _gui_checkbox_text_color = Color.decode( ( String ) st.nextElement() );
1041 else if ( key.equals( "gui_checkbox_and_button_active_color" ) ) {
1042 _gui_checkbox_and_button_active_color = Color.decode( ( String ) st.nextElement() );
1044 else if ( key.equals( "gui_button_text_color" ) ) {
1045 _gui_button_text_color = Color.decode( ( String ) st.nextElement() );
1047 else if ( key.equals( "gui_button_background_color" ) ) {
1048 _gui_button_background_color = Color.decode( ( String ) st.nextElement() );
1050 else if ( key.equals( "gui_menu_background_color" ) ) {
1051 _gui_menu_background_color = Color.decode( ( String ) st.nextElement() );
1053 else if ( key.equals( "gui_menu_text_color" ) ) {
1054 _gui_menu_text_color = Color.decode( ( String ) st.nextElement() );
1056 else if ( key.equals( "gui_button_border_color" ) ) {
1057 _gui_button_border_color = Color.decode( ( String ) st.nextElement() );
1059 else if ( key.equals( "domain_structure_font_color" ) ) {
1060 _domain_structure_font_color = Color.decode( ( String ) st.nextElement() );
1062 else if ( key.equals( "domain_structure_base_color" ) ) {
1063 _domain_structure_base_color = Color.decode( ( String ) st.nextElement() );
1066 else if ( key.equals( "default_node_size" ) ) {
1067 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
1068 setDefaultNodeShapeSize( i );
1070 else if ( key.equals( "default_node_fill" ) ) {
1071 final String fill_str = ( ( String ) st.nextElement() ).trim();
1072 if ( fill_str.equalsIgnoreCase( Options.NodeFill.NONE.toString() ) ) {
1073 setDefaultNodeFill( NodeFill.NONE );
1075 else if ( fill_str.equalsIgnoreCase( Options.NodeFill.GRADIENT.toString() ) ) {
1076 setDefaultNodeFill( NodeFill.GRADIENT );
1078 else if ( fill_str.equalsIgnoreCase( Options.NodeFill.SOLID.toString() ) ) {
1079 setDefaultNodeFill( NodeFill.SOLID );
1082 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + fill_str
1083 + "] for [default_node_fill]" );
1086 else if ( key.equals( "default_node_shape" ) ) {
1087 final String shape_str = ( ( String ) st.nextElement() ).trim();
1088 if ( shape_str.equalsIgnoreCase( Options.NodeShape.NONE.toString() ) ) {
1089 setDefaultNodeShape( NodeShape.NONE );
1091 else if ( shape_str.equalsIgnoreCase( Options.NodeShape.CIRCLE.toString() ) ) {
1092 setDefaultNodeShape( NodeShape.CIRCLE );
1094 else if ( shape_str.equalsIgnoreCase( Options.NodeShape.RECTANGLE.toString() ) ) {
1095 setDefaultNodeShape( NodeShape.RECTANGLE );
1098 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + shape_str
1099 + "] for [default_node_shape]" );
1102 else if ( key.equals( "taxonomy_colorize_node_shapes" ) ) {
1103 setTaxonomyColorizeNodeShapesInsteadOfLabels( parseBoolean( ( String ) st.nextElement() ) );
1105 else if ( st.countTokens() >= 2 ) { // counts the tokens that are not
1108 if ( key.equals( "use_real_br_lengths" ) || key.equals( "phylogram" ) ) {
1109 key_index = Configuration.display_as_phylogram;
1110 if ( key.equals( "use_real_br_lengths" ) ) {
1112 .printWarningMessage( Constants.PRG_NAME,
1113 "configuration key [use_real_br_lengths] is deprecated, use [phylogram] instead" );
1116 else if ( key.equals( "rollover" ) ) {
1117 key_index = Configuration.node_data_popup;
1119 else if ( key.equals( "color_according_to_species" ) ) {
1120 key_index = Configuration.color_according_to_species;
1122 else if ( key.equals( "show_node_names" ) ) {
1123 key_index = Configuration.show_node_names;
1125 else if ( key.equals( "show_taxonomy" ) || key.equals( "show_taxonomy_code" ) ) {
1126 key_index = Configuration.show_tax_code;
1127 if ( key.equals( "show_taxonomy" ) ) {
1129 .printWarningMessage( Constants.PRG_NAME,
1130 "configuration key [show_taxonomy] is deprecated, use [show_taxonomy_code] instead" );
1133 else if ( key.equals( "write_br_length_values" ) ) {
1134 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1135 "configuration key [write_br_length_values] is deprecated" );
1136 key_index = DEPRECATED;
1138 else if ( key.equals( "write_bootstrap_values" ) || key.equals( "write_confidence_values" ) ) {
1139 key_index = Configuration.write_confidence_values;
1140 if ( key.equals( "write_bootstrap_values" ) ) {
1142 .printWarningMessage( Constants.PRG_NAME,
1143 "configuration key [write_bootstrap_values] is deprecated, use [write_confidence_values] instead" );
1146 else if ( key.equals( "write_events" ) || key.equals( "write_dup_spec" ) ) {
1147 key_index = Configuration.write_events;
1148 if ( key.equals( "write_dup_spec" ) ) {
1150 .printWarningMessage( Constants.PRG_NAME,
1151 "configuration key [write_dup_spec] is deprecated, use [write_events] instead" );
1154 else if ( key.equals( "color_branches" ) ) {
1155 key_index = Configuration.color_branches;
1157 else if ( key.equals( "width_branches" ) ) {
1158 key_index = Configuration.width_branches;
1160 else if ( key.equals( "color_orthologous" ) ) {
1161 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1162 "configuration key [color_orthologous] is deprecated" );
1164 else if ( key.equals( "color_subtree_neighbors" ) ) {
1165 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1166 "configuration key [color_subtree_neighbors] is deprecated" );
1168 else if ( key.equals( "color_super_orthologous" ) ) {
1169 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1170 "configuration key [color_super_orthologous] is deprecated" );
1172 else if ( key.equals( "mark_nodes_with_box" ) ) {
1173 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1174 "configuration key [mark_nodes_with_box] is deprecated" );
1175 key_index = DEPRECATED;
1177 else if ( key.equals( "show_domain_architectures" ) ) {
1178 key_index = Configuration.show_domain_architectures;
1180 else if ( key.equals( "show_annotations" ) ) {
1181 key_index = Configuration.show_annotation;
1183 else if ( key.equals( "show_binary_characters" ) ) {
1184 key_index = Configuration.show_binary_characters;
1186 else if ( key.equals( "show_binary_character_counts" ) ) {
1187 key_index = Configuration.show_binary_character_counts;
1189 else if ( key.equals( "show_gene_names" ) ) {
1190 key_index = Configuration.show_gene_names;
1192 else if ( key.equals( "show_gene_symbols" ) ) {
1193 key_index = Configuration.show_gene_symbols;
1195 else if ( key.equals( "show_sequence_acc" ) ) {
1196 key_index = Configuration.show_sequence_acc;
1198 else if ( key.equals( "show_node_ids" ) ) {
1200 .printWarningMessage( Constants.PRG_NAME, "configuration key [show_node_ids] is deprecated" );
1201 key_index = DEPRECATED;
1203 else if ( key.equals( "display_internal_data" ) ) {
1204 key_index = Configuration.display_internal_data;
1206 else if ( key.equals( "dynamically_hide_data" ) ) {
1207 key_index = Configuration.dynamically_hide_data;
1209 else if ( key.equals( "show_taxonomy_names" ) ) {
1210 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1211 "configuration key [show_taxonomy_names] is deprecated" );
1212 key_index = DEPRECATED;
1214 else if ( key.equals( "show_taxonomy_scientific_names" ) ) {
1215 key_index = Configuration.show_taxonomy_scientific_names;
1217 else if ( key.equals( "show_taxonomy_common_names" ) ) {
1218 key_index = Configuration.show_taxonomy_common_names;
1220 else if ( key.equals( "show_taxonomy_images" ) ) {
1221 key_index = Configuration.show_taxonomy_images;
1223 else if ( key.equals( "color_according_to_annotation" ) ) {
1224 key_index = Configuration.color_according_to_annotation;
1226 else if ( key.equals( "show_property" ) ) {
1227 key_index = Configuration.show_property;
1229 else if ( key.equals( "show_vector_data" ) ) {
1230 key_index = Configuration.show_vector_data;
1232 else if ( key.equals( "show_relation_confidence" ) ) {
1233 key_index = Configuration.show_relation_confidence;
1235 // If we've found the key, set the values
1236 if ( key_index >= 0 ) {
1237 display_options[ key_index ][ 1 ] = ( String ) st.nextElement();
1238 display_options[ key_index ][ 2 ] = ( String ) st.nextElement();
1239 // otherwise, keep looking
1242 if ( key_index == DEPRECATED ) {
1245 else if ( key.equals( "click_to" ) ) {
1246 final String click_to_name = ( String ) st.nextElement();
1247 key_index = getClickToIndex( click_to_name );
1248 if ( key_index >= 0 ) {
1249 clickto_options[ key_index ][ 1 ] = ( String ) st.nextElement();
1251 else if ( key_index == DEPRECATED ) {
1255 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown click-to option: "
1259 else if ( key.equals( "species_color" ) ) {
1260 getSpeciesColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1262 else if ( key.equals( "domain_color" ) ) {
1263 getDomainColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1265 else if ( key.equals( "annotation_color" ) ) {
1266 getAnnotationColors()
1267 .put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1269 else if ( key.equals( "function_color" ) ) {
1270 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1271 "configuration key [function_color] is deprecated" );
1273 else if ( key.equals( DISPLAY_COLOR_KEY ) ) {
1274 getDisplayColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1276 else if ( key.equals( WEB_LINK_KEY ) ) {
1277 if ( st.countTokens() == 3 ) {
1278 createWebLink( ( String ) st.nextElement(),
1279 ( String ) st.nextElement(),
1280 ( String ) st.nextElement() );
1283 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1284 "illegal format in configuration file for key [" + key + "]" );
1288 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown configuration key [" + key
1289 + "] in: " + config_filename );
1294 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown configuration key [" + key + "] in: "
1295 + config_filename );
1299 private void setMinConfidenceValue( final double min_confidence_value ) {
1300 _min_confidence_value = min_confidence_value;
1303 void setNodeLabelDirection( final NODE_LABEL_DIRECTION node_label_direction ) {
1304 _node_label_direction = node_label_direction;
1307 private void setNumberOfDigitsAfterCommaForBranchLengthValue( final short _number_of_digits_after_comma_for_branch_length_values ) {
1308 this._number_of_digits_after_comma_for_branch_length_values = _number_of_digits_after_comma_for_branch_length_values;
1311 private void setNumberOfDigitsAfterCommaForConfidenceValues( final short _number_of_digits_after_comma_for_confidence_values ) {
1312 this._number_of_digits_after_comma_for_confidence_values = _number_of_digits_after_comma_for_confidence_values;
1315 private void setOvMaxHeight( final short ov_max_height ) {
1316 _ov_max_height = ov_max_height;
1319 private void setOvMaxWidth( final short ov_max_width ) {
1320 _ov_max_width = ov_max_width;
1323 private void setOvPlacement( final OVERVIEW_PLACEMENT_TYPE ov_placement ) {
1324 _ov_placement = ov_placement;
1327 void setPhylogenyGraphicsType( final PHYLOGENY_GRAPHICS_TYPE phylogeny_graphics_type ) {
1328 _phylogeny_graphics_type = phylogeny_graphics_type;
1331 private void setPrintLineWidth( final float print_line_width ) {
1332 _print_line_width = print_line_width;
1335 private void setReplaceUnderscoresInNhParsing( final boolean nh_parsing_replace_underscores ) {
1336 _nh_parsing_replace_underscores = nh_parsing_replace_underscores;
1339 private void setShowBranchLengthValues( final boolean show_branch_length_values ) {
1340 _show_branch_length_values = show_branch_length_values;
1343 private void setShowOverview( final boolean show_overview ) {
1344 _show_overview = show_overview;
1347 private void setShowScale( final boolean show_scale ) {
1348 _show_scale = show_scale;
1351 private void setValidatePhyloXmlAgainstSchema( final boolean validate_against_phyloxml_xsd_schema ) {
1352 _validate_against_phyloxml_xsd_schema = validate_against_phyloxml_xsd_schema;
1355 void setWebLinks( final SortedMap<String, WebLink> weblinks ) {
1356 _weblinks = weblinks;
1359 static String getDefaultFontFamilyName() {
1360 return DEFAULT_FONT_FAMILY;
1363 static enum TRIPLET {
1364 TRUE, FALSE, UNKNOWN
1367 public Color getDomainStructureFontColor() {
1368 return _domain_structure_font_color;
1371 public Color getDomainStructureBaseColor() {
1372 return _domain_structure_base_color;
1375 public boolean isColorLabelsSameAsParentBranch() {
1376 return _color_labels_same_as_parent_branch;
1379 public boolean isShowDomainLabels() {
1380 return _show_domain_labels;
1383 public boolean isAbbreviateScientificTaxonNames() {
1384 return _abbreviate_scientific_names;
1387 public NodeShape getDefaultNodeShape() {
1388 return _default_node_shape;
1391 private void setDefaultNodeShape( final NodeShape default_node_shape ) {
1392 _default_node_shape = default_node_shape;
1395 private void setDefaultNodeFill( final NodeFill default_node_fill ) {
1396 _default_node_fill = default_node_fill;
1399 public NodeFill getDefaultNodeFill() {
1400 return _default_node_fill;
1403 private void setDefaultNodeShapeSize( final short default_node_shape_size ) {
1404 _default_node_shape_size = default_node_shape_size;
1407 public short getDefaultNodeShapeSize() {
1408 return _default_node_shape_size;
1411 private void setTaxonomyColorizeNodeShapesInsteadOfLabels( final boolean taxonomy_colorize_node_shapes_instead_of_labels ) {
1412 _taxonomy_colorize_node_shapes_instead_of_labels = taxonomy_colorize_node_shapes_instead_of_labels;
1415 public boolean isTaxonomyColorizeNodeShapesInsteadOfLabels() {
1416 return _taxonomy_colorize_node_shapes_instead_of_labels;