2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
5 // Copyright (C) 2008-2010 Christian M. Zmasek
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 // Contact: phylosoft @ gmail . com
23 // WWW: www.phylosoft.org/forester
25 package org.forester.archaeopteryx;
27 import java.awt.Container;
29 import java.awt.event.ActionEvent;
30 import java.awt.event.ActionListener;
31 import java.io.IOException;
32 import java.util.List;
33 import java.util.Locale;
36 import javax.swing.JApplet;
37 import javax.swing.JCheckBoxMenuItem;
38 import javax.swing.JFrame;
39 import javax.swing.JMenu;
40 import javax.swing.JMenuBar;
41 import javax.swing.JMenuItem;
42 import javax.swing.JOptionPane;
43 import javax.swing.JRadioButtonMenuItem;
45 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
46 import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
47 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
48 import org.forester.phylogeny.Phylogeny;
49 import org.forester.util.ForesterConstants;
50 import org.forester.util.ForesterUtil;
52 public abstract class MainFrame extends JFrame implements ActionListener {
54 static final String USE_MOUSEWHEEL_SHIFT_TO_ROTATE = "In this display type, use mousewheel + Shift to rotate [or A and S]";
55 static final String PHYLOXML_REF_TOOL_TIP = Constants.PHYLOXML_REFERENCE; //TODO //FIXME
56 static final String APTX_REF_TOOL_TIP = Constants.APTX_REFERENCE;
57 private static final long serialVersionUID = 3655000897845508358L;
58 final static Font menu_font = new Font( Configuration.getDefaultFontFamilyName(),
61 static final String TYPE_MENU_HEADER = "Type";
62 static final String RECTANGULAR_TYPE_CBMI_LABEL = "Rectangular";
63 static final String EURO_TYPE_CBMI_LABEL = "Euro Type";
64 static final String CURVED_TYPE_CBMI_LABEL = "Curved";
65 static final String TRIANGULAR_TYPE_CBMI_LABEL = "Triangular";
66 static final String CONVEX_TYPE_CBMI_LABEL = "Convex";
67 static final String ROUNDED_TYPE_CBMI_LABEL = "Rounded";
68 static final String UNROOTED_TYPE_CBMI_LABEL = "Unrooted (alpha)"; //TODO
69 static final String CIRCULAR_TYPE_CBMI_LABEL = "Circular (alpha)"; //TODO
70 static final String OPTIONS_HEADER = "Options";
71 static final String SEARCH_SUBHEADER = "Search:";
72 static final String DISPLAY_SUBHEADER = "Display:";
73 static final String SEARCH_TERMS_ONLY_LABEL = "Match Complete Terms Only";
74 static final String SEARCH_CASE_SENSITIVE_LABEL = "Case Sensitive";
75 static final String INVERSE_SEARCH_RESULT_LABEL = "Negate Result";
76 static final String DISPLAY_BRANCH_LENGTH_VALUES_LABEL = "Display Branch Length Values";
77 static final String DISPLAY_SCALE_LABEL = "Display Scale";
78 static final String NON_LINED_UP_CLADOGRAMS_LABEL = "Non-Lined Up Cladograms";
79 static final String UNIFORM_CLADOGRAMS_LABEL = "Total Node Sum Dependent Cladograms";
80 static final String LABEL_DIRECTION_LABEL = "Radial Labels";
81 static final String LABEL_DIRECTION_TIP = "To use radial node labels in radial and unrooted display types";
82 static final String SCREEN_ANTIALIAS_LABEL = "Antialias";
83 static final String COLOR_LABELS_LABEL = "Colorize Labels Same as Parent Branch";
84 static final String BG_GRAD_LABEL = "Background Color Gradient";
85 static final String DISPLAY_NODE_BOXES_LABEL = "Display Node Shapes";
86 static final String SHOW_OVERVIEW_LABEL = "Show Overview";
87 static final String FONT_SIZE_MENU_LABEL = "Font Size";
88 static final String NONUNIFORM_CLADOGRAMS_LABEL = "External Node Sum Dependent Cladograms";
89 static final String SHOW_DOMAIN_LABELS_LABEL = "Show Domain Labels";
90 static final String COLOR_LABELS_TIP = "To use parent branch colors for node labels as well, need to turn off taxonomy dependent colorization and turn on branch colorization for this to become apparent";
91 static final String ABBREV_SN_LABEL = "Abbreviate Scientific Taxonomic Names";
92 static final String TAXONOMY_COLORIZE_NODE_SHAPES_LABEL = "Colorize Node Shapes According to Taxonomy";
93 static final String CYCLE_NODE_SHAPE_LABEL = "Cycle Node Shapes";
94 static final String CYCLE_NODE_FILL_LABEL = "Cycle Node Fill Type";
95 static final String CHOOSE_NODE_SIZE_LABEL = "Choose Node Shape Size";
100 JMenu _options_jmenu;
101 JMenu _font_size_menu;
103 JMenuItem[] _load_phylogeny_from_webservice_menu_items;
105 JMenuItem _open_item;
106 JMenuItem _open_url_item;
107 JMenuItem _save_item;
108 JMenuItem _save_all_item;
109 JMenuItem _close_item;
110 JMenuItem _exit_item;
113 JMenuItem _midpoint_root_item;
114 JMenuItem _taxcolor_item;
115 JMenuItem _confcolor_item;
116 JMenuItem _infer_common_sn_names_item;
117 JMenuItem _collapse_species_specific_subtrees;
118 JMenuItem _collapse_below_threshold; //TODO implememt me
119 JMenuItem _obtain_detailed_taxonomic_information_jmi;
120 JMenuItem _obtain_uniprot_seq_information_jmi;
121 JMenuItem _move_node_names_to_tax_sn_jmi;
122 JMenuItem _move_node_names_to_seq_names_jmi;
123 JMenuItem _extract_tax_code_from_node_names_jmi;
125 JMenuItem _super_tiny_fonts_item;
126 JMenuItem _tiny_fonts_item;
127 JMenuItem _small_fonts_item;
128 JMenuItem _medium_fonts_item;
129 JMenuItem _large_fonts_item;
131 // _ screen and print
132 JMenuItem _choose_font_mi;
133 JMenuItem _switch_colors_mi;
134 JCheckBoxMenuItem _label_direction_cbmi;
136 JCheckBoxMenuItem _screen_antialias_cbmi;
137 JCheckBoxMenuItem _background_gradient_cbmi;
138 JRadioButtonMenuItem _non_lined_up_cladograms_rbmi;
139 JRadioButtonMenuItem _uniform_cladograms_rbmi;
140 JRadioButtonMenuItem _ext_node_dependent_cladogram_rbmi;
141 JCheckBoxMenuItem _show_branch_length_values_cbmi;
142 JCheckBoxMenuItem _show_scale_cbmi; //TODO fix me
143 JCheckBoxMenuItem _show_overview_cbmi;
144 JCheckBoxMenuItem _show_domain_labels;
145 JCheckBoxMenuItem _abbreviate_scientific_names;
146 JCheckBoxMenuItem _color_labels_same_as_parent_branch;
147 JMenuItem _overview_placment_mi;
148 JMenuItem _choose_minimal_confidence_mi;
149 JCheckBoxMenuItem _show_default_node_shapes_cbmi;
150 JMenuItem _cycle_node_shape_mi;
151 JMenuItem _cycle_node_fill_mi;
152 JMenuItem _choose_node_size_mi;
153 JCheckBoxMenuItem _taxonomy_colorize_node_shapes_cbmi;
155 JCheckBoxMenuItem _graphics_export_visible_only_cbmi;
156 JCheckBoxMenuItem _antialias_print_cbmi;
157 JCheckBoxMenuItem _print_black_and_white_cbmi;
158 JCheckBoxMenuItem _print_using_actual_size_cbmi;
159 JCheckBoxMenuItem _graphics_export_using_actual_size_cbmi;
160 JMenuItem _print_size_mi;
161 JMenuItem _choose_pdf_width_mi;
163 JCheckBoxMenuItem _internal_number_are_confidence_for_nh_parsing_cbmi;
164 JCheckBoxMenuItem _extract_pfam_style_tax_codes_cbmi;
165 JCheckBoxMenuItem _replace_underscores_cbmi;
167 JCheckBoxMenuItem _search_case_senstive_cbmi;
168 JCheckBoxMenuItem _search_whole_words_only_cbmi;
169 JCheckBoxMenuItem _inverse_search_result_cbmi;
172 JCheckBoxMenuItem _rectangular_type_cbmi;
173 JCheckBoxMenuItem _triangular_type_cbmi;
174 JCheckBoxMenuItem _curved_type_cbmi;
175 JCheckBoxMenuItem _convex_type_cbmi;
176 JCheckBoxMenuItem _euro_type_cbmi;
177 JCheckBoxMenuItem _rounded_type_cbmi;
178 JCheckBoxMenuItem _unrooted_type_cbmi;
179 JCheckBoxMenuItem _circular_type_cbmi;
180 // view as text menu:
181 JMenuItem _view_as_NH_item;
182 JMenuItem _view_as_NHX_item;
183 JMenuItem _view_as_XML_item;
184 JMenuItem _view_as_nexus_item;
185 JMenuItem _display_basic_information_item;
187 JMenuItem _about_item;
188 JMenuItem _help_item;
189 JMenuItem _website_item;
190 JMenuItem _phyloxml_website_item;
191 JMenuItem _phyloxml_ref_item;
192 JMenuItem _aptx_ref_item;
193 // Handy pointers to child components:
194 MainPanel _mainpanel;
195 Container _contentpane;
196 TextFrame _textframe;
197 Configuration _configuration;
198 JMenuItem _remove_branch_color_item;
202 // Empty constructor.
208 public void actionPerformed( final ActionEvent e ) {
209 final Object o = e.getSource();
210 boolean is_applet = false;
211 JApplet applet = null;
212 if ( getCurrentTreePanel() != null ) {
213 is_applet = getCurrentTreePanel().isApplet();
215 applet = getCurrentTreePanel().obtainApplet();
218 if ( o == _open_url_item ) {
219 readPhylogeniesFromURL();
221 else if ( o == _exit_item ) {
224 else if ( o == _taxcolor_item ) {
227 else if ( o == _confcolor_item ) {
230 else if ( o == _infer_common_sn_names_item ) {
231 if ( isSubtreeDisplayed() ) {
234 if ( getCurrentTreePanel() != null ) {
235 getCurrentTreePanel().inferCommonPartOfScientificNames();
238 else if ( o == _collapse_species_specific_subtrees ) {
239 if ( isSubtreeDisplayed() ) {
242 if ( getCurrentTreePanel() != null ) {
243 getCurrentTreePanel().collapseSpeciesSpecificSubtrees();
246 else if ( o == _remove_branch_color_item ) {
247 if ( isSubtreeDisplayed() ) {
250 removeBranchColors();
252 else if ( o == _midpoint_root_item ) {
253 if ( isSubtreeDisplayed() ) {
258 else if ( o == _switch_colors_mi ) {
261 else if ( o == _display_basic_information_item ) {
262 displayBasicInformation();
264 else if ( o == _view_as_NH_item ) {
267 else if ( o == _view_as_NHX_item ) {
270 else if ( o == _view_as_XML_item ) {
273 else if ( o == _view_as_nexus_item ) {
276 else if ( o == _super_tiny_fonts_item ) {
277 if ( getCurrentTreePanel() != null ) {
278 getCurrentTreePanel().setSuperTinyFonts();
279 getCurrentTreePanel().repaint();
282 else if ( o == _tiny_fonts_item ) {
283 if ( getCurrentTreePanel() != null ) {
284 getCurrentTreePanel().setTinyFonts();
285 getCurrentTreePanel().repaint();
288 else if ( o == _small_fonts_item ) {
289 if ( getCurrentTreePanel() != null ) {
290 getCurrentTreePanel().setSmallFonts();
291 getCurrentTreePanel().repaint();
294 else if ( o == _medium_fonts_item ) {
295 if ( getCurrentTreePanel() != null ) {
296 getCurrentTreePanel().setMediumFonts();
297 getCurrentTreePanel().repaint();
300 else if ( o == _large_fonts_item ) {
301 if ( getCurrentTreePanel() != null ) {
302 getCurrentTreePanel().setLargeFonts();
303 getCurrentTreePanel().repaint();
306 else if ( o == _choose_font_mi ) {
309 else if ( o == _choose_minimal_confidence_mi ) {
310 chooseMinimalConfidence();
312 else if ( o == _overview_placment_mi ) {
313 MainFrame.cycleOverview( getOptions(), getCurrentTreePanel() );
315 else if ( o == _screen_antialias_cbmi ) {
316 updateOptions( getOptions() );
317 updateScreenTextAntialias( getMainPanel().getTreePanels() );
319 else if ( o == _background_gradient_cbmi ) {
320 updateOptions( getOptions() );
322 else if ( o == _show_domain_labels ) {
323 updateOptions( getOptions() );
325 else if ( o == _abbreviate_scientific_names ) {
326 updateOptions( getOptions() );
328 else if ( o == _color_labels_same_as_parent_branch ) {
329 updateOptions( getOptions() );
331 else if ( o == _show_default_node_shapes_cbmi ) {
332 updateOptions( getOptions() );
334 else if ( o == _taxonomy_colorize_node_shapes_cbmi ) {
335 updateOptions( getOptions() );
337 else if ( o == _non_lined_up_cladograms_rbmi ) {
338 updateOptions( getOptions() );
341 else if ( o == _uniform_cladograms_rbmi ) {
342 updateOptions( getOptions() );
345 else if ( o == _ext_node_dependent_cladogram_rbmi ) {
346 updateOptions( getOptions() );
349 else if ( o == _search_case_senstive_cbmi ) {
350 updateOptions( getOptions() );
351 getMainPanel().getControlPanel().search();
353 else if ( o == _search_whole_words_only_cbmi ) {
354 updateOptions( getOptions() );
355 getMainPanel().getControlPanel().search();
357 else if ( o == _inverse_search_result_cbmi ) {
358 updateOptions( getOptions() );
359 getMainPanel().getControlPanel().search();
361 else if ( o == _show_scale_cbmi ) {
362 updateOptions( getOptions() );
364 else if ( o == _show_branch_length_values_cbmi ) {
365 updateOptions( getOptions() );
367 else if ( o == _label_direction_cbmi ) {
368 updateOptions( getOptions() );
370 else if ( o == _show_overview_cbmi ) {
371 updateOptions( getOptions() );
372 if ( getCurrentTreePanel() != null ) {
373 getCurrentTreePanel().updateOvSizes();
376 else if ( ( o == _rectangular_type_cbmi ) || ( o == _triangular_type_cbmi ) || ( o == _curved_type_cbmi )
377 || ( o == _convex_type_cbmi ) || ( o == _euro_type_cbmi ) || ( o == _rounded_type_cbmi )
378 || ( o == _unrooted_type_cbmi ) || ( o == _circular_type_cbmi ) ) {
381 else if ( o == _about_item ) {
384 else if ( o == _help_item ) {
385 help( getConfiguration().getWebLinks() );
387 else if ( o == _website_item ) {
389 Util.openWebsite( Constants.APTX_WEB_SITE, is_applet, applet );
391 catch ( final IOException e1 ) {
392 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
395 else if ( o == _phyloxml_website_item ) {
397 Util.openWebsite( Constants.PHYLOXML_WEB_SITE, is_applet, applet );
399 catch ( final IOException e1 ) {
400 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
403 else if ( o == _aptx_ref_item ) {
405 Util.openWebsite( Constants.APTX_REFERENCE_URL, is_applet, applet );
407 catch ( final IOException e1 ) {
408 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
411 else if ( o == _phyloxml_ref_item ) {
413 Util.openWebsite( Constants.PHYLOXML_REFERENCE_URL, is_applet, applet );
415 catch ( final IOException e1 ) {
416 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
420 if ( _load_phylogeny_from_webservice_menu_items != null ) {
421 for( int i = 0; i < _load_phylogeny_from_webservice_menu_items.length; ++i ) {
422 if ( o == _load_phylogeny_from_webservice_menu_items[ i ] ) {
423 readPhylogeniesFromWebservice( i );
428 _contentpane.repaint();
431 boolean isSubtreeDisplayed() {
432 if ( getCurrentTreePanel() != null ) {
433 if ( getCurrentTreePanel().isCurrentTreeIsSubtree() ) {
435 .showMessageDialog( this,
436 "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.",
437 "Operation can not be exectuted on a sub-tree",
438 JOptionPane.WARNING_MESSAGE );
445 void activateSaveAllIfNeeded() {
446 if ( ( getMainPanel().getTabbedPane() != null ) && ( getMainPanel().getTabbedPane().getTabCount() > 1 ) ) {
447 _save_all_item.setEnabled( true );
450 _save_all_item.setEnabled( false );
454 void buildFileMenu() {
455 _file_jmenu = createMenu( "File", getConfiguration() );
456 _file_jmenu.add( _open_url_item = new JMenuItem( "Read tree from URL/webservice..." ) );
457 _file_jmenu.addSeparator();
458 _file_jmenu.add( _exit_item = new JMenuItem( "Exit" ) );
459 customizeJMenuItem( _open_url_item );
460 customizeJMenuItem( _exit_item );
461 _jmenubar.add( _file_jmenu );
464 void buildFontSizeMenu() {
465 _font_size_menu = createMenu( FONT_SIZE_MENU_LABEL, getConfiguration() );
466 _font_size_menu.add( _super_tiny_fonts_item = new JMenuItem( "Super Tiny Fonts" ) );
467 _font_size_menu.add( _tiny_fonts_item = new JMenuItem( "Tiny Fonts" ) );
468 _font_size_menu.add( _small_fonts_item = new JMenuItem( "Small Fonts" ) );
469 _font_size_menu.add( _medium_fonts_item = new JMenuItem( "Medium Fonts" ) );
470 _font_size_menu.add( _large_fonts_item = new JMenuItem( "Large Fonts" ) );
471 customizeJMenuItem( _super_tiny_fonts_item );
472 customizeJMenuItem( _tiny_fonts_item );
473 customizeJMenuItem( _small_fonts_item );
474 customizeJMenuItem( _medium_fonts_item );
475 customizeJMenuItem( _large_fonts_item );
476 _jmenubar.add( _font_size_menu );
479 void buildHelpMenu() {
480 _help_jmenu = createMenu( "Help", getConfiguration() );
481 _help_jmenu.add( _help_item = new JMenuItem( "Help" ) );
482 _help_jmenu.add( _website_item = new JMenuItem( "Archaeopteryx Home" ) );
483 _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" );
484 _help_jmenu.add( _phyloxml_website_item = new JMenuItem( "phyloXML Home" ) );
485 _help_jmenu.add( _phyloxml_ref_item = new JMenuItem( "phyloXML Reference" ) );
486 _help_jmenu.addSeparator();
487 _help_jmenu.add( _about_item = new JMenuItem( "About" ) );
488 customizeJMenuItem( _help_item );
489 customizeJMenuItem( _website_item );
490 customizeJMenuItem( _phyloxml_website_item );
491 customizeJMenuItem( _aptx_ref_item );
492 customizeJMenuItem( _phyloxml_ref_item );
493 customizeJMenuItem( _about_item );
494 _phyloxml_ref_item.setToolTipText( PHYLOXML_REF_TOOL_TIP );
495 _aptx_ref_item.setToolTipText( APTX_REF_TOOL_TIP );
496 _jmenubar.add( _help_jmenu );
499 void buildTypeMenu() {
500 _type_menu = createMenu( TYPE_MENU_HEADER, getConfiguration() );
501 _type_menu.add( _rectangular_type_cbmi = new JCheckBoxMenuItem( MainFrame.RECTANGULAR_TYPE_CBMI_LABEL ) );
502 _type_menu.add( _euro_type_cbmi = new JCheckBoxMenuItem( MainFrame.EURO_TYPE_CBMI_LABEL ) );
503 _type_menu.add( _rounded_type_cbmi = new JCheckBoxMenuItem( MainFrame.ROUNDED_TYPE_CBMI_LABEL ) );
504 _type_menu.add( _curved_type_cbmi = new JCheckBoxMenuItem( MainFrame.CURVED_TYPE_CBMI_LABEL ) );
505 _type_menu.add( _triangular_type_cbmi = new JCheckBoxMenuItem( MainFrame.TRIANGULAR_TYPE_CBMI_LABEL ) );
506 _type_menu.add( _convex_type_cbmi = new JCheckBoxMenuItem( MainFrame.CONVEX_TYPE_CBMI_LABEL ) );
507 _type_menu.add( _unrooted_type_cbmi = new JCheckBoxMenuItem( MainFrame.UNROOTED_TYPE_CBMI_LABEL ) );
508 _type_menu.add( _circular_type_cbmi = new JCheckBoxMenuItem( MainFrame.CIRCULAR_TYPE_CBMI_LABEL ) );
509 customizeCheckBoxMenuItem( _rectangular_type_cbmi, false );
510 customizeCheckBoxMenuItem( _triangular_type_cbmi, false );
511 customizeCheckBoxMenuItem( _euro_type_cbmi, false );
512 customizeCheckBoxMenuItem( _rounded_type_cbmi, false );
513 customizeCheckBoxMenuItem( _curved_type_cbmi, false );
514 customizeCheckBoxMenuItem( _convex_type_cbmi, false );
515 customizeCheckBoxMenuItem( _unrooted_type_cbmi, false );
516 customizeCheckBoxMenuItem( _circular_type_cbmi, false );
517 _unrooted_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
518 _circular_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
519 initializeTypeMenu( getOptions() );
520 _jmenubar.add( _type_menu );
523 void buildViewMenu() {
524 _view_jmenu = createMenu( "View", getConfiguration() );
525 _view_jmenu.add( _display_basic_information_item = new JMenuItem( "Display Basic Information" ) );
526 _view_jmenu.addSeparator();
527 _view_jmenu.add( _view_as_XML_item = new JMenuItem( "View as phyloXML" ) );
528 _view_jmenu.add( _view_as_NH_item = new JMenuItem( "View as Newick" ) );
529 _view_jmenu.add( _view_as_NHX_item = new JMenuItem( "View as NHX" ) );
530 _view_jmenu.add( _view_as_nexus_item = new JMenuItem( "View as Nexus" ) );
531 customizeJMenuItem( _display_basic_information_item );
532 customizeJMenuItem( _view_as_NH_item );
533 customizeJMenuItem( _view_as_NHX_item );
534 customizeJMenuItem( _view_as_XML_item );
535 customizeJMenuItem( _view_as_nexus_item );
536 _jmenubar.add( _view_jmenu );
539 private void chooseFont() {
540 final FontChooser fc = new FontChooser();
541 fc.setFont( getMainPanel().getTreeFontSet().getLargeFont() );
542 fc.showDialog( this, "Select the Base Font" );
543 getMainPanel().getTreeFontSet().setBaseFont( fc.getFont() );
546 private void chooseMinimalConfidence() {
547 final String s = ( String ) JOptionPane
548 .showInputDialog( this,
549 "Please enter the minimum for confidence values to be displayed.\n"
550 + "[current value: " + getOptions().getMinConfidenceValue() + "]\n",
551 "Minimal Confidence Value",
552 JOptionPane.QUESTION_MESSAGE,
555 getOptions().getMinConfidenceValue() );
556 if ( !ForesterUtil.isEmpty( s ) ) {
557 boolean success = true;
559 final String m_str = s.trim();
560 if ( !ForesterUtil.isEmpty( m_str ) ) {
562 m = Double.parseDouble( m_str );
564 catch ( final Exception ex ) {
571 if ( success && ( m >= 0.0 ) ) {
572 getOptions().setMinConfidenceValue( m );
579 if ( _mainpanel != null ) {
580 _mainpanel.terminate();
582 if ( _contentpane != null ) {
583 _contentpane.removeAll();
590 if ( _mainpanel.getCurrentTreePanel() != null ) {
591 _mainpanel.getCurrentTreePanel().confColor();
595 void customizeCheckBoxMenuItem( final JCheckBoxMenuItem item, final boolean is_selected ) {
596 if ( item != null ) {
597 item.setFont( MainFrame.menu_font );
598 if ( !getConfiguration().isUseNativeUI() ) {
599 item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
600 item.setForeground( getConfiguration().getGuiMenuTextColor() );
602 item.setSelected( is_selected );
603 item.addActionListener( this );
607 void customizeJMenuItem( final JMenuItem jmi ) {
609 jmi.setFont( MainFrame.menu_font );
610 if ( !getConfiguration().isUseNativeUI() ) {
611 jmi.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
612 jmi.setForeground( getConfiguration().getGuiMenuTextColor() );
614 jmi.addActionListener( this );
618 void customizeRadioButtonMenuItem( final JRadioButtonMenuItem item, final boolean is_selected ) {
619 if ( item != null ) {
620 item.setFont( MainFrame.menu_font );
621 if ( !getConfiguration().isUseNativeUI() ) {
622 item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
623 item.setForeground( getConfiguration().getGuiMenuTextColor() );
625 item.setSelected( is_selected );
626 item.addActionListener( this );
630 void exceptionOccuredDuringOpenFile( final Exception e ) {
632 _mainpanel.getCurrentTreePanel().setArrowCursor();
634 catch ( final Exception ex ) {
637 JOptionPane.showMessageDialog( this,
638 ForesterUtil.wordWrap( e.getLocalizedMessage(), 80 ),
639 "Error during File|Open",
640 JOptionPane.ERROR_MESSAGE );
643 void exceptionOccuredDuringSaveAs( final Exception e ) {
645 _mainpanel.getCurrentTreePanel().setArrowCursor();
647 catch ( final Exception ex ) {
650 JOptionPane.showMessageDialog( this, "Exception" + e, "Error during File|SaveAs", JOptionPane.ERROR_MESSAGE );
653 boolean GAndSDoHaveMoreThanOneSpeciesInComman( final Phylogeny gene_tree ) {
654 if ( ( gene_tree == null ) || gene_tree.isEmpty() ) {
655 JOptionPane.showMessageDialog( this,
656 "Gene tree and species tree have no species in common.",
658 JOptionPane.ERROR_MESSAGE );
661 else if ( gene_tree.getNumberOfExternalNodes() < 2 ) {
662 JOptionPane.showMessageDialog( this,
663 "Gene tree and species tree have only one species in common.",
665 JOptionPane.ERROR_MESSAGE );
673 public Configuration getConfiguration() {
674 return _configuration;
677 TreePanel getCurrentTreePanel() {
678 return getMainPanel().getCurrentTreePanel();
681 JMenu getHelpMenu() {
685 JCheckBoxMenuItem getlabelDirectionCbmi() {
686 return _label_direction_cbmi;
689 MainPanel getMainPanel() {
693 JMenuBar getMenuBarOfMainFrame() {
697 Options getOptions() {
701 void initializeTypeMenu( final Options options ) {
702 setTypeMenuToAllUnselected();
703 switch ( options.getPhylogenyGraphicsType() ) {
705 _convex_type_cbmi.setSelected( true );
708 _curved_type_cbmi.setSelected( true );
711 _euro_type_cbmi.setSelected( true );
714 _rounded_type_cbmi.setSelected( true );
717 _triangular_type_cbmi.setSelected( true );
720 _unrooted_type_cbmi.setSelected( true );
723 _circular_type_cbmi.setSelected( true );
726 _rectangular_type_cbmi.setSelected( true );
731 void midpointRoot() {
732 if ( _mainpanel.getCurrentTreePanel() != null ) {
733 _mainpanel.getCurrentTreePanel().midpointRoot();
737 abstract void readPhylogeniesFromURL();
739 void readPhylogeniesFromWebservice( final int i ) {
740 final UrlTreeReader reader = new UrlTreeReader( this, i );
741 new Thread( reader ).start();
744 private void removeBranchColors() {
745 if ( getMainPanel().getCurrentPhylogeny() != null ) {
746 Util.removeBranchColors( getMainPanel().getCurrentPhylogeny() );
750 void removeTextFrame() {
751 if ( _textframe != null ) {
757 void setConfiguration( final Configuration configuration ) {
758 _configuration = configuration;
761 void setOptions( final Options options ) {
765 void setSelectedTypeInTypeMenu( final PHYLOGENY_GRAPHICS_TYPE type ) {
766 setTypeMenuToAllUnselected();
769 _circular_type_cbmi.setSelected( true );
772 _convex_type_cbmi.setSelected( true );
775 _curved_type_cbmi.setSelected( true );
778 _euro_type_cbmi.setSelected( true );
781 _rounded_type_cbmi.setSelected( true );
784 _rectangular_type_cbmi.setSelected( true );
787 _triangular_type_cbmi.setSelected( true );
790 _unrooted_type_cbmi.setSelected( true );
793 throw new IllegalArgumentException( "unknown type: " + type );
797 void setTypeMenuToAllUnselected() {
798 _convex_type_cbmi.setSelected( false );
799 _curved_type_cbmi.setSelected( false );
800 _euro_type_cbmi.setSelected( false );
801 _rounded_type_cbmi.setSelected( false );
802 _triangular_type_cbmi.setSelected( false );
803 _rectangular_type_cbmi.setSelected( false );
804 _unrooted_type_cbmi.setSelected( false );
805 _circular_type_cbmi.setSelected( false );
808 public void showWhole() {
809 _mainpanel.getControlPanel().showWhole();
812 void switchColors() {
813 final TreeColorSet colorset = _mainpanel.getTreeColorSet();
814 final ColorSchemeChooser csc = new ColorSchemeChooser( getMainPanel(), colorset );
815 csc.setVisible( true );
819 if ( _mainpanel.getCurrentTreePanel() != null ) {
820 _mainpanel.getCurrentTreePanel().taxColor();
824 void typeChanged( final Object o ) {
825 updateTypeCheckboxes( getOptions(), o );
826 updateOptions( getOptions() );
827 if ( getCurrentTreePanel() != null ) {
828 final PHYLOGENY_GRAPHICS_TYPE previous_type = getCurrentTreePanel().getPhylogenyGraphicsType();
829 final PHYLOGENY_GRAPHICS_TYPE new_type = getOptions().getPhylogenyGraphicsType();
830 if ( ( ( previous_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) && ( new_type != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) )
831 || ( ( previous_type == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) && ( new_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) )
832 || ( ( previous_type != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) && ( new_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) )
833 || ( ( previous_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) && ( new_type == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) ) {
834 getCurrentTreePanel().getControlPanel().showWhole();
836 if ( getCurrentTreePanel().isPhyHasBranchLengths() && ( new_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
837 getCurrentTreePanel().getControlPanel().setDrawPhylogramEnabled( true );
840 getCurrentTreePanel().getControlPanel().setDrawPhylogramEnabled( false );
842 getCurrentTreePanel().setPhylogenyGraphicsType( getOptions().getPhylogenyGraphicsType() );
843 updateScreenTextAntialias( getMainPanel().getTreePanels() );
844 if ( getCurrentTreePanel().getControlPanel().getDynamicallyHideData() != null ) {
845 if ( new_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) {
846 getCurrentTreePanel().getControlPanel().getDynamicallyHideData().setEnabled( false );
849 getCurrentTreePanel().getControlPanel().getDynamicallyHideData().setEnabled( true );
855 void updateOptions( final Options options ) {
856 options.setAntialiasScreen( ( _screen_antialias_cbmi != null ) && _screen_antialias_cbmi.isSelected() );
857 options.setBackgroundColorGradient( ( _background_gradient_cbmi != null )
858 && _background_gradient_cbmi.isSelected() );
859 options.setShowDomainLabels( ( _show_domain_labels != null ) && _show_domain_labels.isSelected() );
860 options.setAbbreviateScientificTaxonNames( ( _abbreviate_scientific_names != null )
861 && _abbreviate_scientific_names.isSelected() );
862 options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )
863 && _color_labels_same_as_parent_branch.isSelected() );
865 options.setShowDefaultNodeShapes( ( _show_default_node_shapes_cbmi != null )
866 && _show_default_node_shapes_cbmi.isSelected() );
867 options.setTaxonomyColorizeNodeShapes( ( _taxonomy_colorize_node_shapes_cbmi != null )
868 && _taxonomy_colorize_node_shapes_cbmi.isSelected() );
870 if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {
871 options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );
873 else if ( ( _uniform_cladograms_rbmi != null ) && ( _uniform_cladograms_rbmi.isSelected() ) ) {
874 options.setCladogramType( CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
876 else if ( ( _ext_node_dependent_cladogram_rbmi != null ) && ( _ext_node_dependent_cladogram_rbmi.isSelected() ) ) {
877 options.setCladogramType( CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
879 options.setSearchCaseSensitive( ( _search_case_senstive_cbmi != null )
880 && _search_case_senstive_cbmi.isSelected() );
881 if ( ( _show_scale_cbmi != null ) && _show_scale_cbmi.isEnabled() ) {
882 options.setShowScale( _show_scale_cbmi.isSelected() );
884 if ( _label_direction_cbmi != null ) {
885 if ( _label_direction_cbmi.isSelected() ) {
886 options.setNodeLabelDirection( NODE_LABEL_DIRECTION.RADIAL );
889 options.setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
892 options.setShowOverview( ( _show_overview_cbmi != null ) && _show_overview_cbmi.isSelected() );
893 if ( ( _show_branch_length_values_cbmi != null ) && _show_branch_length_values_cbmi.isEnabled() ) {
894 options.setShowBranchLengthValues( _show_branch_length_values_cbmi.isSelected() );
896 options.setPrintUsingActualSize( ( _print_using_actual_size_cbmi != null )
897 && ( _print_using_actual_size_cbmi.isSelected() ) );
898 options.setGraphicsExportUsingActualSize( ( _graphics_export_using_actual_size_cbmi != null )
899 && ( _graphics_export_using_actual_size_cbmi.isSelected() ) );
900 options.setAntialiasPrint( ( _antialias_print_cbmi != null ) && _antialias_print_cbmi.isSelected() );
901 options.setPrintBlackAndWhite( ( _print_black_and_white_cbmi != null )
902 && _print_black_and_white_cbmi.isSelected() );
903 options.setInternalNumberAreConfidenceForNhParsing( ( _internal_number_are_confidence_for_nh_parsing_cbmi != null )
904 && _internal_number_are_confidence_for_nh_parsing_cbmi.isSelected() );
905 options.setExtractPfamTaxonomyCodesInNhParsing( ( _extract_pfam_style_tax_codes_cbmi != null )
906 && _extract_pfam_style_tax_codes_cbmi.isSelected() );
907 options.setReplaceUnderscoresInNhParsing( ( _replace_underscores_cbmi != null )
908 && _replace_underscores_cbmi.isSelected() );
909 options.setMatchWholeTermsOnly( ( _search_whole_words_only_cbmi != null )
910 && _search_whole_words_only_cbmi.isSelected() );
911 options.setInverseSearchResult( ( _inverse_search_result_cbmi != null )
912 && _inverse_search_result_cbmi.isSelected() );
913 if ( _graphics_export_visible_only_cbmi != null ) {
914 options.setGraphicsExportVisibleOnly( _graphics_export_visible_only_cbmi.isSelected() );
915 if ( _graphics_export_visible_only_cbmi.isSelected() && ( _graphics_export_using_actual_size_cbmi != null ) ) {
916 _graphics_export_using_actual_size_cbmi.setSelected( true );
917 _graphics_export_using_actual_size_cbmi.setEnabled( false );
920 _graphics_export_using_actual_size_cbmi.setEnabled( true );
923 if ( ( _rectangular_type_cbmi != null ) && _rectangular_type_cbmi.isSelected() ) {
924 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
926 else if ( ( _triangular_type_cbmi != null ) && _triangular_type_cbmi.isSelected() ) {
927 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR );
929 else if ( ( _curved_type_cbmi != null ) && _curved_type_cbmi.isSelected() ) {
930 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CURVED );
932 else if ( ( _convex_type_cbmi != null ) && _convex_type_cbmi.isSelected() ) {
933 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CONVEX );
935 else if ( ( _euro_type_cbmi != null ) && _euro_type_cbmi.isSelected() ) {
936 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE );
938 else if ( ( _rounded_type_cbmi != null ) && _rounded_type_cbmi.isSelected() ) {
939 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.ROUNDED );
941 else if ( ( _unrooted_type_cbmi != null ) && _unrooted_type_cbmi.isSelected() ) {
942 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.UNROOTED );
944 else if ( ( _circular_type_cbmi != null ) && _circular_type_cbmi.isSelected() ) {
945 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR );
949 void updateTypeCheckboxes( final Options options, final Object o ) {
950 setTypeMenuToAllUnselected();
951 ( ( JCheckBoxMenuItem ) o ).setSelected( true );
954 void displayBasicInformation() {
955 if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty() ) {
958 _textframe = TextFrame.instantiate( Util.crateBasicInformation( _mainpanel.getCurrentPhylogeny() ) );
963 if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty()
964 || ( _mainpanel.getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
967 _textframe = TextFrame.instantiate( _mainpanel.getCurrentPhylogeny().toNexus() );
972 if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty()
973 || ( _mainpanel.getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
976 _textframe = TextFrame.instantiate( _mainpanel.getCurrentPhylogeny().toNewHampshire( false ) );
981 if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty()
982 || ( _mainpanel.getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
985 _textframe = TextFrame.instantiate( _mainpanel.getCurrentPhylogeny().toNewHampshireX() );
990 if ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty()
991 && ( _mainpanel.getCurrentPhylogeny().getNumberOfExternalNodes() <= 10000 ) ) {
992 _textframe = TextFrame.instantiate( _mainpanel.getCurrentPhylogeny().toPhyloXML( 0 ) );
997 * Display the about box.
999 static void about() {
1000 final StringBuffer about = new StringBuffer( "Archaeopteryx\nVersion " + Constants.VERSION + "\n" );
1001 about.append( "Copyright (C) 2007-2011 Christian Zmasek\n" );
1002 about.append( "All Rights Reserved\n" );
1003 about.append( "License: GNU Lesser General Public License (LGPL)\n" );
1004 about.append( "Last modified: " + Constants.PRG_DATE + "\n" );
1005 about.append( "phyloXML version : " + ForesterConstants.PHYLO_XML_VERSION + "\n" );
1006 about.append( "phyloXML location: " + ForesterConstants.PHYLO_XML_LOCATION + "\n" );
1007 if ( !ForesterUtil.isEmpty( ForesterUtil.JAVA_VERSION ) && !ForesterUtil.isEmpty( ForesterUtil.JAVA_VENDOR ) ) {
1008 about.append( "[your Java version: " + ForesterUtil.JAVA_VERSION + " " + ForesterUtil.JAVA_VENDOR + "]\n" );
1010 if ( !ForesterUtil.isEmpty( ForesterUtil.OS_NAME ) && !ForesterUtil.isEmpty( ForesterUtil.OS_ARCH )
1011 && !ForesterUtil.isEmpty( ForesterUtil.OS_VERSION ) ) {
1012 about.append( "[your OS: " + ForesterUtil.OS_NAME + " " + ForesterUtil.OS_ARCH + " "
1013 + ForesterUtil.OS_VERSION + "]\n" );
1015 final Runtime rt = java.lang.Runtime.getRuntime();
1016 final long free_memory = rt.freeMemory() / 1000000;
1017 final long total_memory = rt.totalMemory() / 1000000;
1018 about.append( "[free memory: " + free_memory + "MB, total memory: " + total_memory + "MB]\n" );
1019 about.append( "[locale: " + Locale.getDefault() + "]\n" );
1020 about.append( "References:\n" );
1021 about.append( Constants.PHYLOXML_REFERENCE_SHORT + "\n" );
1022 about.append( "For more information & download:\n" );
1023 about.append( Constants.APTX_WEB_SITE + "\n" );
1024 about.append( "Comments: " + Constants.AUTHOR_EMAIL );
1025 JOptionPane.showMessageDialog( null, about, Constants.PRG_NAME, JOptionPane.PLAIN_MESSAGE );
1028 static String createCurrentFontDesc( final TreeFontSet tree_font_set ) {
1029 return tree_font_set.getLargeFont().getFamily() + " " + tree_font_set.getLargeFont().getSize();
1032 static JMenu createMenu( final String title, final Configuration conf ) {
1033 final JMenu jmenu = new JMenu( title );
1034 if ( !conf.isUseNativeUI() ) {
1035 jmenu.setFont( MainFrame.menu_font );
1036 jmenu.setBackground( conf.getGuiMenuBackgroundColor() );
1037 jmenu.setForeground( conf.getGuiMenuTextColor() );
1042 static JMenuItem customizeMenuItemAsLabel( final JMenuItem label, final Configuration configuration ) {
1043 label.setFont( MainFrame.menu_font.deriveFont( Font.BOLD ) );
1044 if ( !configuration.isUseNativeUI() ) {
1045 label.setBackground( configuration.getGuiMenuBackgroundColor() );
1046 label.setForeground( configuration.getGuiMenuTextColor() );
1047 label.setOpaque( true );
1049 label.setSelected( false );
1050 label.setEnabled( false );
1054 static void cycleOverview( final Options op, final TreePanel tree_panel ) {
1055 switch ( op.getOvPlacement() ) {
1057 op.setOvPlacement( Options.OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
1060 op.setOvPlacement( Options.OVERVIEW_PLACEMENT_TYPE.LOWER_LEFT );
1063 op.setOvPlacement( Options.OVERVIEW_PLACEMENT_TYPE.UPPER_RIGHT );
1066 op.setOvPlacement( Options.OVERVIEW_PLACEMENT_TYPE.LOWER_RIGHT );
1069 throw new RuntimeException( "unknown placement: " + op.getOvPlacement() );
1071 tree_panel.updateOvSettings();
1074 static void help( final Map<String, WebLink> weblinks ) {
1075 final StringBuilder sb = new StringBuilder();
1076 sb.append( "Display options\n" );
1077 sb.append( "-------------------\n" );
1078 sb.append( "Use the checkboxes to select types of information to display on the tree.\n\n" );
1079 sb.append( "Clickable tree nodes\n" );
1080 sb.append( "--------------------\n" );
1081 sb.append( "Tree nodes can be clicked, the action is determined by the 'click on node to' menu\n" );
1082 sb.append( "or by right clicking:\n" );
1083 sb.append( "o Display Node Data -- display information for a node\n" );
1084 sb.append( "o Collapse/Uncollapse -- collapse and uncollapse subtree from clicked node\n" );
1085 sb.append( "o Root/Reroot -- change tree root to clicked node\n" );
1086 sb.append( "o Sub/Super Tree -- toggle between subtree from clicked node and whole tree\n" );
1087 sb.append( "o Swap Descendants -- switch descendant on either side of clicked node\n" );
1088 sb.append( "o Colorize Subtree -- color a subtree\n" );
1089 sb.append( "o Open Sequence Web -- launch a web browser to display sequence information\n" );
1090 sb.append( "o Open Taxonomy Web -- launch a web browser to display taxonomy information\n" );
1091 sb.append( "- there may be additional choices depending on this particular setup\n\n" );
1092 sb.append( "Right clicking on a node always displays the information of a node.\n\n" );
1093 sb.append( "Zooming\n" );
1094 sb.append( "---------\n" );
1095 sb.append( "The mouse wheel and the plus and minus keys control zooming.\n" );
1096 sb.append( "Mouse wheel+Ctrl changes the text size.\n" );
1097 sb.append( "Mouse wheel+Shift controls zooming in vertical direction only.\n" );
1098 sb.append( "Use the buttons on the control panel to zoom the tree in and out, horizontally or vertically.\n" );
1099 sb.append( "The entire tree can be fitted into the window by clicking the \"F\" button, or by pressing F, Delete, or Home.\n" );
1100 sb.append( "The up, down, left, and right keys can be used to move the visible part (if zoomed in).\n" );
1101 sb.append( "Up, down, left, and right+Shift can be used to control zooming horizontally and vertically.\n" );
1102 sb.append( "Plus and minus keys+Ctrl change the text size; F+Ctrl, Delete+Ctrl, or Home+Ctrl resets it.\n\n" );
1103 sb.append( "Quick tree manipulation:\n" );
1104 sb.append( "------------------------\n" );
1105 sb.append( "Order Subtrees -- order the tree by branch length\n" );
1106 sb.append( "Uncollapse All -- uncollapse any and all collapsed branches\n\n" );
1107 sb.append( "Memory problems (Java heap space error)\n" );
1108 sb.append( "---------------------------------------\n" );
1109 sb.append( "Since the Java default memory allocation is quite small, it might by necessary (for trees\n" );
1110 sb.append( "with more than approximately 5000 external nodes) to increase the memory which Java can use, with\n" );
1111 sb.append( "the '-Xmx' Java command line option. For example:\n" );
1112 sb.append( "java -Xms32m -Xmx256m -cp path\\to\\forester.jar org.forester.archaeopteryx.Archaeopteryx\n\n" );
1113 if ( ( weblinks != null ) && ( weblinks.size() > 0 ) ) {
1114 sb.append( "Active web links\n" );
1115 sb.append( "--------------------\n" );
1116 for( final String key : weblinks.keySet() ) {
1117 sb.append( " " + weblinks.get( key ).toString() + "\n" );
1120 // + "General remarks\n"
1121 // + "---------------\n"
1123 // "o The application version permits copying to the clipboard \n"
1125 // " in the \"View\"|\"View as ...\" frame (either by control-c or button press).\n"
1127 // "o Changes made to a subtree affect this subtree and its subtrees,\n"
1128 // + " but not any of its parent tree(s).\n"
1130 // "o Archaeopteryx tries to detect whether the numerical values in a NH tree\n"
1132 // " are likely to be bootstrap values instead of branch length values.\n\n"
1134 // " Remarks regarding SDI (Speciation Duplication Inference):\n"
1136 // "o Each external node of the gene tree (in display) needs to be associated with\n"
1138 // " a species: either directly through the \"Species\" field, or the species\n"
1140 // " is part of the sequence name in the form \"XXXX_SPECIES\"\n"
1142 // " (e.g. \"ACON_DROME\" or \"ACON_DROME/123-4489\" which is also acceptable).\n"
1144 // "o A species tree for each species of the gene tree needs to be loaded with\n"
1146 // " \"SDI\"|\"Load species tree\" prior the SDI execution.\n"
1148 // "o !External nodes of the gene tree associated with species not present in\n"
1150 // " the species tree are REMOVED prior to SDI execution!\n"
1152 // "o Both the gene tree and the species tree must be completely binary.\n"
1154 // "o Duplications and speciations are a function of the position of the root.\n"
1156 // " Hence, after each manual \"Root/Reroot\"ing some duplications will be\n"
1157 // + " incorrect and need to be inferred again\n"
1159 // " with: \"SDI\"|\"SDI (Speciation Duplication Inference)\n\n"
1161 sb.append( "phyloXML\n" );
1162 sb.append( "-------------------\n" );
1163 sb.append( "Reference: " + Constants.PHYLOXML_REFERENCE + "\n" );
1164 sb.append( "Website: " + Constants.PHYLOXML_WEB_SITE + "\n" );
1165 sb.append( "Version: " + ForesterConstants.PHYLO_XML_VERSION + "\n" );
1167 sb.append( "For more information: http://www.phylosoft.org/archaeopteryx/\n" );
1168 sb.append( "Email: " + Constants.AUTHOR_EMAIL + "\n\n" );
1169 TextFrame.instantiate( sb.toString() );
1172 static void setOvPlacementColorChooseMenuItem( final JMenuItem mi, final TreePanel tree_panel ) {
1173 if ( ( tree_panel != null ) && ( tree_panel.getTreeColorSet() != null ) ) {
1174 mi.setText( "Overview Placement... (current: " + tree_panel.getOptions().getOvPlacement() + ")" );
1177 mi.setText( "Overview Placement..." );
1181 static void setTextColorChooseMenuItem( final JMenuItem mi, final TreePanel tree_panel ) {
1182 if ( ( tree_panel != null ) && ( tree_panel.getTreeColorSet() != null ) ) {
1183 mi.setText( "Select Colors... (current: " + tree_panel.getTreeColorSet().getCurrentColorSchemeName() + ")" );
1186 mi.setText( "Select Colors..." );
1190 static void setTextForFontChooserMenuItem( final JMenuItem mi, final String font_desc ) {
1191 mi.setText( "Select Font... (current: " + font_desc + ")" );
1194 static void setTextMinSupportMenuItem( final JMenuItem mi, final Options options, final TreePanel current_tree_panel ) {
1195 if ( ( current_tree_panel == null ) || ( current_tree_panel.getPhylogeny() == null ) ) {
1196 mi.setEnabled( true );
1198 else if ( ForesterUtil.isHasAtLeastOneBranchWithSupportValues( current_tree_panel.getPhylogeny() ) ) {
1199 mi.setEnabled( true );
1202 mi.setEnabled( false );
1204 mi.setText( "Enter Min Confidence Value... (current: " + options.getMinConfidenceValue() + ")" );
1207 static void updateOptionsMenuDependingOnPhylogenyType( final MainPanel main_panel,
1208 final JCheckBoxMenuItem scale,
1209 final JCheckBoxMenuItem branch_lengths,
1210 final JRadioButtonMenuItem non_lined_up,
1211 final JRadioButtonMenuItem uniform_clado,
1212 final JRadioButtonMenuItem nonuniform_clado,
1213 final JCheckBoxMenuItem label_direction_cbmi ) {
1214 final TreePanel tree_panel = main_panel.getCurrentTreePanel();
1215 final ControlPanel control = main_panel.getControlPanel();
1216 final Options options = main_panel.getOptions();
1217 scale.setSelected( options.isShowScale() );
1218 branch_lengths.setSelected( options.isShowBranchLengthValues() );
1219 // non_lined_up.setSelected( options.isNonLinedUpCladogram() );
1220 if ( ( tree_panel != null ) && ( !tree_panel.isPhyHasBranchLengths() ) ) {
1221 scale.setSelected( false );
1222 scale.setEnabled( false );
1223 branch_lengths.setSelected( false );
1224 branch_lengths.setEnabled( false );
1226 else if ( ( tree_panel != null ) && !control.isDrawPhylogram() ) {
1227 scale.setSelected( false );
1228 scale.setEnabled( false );
1229 branch_lengths.setEnabled( true );
1232 scale.setEnabled( true );
1233 branch_lengths.setEnabled( true );
1235 if ( ( tree_panel != null )
1236 && ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.ROUNDED )
1237 && ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE ) && ( tree_panel
1238 .getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR ) ) ) {
1239 branch_lengths.setSelected( false );
1240 branch_lengths.setEnabled( false );
1242 if ( tree_panel != null ) {
1243 if ( ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1244 || ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) {
1245 non_lined_up.setEnabled( false );
1246 uniform_clado.setEnabled( false );
1247 nonuniform_clado.setEnabled( false );
1250 non_lined_up.setEnabled( true );
1251 uniform_clado.setEnabled( true );
1252 nonuniform_clado.setEnabled( true );
1256 if ( ( tree_panel != null )
1257 && ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE ) && ( tree_panel
1258 .getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR ) ) ) {
1259 branch_lengths.setSelected( false );
1260 branch_lengths.setEnabled( false );
1262 if ( ( tree_panel != null )
1263 && ( ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( tree_panel
1264 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) {
1265 non_lined_up.setEnabled( false );
1268 // non_lined_up.setSelected( options.isNonLinedUpCladogram() );
1269 non_lined_up.setEnabled( true );
1272 label_direction_cbmi.setEnabled( true );
1273 if ( tree_panel != null ) {
1274 if ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1275 && ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1276 label_direction_cbmi.setEnabled( false );
1278 if ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) {
1279 scale.setSelected( false );
1280 scale.setEnabled( false );
1285 static void updateScreenTextAntialias( final List<TreePanel> treepanels ) {
1286 for( final TreePanel tree_panel : treepanels ) {
1287 tree_panel.setTextAntialias();