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.Icon;
37 import javax.swing.JApplet;
38 import javax.swing.JCheckBoxMenuItem;
39 import javax.swing.JFrame;
40 import javax.swing.JMenu;
41 import javax.swing.JMenuBar;
42 import javax.swing.JMenuItem;
43 import javax.swing.JOptionPane;
44 import javax.swing.JRadioButtonMenuItem;
46 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
47 import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
48 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
49 import org.forester.phylogeny.Phylogeny;
50 import org.forester.util.ForesterConstants;
51 import org.forester.util.ForesterUtil;
53 public abstract class MainFrame extends JFrame implements ActionListener {
55 static final String USE_MOUSEWHEEL_SHIFT_TO_ROTATE = "In this display type, use mousewheel + Shift to rotate [or A and S]";
56 static final String PHYLOXML_REF_TOOL_TIP = Constants.PHYLOXML_REFERENCE; //TODO //FIXME
57 static final String APTX_REF_TOOL_TIP = Constants.APTX_REFERENCE;
58 private static final long serialVersionUID = 3655000897845508358L;
59 final static Font menu_font = new Font( Configuration.getDefaultFontFamilyName(),
62 static final String TYPE_MENU_HEADER = "Type";
63 static final String RECTANGULAR_TYPE_CBMI_LABEL = "Rectangular";
64 static final String EURO_TYPE_CBMI_LABEL = "Euro Type";
65 static final String CURVED_TYPE_CBMI_LABEL = "Curved";
66 static final String TRIANGULAR_TYPE_CBMI_LABEL = "Triangular";
67 static final String CONVEX_TYPE_CBMI_LABEL = "Convex";
68 static final String ROUNDED_TYPE_CBMI_LABEL = "Rounded";
69 static final String UNROOTED_TYPE_CBMI_LABEL = "Unrooted (alpha)"; //TODO
70 static final String CIRCULAR_TYPE_CBMI_LABEL = "Circular (alpha)"; //TODO
71 static final String OPTIONS_HEADER = "Options";
72 static final String SEARCH_SUBHEADER = "Search:";
73 static final String DISPLAY_SUBHEADER = "Display:";
74 static final String SEARCH_TERMS_ONLY_LABEL = "Match Complete Terms Only";
75 static final String SEARCH_CASE_SENSITIVE_LABEL = "Case Sensitive";
76 static final String INVERSE_SEARCH_RESULT_LABEL = "Negate Result";
77 static final String DISPLAY_BRANCH_LENGTH_VALUES_LABEL = "Display Branch Length Values";
78 static final String DISPLAY_SCALE_LABEL = "Display Scale";
79 static final String NON_LINED_UP_CLADOGRAMS_LABEL = "Non-Lined Up Cladograms";
80 static final String UNIFORM_CLADOGRAMS_LABEL = "Total Node Sum Dependent Cladograms";
81 static final String LABEL_DIRECTION_LABEL = "Radial Labels";
82 static final String LABEL_DIRECTION_TIP = "To use radial node labels in radial and unrooted display types";
83 static final String SCREEN_ANTIALIAS_LABEL = "Antialias";
84 static final String COLOR_LABELS_LABEL = "Colorize Labels Same as Parent Branch";
85 static final String BG_GRAD_LABEL = "Background Color Gradient";
86 static final String DISPLAY_NODE_BOXES_LABEL = "Display Node Shapes";
87 static final String SHOW_OVERVIEW_LABEL = "Show Overview";
88 static final String FONT_SIZE_MENU_LABEL = "Font Size";
89 static final String NONUNIFORM_CLADOGRAMS_LABEL = "External Node Sum Dependent Cladograms";
90 static final String SHOW_DOMAIN_LABELS_LABEL = "Show Domain Labels";
91 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";
92 static final String ABBREV_SN_LABEL = "Abbreviate Scientific Taxonomic Names";
93 static final String TAXONOMY_COLORIZE_NODE_SHAPES_LABEL = "Colorize Node Shapes According to Taxonomy";
94 static final String CYCLE_NODE_SHAPE_LABEL = "Cycle Node Shapes";
95 static final String CYCLE_NODE_FILL_LABEL = "Cycle Node Fill Type";
96 static final String CHOOSE_NODE_SIZE_LABEL = "Choose Node Shape Size";
101 JMenu _options_jmenu;
102 JMenu _font_size_menu;
104 JMenuItem[] _load_phylogeny_from_webservice_menu_items;
106 JMenuItem _open_item;
107 JMenuItem _open_url_item;
108 JMenuItem _save_item;
109 JMenuItem _save_all_item;
110 JMenuItem _close_item;
111 JMenuItem _exit_item;
114 JMenuItem _midpoint_root_item;
115 JMenuItem _taxcolor_item;
116 JMenuItem _confcolor_item;
117 JMenuItem _infer_common_sn_names_item;
118 JMenuItem _collapse_species_specific_subtrees;
119 JMenuItem _collapse_below_threshold; //TODO implememt me
120 JMenuItem _obtain_detailed_taxonomic_information_jmi;
121 JMenuItem _obtain_uniprot_seq_information_jmi;
122 JMenuItem _move_node_names_to_tax_sn_jmi;
123 JMenuItem _move_node_names_to_seq_names_jmi;
124 JMenuItem _extract_tax_code_from_node_names_jmi;
126 JMenuItem _super_tiny_fonts_item;
127 JMenuItem _tiny_fonts_item;
128 JMenuItem _small_fonts_item;
129 JMenuItem _medium_fonts_item;
130 JMenuItem _large_fonts_item;
132 // _ screen and print
133 JMenuItem _choose_font_mi;
134 JMenuItem _switch_colors_mi;
135 JCheckBoxMenuItem _label_direction_cbmi;
137 JCheckBoxMenuItem _screen_antialias_cbmi;
138 JCheckBoxMenuItem _background_gradient_cbmi;
140 JRadioButtonMenuItem _non_lined_up_cladograms_rbmi;
141 JRadioButtonMenuItem _uniform_cladograms_rbmi;
142 JRadioButtonMenuItem _ext_node_dependent_cladogram_rbmi;
143 JCheckBoxMenuItem _show_branch_length_values_cbmi;
144 JCheckBoxMenuItem _show_scale_cbmi; //TODO fix me
145 JCheckBoxMenuItem _show_overview_cbmi;
146 JCheckBoxMenuItem _show_domain_labels;
147 JCheckBoxMenuItem _abbreviate_scientific_names;
148 JCheckBoxMenuItem _color_labels_same_as_parent_branch;
149 JMenuItem _overview_placment_mi;
150 JMenuItem _choose_minimal_confidence_mi;
152 JCheckBoxMenuItem _show_default_node_shapes_cbmi;
153 JMenuItem _cycle_node_shape_mi;
154 JMenuItem _cycle_node_fill_mi;
155 JMenuItem _choose_node_size_mi;
156 JCheckBoxMenuItem _taxonomy_colorize_node_shapes_cbmi;
158 JCheckBoxMenuItem _graphics_export_visible_only_cbmi;
159 JCheckBoxMenuItem _antialias_print_cbmi;
160 JCheckBoxMenuItem _print_black_and_white_cbmi;
161 JCheckBoxMenuItem _print_using_actual_size_cbmi;
162 JCheckBoxMenuItem _graphics_export_using_actual_size_cbmi;
163 JMenuItem _print_size_mi;
164 JMenuItem _choose_pdf_width_mi;
166 JCheckBoxMenuItem _internal_number_are_confidence_for_nh_parsing_cbmi;
167 JCheckBoxMenuItem _extract_pfam_style_tax_codes_cbmi;
168 JCheckBoxMenuItem _replace_underscores_cbmi;
170 JCheckBoxMenuItem _search_case_senstive_cbmi;
171 JCheckBoxMenuItem _search_whole_words_only_cbmi;
172 JCheckBoxMenuItem _inverse_search_result_cbmi;
175 JCheckBoxMenuItem _rectangular_type_cbmi;
176 JCheckBoxMenuItem _triangular_type_cbmi;
177 JCheckBoxMenuItem _curved_type_cbmi;
178 JCheckBoxMenuItem _convex_type_cbmi;
179 JCheckBoxMenuItem _euro_type_cbmi;
180 JCheckBoxMenuItem _rounded_type_cbmi;
181 JCheckBoxMenuItem _unrooted_type_cbmi;
182 JCheckBoxMenuItem _circular_type_cbmi;
183 // view as text menu:
184 JMenuItem _view_as_NH_item;
185 JMenuItem _view_as_NHX_item;
186 JMenuItem _view_as_XML_item;
187 JMenuItem _view_as_nexus_item;
188 JMenuItem _display_basic_information_item;
190 JMenuItem _about_item;
191 JMenuItem _help_item;
192 JMenuItem _website_item;
193 JMenuItem _phyloxml_website_item;
194 JMenuItem _phyloxml_ref_item;
195 JMenuItem _aptx_ref_item;
196 // Handy pointers to child components:
197 MainPanel _mainpanel;
198 Container _contentpane;
199 TextFrame _textframe;
200 Configuration _configuration;
201 JMenuItem _remove_branch_color_item;
205 // Empty constructor.
211 public void actionPerformed( final ActionEvent e ) {
212 final Object o = e.getSource();
213 boolean is_applet = false;
214 JApplet applet = null;
215 if ( getCurrentTreePanel() != null ) {
216 is_applet = getCurrentTreePanel().isApplet();
218 applet = getCurrentTreePanel().obtainApplet();
221 if ( o == _open_url_item ) {
222 readPhylogeniesFromURL();
224 else if ( o == _exit_item ) {
227 else if ( o == _taxcolor_item ) {
230 else if ( o == _confcolor_item ) {
233 else if ( o == _infer_common_sn_names_item ) {
234 if ( isSubtreeDisplayed() ) {
237 if ( getCurrentTreePanel() != null ) {
238 getCurrentTreePanel().inferCommonPartOfScientificNames();
241 else if ( o == _collapse_species_specific_subtrees ) {
242 if ( isSubtreeDisplayed() ) {
245 if ( getCurrentTreePanel() != null ) {
246 getCurrentTreePanel().collapseSpeciesSpecificSubtrees();
249 else if ( o == _remove_branch_color_item ) {
250 if ( isSubtreeDisplayed() ) {
253 removeBranchColors();
255 else if ( o == _midpoint_root_item ) {
256 if ( isSubtreeDisplayed() ) {
261 else if ( o == _switch_colors_mi ) {
264 else if ( o == _display_basic_information_item ) {
265 displayBasicInformation();
267 else if ( o == _view_as_NH_item ) {
270 else if ( o == _view_as_NHX_item ) {
273 else if ( o == _view_as_XML_item ) {
276 else if ( o == _view_as_nexus_item ) {
279 else if ( o == _super_tiny_fonts_item ) {
280 if ( getCurrentTreePanel() != null ) {
281 getCurrentTreePanel().setSuperTinyFonts();
282 getCurrentTreePanel().repaint();
285 else if ( o == _tiny_fonts_item ) {
286 if ( getCurrentTreePanel() != null ) {
287 getCurrentTreePanel().setTinyFonts();
288 getCurrentTreePanel().repaint();
291 else if ( o == _small_fonts_item ) {
292 if ( getCurrentTreePanel() != null ) {
293 getCurrentTreePanel().setSmallFonts();
294 getCurrentTreePanel().repaint();
297 else if ( o == _medium_fonts_item ) {
298 if ( getCurrentTreePanel() != null ) {
299 getCurrentTreePanel().setMediumFonts();
300 getCurrentTreePanel().repaint();
303 else if ( o == _large_fonts_item ) {
304 if ( getCurrentTreePanel() != null ) {
305 getCurrentTreePanel().setLargeFonts();
306 getCurrentTreePanel().repaint();
309 else if ( o == _choose_font_mi ) {
312 else if ( o == _choose_minimal_confidence_mi ) {
313 chooseMinimalConfidence();
315 else if ( o == _overview_placment_mi ) {
316 MainFrame.cycleOverview( getOptions(), getCurrentTreePanel() );
318 else if ( o == _screen_antialias_cbmi ) {
319 updateOptions( getOptions() );
320 updateScreenTextAntialias( getMainPanel().getTreePanels() );
322 else if ( o == _background_gradient_cbmi ) {
323 updateOptions( getOptions() );
325 else if ( o == _show_domain_labels ) {
326 updateOptions( getOptions() );
328 else if ( o == _abbreviate_scientific_names ) {
329 updateOptions( getOptions() );
331 else if ( o == _color_labels_same_as_parent_branch ) {
332 updateOptions( getOptions() );
334 else if ( o == _show_default_node_shapes_cbmi ) {
335 updateOptions( getOptions() );
337 else if ( o == _taxonomy_colorize_node_shapes_cbmi ) {
338 updateOptions( getOptions() );
341 else if ( o == _non_lined_up_cladograms_rbmi ) {
342 updateOptions( getOptions() );
345 else if ( o == _uniform_cladograms_rbmi ) {
346 updateOptions( getOptions() );
349 else if ( o == _ext_node_dependent_cladogram_rbmi ) {
350 updateOptions( getOptions() );
353 else if ( o == _search_case_senstive_cbmi ) {
354 updateOptions( getOptions() );
355 getMainPanel().getControlPanel().search();
357 else if ( o == _search_whole_words_only_cbmi ) {
358 updateOptions( getOptions() );
359 getMainPanel().getControlPanel().search();
361 else if ( o == _inverse_search_result_cbmi ) {
362 updateOptions( getOptions() );
363 getMainPanel().getControlPanel().search();
365 else if ( o == _show_scale_cbmi ) {
366 updateOptions( getOptions() );
368 else if ( o == _show_branch_length_values_cbmi ) {
369 updateOptions( getOptions() );
371 else if ( o == _label_direction_cbmi ) {
372 updateOptions( getOptions() );
374 else if ( o == _show_overview_cbmi ) {
375 updateOptions( getOptions() );
376 if ( getCurrentTreePanel() != null ) {
377 getCurrentTreePanel().updateOvSizes();
380 else if ( ( o == _rectangular_type_cbmi ) || ( o == _triangular_type_cbmi ) || ( o == _curved_type_cbmi )
381 || ( o == _convex_type_cbmi ) || ( o == _euro_type_cbmi ) || ( o == _rounded_type_cbmi )
382 || ( o == _unrooted_type_cbmi ) || ( o == _circular_type_cbmi ) ) {
385 else if ( o == _about_item ) {
388 else if ( o == _help_item ) {
389 help( getConfiguration().getWebLinks() );
391 else if ( o == _website_item ) {
393 Util.openWebsite( Constants.APTX_WEB_SITE, is_applet, applet );
395 catch ( final IOException e1 ) {
396 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
399 else if ( o == _phyloxml_website_item ) {
401 Util.openWebsite( Constants.PHYLOXML_WEB_SITE, is_applet, applet );
403 catch ( final IOException e1 ) {
404 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
407 else if ( o == _aptx_ref_item ) {
409 Util.openWebsite( Constants.APTX_REFERENCE_URL, is_applet, applet );
411 catch ( final IOException e1 ) {
412 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
415 else if ( o == _phyloxml_ref_item ) {
417 Util.openWebsite( Constants.PHYLOXML_REFERENCE_URL, is_applet, applet );
419 catch ( final IOException e1 ) {
420 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
424 if ( _load_phylogeny_from_webservice_menu_items != null ) {
425 for( int i = 0; i < _load_phylogeny_from_webservice_menu_items.length; ++i ) {
426 if ( o == _load_phylogeny_from_webservice_menu_items[ i ] ) {
427 readPhylogeniesFromWebservice( i );
432 _contentpane.repaint();
435 boolean isSubtreeDisplayed() {
436 if ( getCurrentTreePanel() != null ) {
437 if ( getCurrentTreePanel().isCurrentTreeIsSubtree() ) {
439 .showMessageDialog( this,
440 "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.",
441 "Operation can not be exectuted on a sub-tree",
442 JOptionPane.WARNING_MESSAGE );
449 void activateSaveAllIfNeeded() {
450 if ( ( getMainPanel().getTabbedPane() != null ) && ( getMainPanel().getTabbedPane().getTabCount() > 1 ) ) {
451 _save_all_item.setEnabled( true );
454 _save_all_item.setEnabled( false );
458 void buildFileMenu() {
459 _file_jmenu = createMenu( "File", getConfiguration() );
460 _file_jmenu.add( _open_url_item = new JMenuItem( "Read tree from URL/webservice..." ) );
461 _file_jmenu.addSeparator();
462 _file_jmenu.add( _exit_item = new JMenuItem( "Exit" ) );
463 customizeJMenuItem( _open_url_item );
464 customizeJMenuItem( _exit_item );
465 _jmenubar.add( _file_jmenu );
468 void buildFontSizeMenu() {
469 _font_size_menu = createMenu( FONT_SIZE_MENU_LABEL, getConfiguration() );
470 _font_size_menu.add( _super_tiny_fonts_item = new JMenuItem( "Super Tiny Fonts" ) );
471 _font_size_menu.add( _tiny_fonts_item = new JMenuItem( "Tiny Fonts" ) );
472 _font_size_menu.add( _small_fonts_item = new JMenuItem( "Small Fonts" ) );
473 _font_size_menu.add( _medium_fonts_item = new JMenuItem( "Medium Fonts" ) );
474 _font_size_menu.add( _large_fonts_item = new JMenuItem( "Large Fonts" ) );
475 customizeJMenuItem( _super_tiny_fonts_item );
476 customizeJMenuItem( _tiny_fonts_item );
477 customizeJMenuItem( _small_fonts_item );
478 customizeJMenuItem( _medium_fonts_item );
479 customizeJMenuItem( _large_fonts_item );
480 _jmenubar.add( _font_size_menu );
483 void buildHelpMenu() {
484 _help_jmenu = createMenu( "Help", getConfiguration() );
485 _help_jmenu.add( _help_item = new JMenuItem( "Help" ) );
486 _help_jmenu.add( _website_item = new JMenuItem( "Archaeopteryx Home" ) );
487 _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" );
488 _help_jmenu.add( _phyloxml_website_item = new JMenuItem( "phyloXML Home" ) );
489 _help_jmenu.add( _phyloxml_ref_item = new JMenuItem( "phyloXML Reference" ) );
490 _help_jmenu.addSeparator();
491 _help_jmenu.add( _about_item = new JMenuItem( "About" ) );
492 customizeJMenuItem( _help_item );
493 customizeJMenuItem( _website_item );
494 customizeJMenuItem( _phyloxml_website_item );
495 customizeJMenuItem( _aptx_ref_item );
496 customizeJMenuItem( _phyloxml_ref_item );
497 customizeJMenuItem( _about_item );
498 _phyloxml_ref_item.setToolTipText( PHYLOXML_REF_TOOL_TIP );
499 _aptx_ref_item.setToolTipText( APTX_REF_TOOL_TIP );
500 _jmenubar.add( _help_jmenu );
503 void buildTypeMenu() {
504 _type_menu = createMenu( TYPE_MENU_HEADER, getConfiguration() );
505 _type_menu.add( _rectangular_type_cbmi = new JCheckBoxMenuItem( MainFrame.RECTANGULAR_TYPE_CBMI_LABEL ) );
506 _type_menu.add( _euro_type_cbmi = new JCheckBoxMenuItem( MainFrame.EURO_TYPE_CBMI_LABEL ) );
507 _type_menu.add( _rounded_type_cbmi = new JCheckBoxMenuItem( MainFrame.ROUNDED_TYPE_CBMI_LABEL ) );
508 _type_menu.add( _curved_type_cbmi = new JCheckBoxMenuItem( MainFrame.CURVED_TYPE_CBMI_LABEL ) );
509 _type_menu.add( _triangular_type_cbmi = new JCheckBoxMenuItem( MainFrame.TRIANGULAR_TYPE_CBMI_LABEL ) );
510 _type_menu.add( _convex_type_cbmi = new JCheckBoxMenuItem( MainFrame.CONVEX_TYPE_CBMI_LABEL ) );
511 _type_menu.add( _unrooted_type_cbmi = new JCheckBoxMenuItem( MainFrame.UNROOTED_TYPE_CBMI_LABEL ) );
512 _type_menu.add( _circular_type_cbmi = new JCheckBoxMenuItem( MainFrame.CIRCULAR_TYPE_CBMI_LABEL ) );
513 customizeCheckBoxMenuItem( _rectangular_type_cbmi, false );
514 customizeCheckBoxMenuItem( _triangular_type_cbmi, false );
515 customizeCheckBoxMenuItem( _euro_type_cbmi, false );
516 customizeCheckBoxMenuItem( _rounded_type_cbmi, false );
517 customizeCheckBoxMenuItem( _curved_type_cbmi, false );
518 customizeCheckBoxMenuItem( _convex_type_cbmi, false );
519 customizeCheckBoxMenuItem( _unrooted_type_cbmi, false );
520 customizeCheckBoxMenuItem( _circular_type_cbmi, false );
521 _unrooted_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
522 _circular_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
523 initializeTypeMenu( getOptions() );
524 _jmenubar.add( _type_menu );
527 void buildViewMenu() {
528 _view_jmenu = createMenu( "View", getConfiguration() );
529 _view_jmenu.add( _display_basic_information_item = new JMenuItem( "Display Basic Information" ) );
530 _view_jmenu.addSeparator();
531 _view_jmenu.add( _view_as_XML_item = new JMenuItem( "View as phyloXML" ) );
532 _view_jmenu.add( _view_as_NH_item = new JMenuItem( "View as Newick" ) );
533 _view_jmenu.add( _view_as_NHX_item = new JMenuItem( "View as NHX" ) );
534 _view_jmenu.add( _view_as_nexus_item = new JMenuItem( "View as Nexus" ) );
535 customizeJMenuItem( _display_basic_information_item );
536 customizeJMenuItem( _view_as_NH_item );
537 customizeJMenuItem( _view_as_NHX_item );
538 customizeJMenuItem( _view_as_XML_item );
539 customizeJMenuItem( _view_as_nexus_item );
540 _jmenubar.add( _view_jmenu );
543 private void chooseFont() {
544 final FontChooser fc = new FontChooser();
545 fc.setFont( getMainPanel().getTreeFontSet().getLargeFont() );
546 fc.showDialog( this, "Select the Base Font" );
547 getMainPanel().getTreeFontSet().setBaseFont( fc.getFont() );
550 private void chooseMinimalConfidence() {
551 final String s = ( String ) JOptionPane
552 .showInputDialog( this,
553 "Please enter the minimum for confidence values to be displayed.\n"
554 + "[current value: " + getOptions().getMinConfidenceValue() + "]\n",
555 "Minimal Confidence Value",
556 JOptionPane.QUESTION_MESSAGE,
559 getOptions().getMinConfidenceValue() );
560 if ( !ForesterUtil.isEmpty( s ) ) {
561 boolean success = true;
563 final String m_str = s.trim();
564 if ( !ForesterUtil.isEmpty( m_str ) ) {
566 m = Double.parseDouble( m_str );
568 catch ( final Exception ex ) {
575 if ( success && ( m >= 0.0 ) ) {
576 getOptions().setMinConfidenceValue( m );
583 if ( _mainpanel != null ) {
584 _mainpanel.terminate();
586 if ( _contentpane != null ) {
587 _contentpane.removeAll();
594 if ( _mainpanel.getCurrentTreePanel() != null ) {
595 _mainpanel.getCurrentTreePanel().confColor();
599 void customizeCheckBoxMenuItem( final JCheckBoxMenuItem item, final boolean is_selected ) {
600 if ( item != null ) {
601 item.setFont( MainFrame.menu_font );
602 if ( !getConfiguration().isUseNativeUI() ) {
603 item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
604 item.setForeground( getConfiguration().getGuiMenuTextColor() );
606 item.setSelected( is_selected );
607 item.addActionListener( this );
611 void customizeJMenuItem( final JMenuItem jmi ) {
613 jmi.setFont( MainFrame.menu_font );
614 if ( !getConfiguration().isUseNativeUI() ) {
615 jmi.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
616 jmi.setForeground( getConfiguration().getGuiMenuTextColor() );
618 jmi.addActionListener( this );
622 void customizeRadioButtonMenuItem( final JRadioButtonMenuItem item, final boolean is_selected ) {
623 if ( item != null ) {
624 item.setFont( MainFrame.menu_font );
625 if ( !getConfiguration().isUseNativeUI() ) {
626 item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
627 item.setForeground( getConfiguration().getGuiMenuTextColor() );
629 item.setSelected( is_selected );
630 item.addActionListener( this );
634 void exceptionOccuredDuringOpenFile( final Exception e ) {
636 _mainpanel.getCurrentTreePanel().setArrowCursor();
638 catch ( final Exception ex ) {
641 JOptionPane.showMessageDialog( this,
642 ForesterUtil.wordWrap( e.getLocalizedMessage(), 80 ),
643 "Error during File|Open",
644 JOptionPane.ERROR_MESSAGE );
647 void exceptionOccuredDuringSaveAs( final Exception e ) {
649 _mainpanel.getCurrentTreePanel().setArrowCursor();
651 catch ( final Exception ex ) {
654 JOptionPane.showMessageDialog( this, "Exception" + e, "Error during File|SaveAs", JOptionPane.ERROR_MESSAGE );
657 boolean GAndSDoHaveMoreThanOneSpeciesInComman( final Phylogeny gene_tree ) {
658 if ( ( gene_tree == null ) || gene_tree.isEmpty() ) {
659 JOptionPane.showMessageDialog( this,
660 "Gene tree and species tree have no species in common.",
662 JOptionPane.ERROR_MESSAGE );
665 else if ( gene_tree.getNumberOfExternalNodes() < 2 ) {
666 JOptionPane.showMessageDialog( this,
667 "Gene tree and species tree have only one species in common.",
669 JOptionPane.ERROR_MESSAGE );
677 public Configuration getConfiguration() {
678 return _configuration;
681 TreePanel getCurrentTreePanel() {
682 return getMainPanel().getCurrentTreePanel();
685 JMenu getHelpMenu() {
689 JCheckBoxMenuItem getlabelDirectionCbmi() {
690 return _label_direction_cbmi;
693 MainPanel getMainPanel() {
697 JMenuBar getMenuBarOfMainFrame() {
701 Options getOptions() {
705 void initializeTypeMenu( final Options options ) {
706 setTypeMenuToAllUnselected();
707 switch ( options.getPhylogenyGraphicsType() ) {
709 _convex_type_cbmi.setSelected( true );
712 _curved_type_cbmi.setSelected( true );
715 _euro_type_cbmi.setSelected( true );
718 _rounded_type_cbmi.setSelected( true );
721 _triangular_type_cbmi.setSelected( true );
724 _unrooted_type_cbmi.setSelected( true );
727 _circular_type_cbmi.setSelected( true );
730 _rectangular_type_cbmi.setSelected( true );
735 void midpointRoot() {
736 if ( _mainpanel.getCurrentTreePanel() != null ) {
737 _mainpanel.getCurrentTreePanel().midpointRoot();
741 abstract void readPhylogeniesFromURL();
743 void readPhylogeniesFromWebservice( final int i ) {
744 final UrlTreeReader reader = new UrlTreeReader( this, i );
745 new Thread( reader ).start();
748 private void removeBranchColors() {
749 if ( getMainPanel().getCurrentPhylogeny() != null ) {
750 Util.removeBranchColors( getMainPanel().getCurrentPhylogeny() );
754 void removeTextFrame() {
755 if ( _textframe != null ) {
761 void setConfiguration( final Configuration configuration ) {
762 _configuration = configuration;
765 void setOptions( final Options options ) {
769 void setSelectedTypeInTypeMenu( final PHYLOGENY_GRAPHICS_TYPE type ) {
770 setTypeMenuToAllUnselected();
773 _circular_type_cbmi.setSelected( true );
776 _convex_type_cbmi.setSelected( true );
779 _curved_type_cbmi.setSelected( true );
782 _euro_type_cbmi.setSelected( true );
785 _rounded_type_cbmi.setSelected( true );
788 _rectangular_type_cbmi.setSelected( true );
791 _triangular_type_cbmi.setSelected( true );
794 _unrooted_type_cbmi.setSelected( true );
797 throw new IllegalArgumentException( "unknown type: " + type );
801 void setTypeMenuToAllUnselected() {
802 _convex_type_cbmi.setSelected( false );
803 _curved_type_cbmi.setSelected( false );
804 _euro_type_cbmi.setSelected( false );
805 _rounded_type_cbmi.setSelected( false );
806 _triangular_type_cbmi.setSelected( false );
807 _rectangular_type_cbmi.setSelected( false );
808 _unrooted_type_cbmi.setSelected( false );
809 _circular_type_cbmi.setSelected( false );
812 public void showWhole() {
813 _mainpanel.getControlPanel().showWhole();
816 void switchColors() {
817 final TreeColorSet colorset = _mainpanel.getTreeColorSet();
818 final ColorSchemeChooser csc = new ColorSchemeChooser( getMainPanel(), colorset );
819 csc.setVisible( true );
823 if ( _mainpanel.getCurrentTreePanel() != null ) {
824 _mainpanel.getCurrentTreePanel().taxColor();
828 void typeChanged( final Object o ) {
829 updateTypeCheckboxes( getOptions(), o );
830 updateOptions( getOptions() );
831 if ( getCurrentTreePanel() != null ) {
832 final PHYLOGENY_GRAPHICS_TYPE previous_type = getCurrentTreePanel().getPhylogenyGraphicsType();
833 final PHYLOGENY_GRAPHICS_TYPE new_type = getOptions().getPhylogenyGraphicsType();
834 if ( ( ( previous_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) && ( new_type != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) )
835 || ( ( previous_type == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) && ( new_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) )
836 || ( ( previous_type != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) && ( new_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) )
837 || ( ( previous_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) && ( new_type == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) ) {
838 getCurrentTreePanel().getControlPanel().showWhole();
840 if ( getCurrentTreePanel().isPhyHasBranchLengths() && ( new_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
841 getCurrentTreePanel().getControlPanel().setDrawPhylogramEnabled( true );
844 getCurrentTreePanel().getControlPanel().setDrawPhylogramEnabled( false );
846 getCurrentTreePanel().setPhylogenyGraphicsType( getOptions().getPhylogenyGraphicsType() );
847 updateScreenTextAntialias( getMainPanel().getTreePanels() );
848 if ( getCurrentTreePanel().getControlPanel().getDynamicallyHideData() != null ) {
849 if ( new_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) {
850 getCurrentTreePanel().getControlPanel().getDynamicallyHideData().setEnabled( false );
853 getCurrentTreePanel().getControlPanel().getDynamicallyHideData().setEnabled( true );
859 void updateOptions( final Options options ) {
860 options.setAntialiasScreen( ( _screen_antialias_cbmi != null ) && _screen_antialias_cbmi.isSelected() );
861 options.setBackgroundColorGradient( ( _background_gradient_cbmi != null )
862 && _background_gradient_cbmi.isSelected() );
863 options.setShowDomainLabels( ( _show_domain_labels != null ) && _show_domain_labels.isSelected() );
864 options.setAbbreviateScientificTaxonNames( ( _abbreviate_scientific_names != null )
865 && _abbreviate_scientific_names.isSelected() );
866 options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )
867 && _color_labels_same_as_parent_branch.isSelected() );
869 options.setShowDefaultNodeShapes( ( _show_default_node_shapes_cbmi != null ) && _show_default_node_shapes_cbmi.isSelected() );
870 options.setTaxonomyColorizeNodeShapes( ( _taxonomy_colorize_node_shapes_cbmi != null ) && _taxonomy_colorize_node_shapes_cbmi.isSelected() );
873 if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {
874 options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );
876 else if ( ( _uniform_cladograms_rbmi != null ) && ( _uniform_cladograms_rbmi.isSelected() ) ) {
877 options.setCladogramType( CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
879 else if ( ( _ext_node_dependent_cladogram_rbmi != null ) && ( _ext_node_dependent_cladogram_rbmi.isSelected() ) ) {
880 options.setCladogramType( CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
882 options.setSearchCaseSensitive( ( _search_case_senstive_cbmi != null )
883 && _search_case_senstive_cbmi.isSelected() );
884 if ( ( _show_scale_cbmi != null ) && _show_scale_cbmi.isEnabled() ) {
885 options.setShowScale( _show_scale_cbmi.isSelected() );
887 if ( _label_direction_cbmi != null ) {
888 if ( _label_direction_cbmi.isSelected() ) {
889 options.setNodeLabelDirection( NODE_LABEL_DIRECTION.RADIAL );
892 options.setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
895 options.setShowOverview( ( _show_overview_cbmi != null ) && _show_overview_cbmi.isSelected() );
896 if ( ( _show_branch_length_values_cbmi != null ) && _show_branch_length_values_cbmi.isEnabled() ) {
897 options.setShowBranchLengthValues( _show_branch_length_values_cbmi.isSelected() );
899 options.setPrintUsingActualSize( ( _print_using_actual_size_cbmi != null )
900 && ( _print_using_actual_size_cbmi.isSelected() ) );
901 options.setGraphicsExportUsingActualSize( ( _graphics_export_using_actual_size_cbmi != null )
902 && ( _graphics_export_using_actual_size_cbmi.isSelected() ) );
903 options.setAntialiasPrint( ( _antialias_print_cbmi != null ) && _antialias_print_cbmi.isSelected() );
904 options.setPrintBlackAndWhite( ( _print_black_and_white_cbmi != null )
905 && _print_black_and_white_cbmi.isSelected() );
906 options.setInternalNumberAreConfidenceForNhParsing( ( _internal_number_are_confidence_for_nh_parsing_cbmi != null )
907 && _internal_number_are_confidence_for_nh_parsing_cbmi.isSelected() );
908 options.setExtractPfamTaxonomyCodesInNhParsing( ( _extract_pfam_style_tax_codes_cbmi != null )
909 && _extract_pfam_style_tax_codes_cbmi.isSelected() );
910 options.setReplaceUnderscoresInNhParsing( ( _replace_underscores_cbmi != null )
911 && _replace_underscores_cbmi.isSelected() );
912 options.setMatchWholeTermsOnly( ( _search_whole_words_only_cbmi != null )
913 && _search_whole_words_only_cbmi.isSelected() );
914 options.setInverseSearchResult( ( _inverse_search_result_cbmi != null )
915 && _inverse_search_result_cbmi.isSelected() );
916 if ( _graphics_export_visible_only_cbmi != null ) {
917 options.setGraphicsExportVisibleOnly( _graphics_export_visible_only_cbmi.isSelected() );
918 if ( _graphics_export_visible_only_cbmi.isSelected() && ( _graphics_export_using_actual_size_cbmi != null ) ) {
919 _graphics_export_using_actual_size_cbmi.setSelected( true );
920 _graphics_export_using_actual_size_cbmi.setEnabled( false );
923 _graphics_export_using_actual_size_cbmi.setEnabled( true );
926 if ( ( _rectangular_type_cbmi != null ) && _rectangular_type_cbmi.isSelected() ) {
927 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
929 else if ( ( _triangular_type_cbmi != null ) && _triangular_type_cbmi.isSelected() ) {
930 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR );
932 else if ( ( _curved_type_cbmi != null ) && _curved_type_cbmi.isSelected() ) {
933 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CURVED );
935 else if ( ( _convex_type_cbmi != null ) && _convex_type_cbmi.isSelected() ) {
936 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CONVEX );
938 else if ( ( _euro_type_cbmi != null ) && _euro_type_cbmi.isSelected() ) {
939 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE );
941 else if ( ( _rounded_type_cbmi != null ) && _rounded_type_cbmi.isSelected() ) {
942 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.ROUNDED );
944 else if ( ( _unrooted_type_cbmi != null ) && _unrooted_type_cbmi.isSelected() ) {
945 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.UNROOTED );
947 else if ( ( _circular_type_cbmi != null ) && _circular_type_cbmi.isSelected() ) {
948 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR );
952 void updateTypeCheckboxes( final Options options, final Object o ) {
953 setTypeMenuToAllUnselected();
954 ( ( JCheckBoxMenuItem ) o ).setSelected( true );
957 void displayBasicInformation() {
958 if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty() ) {
961 _textframe = TextFrame.instantiate( Util.crateBasicInformation( _mainpanel.getCurrentPhylogeny() ) );
966 if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty()
967 || ( _mainpanel.getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
970 _textframe = TextFrame.instantiate( _mainpanel.getCurrentPhylogeny().toNexus() );
975 if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty()
976 || ( _mainpanel.getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
979 _textframe = TextFrame.instantiate( _mainpanel.getCurrentPhylogeny().toNewHampshire( false ) );
984 if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty()
985 || ( _mainpanel.getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
988 _textframe = TextFrame.instantiate( _mainpanel.getCurrentPhylogeny().toNewHampshireX() );
993 if ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty()
994 && ( _mainpanel.getCurrentPhylogeny().getNumberOfExternalNodes() <= 10000 ) ) {
995 _textframe = TextFrame.instantiate( _mainpanel.getCurrentPhylogeny().toPhyloXML( 0 ) );
1000 * Display the about box.
1002 static void about() {
1003 final StringBuffer about = new StringBuffer( "Archaeopteryx\nVersion " + Constants.VERSION + "\n" );
1004 about.append( "Copyright (C) 2007-2011 Christian Zmasek\n" );
1005 about.append( "All Rights Reserved\n" );
1006 about.append( "License: GNU Lesser General Public License (LGPL)\n" );
1007 about.append( "Last modified: " + Constants.PRG_DATE + "\n" );
1008 about.append( "phyloXML version : " + ForesterConstants.PHYLO_XML_VERSION + "\n" );
1009 about.append( "phyloXML location: " + ForesterConstants.PHYLO_XML_LOCATION + "\n" );
1010 if ( !ForesterUtil.isEmpty( ForesterUtil.JAVA_VERSION ) && !ForesterUtil.isEmpty( ForesterUtil.JAVA_VENDOR ) ) {
1011 about.append( "[your Java version: " + ForesterUtil.JAVA_VERSION + " " + ForesterUtil.JAVA_VENDOR + "]\n" );
1013 if ( !ForesterUtil.isEmpty( ForesterUtil.OS_NAME ) && !ForesterUtil.isEmpty( ForesterUtil.OS_ARCH )
1014 && !ForesterUtil.isEmpty( ForesterUtil.OS_VERSION ) ) {
1015 about.append( "[your OS: " + ForesterUtil.OS_NAME + " " + ForesterUtil.OS_ARCH + " "
1016 + ForesterUtil.OS_VERSION + "]\n" );
1018 final Runtime rt = java.lang.Runtime.getRuntime();
1019 final long free_memory = rt.freeMemory() / 1000000;
1020 final long total_memory = rt.totalMemory() / 1000000;
1021 about.append( "[free memory: " + free_memory + "MB, total memory: " + total_memory + "MB]\n" );
1022 about.append( "[locale: " + Locale.getDefault() + "]\n" );
1023 about.append( "References:\n" );
1024 about.append( Constants.PHYLOXML_REFERENCE_SHORT + "\n" );
1025 about.append( "For more information & download:\n" );
1026 about.append( Constants.APTX_WEB_SITE + "\n" );
1027 about.append( "Comments: " + Constants.AUTHOR_EMAIL );
1028 JOptionPane.showMessageDialog( null, about, Constants.PRG_NAME, JOptionPane.PLAIN_MESSAGE );
1031 static String createCurrentFontDesc( final TreeFontSet tree_font_set ) {
1032 return tree_font_set.getLargeFont().getFamily() + " " + tree_font_set.getLargeFont().getSize();
1035 static JMenu createMenu( final String title, final Configuration conf ) {
1036 final JMenu jmenu = new JMenu( title );
1037 if ( !conf.isUseNativeUI() ) {
1038 jmenu.setFont( MainFrame.menu_font );
1039 jmenu.setBackground( conf.getGuiMenuBackgroundColor() );
1040 jmenu.setForeground( conf.getGuiMenuTextColor() );
1045 static JMenuItem customizeMenuItemAsLabel( final JMenuItem label, final Configuration configuration ) {
1046 label.setFont( MainFrame.menu_font.deriveFont( Font.BOLD ) );
1047 if ( !configuration.isUseNativeUI() ) {
1048 label.setBackground( configuration.getGuiMenuBackgroundColor() );
1049 label.setForeground( configuration.getGuiMenuTextColor() );
1050 label.setOpaque( true );
1052 label.setSelected( false );
1053 label.setEnabled( false );
1057 static void cycleOverview( final Options op, final TreePanel tree_panel ) {
1058 switch ( op.getOvPlacement() ) {
1060 op.setOvPlacement( Options.OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
1063 op.setOvPlacement( Options.OVERVIEW_PLACEMENT_TYPE.LOWER_LEFT );
1066 op.setOvPlacement( Options.OVERVIEW_PLACEMENT_TYPE.UPPER_RIGHT );
1069 op.setOvPlacement( Options.OVERVIEW_PLACEMENT_TYPE.LOWER_RIGHT );
1072 throw new RuntimeException( "unknown placement: " + op.getOvPlacement() );
1074 tree_panel.updateOvSettings();
1077 static void help( final Map<String, WebLink> weblinks ) {
1078 final StringBuilder sb = new StringBuilder();
1079 sb.append( "Display options\n" );
1080 sb.append( "-------------------\n" );
1081 sb.append( "Use the checkboxes to select types of information to display on the tree.\n\n" );
1082 sb.append( "Clickable tree nodes\n" );
1083 sb.append( "--------------------\n" );
1084 sb.append( "Tree nodes can be clicked, the action is determined by the 'click on node to' menu\n" );
1085 sb.append( "or by right clicking:\n" );
1086 sb.append( "o Display Node Data -- display information for a node\n" );
1087 sb.append( "o Collapse/Uncollapse -- collapse and uncollapse subtree from clicked node\n" );
1088 sb.append( "o Root/Reroot -- change tree root to clicked node\n" );
1089 sb.append( "o Sub/Super Tree -- toggle between subtree from clicked node and whole tree\n" );
1090 sb.append( "o Swap Descendants -- switch descendant on either side of clicked node\n" );
1091 sb.append( "o Colorize Subtree -- color a subtree\n" );
1092 sb.append( "o Open Sequence Web -- launch a web browser to display sequence information\n" );
1093 sb.append( "o Open Taxonomy Web -- launch a web browser to display taxonomy information\n" );
1094 sb.append( "- there may be additional choices depending on this particular setup\n\n" );
1095 sb.append( "Right clicking on a node always displays the information of a node.\n\n" );
1096 sb.append( "Zooming\n" );
1097 sb.append( "---------\n" );
1098 sb.append( "The mouse wheel and the plus and minus keys control zooming.\n" );
1099 sb.append( "Mouse wheel+Ctrl changes the text size.\n" );
1100 sb.append( "Mouse wheel+Shift controls zooming in vertical direction only.\n" );
1101 sb.append( "Use the buttons on the control panel to zoom the tree in and out, horizontally or vertically.\n" );
1102 sb.append( "The entire tree can be fitted into the window by clicking the \"F\" button, or by pressing F, Delete, or Home.\n" );
1103 sb.append( "The up, down, left, and right keys can be used to move the visible part (if zoomed in).\n" );
1104 sb.append( "Up, down, left, and right+Shift can be used to control zooming horizontally and vertically.\n" );
1105 sb.append( "Plus and minus keys+Ctrl change the text size; F+Ctrl, Delete+Ctrl, or Home+Ctrl resets it.\n\n" );
1106 sb.append( "Quick tree manipulation:\n" );
1107 sb.append( "------------------------\n" );
1108 sb.append( "Order Subtrees -- order the tree by branch length\n" );
1109 sb.append( "Uncollapse All -- uncollapse any and all collapsed branches\n\n" );
1110 sb.append( "Memory problems (Java heap space error)\n" );
1111 sb.append( "---------------------------------------\n" );
1112 sb.append( "Since the Java default memory allocation is quite small, it might by necessary (for trees\n" );
1113 sb.append( "with more than approximately 5000 external nodes) to increase the memory which Java can use, with\n" );
1114 sb.append( "the '-Xmx' Java command line option. For example:\n" );
1115 sb.append( "java -Xms32m -Xmx256m -cp path\\to\\forester.jar org.forester.archaeopteryx.Archaeopteryx\n\n" );
1116 if ( ( weblinks != null ) && ( weblinks.size() > 0 ) ) {
1117 sb.append( "Active web links\n" );
1118 sb.append( "--------------------\n" );
1119 for( final String key : weblinks.keySet() ) {
1120 sb.append( " " + weblinks.get( key ).toString() + "\n" );
1123 // + "General remarks\n"
1124 // + "---------------\n"
1126 // "o The application version permits copying to the clipboard \n"
1128 // " in the \"View\"|\"View as ...\" frame (either by control-c or button press).\n"
1130 // "o Changes made to a subtree affect this subtree and its subtrees,\n"
1131 // + " but not any of its parent tree(s).\n"
1133 // "o Archaeopteryx tries to detect whether the numerical values in a NH tree\n"
1135 // " are likely to be bootstrap values instead of branch length values.\n\n"
1137 // " Remarks regarding SDI (Speciation Duplication Inference):\n"
1139 // "o Each external node of the gene tree (in display) needs to be associated with\n"
1141 // " a species: either directly through the \"Species\" field, or the species\n"
1143 // " is part of the sequence name in the form \"XXXX_SPECIES\"\n"
1145 // " (e.g. \"ACON_DROME\" or \"ACON_DROME/123-4489\" which is also acceptable).\n"
1147 // "o A species tree for each species of the gene tree needs to be loaded with\n"
1149 // " \"SDI\"|\"Load species tree\" prior the SDI execution.\n"
1151 // "o !External nodes of the gene tree associated with species not present in\n"
1153 // " the species tree are REMOVED prior to SDI execution!\n"
1155 // "o Both the gene tree and the species tree must be completely binary.\n"
1157 // "o Duplications and speciations are a function of the position of the root.\n"
1159 // " Hence, after each manual \"Root/Reroot\"ing some duplications will be\n"
1160 // + " incorrect and need to be inferred again\n"
1162 // " with: \"SDI\"|\"SDI (Speciation Duplication Inference)\n\n"
1164 sb.append( "phyloXML\n" );
1165 sb.append( "-------------------\n" );
1166 sb.append( "Reference: " + Constants.PHYLOXML_REFERENCE + "\n" );
1167 sb.append( "Website: " + Constants.PHYLOXML_WEB_SITE + "\n" );
1168 sb.append( "Version: " + ForesterConstants.PHYLO_XML_VERSION + "\n" );
1170 sb.append( "For more information: http://www.phylosoft.org/archaeopteryx/\n" );
1171 sb.append( "Email: " + Constants.AUTHOR_EMAIL + "\n\n" );
1172 TextFrame.instantiate( sb.toString() );
1175 static void setOvPlacementColorChooseMenuItem( final JMenuItem mi, final TreePanel tree_panel ) {
1176 if ( ( tree_panel != null ) && ( tree_panel.getTreeColorSet() != null ) ) {
1177 mi.setText( "Overview Placement... (current: " + tree_panel.getOptions().getOvPlacement() + ")" );
1180 mi.setText( "Overview Placement..." );
1184 static void setTextColorChooseMenuItem( final JMenuItem mi, final TreePanel tree_panel ) {
1185 if ( ( tree_panel != null ) && ( tree_panel.getTreeColorSet() != null ) ) {
1186 mi.setText( "Select Colors... (current: " + tree_panel.getTreeColorSet().getCurrentColorSchemeName() + ")" );
1189 mi.setText( "Select Colors..." );
1193 static void setTextForFontChooserMenuItem( final JMenuItem mi, final String font_desc ) {
1194 mi.setText( "Select Font... (current: " + font_desc + ")" );
1197 static void setTextMinSupportMenuItem( final JMenuItem mi, final Options options, final TreePanel current_tree_panel ) {
1198 if ( ( current_tree_panel == null ) || ( current_tree_panel.getPhylogeny() == null ) ) {
1199 mi.setEnabled( true );
1201 else if ( ForesterUtil.isHasAtLeastOneBranchWithSupportValues( current_tree_panel.getPhylogeny() ) ) {
1202 mi.setEnabled( true );
1205 mi.setEnabled( false );
1207 mi.setText( "Enter Min Confidence Value... (current: " + options.getMinConfidenceValue() + ")" );
1210 static void updateOptionsMenuDependingOnPhylogenyType( final MainPanel main_panel,
1211 final JCheckBoxMenuItem scale,
1212 final JCheckBoxMenuItem branch_lengths,
1213 final JRadioButtonMenuItem non_lined_up,
1214 final JRadioButtonMenuItem uniform_clado,
1215 final JRadioButtonMenuItem nonuniform_clado,
1216 final JCheckBoxMenuItem label_direction_cbmi ) {
1217 final TreePanel tree_panel = main_panel.getCurrentTreePanel();
1218 final ControlPanel control = main_panel.getControlPanel();
1219 final Options options = main_panel.getOptions();
1220 scale.setSelected( options.isShowScale() );
1221 branch_lengths.setSelected( options.isShowBranchLengthValues() );
1222 // non_lined_up.setSelected( options.isNonLinedUpCladogram() );
1223 if ( ( tree_panel != null ) && ( !tree_panel.isPhyHasBranchLengths() ) ) {
1224 scale.setSelected( false );
1225 scale.setEnabled( false );
1226 branch_lengths.setSelected( false );
1227 branch_lengths.setEnabled( false );
1229 else if ( ( tree_panel != null ) && !control.isDrawPhylogram() ) {
1230 scale.setSelected( false );
1231 scale.setEnabled( false );
1232 branch_lengths.setEnabled( true );
1235 scale.setEnabled( true );
1236 branch_lengths.setEnabled( true );
1238 if ( ( tree_panel != null )
1239 && ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.ROUNDED )
1240 && ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE ) && ( tree_panel
1241 .getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR ) ) ) {
1242 branch_lengths.setSelected( false );
1243 branch_lengths.setEnabled( false );
1245 if ( tree_panel != null ) {
1246 if ( ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1247 || ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) {
1248 non_lined_up.setEnabled( false );
1249 uniform_clado.setEnabled( false );
1250 nonuniform_clado.setEnabled( false );
1253 non_lined_up.setEnabled( true );
1254 uniform_clado.setEnabled( true );
1255 nonuniform_clado.setEnabled( true );
1259 if ( ( tree_panel != null )
1260 && ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE ) && ( tree_panel
1261 .getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR ) ) ) {
1262 branch_lengths.setSelected( false );
1263 branch_lengths.setEnabled( false );
1265 if ( ( tree_panel != null )
1266 && ( ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( tree_panel
1267 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) {
1268 non_lined_up.setEnabled( false );
1271 // non_lined_up.setSelected( options.isNonLinedUpCladogram() );
1272 non_lined_up.setEnabled( true );
1275 label_direction_cbmi.setEnabled( true );
1276 if ( tree_panel != null ) {
1277 if ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1278 && ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1279 label_direction_cbmi.setEnabled( false );
1281 if ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) {
1282 scale.setSelected( false );
1283 scale.setEnabled( false );
1288 static void updateScreenTextAntialias( final List<TreePanel> treepanels ) {
1289 for( final TreePanel tree_panel : treepanels ) {
1290 tree_panel.setTextAntialias();