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.OVERVIEW_PLACEMENT_TYPE;
49 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
50 import org.forester.phylogeny.data.NodeVisualization;
51 import org.forester.phylogeny.data.NodeVisualization.NodeFill;
52 import org.forester.phylogeny.data.NodeVisualization.NodeShape;
53 import org.forester.util.ForesterUtil;
55 public final class Configuration {
58 NATIVE, CROSSPLATFORM, NIMBUS, UNKNOWN
60 static final String VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA = "validate_against_phyloxml_xsd_schema";
61 private static final String WEB_LINK_KEY = "web_link";
62 private static final String DISPLAY_COLOR_KEY = "display_color";
63 private static final int DEPRECATED = -2;
64 private UI _ui = UI.UNKNOWN;
65 private boolean _use_tabbed_display = false;
66 private boolean _hide_controls_and_menus = false;
67 private CLADOGRAM_TYPE _cladogram_type = Constants.CLADOGRAM_TYPE_DEFAULT;
68 private SortedMap<String, WebLink> _weblinks = null;
69 private SortedMap<String, Color> _display_colors = null;
70 private boolean _antialias_screen = true;
71 private PHYLOGENY_GRAPHICS_TYPE _phylogeny_graphics_type = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR;
72 private String _base_font_family_name = "";
73 private int _base_font_size = -1;
74 private int _graphics_export_x = -1;
75 private int _graphics_export_y = -1;
76 private short _ov_max_width = 80;
77 private short _ov_max_height = 80;
78 private OVERVIEW_PLACEMENT_TYPE _ov_placement = OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT;
79 private double _min_confidence_value = Options.MIN_CONFIDENCE_DEFAULT;
80 private float _print_line_width = Constants.PDF_LINE_WIDTH_DEFAULT;
81 private boolean _show_scale = false;
82 private boolean _show_branch_length_values = false;
83 private boolean _show_overview = true;
84 private short _number_of_digits_after_comma_for_confidence_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_CONFIDENCE_VALUES_DEFAULT;
85 private short _number_of_digits_after_comma_for_branch_length_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_BRANCH_LENGTH_VALUES_DEFAULT;
86 private boolean _editable = true;
87 private boolean _nh_parsing_replace_underscores = false;
88 private boolean _nh_parsing_extract_pfam_taxonomy_codes = false;
89 private boolean _internal_number_are_confidence_for_nh_parsing = false;
90 private boolean _display_sequence_relations = false;
91 private boolean _validate_against_phyloxml_xsd_schema = Constants.VALIDATE_AGAINST_PHYLOXML_XSD_SCJEMA_DEFAULT;
92 private boolean _background_color_gradient = false;
93 private boolean _show_domain_labels = true;
94 private boolean _abbreviate_scientific_names = false;
95 private boolean _color_labels_same_as_parent_branch = false;
96 private int _default_bootstrap_samples = -1;
97 private boolean _show_default_node_shapes = false;
98 private NodeShape _default_node_shape = NodeShape.CIRCLE;
99 private NodeFill _default_node_fill = NodeFill.GRADIENT;
100 private short _default_node_shape_size = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
101 private boolean _taxonomy_colorize_node_shapes = false;
102 final static int display_as_phylogram = 0;
103 final static int show_node_names = 1;
104 final static int show_tax_code = 2;
105 final static int show_annotation = 3;
106 final static int write_confidence_values = 4;
107 final static int write_events = 5;
108 final static int color_according_to_species = 6;
109 final static int color_branches = 7;
110 final static int width_branches = 8;
111 final static int show_custom_node_shapes = 9;
112 final static int show_domain_architectures = 10;
113 final static int show_binary_characters = 11;
114 final static int show_binary_character_counts = 12;
115 final static int show_gene_names = 13;
116 final static int show_sequence_acc = 14;
117 final static int display_internal_data = 15;
118 final static int dynamically_hide_data = 16;
119 final static int show_taxonomy_scientific_names = 17;
120 final static int show_taxonomy_common_names = 18;
121 final static int color_according_to_annotation = 19;
122 final static int show_property = 20;
123 final static int show_gene_symbols = 21;
124 final static int node_data_popup = 22;
125 final static int show_relation_confidence = 23;
126 final static int show_vector_data = 24;
127 final static int show_taxonomy_images = 25;
128 // ------------------
130 // ------------------
131 final static int display_node_data = 0;
132 final static int collapse_uncollapse = 1;
133 final static int reroot = 2;
134 final static int subtree = 3;
135 final static int swap = 4;
136 final static int color_subtree = 5;
137 final static int open_seq_web = 6;
138 final static int open_tax_web = 7;
139 final static int cut_subtree = 8;
140 final static int copy_subtree = 9;
141 final static int paste_subtree = 10;
142 final static int delete_subtree_or_node = 11;
143 final static int add_new_node = 12;
144 final static int edit_node_data = 13;
145 final static int blast = 14;
146 // ---------------------------
147 // Display options for trees
148 // ---------------------------
149 // ---------------------------------
150 // Pertaining to the config itself
151 // ---------------------------------
152 // Full path to config (may be URL)
153 String config_filename;
154 String default_config_filename = Constants.DEFAULT_CONFIGURATION_FILE_NAME;
155 final static String display_options[][] = {
156 { "Phylogram", "display", "?" }, { "Node Name", "display", "yes" }, { "Taxonomy Code", "display", "yes" },
157 { "Annotation", "nodisplay", "no" }, { "Confidence Value", "display", "?" }, { "Event", "display", "?" },
158 { "Taxonomy Colorize", "display", "yes" }, { "Colorize Branches", "display", "no" },
159 { "Use Branch-Widths", "display", "no" }, { "Show Custom Nodes", "display", "yes" },
160 { "Domains", "nodisplay", "no" }, { "Binary Characters", "nodisplay", "no" },
161 { "Binary Char Counts", "nodisplay", "no" }, { "Prot/Gene Name", "display", "yes" },
162 { "Prot/Gene Acc", "display", "no" }, { "Show Internal Data", "display", "yes" },
163 { "Dyna Hide", "display", "yes" }, { "Taxonomy Scientific", "display", "yes" },
164 { "Taxonomy Common", "display", "no" }, { "Annotation Colorize", "nodisplay", "no" },
165 { "Property", "nodisplay", "no" }, { "Prot/Gene Symbol", "display", "yes" },
166 { "Rollover", "display", "yes" }, { "Relation Confidence", "display", "no" },
167 { "Vector Data", "display", "no" }, { "Taxonomy Images", "display", "no" } };
168 final static String clickto_options[][] = {
169 { "Display Node Data", "display" }, { "Collapse/Uncollapse", "display" }, { "Root/Reroot", "display" },
170 { "Sub/Super Tree", "display" }, { "Swap Descendants", "display" }, { "Colorize Subtree", "display" },
171 { "Open Sequence Web", "display" }, { "Open Taxonomy Web", "display" }, { "Cut Subtree", "display" },
172 { "Copy Subtree", "display" }, { "Paste Subtree", "display" }, { "Delete Subtree/Node", "display" },
173 { "Add New Node", "display" }, { "Edit Node Data", "display" }, { "Blast", "nodisplay" } };
174 // This option is selected in the dropdown
175 int default_clickto = Configuration.display_node_data;
179 TreeColorSet tree_color_set;
183 TreeFontSet tree_font_set;
187 private static Hashtable<String, Color> _species_colors;
191 private static Hashtable<String, Color> _domain_colors;
195 private static Hashtable<String, Color> _annotation_colors;
196 boolean verbose = Constants.VERBOSE_DEFAULT;
197 private NODE_LABEL_DIRECTION _node_label_direction = NODE_LABEL_DIRECTION.HORIZONTAL;
198 private Color _gui_background_color = Constants.GUI_BACKGROUND_DEFAULT;
199 private Color _gui_checkbox_text_color = Constants.CHECKBOX_TEXT_COLOR_DEFAULT;
200 private Color _gui_checkbox_and_button_active_color = Constants.CHECKBOX_AND_BUTTON_ACTIVE_COLOR_DEFAULT;
201 private Color _gui_button_text_color = Constants.BUTTON_TEXT_COLOR_DEFAULT;
202 private Color _gui_button_background_color = Constants.BUTTON_BACKGROUND_COLOR_DEFAULT;
203 private Color _gui_menu_background_color = Constants.MENU_BACKGROUND_COLOR_DEFAULT;
204 private Color _gui_menu_text_color = Constants.MENU_TEXT_COLOR_DEFAULT;
205 private Color _gui_button_border_color = Constants.BUTTON_BORDER_COLOR_DEFAULT;
206 private Color _domain_structure_font_color = Constants.DOMAIN_STRUCTURE_FONT_COLOR_DEFAULT;
207 private Color _domain_structure_base_color = Constants.DOMAIN_STRUCTURE_BASE_COLOR_DEFAULT;
208 private static String DEFAULT_FONT_FAMILY = "";
210 for( final String font_name : Constants.DEFAULT_FONT_CHOICES ) {
211 if ( Arrays.binarySearch( Util.getAvailableFontFamiliesSorted(), font_name ) >= 0 ) {
212 DEFAULT_FONT_FAMILY = font_name;
216 if ( ForesterUtil.isEmpty( DEFAULT_FONT_FAMILY ) ) {
217 DEFAULT_FONT_FAMILY = Constants.DEFAULT_FONT_CHOICES[ Constants.DEFAULT_FONT_CHOICES.length - 1 ];
221 public Configuration( final String cf, final boolean is_url, final boolean is_applet ) {
222 if ( ForesterUtil.isEmpty( cf ) ) {
223 config_filename = default_config_filename;
226 config_filename = cf;
228 setWebLinks( new TreeMap<String, WebLink>() );
229 setDisplayColors( new TreeMap<String, Color>() );
230 config_filename = config_filename.trim();
233 // If URL, open accordingly
235 u = new URL( config_filename );
237 final InputStreamReader isr = new InputStreamReader( u.openStream() );
238 final BufferedReader bf = new BufferedReader( isr );
241 ForesterUtil.programMessage( Constants.PRG_NAME, "successfully read from configuration url ["
242 + config_filename + "]" );
244 catch ( final Exception e ) {
245 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "failed to read configuration from ["
246 + config_filename + "]: " + e.getLocalizedMessage() );
249 catch ( final Exception e ) {
250 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "cannot find or open configuration url ["
251 + config_filename + "]" );
255 // Otherwise, open as a file
256 File f = new File( config_filename );
258 f = new File( config_filename + ".txt" );
260 if ( f.exists() && f.canRead() ) {
262 final BufferedReader bf = new BufferedReader( new FileReader( f ) );
266 catch ( final Exception e ) {
267 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "failed to read configuration from ["
268 + config_filename + "]: " + e );
272 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "cannot find or open configuration file ["
273 + config_filename + "]" );
278 private void createWebLink( final String url_str, final String desc, final String source_identifier ) {
279 WebLink weblink = null;
282 weblink = new WebLink( new URL( url_str.trim() ), desc.trim(), source_identifier.trim() );
284 catch ( final MalformedURLException e ) {
285 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not create URL from [" + url_str + "]" );
288 if ( !ex && ( weblink != null ) ) {
289 getWebLinks().put( weblink.getSourceIdentifier().toLowerCase(), weblink );
293 Color getGuiBackgroundColor() {
294 return _gui_background_color;
297 Color getGuiCheckboxTextColor() {
298 return _gui_checkbox_text_color;
301 Color getGuiCheckboxAndButtonActiveColor() {
302 return _gui_checkbox_and_button_active_color;
305 Color getGuiButtonTextColor() {
306 return _gui_button_text_color;
309 Color getGuiButtonBackgroundColor() {
310 return _gui_button_background_color;
313 Color getGuiMenuBackgroundColor() {
314 return _gui_menu_background_color;
317 Color getGuiMenuTextColor() {
318 return _gui_menu_text_color;
321 Color getGuiButtonBorderColor() {
322 return _gui_button_border_color;
325 boolean displaySequenceRelations() {
326 return _display_sequence_relations;
329 boolean doCheckOption( final int which ) {
330 return ( display_options[ which ][ 2 ].equalsIgnoreCase( "yes" ) )
331 || ( display_options[ which ][ 2 ].equalsIgnoreCase( "true" ) );
334 boolean doDisplayClickToOption( final int which ) {
335 return clickto_options[ which ][ 1 ].equalsIgnoreCase( "display" );
338 boolean doDisplayOption( final int which ) {
339 return display_options[ which ][ 1 ].equalsIgnoreCase( "display" );
343 * Will attempt to use the phylogeny to determine whether to check
344 * this or not (e.g. phylogram)
347 boolean doGuessCheckOption( final int which ) {
348 return display_options[ which ][ 2 ].equals( "?" );
351 Map<String, Color> getAnnotationColors() {
352 if ( _annotation_colors == null ) {
353 _annotation_colors = new Hashtable<String, Color>();
355 return _annotation_colors;
358 public String getBaseFontFamilyName() {
359 return _base_font_family_name;
362 int getBaseFontSize() {
363 return _base_font_size;
366 CLADOGRAM_TYPE getCladogramType() {
367 return _cladogram_type;
370 private int getClickToIndex( final String name ) {
372 if ( name.equals( "edit_info" ) ) {
373 index = Configuration.display_node_data;
375 .printWarningMessage( Constants.PRG_NAME,
376 "configuration key [edit_info] is deprecated, use [display node data] instead" );
378 else if ( name.equals( "display_node_data" ) ) {
379 index = Configuration.display_node_data;
381 else if ( name.equals( "collapse_uncollapse" ) ) {
382 index = Configuration.collapse_uncollapse;
384 else if ( name.equals( "reroot" ) ) {
385 index = Configuration.reroot;
387 else if ( name.equals( "subtree" ) ) {
388 index = Configuration.subtree;
390 else if ( name.equals( "swap" ) ) {
391 index = Configuration.swap;
393 else if ( name.equals( "display_sequences" ) ) {
395 .printWarningMessage( Constants.PRG_NAME, "configuration key [display_sequences] is deprecated" );
398 else if ( name.equals( "open_seq_web" ) ) {
399 index = Configuration.open_seq_web;
401 else if ( name.equals( "open_tax_web" ) ) {
402 index = Configuration.open_tax_web;
404 else if ( name.equals( "cut_subtree" ) ) {
405 index = Configuration.cut_subtree;
407 else if ( name.equals( "copy_subtree" ) ) {
408 index = Configuration.copy_subtree;
410 else if ( name.equals( "paste_subtree" ) ) {
411 index = Configuration.paste_subtree;
413 else if ( name.equals( "delete" ) ) {
414 index = Configuration.delete_subtree_or_node;
416 else if ( name.equals( "add_new_node" ) ) {
417 index = Configuration.add_new_node;
419 else if ( name.equals( "edit_node_data" ) ) {
420 index = Configuration.edit_node_data;
422 else if ( name.equals( "display_node_popup" ) ) {
423 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
424 "configuration key [display_node_popup] is deprecated" );
427 else if ( name.equals( "custom_option" ) ) {
428 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "configuration key [custom_option] is deprecated" );
431 else if ( name.equals( "color_subtree" ) ) {
432 index = Configuration.color_subtree;
434 else if ( name.equals( "go_to_swiss_prot" ) ) {
435 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "configuration key [go_to_swiss_prot] is deprecated" );
441 int getClickToOptionsCount() {
442 return clickto_options.length;
445 String getClickToTitle( final int which ) {
446 return clickto_options[ which ][ 0 ];
449 int getDefaultDisplayClicktoOption() {
450 return default_clickto;
453 SortedMap<String, Color> getDisplayColors() {
454 return _display_colors;
457 String getDisplayTitle( final int which ) {
458 return display_options[ which ][ 0 ];
461 Map<String, Color> getDomainColors() {
462 if ( _domain_colors == null ) {
463 _domain_colors = new Hashtable<String, Color>();
465 return _domain_colors;
468 int getGraphicsExportX() {
469 return _graphics_export_x;
472 int getGraphicsExportY() {
473 return _graphics_export_y;
476 public int getDefaultBootstrapSamples() {
477 return _default_bootstrap_samples;
480 double getMinConfidenceValue() {
481 return _min_confidence_value;
484 NODE_LABEL_DIRECTION getNodeLabelDirection() {
485 return _node_label_direction;
488 short getNumberOfDigitsAfterCommaForBranchLengthValues() {
489 return _number_of_digits_after_comma_for_branch_length_values;
492 short getNumberOfDigitsAfterCommaForConfidenceValues() {
493 return _number_of_digits_after_comma_for_confidence_values;
496 short getOvMaxHeight() {
497 return _ov_max_height;
500 short getOvMaxWidth() {
501 return _ov_max_width;
504 OVERVIEW_PLACEMENT_TYPE getOvPlacement() {
505 return _ov_placement;
508 PHYLOGENY_GRAPHICS_TYPE getPhylogenyGraphicsType() {
509 return _phylogeny_graphics_type;
512 float getPrintLineWidth() {
513 return _print_line_width;
516 Hashtable<String, Color> getSpeciesColors() {
517 if ( _species_colors == null ) {
518 _species_colors = new Hashtable<String, Color>();
520 return _species_colors;
523 TreeColorSet getTreeColorSet() {
527 TreeFontSet getTreeFontSet() {
531 WebLink getWebLink( final String source ) {
532 return getWebLinks().get( source );
535 Map<String, WebLink> getWebLinks() {
539 boolean isAntialiasScreen() {
540 return _antialias_screen;
543 public boolean isBackgroundColorGradient() {
544 return _background_color_gradient;
548 * Convenience method.
550 * @return true if value in configuration file was 'yes'
552 boolean isDrawAsPhylogram() {
553 return doCheckOption( display_as_phylogram );
556 boolean isEditable() {
560 boolean isExtractPfamTaxonomyCodesInNhParsing() {
561 return _nh_parsing_extract_pfam_taxonomy_codes;
564 boolean isHasWebLink( final String source ) {
565 return getWebLinks().containsKey( source );
569 * Only used by ArchaeoptryxE.
572 boolean isHideControlPanelAndMenubar() {
573 return _hide_controls_and_menus;
576 boolean isInternalNumberAreConfidenceForNhParsing() {
577 return _internal_number_are_confidence_for_nh_parsing;
580 boolean isReplaceUnderscoresInNhParsing() {
581 return _nh_parsing_replace_underscores;
584 boolean isShowBranchLengthValues() {
585 return _show_branch_length_values;
588 boolean isShowOverview() {
589 return _show_overview;
592 boolean isShowScale() {
596 final boolean isUseNativeUI() {
597 if ( ( _ui == UI.UNKNOWN ) && Util.isMac() && Util.isJava15() ) {
600 return _ui == UI.NATIVE;
604 * Only used by ArchaeoptryxE.
607 boolean isUseTabbedDisplay() {
608 return _use_tabbed_display;
611 boolean isValidatePhyloXmlAgainstSchema() {
612 return _validate_against_phyloxml_xsd_schema;
615 private boolean parseBoolean( final String str ) {
616 final String my_str = str.trim().toLowerCase();
617 if ( my_str.equals( "yes" ) || my_str.equals( "true" ) ) {
620 else if ( my_str.equals( "no" ) || my_str.equals( "false" ) ) {
624 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse boolean value from [" + str + "]" );
629 private double parseDouble( final String str ) {
632 d = Double.parseDouble( str );
634 catch ( final Exception e ) {
635 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse double from [" + str + "]" );
641 private float parseFloat( final String str ) {
644 f = Float.parseFloat( str );
646 catch ( final Exception e ) {
647 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse float from [" + str + "]" );
653 private int parseInt( final String str ) {
656 i = Integer.parseInt( str );
658 catch ( final Exception e ) {
659 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse integer from [" + str + "]" );
665 private short parseShort( final String str ) {
668 i = Short.parseShort( str );
670 catch ( final Exception e ) {
671 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse short from [" + str + "]" );
677 private void processFontFamily( final StringTokenizer st ) {
678 setBaseFontFamilyName( "" );
679 final String font_str = ( ( String ) st.nextElement() ).trim();
680 final String[] fonts = font_str.split( ",+" );
681 for( String font : fonts ) {
682 font = font.replace( '_', ' ' ).trim();
683 if ( Arrays.binarySearch( Util.getAvailableFontFamiliesSorted(), font ) >= 0 ) {
684 setBaseFontFamilyName( font );
691 * read each line of config file, process non-comment lines
692 * @throws IOException
694 private void readConfig( final BufferedReader conf_in ) throws IOException {
697 line = conf_in.readLine();
698 if ( line != null ) {
700 // skip comments and blank lines
701 if ( !line.startsWith( "#" ) && ( !ForesterUtil.isEmpty( line ) ) ) {
702 // convert runs of spaces to tabs
703 line = line.replaceAll( "\\s+", "\t" );
704 final StringTokenizer st = new StringTokenizer( line, "\t" );
708 } while ( line != null );
711 private void setAntialiasScreen( final boolean antialias_screen ) {
712 _antialias_screen = antialias_screen;
715 public void setBackgroundColorGradient( final boolean background_color_gradient ) {
716 _background_color_gradient = background_color_gradient;
719 private void setBaseFontFamilyName( final String base_font_family_name ) {
720 _base_font_family_name = base_font_family_name;
723 private void setBaseFontSize( final int base_font_size ) {
724 _base_font_size = base_font_size;
727 private void setShowDomainLabels( final boolean show_domain_labels ) {
728 _show_domain_labels = show_domain_labels;
731 private void setAbbreviateScientificTaxonNames( final boolean abbreviate_scientific_names ) {
732 _abbreviate_scientific_names = abbreviate_scientific_names;
735 private void setColorLabelsSameAsParentBranch( final boolean color_labels_same_as_parent_branch ) {
736 _color_labels_same_as_parent_branch = color_labels_same_as_parent_branch;
739 private void setCladogramType( final CLADOGRAM_TYPE cladogram_type ) {
740 _cladogram_type = cladogram_type;
743 void setDisplayColors( final SortedMap<String, Color> display_colors ) {
744 _display_colors = display_colors;
747 private void setDisplaySequenceRelations( final boolean display_sequence_relations ) {
748 _display_sequence_relations = display_sequence_relations;
751 private void setEditable( final boolean editable ) {
752 _editable = editable;
755 private void setExtractPfamTaxonomyCodesInNhParsing( final boolean nh_parsing_extract_pfam_taxonomy_codes ) {
756 _nh_parsing_extract_pfam_taxonomy_codes = nh_parsing_extract_pfam_taxonomy_codes;
759 private void setGraphicsExportX( final int graphics_export_x ) {
760 _graphics_export_x = graphics_export_x;
763 private void setGraphicsExportY( final int graphics_export_y ) {
764 _graphics_export_y = graphics_export_y;
767 private void setDefaultBootstrapSamples( final int default_bootstrap_samples ) {
768 _default_bootstrap_samples = default_bootstrap_samples;
771 private void setInternalNumberAreConfidenceForNhParsing( final boolean internal_number_are_confidence_for_nh_parsing ) {
772 _internal_number_are_confidence_for_nh_parsing = internal_number_are_confidence_for_nh_parsing;
776 * Set a key-value(s) tuple
778 private void setKeyValue( final StringTokenizer st ) {
779 String key = ( String ) st.nextElement();
780 key = key.replace( ':', ' ' );
782 key = key.toLowerCase();
783 // Handle single value settings first:
784 if ( key.equals( "default_click_to" ) ) {
785 final String clickto_name = ( String ) st.nextElement();
786 default_clickto = getClickToIndex( clickto_name );
787 if ( default_clickto == -1 ) {
788 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "invalid value [" + clickto_name
789 + "] for [default_click_to]" );
792 else if ( default_clickto == DEPRECATED ) {
796 else if ( key.equals( "native_ui" ) ) {
797 final String my_str = ( ( String ) st.nextElement() ).trim().toLowerCase();
798 if ( my_str.equals( "yes" ) || my_str.equals( "true" ) ) {
801 else if ( my_str.equals( "no" ) || my_str.equals( "false" ) ) {
802 _ui = UI.CROSSPLATFORM;
804 else if ( my_str.equals( "?" ) ) {
808 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse yes/no/? value from [" + my_str
813 else if ( key.equals( VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA ) ) {
814 setValidatePhyloXmlAgainstSchema( parseBoolean( ( String ) st.nextElement() ) );
816 else if ( key.equals( "antialias_screen" ) ) {
817 setAntialiasScreen( parseBoolean( ( String ) st.nextElement() ) );
819 else if ( key.equals( "phylogeny_graphics_type" ) ) {
820 final String type_str = ( ( String ) st.nextElement() ).trim();
821 if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CONVEX.toString() ) ) {
822 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CONVEX );
824 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CURVED.toString() ) ) {
825 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CURVED );
827 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE.toString() ) ) {
828 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE );
830 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.ROUNDED.toString() ) ) {
831 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.ROUNDED );
833 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR.toString() ) ) {
834 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
836 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR.toString() ) ) {
837 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR );
839 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.UNROOTED.toString() ) ) {
840 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.UNROOTED );
842 else if ( type_str.equalsIgnoreCase( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR.toString() ) ) {
843 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR );
846 setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
847 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
848 + "] for [phylogeny_graphics_type]" );
851 else if ( key.equals( "min_confidence_value" ) ) {
852 final String mcv_str = ( ( String ) st.nextElement() ).trim();
853 final double d = parseDouble( mcv_str );
854 setMinConfidenceValue( d );
856 else if ( key.equals( "font_family" ) ) {
857 processFontFamily( st );
859 else if ( key.equals( "font_size" ) ) {
860 final String size_str = ( ( String ) st.nextElement() ).trim();
861 final int i = parseInt( size_str );
862 setBaseFontSize( i );
864 else if ( key.equals( "graphics_export_x" ) ) {
865 final String str = ( ( String ) st.nextElement() ).trim();
866 final int i = parseInt( str );
867 setGraphicsExportX( i );
869 else if ( key.equals( "graphics_export_y" ) ) {
870 final String str = ( ( String ) st.nextElement() ).trim();
871 final int i = parseInt( str );
872 setGraphicsExportY( i );
874 else if ( key.equals( "pdf_export_line_width" ) ) {
875 final String str = ( ( String ) st.nextElement() ).trim();
876 final float f = parseFloat( str );
878 setPrintLineWidth( f );
881 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
882 "value for [pdf_export_line_width] cannot be zero or negative" );
885 else if ( key.equals( "default_number_of_bootstrap_resamples" ) ) {
886 final String str = ( ( String ) st.nextElement() ).trim();
887 final int i = parseInt( str );
889 setDefaultBootstrapSamples( i );
893 .printWarningMessage( Constants.PRG_NAME,
894 "value for [default_number_of_bootstrap_resamples] cannot be negative" );
897 else if ( key.equals( "show_scale" ) ) {
898 setShowScale( parseBoolean( ( String ) st.nextElement() ) );
900 else if ( key.equals( "show_overview" ) ) {
901 setShowOverview( parseBoolean( ( String ) st.nextElement() ) );
903 else if ( key.equals( "show_branch_length_values" ) ) {
904 setShowBranchLengthValues( parseBoolean( ( String ) st.nextElement() ) );
906 else if ( key.equals( "background_gradient" ) ) {
907 setBackgroundColorGradient( parseBoolean( ( String ) st.nextElement() ) );
909 else if ( key.equals( "color_labels_same_as_branch_length_values" ) ) {
910 setColorLabelsSameAsParentBranch( parseBoolean( ( String ) st.nextElement() ) );
912 else if ( key.equals( "show_domain_labels" ) ) {
913 setShowDomainLabels( parseBoolean( ( String ) st.nextElement() ) );
915 else if ( key.equals( "abbreviate_scientific_names" ) ) {
916 setAbbreviateScientificTaxonNames( parseBoolean( ( String ) st.nextElement() ) );
918 else if ( key.equals( "cladogram_type" ) ) {
919 final String type_str = ( ( String ) st.nextElement() ).trim();
920 if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.NON_LINED_UP.toString() ) ) {
921 setCladogramType( Options.CLADOGRAM_TYPE.NON_LINED_UP );
923 else if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.EXT_NODE_SUM_DEP.toString() ) ) {
924 setCladogramType( Options.CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
926 else if ( type_str.equalsIgnoreCase( Options.CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP.toString() ) ) {
927 setCladogramType( Options.CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
930 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
931 + "] for [cladogram_type]" );
934 else if ( key.equals( "non_lined_up_cladogram" ) ) {
936 .printWarningMessage( Constants.PRG_NAME,
937 "configuration key [non_lined_up_cladogram] is deprecated, use [cladogram_type] instead" );
939 else if ( key.equals( "hide_controls_and_menus" ) ) {
940 _hide_controls_and_menus = parseBoolean( ( String ) st.nextElement() );
942 else if ( key.equals( "use_tabbed_display" ) ) {
943 _use_tabbed_display = parseBoolean( ( String ) st.nextElement() );
945 else if ( key.equals( "overview_width" ) ) {
946 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
949 else if ( key.equals( "overview_height" ) ) {
950 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
953 else if ( key.equals( "overview_placement_type" ) ) {
954 final String type_str = ( ( String ) st.nextElement() ).trim();
955 if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT.toTag() ) ) {
956 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
958 else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.UPPER_RIGHT.toTag() ) ) {
959 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_RIGHT );
961 else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.LOWER_LEFT.toTag() ) ) {
962 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.LOWER_LEFT );
964 else if ( type_str.equalsIgnoreCase( OVERVIEW_PLACEMENT_TYPE.LOWER_RIGHT.toTag() ) ) {
965 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.LOWER_RIGHT );
968 setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
969 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
970 + "] for [overview_placement_type]" );
973 else if ( key.equals( "node_label_direction" ) ) {
974 final String type_str = ( ( String ) st.nextElement() ).trim();
975 if ( type_str.equalsIgnoreCase( NODE_LABEL_DIRECTION.HORIZONTAL.toString() ) ) {
976 setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
978 else if ( type_str.equalsIgnoreCase( NODE_LABEL_DIRECTION.RADIAL.toString() ) ) {
979 setNodeLabelDirection( NODE_LABEL_DIRECTION.RADIAL );
982 setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
983 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
984 + "] for [node_label_direction]" );
987 else if ( key.equals( "branch_length_value_digits" ) ) {
988 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
990 setNumberOfDigitsAfterCommaForBranchLengthValue( i );
993 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "illegal value [" + i
994 + "] for [branch_length_value_digits]" );
997 else if ( key.equals( "confidence_value_digits" ) ) {
998 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
1000 setNumberOfDigitsAfterCommaForConfidenceValues( i );
1003 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "illegal value [" + i
1004 + "] for [confidence_value_digits]" );
1007 else if ( key.equals( "allow_editing" ) ) {
1008 setEditable( parseBoolean( ( String ) st.nextElement() ) );
1010 else if ( key.equals( "display_sequence_relations" ) ) {
1011 setDisplaySequenceRelations( parseBoolean( ( String ) st.nextElement() ) );
1013 else if ( key.equals( "replace_underscores_in_nh_parsing" ) ) {
1014 final boolean r = parseBoolean( ( String ) st.nextElement() );
1015 if ( r && isExtractPfamTaxonomyCodesInNhParsing() ) {
1017 .printWarningMessage( Constants.PRG_NAME,
1018 "attempt to extract taxonomies and replace underscores at the same time" );
1021 setReplaceUnderscoresInNhParsing( r );
1024 else if ( key.equals( "extract_taxonomy_codes_in_nh_parsing" ) ) {
1025 final boolean e = parseBoolean( ( String ) st.nextElement() );
1026 if ( e && isReplaceUnderscoresInNhParsing() ) {
1028 .printWarningMessage( Constants.PRG_NAME,
1029 "attempt to extract taxonomies and replace underscores at the same time" );
1032 setExtractPfamTaxonomyCodesInNhParsing( e );
1035 else if ( key.equals( "internal_labels_are_confidence_values" ) ) {
1036 setInternalNumberAreConfidenceForNhParsing( parseBoolean( ( String ) st.nextElement() ) );
1038 else if ( key.equals( "gui_background_color" ) ) {
1039 _gui_background_color = Color.decode( ( String ) st.nextElement() );
1041 else if ( key.equals( "gui_checkbox_text_color" ) ) {
1042 _gui_checkbox_text_color = Color.decode( ( String ) st.nextElement() );
1044 else if ( key.equals( "gui_checkbox_and_button_active_color" ) ) {
1045 _gui_checkbox_and_button_active_color = Color.decode( ( String ) st.nextElement() );
1047 else if ( key.equals( "gui_button_text_color" ) ) {
1048 _gui_button_text_color = Color.decode( ( String ) st.nextElement() );
1050 else if ( key.equals( "gui_button_background_color" ) ) {
1051 _gui_button_background_color = Color.decode( ( String ) st.nextElement() );
1053 else if ( key.equals( "gui_menu_background_color" ) ) {
1054 _gui_menu_background_color = Color.decode( ( String ) st.nextElement() );
1056 else if ( key.equals( "gui_menu_text_color" ) ) {
1057 _gui_menu_text_color = Color.decode( ( String ) st.nextElement() );
1059 else if ( key.equals( "gui_button_border_color" ) ) {
1060 _gui_button_border_color = Color.decode( ( String ) st.nextElement() );
1062 else if ( key.equals( "domain_structure_font_color" ) ) {
1063 _domain_structure_font_color = Color.decode( ( String ) st.nextElement() );
1065 else if ( key.equals( "domain_structure_base_color" ) ) {
1066 _domain_structure_base_color = Color.decode( ( String ) st.nextElement() );
1068 else if ( key.equals( "show_default_node_shapes" ) ) {
1069 setShowDefaultNodeShapes( parseBoolean( ( ( String ) st.nextElement() ).trim() ) );
1071 else if ( key.equals( "default_node_size" ) ) {
1072 final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
1073 setDefaultNodeShapeSize( i );
1075 else if ( key.equals( "default_node_fill" ) ) {
1076 final String fill_str = ( ( String ) st.nextElement() ).trim();
1077 if ( fill_str.equalsIgnoreCase( NodeVisualization.NodeFill.NONE.toString() ) ) {
1078 setDefaultNodeFill( NodeFill.NONE );
1080 else if ( fill_str.equalsIgnoreCase( NodeVisualization.NodeFill.GRADIENT.toString() ) ) {
1081 setDefaultNodeFill( NodeFill.GRADIENT );
1083 else if ( fill_str.equalsIgnoreCase( NodeVisualization.NodeFill.SOLID.toString() ) ) {
1084 setDefaultNodeFill( NodeFill.SOLID );
1087 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + fill_str
1088 + "] for [default_node_fill]" );
1091 else if ( key.equals( "default_node_shape" ) ) {
1092 final String shape_str = ( ( String ) st.nextElement() ).trim();
1093 if ( shape_str.equalsIgnoreCase( NodeVisualization.NodeShape.CIRCLE.toString() ) ) {
1094 setDefaultNodeShape( NodeShape.CIRCLE );
1096 else if ( shape_str.equalsIgnoreCase( NodeVisualization.NodeShape.RECTANGLE.toString() ) ) {
1097 setDefaultNodeShape( NodeShape.RECTANGLE );
1100 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + shape_str
1101 + "] for [default_node_shape]" );
1104 else if ( key.equals( "taxonomy_colorize_node_shapes" ) ) {
1105 setTaxonomyColorizeNodeShapes( parseBoolean( ( String ) st.nextElement() ) );
1107 else if ( st.countTokens() >= 2 ) { // counts the tokens that are not
1110 if ( key.equals( "use_real_br_lengths" ) || key.equals( "phylogram" ) ) {
1111 key_index = Configuration.display_as_phylogram;
1112 if ( key.equals( "use_real_br_lengths" ) ) {
1114 .printWarningMessage( Constants.PRG_NAME,
1115 "configuration key [use_real_br_lengths] is deprecated, use [phylogram] instead" );
1118 else if ( key.equals( "rollover" ) ) {
1119 key_index = Configuration.node_data_popup;
1121 else if ( key.equals( "color_according_to_species" ) ) {
1122 key_index = Configuration.color_according_to_species;
1124 else if ( key.equals( "show_node_names" ) ) {
1125 key_index = Configuration.show_node_names;
1127 else if ( key.equals( "show_taxonomy" ) || key.equals( "show_taxonomy_code" ) ) {
1128 key_index = Configuration.show_tax_code;
1129 if ( key.equals( "show_taxonomy" ) ) {
1131 .printWarningMessage( Constants.PRG_NAME,
1132 "configuration key [show_taxonomy] is deprecated, use [show_taxonomy_code] instead" );
1135 else if ( key.equals( "write_br_length_values" ) ) {
1136 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1137 "configuration key [write_br_length_values] is deprecated" );
1138 key_index = DEPRECATED;
1140 else if ( key.equals( "write_bootstrap_values" ) || key.equals( "write_confidence_values" ) ) {
1141 key_index = Configuration.write_confidence_values;
1142 if ( key.equals( "write_bootstrap_values" ) ) {
1144 .printWarningMessage( Constants.PRG_NAME,
1145 "configuration key [write_bootstrap_values] is deprecated, use [write_confidence_values] instead" );
1148 else if ( key.equals( "write_events" ) || key.equals( "write_dup_spec" ) ) {
1149 key_index = Configuration.write_events;
1150 if ( key.equals( "write_dup_spec" ) ) {
1152 .printWarningMessage( Constants.PRG_NAME,
1153 "configuration key [write_dup_spec] is deprecated, use [write_events] instead" );
1156 else if ( key.equals( "color_branches" ) ) {
1157 key_index = Configuration.color_branches;
1159 else if ( key.equals( "width_branches" ) ) {
1160 key_index = Configuration.width_branches;
1162 else if ( key.equals( "color_orthologous" ) ) {
1163 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1164 "configuration key [color_orthologous] is deprecated" );
1166 else if ( key.equals( "color_subtree_neighbors" ) ) {
1167 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1168 "configuration key [color_subtree_neighbors] is deprecated" );
1170 else if ( key.equals( "color_super_orthologous" ) ) {
1171 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1172 "configuration key [color_super_orthologous] is deprecated" );
1174 else if ( key.equals( "mark_nodes_with_box" ) ) {
1175 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1176 "configuration key [mark_nodes_with_box] is deprecated" );
1177 key_index = DEPRECATED;
1179 else if ( key.equals( "show_domain_architectures" ) ) {
1180 key_index = Configuration.show_domain_architectures;
1182 else if ( key.equals( "show_annotations" ) ) {
1183 key_index = Configuration.show_annotation;
1185 else if ( key.equals( "show_binary_characters" ) ) {
1186 key_index = Configuration.show_binary_characters;
1188 else if ( key.equals( "show_binary_character_counts" ) ) {
1189 key_index = Configuration.show_binary_character_counts;
1191 else if ( key.equals( "show_gene_names" ) ) {
1192 key_index = Configuration.show_gene_names;
1194 else if ( key.equals( "show_gene_symbols" ) ) {
1195 key_index = Configuration.show_gene_symbols;
1197 else if ( key.equals( "show_sequence_acc" ) ) {
1198 key_index = Configuration.show_sequence_acc;
1200 else if ( key.equals( "show_node_ids" ) ) {
1202 .printWarningMessage( Constants.PRG_NAME, "configuration key [show_node_ids] is deprecated" );
1203 key_index = DEPRECATED;
1205 else if ( key.equals( "display_internal_data" ) ) {
1206 key_index = Configuration.display_internal_data;
1208 else if ( key.equals( "dynamically_hide_data" ) ) {
1209 key_index = Configuration.dynamically_hide_data;
1211 else if ( key.equals( "show_taxonomy_names" ) ) {
1212 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1213 "configuration key [show_taxonomy_names] is deprecated" );
1214 key_index = DEPRECATED;
1216 else if ( key.equals( "show_taxonomy_scientific_names" ) ) {
1217 key_index = Configuration.show_taxonomy_scientific_names;
1219 else if ( key.equals( "show_taxonomy_common_names" ) ) {
1220 key_index = Configuration.show_taxonomy_common_names;
1222 else if ( key.equals( "show_taxonomy_images" ) ) {
1223 key_index = Configuration.show_taxonomy_images;
1225 else if ( key.equals( "color_according_to_annotation" ) ) {
1226 key_index = Configuration.color_according_to_annotation;
1228 else if ( key.equals( "show_property" ) ) {
1229 key_index = Configuration.show_property;
1231 else if ( key.equals( "show_vector_data" ) ) {
1232 key_index = Configuration.show_vector_data;
1234 else if ( key.equals( "show_relation_confidence" ) ) {
1235 key_index = Configuration.show_relation_confidence;
1237 else if ( key.equals( "show_custom_node_shapes" ) ) {
1238 key_index = Configuration.show_custom_node_shapes;
1240 // If we've found the key, set the values
1241 if ( key_index >= 0 ) {
1242 display_options[ key_index ][ 1 ] = ( String ) st.nextElement();
1243 display_options[ key_index ][ 2 ] = ( String ) st.nextElement();
1244 // otherwise, keep looking
1247 if ( key_index == DEPRECATED ) {
1250 else if ( key.equals( "click_to" ) ) {
1251 final String click_to_name = ( String ) st.nextElement();
1252 key_index = getClickToIndex( click_to_name );
1253 if ( key_index >= 0 ) {
1254 clickto_options[ key_index ][ 1 ] = ( String ) st.nextElement();
1256 else if ( key_index == DEPRECATED ) {
1260 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown click-to option: "
1264 else if ( key.equals( "species_color" ) ) {
1265 getSpeciesColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1267 else if ( key.equals( "domain_color" ) ) {
1268 getDomainColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1270 else if ( key.equals( "annotation_color" ) ) {
1271 getAnnotationColors()
1272 .put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1274 else if ( key.equals( "function_color" ) ) {
1275 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1276 "configuration key [function_color] is deprecated" );
1278 else if ( key.equals( DISPLAY_COLOR_KEY ) ) {
1279 getDisplayColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
1281 else if ( key.equals( WEB_LINK_KEY ) ) {
1282 if ( st.countTokens() == 3 ) {
1283 createWebLink( ( String ) st.nextElement(),
1284 ( String ) st.nextElement(),
1285 ( String ) st.nextElement() );
1288 ForesterUtil.printWarningMessage( Constants.PRG_NAME,
1289 "illegal format in configuration file for key [" + key + "]" );
1293 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown configuration key [" + key
1294 + "] in: " + config_filename );
1299 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown configuration key [" + key + "] in: "
1300 + config_filename );
1304 private void setMinConfidenceValue( final double min_confidence_value ) {
1305 _min_confidence_value = min_confidence_value;
1308 void setNodeLabelDirection( final NODE_LABEL_DIRECTION node_label_direction ) {
1309 _node_label_direction = node_label_direction;
1312 private void setNumberOfDigitsAfterCommaForBranchLengthValue( final short _number_of_digits_after_comma_for_branch_length_values ) {
1313 this._number_of_digits_after_comma_for_branch_length_values = _number_of_digits_after_comma_for_branch_length_values;
1316 private void setNumberOfDigitsAfterCommaForConfidenceValues( final short _number_of_digits_after_comma_for_confidence_values ) {
1317 this._number_of_digits_after_comma_for_confidence_values = _number_of_digits_after_comma_for_confidence_values;
1320 private void setOvMaxHeight( final short ov_max_height ) {
1321 _ov_max_height = ov_max_height;
1324 private void setOvMaxWidth( final short ov_max_width ) {
1325 _ov_max_width = ov_max_width;
1328 private void setOvPlacement( final OVERVIEW_PLACEMENT_TYPE ov_placement ) {
1329 _ov_placement = ov_placement;
1332 void setPhylogenyGraphicsType( final PHYLOGENY_GRAPHICS_TYPE phylogeny_graphics_type ) {
1333 _phylogeny_graphics_type = phylogeny_graphics_type;
1336 private void setPrintLineWidth( final float print_line_width ) {
1337 _print_line_width = print_line_width;
1340 private void setReplaceUnderscoresInNhParsing( final boolean nh_parsing_replace_underscores ) {
1341 _nh_parsing_replace_underscores = nh_parsing_replace_underscores;
1344 private void setShowBranchLengthValues( final boolean show_branch_length_values ) {
1345 _show_branch_length_values = show_branch_length_values;
1348 private void setShowOverview( final boolean show_overview ) {
1349 _show_overview = show_overview;
1352 private void setShowScale( final boolean show_scale ) {
1353 _show_scale = show_scale;
1356 private void setValidatePhyloXmlAgainstSchema( final boolean validate_against_phyloxml_xsd_schema ) {
1357 _validate_against_phyloxml_xsd_schema = validate_against_phyloxml_xsd_schema;
1360 void setWebLinks( final SortedMap<String, WebLink> weblinks ) {
1361 _weblinks = weblinks;
1364 static String getDefaultFontFamilyName() {
1365 return DEFAULT_FONT_FAMILY;
1368 static enum TRIPLET {
1369 TRUE, FALSE, UNKNOWN
1372 public Color getDomainStructureFontColor() {
1373 return _domain_structure_font_color;
1376 public Color getDomainStructureBaseColor() {
1377 return _domain_structure_base_color;
1380 public boolean isColorLabelsSameAsParentBranch() {
1381 return _color_labels_same_as_parent_branch;
1384 public boolean isShowDomainLabels() {
1385 return _show_domain_labels;
1388 public boolean isAbbreviateScientificTaxonNames() {
1389 return _abbreviate_scientific_names;
1392 public NodeShape getDefaultNodeShape() {
1393 return _default_node_shape;
1396 private void setDefaultNodeShape( final NodeShape default_node_shape ) {
1397 _default_node_shape = default_node_shape;
1400 private void setDefaultNodeFill( final NodeFill default_node_fill ) {
1401 _default_node_fill = default_node_fill;
1404 public NodeFill getDefaultNodeFill() {
1405 return _default_node_fill;
1408 private void setDefaultNodeShapeSize( final short default_node_shape_size ) {
1409 _default_node_shape_size = default_node_shape_size;
1412 public short getDefaultNodeShapeSize() {
1413 return _default_node_shape_size;
1416 private void setTaxonomyColorizeNodeShapes( final boolean taxonomy_colorize_node_shapes ) {
1417 _taxonomy_colorize_node_shapes = taxonomy_colorize_node_shapes;
1420 public boolean isTaxonomyColorizeNodeShapes() {
1421 return _taxonomy_colorize_node_shapes;
1424 public boolean isShowDefaultNodeShapes() {
1425 return _show_default_node_shapes;
1428 private void setShowDefaultNodeShapes( final boolean show_default_node_shapes ) {
1429 _show_default_node_shapes = show_default_node_shapes;