2 package org.forester.archaeopteryx;
4 import java.awt.BorderLayout;
5 import java.awt.Container;
6 import java.awt.event.ActionEvent;
7 import java.awt.event.ActionListener;
8 import java.awt.event.ComponentAdapter;
9 import java.awt.event.ComponentEvent;
10 import java.io.ByteArrayOutputStream;
12 import java.io.IOException;
14 import java.util.List;
16 import javax.swing.ButtonGroup;
17 import javax.swing.JApplet;
18 import javax.swing.JCheckBoxMenuItem;
19 import javax.swing.JMenu;
20 import javax.swing.JMenuBar;
21 import javax.swing.JMenuItem;
22 import javax.swing.JOptionPane;
23 import javax.swing.JRadioButtonMenuItem;
24 import javax.swing.UIManager;
25 import javax.swing.UnsupportedLookAndFeelException;
26 import javax.swing.event.ChangeEvent;
27 import javax.swing.event.ChangeListener;
29 import org.apache.commons.codec.binary.Base64;
30 import org.forester.archaeopteryx.AptxUtil.GraphicsExportType;
31 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
32 import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
33 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
34 import org.forester.phylogeny.Phylogeny;
35 import org.forester.phylogeny.data.SequenceRelation;
36 import org.forester.util.ForesterConstants;
37 import org.forester.util.ForesterUtil;
40 // <applet archive="forester.jar"
41 // code="org.forester.archaeopteryx.ArchaeopteryxE.class"
42 // codebase="http://www.myserver.org/path/to/forester"
45 // alt="ArchaeopteryxE is not working on your system (requires at least Sun Java 1.5)!">
46 // <param name="url_of_tree_to_load"
47 // value="http://www.myserver.org/examples/data/apaf.xml">
48 // <param name="config_file"
49 // value="http://www.myserver.org/examples/config/config_file.txt">
51 public class ArchaeopteryxE extends JApplet implements ActionListener {
53 private final static String NAME = "ArchaeopteryxE";
54 private static final long serialVersionUID = -1220055577935759443L;
55 private Configuration _configuration;
56 private MainPanelApplets _main_panel;
57 private JMenuBar _jmenubar;
58 private JMenu _options_jmenu;
59 private JMenu _font_size_menu;
60 private JMenuItem _super_tiny_fonts_mi;
61 private JMenuItem _tiny_fonts_mi;
62 private JMenuItem _small_fonts_mi;
63 private JMenuItem _medium_fonts_mi;
64 private JMenuItem _large_fonts_mi;
65 private TextFrame _textframe;
66 private JMenu _tools_menu;
67 private JMenuItem _taxcolor_item;
68 private JMenuItem _confcolor_item;
69 private JMenuItem _midpoint_root_item;
70 private JMenu _view_jmenu;
71 private JMenuItem _view_as_XML_item;
72 private JMenuItem _view_as_NH_item;
73 private JMenuItem _view_as_NHX_item;
74 private JMenuItem _view_as_nexus_item;
75 private JMenu _type_menu;
76 private JCheckBoxMenuItem _rectangular_type_cbmi;
77 private JCheckBoxMenuItem _triangular_type_cbmi;
78 private JCheckBoxMenuItem _curved_type_cbmi;
79 private JCheckBoxMenuItem _convex_type_cbmi;
80 private JCheckBoxMenuItem _euro_type_cbmi;
81 private JCheckBoxMenuItem _rounded_type_cbmi;
82 private JCheckBoxMenuItem _unrooted_type_cbmi;
83 private JCheckBoxMenuItem _circular_type_cbmi;
84 private JMenuItem _help_item;
85 private JMenuItem _about_item;
86 private JMenu _help_jmenu;
87 private JMenuItem _website_item;
88 private JMenuItem _phyloxml_website_item;
89 private JMenuItem _phyloxml_ref_item;
90 private JMenuItem _aptx_ref_item;
91 private JMenuItem _remove_branch_color_item;
92 private JMenuItem _infer_common_sn_names_item;
93 private JCheckBoxMenuItem _show_domain_labels;
94 private JCheckBoxMenuItem _color_labels_same_as_parent_branch;
95 private JCheckBoxMenuItem _abbreviate_scientific_names;
96 private JCheckBoxMenuItem _screen_antialias_cbmi;
97 private JCheckBoxMenuItem _background_gradient_cbmi;
98 private JRadioButtonMenuItem _non_lined_up_cladograms_rbmi;
99 private JRadioButtonMenuItem _uniform_cladograms_rbmi;
100 private JRadioButtonMenuItem _ext_node_dependent_cladogram_rbmi;
101 private Options _options;
102 private JMenuItem _choose_font_mi;
103 private JMenuItem _switch_colors_mi;
104 JCheckBoxMenuItem _label_direction_cbmi;
105 private JCheckBoxMenuItem _show_scale_cbmi;
106 private JCheckBoxMenuItem _search_case_senstive_cbmi;
107 private JCheckBoxMenuItem _search_whole_words_only_cbmi;
108 private JCheckBoxMenuItem _inverse_search_result_cbmi;
109 private JCheckBoxMenuItem _show_overview_cbmi;
110 private JMenuItem _choose_minimal_confidence_mi;
111 private JCheckBoxMenuItem _show_branch_length_values_cbmi;
112 private JMenuItem _collapse_species_specific_subtrees;
113 private JMenuItem _overview_placment_mi;
114 private ButtonGroup _radio_group_1;
115 private JCheckBoxMenuItem _show_default_node_shapes_cbmi;
116 private JMenuItem _cycle_node_shape_mi;
117 private JMenuItem _cycle_node_fill_mi;
118 private JMenuItem _choose_node_size_mi;
119 private JCheckBoxMenuItem _taxonomy_colorize_node_shapes_cbmi;
120 private JCheckBoxMenuItem _show_confidence_stddev_cbmi;
123 public void actionPerformed( final ActionEvent e ) {
124 final Object o = e.getSource();
125 if ( o == _midpoint_root_item ) {
126 getMainPanel().getCurrentTreePanel().midpointRoot();
128 else if ( o == _taxcolor_item ) {
129 getMainPanel().getCurrentTreePanel().taxColor();
131 else if ( o == _confcolor_item ) {
132 getMainPanel().getCurrentTreePanel().confColor();
134 else if ( o == _infer_common_sn_names_item ) {
135 if ( getCurrentTreePanel() != null ) {
136 getCurrentTreePanel().inferCommonPartOfScientificNames();
139 else if ( o == _collapse_species_specific_subtrees ) {
140 if ( getCurrentTreePanel() != null ) {
141 getCurrentTreePanel().collapseSpeciesSpecificSubtrees();
144 else if ( o == _remove_branch_color_item ) {
145 removeBranchColors();
147 else if ( o == _switch_colors_mi ) {
150 else if ( o == _view_as_NH_item ) {
153 else if ( o == _view_as_NHX_item ) {
156 else if ( o == _view_as_XML_item ) {
159 else if ( o == _view_as_nexus_item ) {
162 else if ( o == _super_tiny_fonts_mi ) {
163 if ( getCurrentTreePanel() != null ) {
164 getCurrentTreePanel().setSuperTinyFonts();
165 getCurrentTreePanel().repaint();
168 else if ( o == _tiny_fonts_mi ) {
169 if ( getCurrentTreePanel() != null ) {
170 getCurrentTreePanel().setTinyFonts();
171 getCurrentTreePanel().repaint();
174 else if ( o == _small_fonts_mi ) {
175 if ( getCurrentTreePanel() != null ) {
176 getCurrentTreePanel().setSmallFonts();
177 getCurrentTreePanel().repaint();
180 else if ( o == _medium_fonts_mi ) {
181 if ( getCurrentTreePanel() != null ) {
182 getCurrentTreePanel().setMediumFonts();
183 getCurrentTreePanel().repaint();
186 else if ( o == _large_fonts_mi ) {
187 if ( getCurrentTreePanel() != null ) {
188 getCurrentTreePanel().setLargeFonts();
189 getCurrentTreePanel().repaint();
192 else if ( o == _choose_font_mi ) {
195 else if ( o == _choose_minimal_confidence_mi ) {
196 chooseMinimalConfidence();
198 else if ( o == _choose_node_size_mi ) {
199 MainFrame.chooseNodeSize( getOptions(), this );
201 else if ( o == _overview_placment_mi ) {
202 MainFrame.cycleOverview( getOptions(), getCurrentTreePanel() );
204 else if ( o == _cycle_node_fill_mi ) {
205 MainFrame.cycleNodeFill( getOptions(), getCurrentTreePanel() );
207 else if ( o == _cycle_node_shape_mi ) {
208 MainFrame.cycleNodeShape( getOptions(), getCurrentTreePanel() );
210 else if ( o == _non_lined_up_cladograms_rbmi ) {
211 updateOptions( getOptions() );
212 _main_panel.getControlPanel().showWhole();
214 else if ( o == _uniform_cladograms_rbmi ) {
215 updateOptions( getOptions() );
216 _main_panel.getControlPanel().showWhole();
218 else if ( o == _ext_node_dependent_cladogram_rbmi ) {
219 updateOptions( getOptions() );
220 _main_panel.getControlPanel().showWhole();
222 else if ( o == _search_case_senstive_cbmi ) {
223 updateOptions( getOptions() );
224 getMainPanel().getControlPanel().search();
226 else if ( o == _search_whole_words_only_cbmi ) {
227 updateOptions( getOptions() );
228 getMainPanel().getControlPanel().search();
230 else if ( o == _inverse_search_result_cbmi ) {
231 updateOptions( getOptions() );
232 getMainPanel().getControlPanel().search();
234 else if ( o == _show_scale_cbmi ) {
235 updateOptions( getOptions() );
237 else if ( o == _show_branch_length_values_cbmi ) {
238 updateOptions( getOptions() );
240 else if ( o == _show_confidence_stddev_cbmi ) {
241 updateOptions( getOptions() );
243 else if ( o == _label_direction_cbmi ) {
244 updateOptions( getOptions() );
246 else if ( o == _show_overview_cbmi ) {
247 updateOptions( getOptions() );
248 if ( getCurrentTreePanel() != null ) {
249 getCurrentTreePanel().updateOvSizes();
252 else if ( ( o == _rectangular_type_cbmi ) || ( o == _triangular_type_cbmi ) || ( o == _curved_type_cbmi )
253 || ( o == _convex_type_cbmi ) || ( o == _rounded_type_cbmi ) || ( o == _euro_type_cbmi )
254 || ( o == _unrooted_type_cbmi ) || ( o == _circular_type_cbmi ) ) {
257 else if ( o == _screen_antialias_cbmi ) {
258 updateOptions( getOptions() );
259 setupScreenTextAntialias( getMainPanel().getTreePanels(), isScreenAntialias() );
261 else if ( o == _background_gradient_cbmi ) {
262 updateOptions( getOptions() );
264 else if ( o == _show_domain_labels ) {
265 updateOptions( getOptions() );
267 else if ( o == _color_labels_same_as_parent_branch ) {
268 updateOptions( getOptions() );
270 else if ( o == _show_default_node_shapes_cbmi ) {
271 updateOptions( getOptions() );
273 else if ( o == _taxonomy_colorize_node_shapes_cbmi ) {
274 updateOptions( getOptions() );
276 else if ( o == _about_item ) {
279 else if ( o == _help_item ) {
280 MainFrame.help( getConfiguration().getWebLinks() );
282 else if ( o == _website_item ) {
284 AptxUtil.openWebsite( Constants.APTX_WEB_SITE, true, this );
286 catch ( final IOException e1 ) {
287 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
290 else if ( o == _phyloxml_website_item ) {
292 AptxUtil.openWebsite( Constants.PHYLOXML_WEB_SITE, true, this );
294 catch ( final IOException e1 ) {
295 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
298 else if ( o == _aptx_ref_item ) {
300 AptxUtil.openWebsite( Constants.APTX_REFERENCE_URL, true, this );
302 catch ( final IOException e1 ) {
303 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
306 else if ( o == _phyloxml_ref_item ) {
308 AptxUtil.openWebsite( Constants.PHYLOXML_REFERENCE_URL, true, this );
310 catch ( final IOException e1 ) {
311 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
318 * This method returns the current phylogeny as a string in the chosen format
320 * @param format must be NH, NHX, NEXUS or PHYLOXML
321 * @return the phylogeny string
322 * @author Herve Menager
324 public String getCurrentPhylogeny( final String format ) {
326 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
327 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
330 switch ( ForesterConstants.PhylogeneticTreeFormats.valueOf( format ) ) {
332 return getMainPanel().getCurrentPhylogeny().toNewHampshire();
334 return getMainPanel().getCurrentPhylogeny().toNewHampshireX();
336 return getMainPanel().getCurrentPhylogeny().toNexus();
338 return getMainPanel().getCurrentPhylogeny().toPhyloXML( -1 );
346 * This method returns a view of the current phylogeny in a chosen
347 * graphics format, base64-encoded in a string so that in can be used
350 * @param format must be GraphicsExportType (gif, jpg, pdf, png, tif, bmp)
351 * @return the phylogeny string
352 * @author Herve Menager
354 public String getCurrentPhylogenyGraphicsAsBase64EncodedString( final String format ) {
355 final ByteArrayOutputStream baos = new ByteArrayOutputStream();
357 AptxUtil.writePhylogenyToGraphicsByteArrayOutputStream( baos,
358 _main_panel.getWidth(),
359 _main_panel.getHeight(),
360 getCurrentTreePanel(),
361 getCurrentTreePanel().getControlPanel(),
362 GraphicsExportType.valueOf( format ),
365 catch ( final IOException ioe ) {
366 ForesterUtil.printErrorMessage( NAME, ioe.toString() );
367 ioe.printStackTrace();
368 JOptionPane.showMessageDialog( this,
369 NAME + ": Failed to generate graphics: " + "\nException: " + ioe,
370 "Failed to generate graphics",
371 JOptionPane.ERROR_MESSAGE );
374 final byte[] bytes = baos.toByteArray();
375 final String dataImg = Base64.encodeBase64String( bytes );
379 void buildFontSizeMenu() {
380 _font_size_menu = MainFrame.createMenu( MainFrame.FONT_SIZE_MENU_LABEL, getConfiguration() );
381 _font_size_menu.add( _super_tiny_fonts_mi = new JMenuItem( "Super tiny fonts" ) );
382 _font_size_menu.add( _tiny_fonts_mi = new JMenuItem( "Tiny fonts" ) );
383 _font_size_menu.add( _small_fonts_mi = new JMenuItem( "Small fonts" ) );
384 _font_size_menu.add( _medium_fonts_mi = new JMenuItem( "Medium fonts" ) );
385 _font_size_menu.add( _large_fonts_mi = new JMenuItem( "Large fonts" ) );
386 customizeJMenuItem( _super_tiny_fonts_mi );
387 customizeJMenuItem( _tiny_fonts_mi );
388 customizeJMenuItem( _small_fonts_mi );
389 customizeJMenuItem( _medium_fonts_mi );
390 customizeJMenuItem( _large_fonts_mi );
391 _jmenubar.add( _font_size_menu );
394 void buildHelpMenu() {
395 _help_jmenu = MainFrame.createMenu( "Help", getConfiguration() );
396 _help_jmenu.add( _help_item = new JMenuItem( "Help" ) );
397 _help_jmenu.add( _website_item = new JMenuItem( "Archaeopteryx Home" ) );
398 _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" );
399 _help_jmenu.add( _phyloxml_website_item = new JMenuItem( "phyloXML Home" ) );
400 _help_jmenu.add( _phyloxml_ref_item = new JMenuItem( "phyloXML Reference" ) );
401 _help_jmenu.addSeparator();
402 _help_jmenu.add( _about_item = new JMenuItem( "About" ) );
403 customizeJMenuItem( _help_item );
404 customizeJMenuItem( _website_item );
405 customizeJMenuItem( _phyloxml_website_item );
406 customizeJMenuItem( _aptx_ref_item );
407 customizeJMenuItem( _phyloxml_ref_item );
408 customizeJMenuItem( _about_item );
409 _phyloxml_ref_item.setToolTipText( MainFrame.PHYLOXML_REF_TOOL_TIP );
410 _aptx_ref_item.setToolTipText( MainFrame.APTX_REF_TOOL_TIP );
411 _jmenubar.add( _help_jmenu );
414 void buildOptionsMenu() {
415 _options_jmenu = MainFrame.createMenu( MainFrame.OPTIONS_HEADER, getConfiguration() );
416 _options_jmenu.addChangeListener( new ChangeListener() {
419 public void stateChanged( final ChangeEvent e ) {
420 MainFrame.setOvPlacementColorChooseMenuItem( _overview_placment_mi, getOptions() );
421 MainFrame.setTextColorChooseMenuItem( _switch_colors_mi, getCurrentTreePanel() );
423 .setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() );
424 MainFrame.setTextForFontChooserMenuItem( _choose_font_mi, MainFrame
425 .createCurrentFontDesc( getMainPanel().getTreeFontSet() ) );
426 MainFrame.updateOptionsMenuDependingOnPhylogenyType( getMainPanel(),
428 _show_branch_length_values_cbmi,
429 _non_lined_up_cladograms_rbmi,
430 _uniform_cladograms_rbmi,
431 _ext_node_dependent_cladogram_rbmi,
432 _label_direction_cbmi );
433 MainFrame.setCycleNodeFillMenuItem( _cycle_node_fill_mi, getOptions() );
434 MainFrame.setCycleNodeShapeMenuItem( _cycle_node_shape_mi, getOptions() );
435 MainFrame.setTextNodeSizeMenuItem( _choose_node_size_mi, getOptions() );
438 _options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.DISPLAY_SUBHEADER ),
439 getConfiguration() ) );
441 .add( _ext_node_dependent_cladogram_rbmi = new JRadioButtonMenuItem( MainFrame.NONUNIFORM_CLADOGRAMS_LABEL ) );
442 _options_jmenu.add( _uniform_cladograms_rbmi = new JRadioButtonMenuItem( MainFrame.UNIFORM_CLADOGRAMS_LABEL ) );
444 .add( _non_lined_up_cladograms_rbmi = new JRadioButtonMenuItem( MainFrame.NON_LINED_UP_CLADOGRAMS_LABEL ) );
445 _radio_group_1 = new ButtonGroup();
446 _radio_group_1.add( _ext_node_dependent_cladogram_rbmi );
447 _radio_group_1.add( _uniform_cladograms_rbmi );
448 _radio_group_1.add( _non_lined_up_cladograms_rbmi );
449 _options_jmenu.add( _show_overview_cbmi = new JCheckBoxMenuItem( MainFrame.SHOW_OVERVIEW_LABEL ) );
450 _options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_SCALE_LABEL ) );
452 .add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
453 _options_jmenu.add( _show_confidence_stddev_cbmi = new JCheckBoxMenuItem( MainFrame.SHOW_CONF_STDDEV_LABEL ) );
455 .add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL ) );
457 .add( _taxonomy_colorize_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.TAXONOMY_COLORIZE_NODE_SHAPES_LABEL ) );
458 _options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
459 _options_jmenu.add( _cycle_node_fill_mi = new JMenuItem( MainFrame.CYCLE_NODE_FILL_LABEL ) );
460 _options_jmenu.add( _choose_node_size_mi = new JMenuItem( MainFrame.CHOOSE_NODE_SIZE_LABEL ) );
461 _options_jmenu.add( _label_direction_cbmi = new JCheckBoxMenuItem( MainFrame.LABEL_DIRECTION_LABEL ) );
463 .add( _color_labels_same_as_parent_branch = new JCheckBoxMenuItem( MainFrame.COLOR_LABELS_LABEL ) );
464 _color_labels_same_as_parent_branch.setToolTipText( MainFrame.COLOR_LABELS_TIP );
465 _options_jmenu.add( _abbreviate_scientific_names = new JCheckBoxMenuItem( MainFrame.ABBREV_SN_LABEL ) );
466 _label_direction_cbmi.setToolTipText( MainFrame.LABEL_DIRECTION_TIP );
467 _options_jmenu.add( _screen_antialias_cbmi = new JCheckBoxMenuItem( MainFrame.SCREEN_ANTIALIAS_LABEL ) );
468 _options_jmenu.add( _background_gradient_cbmi = new JCheckBoxMenuItem( MainFrame.BG_GRAD_LABEL ) );
469 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
470 _options_jmenu.add( _show_domain_labels = new JCheckBoxMenuItem( MainFrame.SHOW_DOMAIN_LABELS_LABEL ) );
472 _options_jmenu.add( _choose_minimal_confidence_mi = new JMenuItem( "" ) );
473 _options_jmenu.add( _overview_placment_mi = new JMenuItem( "" ) );
474 _options_jmenu.add( _switch_colors_mi = new JMenuItem( "" ) );
475 _options_jmenu.add( _choose_font_mi = new JMenuItem( "" ) );
476 _options_jmenu.addSeparator();
477 _options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.SEARCH_SUBHEADER ),
478 getConfiguration() ) );
480 .add( _search_case_senstive_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_CASE_SENSITIVE_LABEL ) );
481 _options_jmenu.add( _search_whole_words_only_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_TERMS_ONLY_LABEL ) );
483 .add( _inverse_search_result_cbmi = new JCheckBoxMenuItem( MainFrame.INVERSE_SEARCH_RESULT_LABEL ) );
484 customizeJMenuItem( _choose_font_mi );
485 customizeJMenuItem( _choose_minimal_confidence_mi );
486 customizeJMenuItem( _switch_colors_mi );
487 customizeJMenuItem( _overview_placment_mi );
488 customizeCheckBoxMenuItem( _label_direction_cbmi,
489 getOptions().getNodeLabelDirection() == NODE_LABEL_DIRECTION.RADIAL );
490 customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() );
491 customizeCheckBoxMenuItem( _background_gradient_cbmi, getOptions().isBackgroundColorGradient() );
492 customizeCheckBoxMenuItem( _show_domain_labels, getOptions().isShowDomainLabels() );
493 customizeCheckBoxMenuItem( _abbreviate_scientific_names, getOptions().isAbbreviateScientificTaxonNames() );
494 customizeCheckBoxMenuItem( _show_default_node_shapes_cbmi, getOptions().isShowDefaultNodeShapes() );
495 customizeCheckBoxMenuItem( _taxonomy_colorize_node_shapes_cbmi, getOptions().isTaxonomyColorizeNodeShapes() );
496 customizeJMenuItem( _cycle_node_shape_mi );
497 customizeJMenuItem( _cycle_node_fill_mi );
498 customizeJMenuItem( _choose_node_size_mi );
499 customizeCheckBoxMenuItem( _color_labels_same_as_parent_branch, getOptions().isColorLabelsSameAsParentBranch() );
500 customizeCheckBoxMenuItem( _search_case_senstive_cbmi, getOptions().isSearchCaseSensitive() );
501 customizeCheckBoxMenuItem( _show_scale_cbmi, getOptions().isShowScale() );
502 customizeRadioButtonMenuItem( _non_lined_up_cladograms_rbmi,
503 getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP );
504 customizeRadioButtonMenuItem( _uniform_cladograms_rbmi,
505 getOptions().getCladogramType() == CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
506 customizeRadioButtonMenuItem( _ext_node_dependent_cladogram_rbmi,
507 getOptions().getCladogramType() == CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
508 customizeCheckBoxMenuItem( _show_branch_length_values_cbmi, getOptions().isShowBranchLengthValues() );
509 customizeCheckBoxMenuItem( _show_overview_cbmi, getOptions().isShowOverview() );
510 customizeCheckBoxMenuItem( _search_whole_words_only_cbmi, getOptions().isMatchWholeTermsOnly() );
511 customizeCheckBoxMenuItem( _inverse_search_result_cbmi, getOptions().isInverseSearchResult() );
512 customizeCheckBoxMenuItem( _show_confidence_stddev_cbmi, getOptions().isShowConfidenceStddev() );
513 _jmenubar.add( _options_jmenu );
516 void buildToolsMenu() {
517 _tools_menu = MainFrame.createMenu( "Tools", getConfiguration() );
518 _tools_menu.add( _confcolor_item = new JMenuItem( "Colorize Branches Depending on Confidence" ) );
519 customizeJMenuItem( _confcolor_item );
520 _tools_menu.add( _taxcolor_item = new JMenuItem( "Taxonomy Colorize Branches" ) );
521 customizeJMenuItem( _taxcolor_item );
522 _tools_menu.add( _remove_branch_color_item = new JMenuItem( "Delete Branch Colors" ) );
523 _remove_branch_color_item.setToolTipText( "To delete branch color values from the current phylogeny." );
524 customizeJMenuItem( _remove_branch_color_item );
525 _tools_menu.addSeparator();
526 _tools_menu.add( _midpoint_root_item = new JMenuItem( "Midpoint-Root" ) );
527 customizeJMenuItem( _midpoint_root_item );
528 _tools_menu.addSeparator();
530 .add( _infer_common_sn_names_item = new JMenuItem( "Infer Common Parts of Internal Scientific Names" ) );
531 customizeJMenuItem( _infer_common_sn_names_item );
532 _tools_menu.add( _collapse_species_specific_subtrees = new JMenuItem( "Collapse Species-Specific Subtrees" ) );
533 customizeJMenuItem( _collapse_species_specific_subtrees );
534 _jmenubar.add( _tools_menu );
537 void buildTypeMenu() {
538 _type_menu = MainFrame.createMenu( MainFrame.TYPE_MENU_HEADER, getConfiguration() );
539 _type_menu.add( _rectangular_type_cbmi = new JCheckBoxMenuItem( MainFrame.RECTANGULAR_TYPE_CBMI_LABEL ) );
540 _type_menu.add( _euro_type_cbmi = new JCheckBoxMenuItem( MainFrame.EURO_TYPE_CBMI_LABEL ) );
541 _type_menu.add( _rounded_type_cbmi = new JCheckBoxMenuItem( MainFrame.ROUNDED_TYPE_CBMI_LABEL ) );
542 _type_menu.add( _curved_type_cbmi = new JCheckBoxMenuItem( MainFrame.CURVED_TYPE_CBMI_LABEL ) );
543 _type_menu.add( _triangular_type_cbmi = new JCheckBoxMenuItem( MainFrame.TRIANGULAR_TYPE_CBMI_LABEL ) );
544 _type_menu.add( _convex_type_cbmi = new JCheckBoxMenuItem( MainFrame.CONVEX_TYPE_CBMI_LABEL ) );
545 _type_menu.add( _unrooted_type_cbmi = new JCheckBoxMenuItem( MainFrame.UNROOTED_TYPE_CBMI_LABEL ) );
546 _type_menu.add( _circular_type_cbmi = new JCheckBoxMenuItem( MainFrame.CIRCULAR_TYPE_CBMI_LABEL ) );
547 customizeCheckBoxMenuItem( _rectangular_type_cbmi, false );
548 customizeCheckBoxMenuItem( _triangular_type_cbmi, false );
549 customizeCheckBoxMenuItem( _euro_type_cbmi, false );
550 customizeCheckBoxMenuItem( _rounded_type_cbmi, false );
551 customizeCheckBoxMenuItem( _curved_type_cbmi, false );
552 customizeCheckBoxMenuItem( _convex_type_cbmi, false );
553 customizeCheckBoxMenuItem( _unrooted_type_cbmi, false );
554 customizeCheckBoxMenuItem( _circular_type_cbmi, false );
555 _unrooted_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
556 _circular_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
557 initializeTypeMenu( getOptions() );
558 _jmenubar.add( _type_menu );
561 void buildViewMenu() {
562 _view_jmenu = MainFrame.createMenu( "View as Text", getConfiguration() );
563 _view_jmenu.add( _view_as_XML_item = new JMenuItem( "View as phyloXML" ) );
564 _view_jmenu.add( _view_as_NH_item = new JMenuItem( "View as Newick" ) );
565 _view_jmenu.add( _view_as_NHX_item = new JMenuItem( "View as NHX" ) );
566 _view_jmenu.add( _view_as_nexus_item = new JMenuItem( "View as Nexus" ) );
567 customizeJMenuItem( _view_as_NH_item );
568 customizeJMenuItem( _view_as_NHX_item );
569 customizeJMenuItem( _view_as_XML_item );
570 customizeJMenuItem( _view_as_nexus_item );
571 _jmenubar.add( _view_jmenu );
574 private void chooseFont() {
575 final FontChooser fc = new FontChooser();
576 fc.setFont( getMainPanel().getTreeFontSet().getLargeFont() );
577 fc.showDialog( this, "Select the Base Font" );
578 getMainPanel().getTreeFontSet().setBaseFont( fc.getFont() );
581 private void chooseMinimalConfidence() {
582 final String s = ( String ) JOptionPane
583 .showInputDialog( this,
584 "Please the minimum for confidence values to be displayed.\n" + "[current value: "
585 + getOptions().getMinConfidenceValue() + "]\n",
586 "Minimal Confidence Value",
587 JOptionPane.QUESTION_MESSAGE,
590 getOptions().getMinConfidenceValue() );
591 if ( !ForesterUtil.isEmpty( s ) ) {
592 boolean success = true;
594 final String m_str = s.trim();
595 if ( !ForesterUtil.isEmpty( m_str ) ) {
597 m = Double.parseDouble( m_str );
599 catch ( final Exception ex ) {
606 if ( success && ( m >= 0.0 ) ) {
607 getOptions().setMinConfidenceValue( m );
612 void customizeCheckBoxMenuItem( final JCheckBoxMenuItem item, final boolean is_selected ) {
613 if ( item != null ) {
614 item.setFont( MainFrame.menu_font );
615 if ( !getConfiguration().isUseNativeUI() ) {
616 item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
617 item.setForeground( getConfiguration().getGuiMenuTextColor() );
619 item.setSelected( is_selected );
620 item.addActionListener( this );
624 void customizeJMenuItem( final JMenuItem jmi ) {
625 jmi.setFont( MainFrame.menu_font );
626 if ( !getConfiguration().isUseNativeUI() ) {
627 jmi.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
628 jmi.setForeground( getConfiguration().getGuiMenuTextColor() );
630 jmi.addActionListener( this );
633 private void customizeRadioButtonMenuItem( final JRadioButtonMenuItem item, final boolean is_selected ) {
634 if ( item != null ) {
635 item.setFont( MainFrame.menu_font );
636 if ( !getConfiguration().isUseNativeUI() ) {
637 item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
638 item.setForeground( getConfiguration().getGuiMenuTextColor() );
640 item.setSelected( is_selected );
641 item.addActionListener( this );
646 public void destroy() {
647 AptxUtil.printAppletMessage( NAME, "going to be destroyed " );
649 if ( getMainPanel() != null ) {
650 getMainPanel().terminate();
654 Configuration getConfiguration() {
655 return _configuration;
658 TreePanel getCurrentTreePanel() {
659 return getMainPanel().getCurrentTreePanel();
662 JCheckBoxMenuItem getlabelDirectionCbmi() {
663 return _label_direction_cbmi;
666 private MainPanel getMainPanel() {
670 public Options getOptions() {
674 Options getOtions() {
680 final String config_filename = getParameter( Constants.APPLET_PARAM_NAME_FOR_CONFIG_FILE_URL );
681 AptxUtil.printAppletMessage( NAME, "URL for configuration file is: " + config_filename );
682 final Configuration configuration = new Configuration( config_filename, true, true, true );
683 setConfiguration( configuration );
684 setOptions( Options.createInstance( configuration ) );
687 Phylogeny[] phys = null;
688 final String phys_url_string = getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
689 AptxUtil.printAppletMessage( NAME, "URL for phylogenies is " + phys_url_string );
690 // Get URL to tree file
691 if ( phys_url_string != null ) {
693 phys_url = new URL( phys_url_string );
695 catch ( final Exception e ) {
696 ForesterUtil.printErrorMessage( NAME, "error: " + e );
698 JOptionPane.showMessageDialog( this, NAME + ": Could not create URL from: \"" + phys_url_string
699 + "\"\nException: " + e, "Failed to create URL", JOptionPane.ERROR_MESSAGE );
702 // Load the tree from URL
703 if ( phys_url != null ) {
705 phys = AptxUtil.readPhylogeniesFromUrl( phys_url, getConfiguration().isValidatePhyloXmlAgainstSchema() );
707 catch ( final Exception e ) {
708 ForesterUtil.printErrorMessage( NAME, e.toString() );
710 JOptionPane.showMessageDialog( this,
711 NAME + ": Failed to read phylogenies: " + "\nException: " + e,
712 "Failed to read phylogenies",
713 JOptionPane.ERROR_MESSAGE );
716 if ( ( phys == null ) || ( phys.length < 1 ) ) {
717 ForesterUtil.printErrorMessage( NAME, "phylogenies from [" + phys_url + "] are null or empty" );
718 JOptionPane.showMessageDialog( this,
719 NAME + ": phylogenies from [" + phys_url + "] are null or empty",
720 "Failed to read phylogenies",
721 JOptionPane.ERROR_MESSAGE );
725 AptxUtil.printAppletMessage( NAME, "loaded " + phys.length + " phylogenies from: " + phys_url );
728 setMainPanel( new MainPanelApplets( getConfiguration(), this ) );
729 _jmenubar = new JMenuBar();
730 if ( !getConfiguration().isHideControlPanelAndMenubar() ) {
731 if ( !getConfiguration().isUseNativeUI() ) {
732 _jmenubar.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
740 setJMenuBar( _jmenubar );
742 final Container contentpane = getContentPane();
743 contentpane.setLayout( new BorderLayout() );
744 contentpane.add( getMainPanel(), BorderLayout.CENTER );
745 addComponentListener( new ComponentAdapter() {
748 public void componentResized( final ComponentEvent e ) {
749 if ( getMainPanel().getCurrentTreePanel() != null ) {
750 getMainPanel().getCurrentTreePanel().setParametersForPainting( getMainPanel().getCurrentTreePanel()
752 getMainPanel().getCurrentTreePanel()
758 if ( getConfiguration().isUseTabbedDisplay() ) {
759 AptxUtil.printAppletMessage( NAME, "using tabbed display" );
760 AptxUtil.addPhylogeniesToTabs( phys,
761 new File( phys_url.getFile() ).getName(),
767 AptxUtil.printAppletMessage( NAME, "not using tabbed display" );
768 AptxUtil.addPhylogenyToPanel( phys, getConfiguration(), getMainPanel() );
772 getMainPanel().getControlPanel().showWholeAll();
773 getMainPanel().getControlPanel().showWhole();
775 AptxUtil.printAppletMessage( NAME, "successfully initialized" );
777 getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().removeAllItems();
778 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
779 .getRelevantSequenceRelationTypes() ) {
780 getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().addItem( type );
782 final String default_relation = getParameter( Constants.APPLET_PARAM_NAME_FOR_DEFAULT_SEQUENCE_RELATION_TYPE );
783 if ( default_relation != null ) {
784 getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().setSelectedItem( default_relation );
786 final String default_sequence = getParameter( Constants.APPLET_PARAM_NAME_FOR_DEFAULT_QUERY_SEQUENCE );
787 if ( default_sequence != null ) {
788 getCurrentTreePanel().getControlPanel().getSequenceRelationBox().setSelectedItem( default_sequence );
794 void initializeTypeMenu( final Options options ) {
795 setTypeMenuToAllUnselected();
797 switch ( options.getPhylogenyGraphicsType() ) {
799 _convex_type_cbmi.setSelected( true );
802 _curved_type_cbmi.setSelected( true );
805 _euro_type_cbmi.setSelected( true );
808 _rounded_type_cbmi.setSelected( true );
811 _triangular_type_cbmi.setSelected( true );
814 _unrooted_type_cbmi.setSelected( true );
817 _circular_type_cbmi.setSelected( true );
820 _rectangular_type_cbmi.setSelected( true );
824 catch ( final NullPointerException np ) {
825 // In all likelihood, this is caused by menu-less display.
829 private boolean isScreenAntialias() {
833 private void removeBranchColors() {
834 if ( getMainPanel().getCurrentPhylogeny() != null ) {
835 AptxUtil.removeBranchColors( getMainPanel().getCurrentPhylogeny() );
839 void removeTextFrame() {
840 if ( _textframe != null ) {
846 void setConfiguration( final Configuration configuration ) {
847 _configuration = configuration;
850 private void setMainPanel( final MainPanelApplets main_panel ) {
851 _main_panel = main_panel;
854 void setOptions( final Options options ) {
858 void setSelectedTypeInTypeMenu( final PHYLOGENY_GRAPHICS_TYPE type ) {
859 setTypeMenuToAllUnselected();
863 _circular_type_cbmi.setSelected( true );
866 _convex_type_cbmi.setSelected( true );
869 _curved_type_cbmi.setSelected( true );
872 _euro_type_cbmi.setSelected( true );
875 _rounded_type_cbmi.setSelected( true );
878 _rectangular_type_cbmi.setSelected( true );
881 _triangular_type_cbmi.setSelected( true );
884 _unrooted_type_cbmi.setSelected( true );
887 throw new IllegalArgumentException( "unknown type: " + type );
890 catch ( final NullPointerException np ) {
891 // In all likelihood, this is caused by menu-less display.
895 void setTypeMenuToAllUnselected() {
896 if ( _convex_type_cbmi != null ) {
897 _convex_type_cbmi.setSelected( false );
899 if ( _curved_type_cbmi != null ) {
900 _curved_type_cbmi.setSelected( false );
902 if ( _euro_type_cbmi != null ) {
903 _euro_type_cbmi.setSelected( false );
905 if ( _rounded_type_cbmi != null ) {
906 _rounded_type_cbmi.setSelected( false );
908 if ( _triangular_type_cbmi != null ) {
909 _triangular_type_cbmi.setSelected( false );
911 if ( _rectangular_type_cbmi != null ) {
912 _rectangular_type_cbmi.setSelected( false );
914 if ( _unrooted_type_cbmi != null ) {
915 _unrooted_type_cbmi.setSelected( false );
917 if ( _circular_type_cbmi != null ) {
918 _circular_type_cbmi.setSelected( false );
922 private void setupUI() {
924 if ( getConfiguration().isUseNativeUI() ) {
925 UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
928 UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );
931 catch ( final UnsupportedLookAndFeelException e ) {
932 AptxUtil.dieWithSystemError( "UnsupportedLookAndFeelException: " + e.toString() );
934 catch ( final ClassNotFoundException e ) {
935 AptxUtil.dieWithSystemError( "ClassNotFoundException: " + e.toString() );
937 catch ( final InstantiationException e ) {
938 AptxUtil.dieWithSystemError( "InstantiationException: " + e.toString() );
940 catch ( final IllegalAccessException e ) {
941 AptxUtil.dieWithSystemError( "IllegalAccessException: " + e.toString() );
943 catch ( final Exception e ) {
944 AptxUtil.dieWithSystemError( e.toString() );
949 public void start() {
950 if ( getMainPanel() != null ) {
951 getMainPanel().validate();
954 requestFocusInWindow();
956 AptxUtil.printAppletMessage( NAME, "started" );
959 void switchColors() {
960 final TreeColorSet colorset = getMainPanel().getCurrentTreePanel().getTreeColorSet();
961 final ColorSchemeChooser csc = new ColorSchemeChooser( getMainPanel(), colorset );
962 csc.setVisible( true );
963 getMainPanel().setTreeColorSet( colorset );
966 void typeChanged( final Object o ) {
967 updateTypeCheckboxes( getOptions(), o );
968 updateOptions( getOptions() );
969 if ( getCurrentTreePanel() != null ) {
970 final PHYLOGENY_GRAPHICS_TYPE previous_type = getCurrentTreePanel().getPhylogenyGraphicsType();
971 final PHYLOGENY_GRAPHICS_TYPE new_type = getOptions().getPhylogenyGraphicsType();
972 if ( ( ( previous_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) && ( new_type != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) )
973 || ( ( previous_type == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) && ( new_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) )
974 || ( ( previous_type != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) && ( new_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) )
975 || ( ( previous_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) && ( new_type == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) ) {
976 getCurrentTreePanel().getControlPanel().showWhole();
978 if ( getCurrentTreePanel().isPhyHasBranchLengths() && ( new_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
979 getCurrentTreePanel().getControlPanel().setDrawPhylogramEnabled( true );
982 getCurrentTreePanel().getControlPanel().setDrawPhylogramEnabled( false );
984 getCurrentTreePanel().setPhylogenyGraphicsType( getOptions().getPhylogenyGraphicsType() );
985 MainFrame.updateScreenTextAntialias( getMainPanel().getTreePanels() );
989 void updateOptions( final Options options ) {
990 options.setAntialiasScreen( ( _screen_antialias_cbmi != null ) && _screen_antialias_cbmi.isSelected() );
991 options.setBackgroundColorGradient( ( _background_gradient_cbmi != null )
992 && _background_gradient_cbmi.isSelected() );
993 options.setShowDomainLabels( ( _show_domain_labels != null ) && _show_domain_labels.isSelected() );
994 options.setAbbreviateScientificTaxonNames( ( _abbreviate_scientific_names != null )
995 && _abbreviate_scientific_names.isSelected() );
996 options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )
997 && _color_labels_same_as_parent_branch.isSelected() );
998 options.setShowDefaultNodeShapes( ( _show_default_node_shapes_cbmi != null )
999 && _show_default_node_shapes_cbmi.isSelected() );
1000 options.setTaxonomyColorizeNodeShapes( ( _taxonomy_colorize_node_shapes_cbmi != null )
1001 && _taxonomy_colorize_node_shapes_cbmi.isSelected() );
1002 if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {
1003 options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );
1005 else if ( ( _uniform_cladograms_rbmi != null ) && ( _uniform_cladograms_rbmi.isSelected() ) ) {
1006 options.setCladogramType( CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
1008 else if ( ( _ext_node_dependent_cladogram_rbmi != null ) && ( _ext_node_dependent_cladogram_rbmi.isSelected() ) ) {
1009 options.setCladogramType( CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
1011 options.setSearchCaseSensitive( ( _search_case_senstive_cbmi != null )
1012 && _search_case_senstive_cbmi.isSelected() );
1013 if ( ( _show_scale_cbmi != null ) && _show_scale_cbmi.isEnabled() ) {
1014 options.setShowScale( _show_scale_cbmi.isSelected() );
1016 if ( _label_direction_cbmi != null ) {
1017 if ( _label_direction_cbmi.isSelected() ) {
1018 options.setNodeLabelDirection( NODE_LABEL_DIRECTION.RADIAL );
1021 options.setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
1024 options.setShowOverview( ( _show_overview_cbmi != null ) && _show_overview_cbmi.isSelected() );
1025 options.setShowConfidenceStddev( ( _show_confidence_stddev_cbmi != null )
1026 && _show_confidence_stddev_cbmi.isSelected() );
1027 if ( ( _show_branch_length_values_cbmi != null ) && _show_branch_length_values_cbmi.isEnabled() ) {
1028 options.setShowBranchLengthValues( _show_branch_length_values_cbmi.isSelected() );
1030 options.setMatchWholeTermsOnly( ( _search_whole_words_only_cbmi != null )
1031 && _search_whole_words_only_cbmi.isSelected() );
1032 options.setInverseSearchResult( ( _inverse_search_result_cbmi != null )
1033 && _inverse_search_result_cbmi.isSelected() );
1034 if ( ( _rectangular_type_cbmi != null ) && _rectangular_type_cbmi.isSelected() ) {
1035 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
1037 else if ( ( _triangular_type_cbmi != null ) && _triangular_type_cbmi.isSelected() ) {
1038 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR );
1040 else if ( ( _curved_type_cbmi != null ) && _curved_type_cbmi.isSelected() ) {
1041 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CURVED );
1043 else if ( ( _convex_type_cbmi != null ) && _convex_type_cbmi.isSelected() ) {
1044 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CONVEX );
1046 else if ( ( _euro_type_cbmi != null ) && _euro_type_cbmi.isSelected() ) {
1047 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE );
1049 else if ( ( _rounded_type_cbmi != null ) && _rounded_type_cbmi.isSelected() ) {
1050 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.ROUNDED );
1052 else if ( ( _unrooted_type_cbmi != null ) && _unrooted_type_cbmi.isSelected() ) {
1053 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.UNROOTED );
1055 else if ( ( _circular_type_cbmi != null ) && _circular_type_cbmi.isSelected() ) {
1056 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR );
1060 void updateTypeCheckboxes( final Options options, final Object o ) {
1061 setTypeMenuToAllUnselected();
1062 ( ( JCheckBoxMenuItem ) o ).setSelected( true );
1065 void viewAsNexus() {
1067 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
1068 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
1071 _textframe = TextFrame.instantiate( getMainPanel().getCurrentPhylogeny().toNexus() );
1076 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
1077 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
1080 _textframe = TextFrame.instantiate( getMainPanel().getCurrentPhylogeny().toNewHampshire() );
1085 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
1086 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
1089 _textframe = TextFrame.instantiate( getMainPanel().getCurrentPhylogeny().toNewHampshireX() );
1094 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
1095 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
1098 _textframe = TextFrame.instantiate( getMainPanel().getCurrentPhylogeny().toPhyloXML( 0 ) );
1101 static void setupScreenTextAntialias( final List<TreePanel> treepanels, final boolean antialias ) {
1102 for( final TreePanel tree_panel : treepanels ) {
1103 tree_panel.setTextAntialias();