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.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
30 import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
31 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
32 import org.forester.archaeopteryx.Util.GraphicsExportType;
33 import org.forester.phylogeny.Phylogeny;
34 import org.forester.phylogeny.data.SequenceRelation;
35 import org.forester.util.ForesterConstants;
36 import org.forester.util.ForesterUtil;
37 import org.apache.commons.codec.binary.Base64;
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;
122 public void actionPerformed( final ActionEvent e ) {
123 final Object o = e.getSource();
124 if ( o == _midpoint_root_item ) {
125 getMainPanel().getCurrentTreePanel().midpointRoot();
127 else if ( o == _taxcolor_item ) {
128 getMainPanel().getCurrentTreePanel().taxColor();
130 else if ( o == _confcolor_item ) {
131 getMainPanel().getCurrentTreePanel().confColor();
133 else if ( o == _infer_common_sn_names_item ) {
134 if ( getCurrentTreePanel() != null ) {
135 getCurrentTreePanel().inferCommonPartOfScientificNames();
138 else if ( o == _collapse_species_specific_subtrees ) {
139 if ( getCurrentTreePanel() != null ) {
140 getCurrentTreePanel().collapseSpeciesSpecificSubtrees();
143 else if ( o == _remove_branch_color_item ) {
144 removeBranchColors();
146 else if ( o == _switch_colors_mi ) {
149 else if ( o == _view_as_NH_item ) {
152 else if ( o == _view_as_NHX_item ) {
155 else if ( o == _view_as_XML_item ) {
158 else if ( o == _view_as_nexus_item ) {
161 else if ( o == _super_tiny_fonts_mi ) {
162 if ( getCurrentTreePanel() != null ) {
163 getCurrentTreePanel().setSuperTinyFonts();
164 getCurrentTreePanel().repaint();
167 else if ( o == _tiny_fonts_mi ) {
168 if ( getCurrentTreePanel() != null ) {
169 getCurrentTreePanel().setTinyFonts();
170 getCurrentTreePanel().repaint();
173 else if ( o == _small_fonts_mi ) {
174 if ( getCurrentTreePanel() != null ) {
175 getCurrentTreePanel().setSmallFonts();
176 getCurrentTreePanel().repaint();
179 else if ( o == _medium_fonts_mi ) {
180 if ( getCurrentTreePanel() != null ) {
181 getCurrentTreePanel().setMediumFonts();
182 getCurrentTreePanel().repaint();
185 else if ( o == _large_fonts_mi ) {
186 if ( getCurrentTreePanel() != null ) {
187 getCurrentTreePanel().setLargeFonts();
188 getCurrentTreePanel().repaint();
191 else if ( o == _choose_font_mi ) {
194 else if ( o == _choose_minimal_confidence_mi ) {
195 chooseMinimalConfidence();
197 else if ( o == _choose_node_size_mi ) {
198 MainFrame.chooseNodeSize( getOptions(), this );
200 else if ( o == _overview_placment_mi ) {
201 MainFrame.cycleOverview( getOptions(), getCurrentTreePanel() );
203 else if ( o == _cycle_node_fill_mi ) {
204 MainFrame.cycleNodeFill( getOptions(), getCurrentTreePanel() );
206 else if ( o == _cycle_node_shape_mi ) {
207 MainFrame.cycleNodeShape( getOptions(), getCurrentTreePanel() );
209 else if ( o == _non_lined_up_cladograms_rbmi ) {
210 updateOptions( getOptions() );
211 _main_panel.getControlPanel().showWhole();
213 else if ( o == _uniform_cladograms_rbmi ) {
214 updateOptions( getOptions() );
215 _main_panel.getControlPanel().showWhole();
217 else if ( o == _ext_node_dependent_cladogram_rbmi ) {
218 updateOptions( getOptions() );
219 _main_panel.getControlPanel().showWhole();
221 else if ( o == _search_case_senstive_cbmi ) {
222 updateOptions( getOptions() );
223 getMainPanel().getControlPanel().search();
225 else if ( o == _search_whole_words_only_cbmi ) {
226 updateOptions( getOptions() );
227 getMainPanel().getControlPanel().search();
229 else if ( o == _inverse_search_result_cbmi ) {
230 updateOptions( getOptions() );
231 getMainPanel().getControlPanel().search();
233 else if ( o == _show_scale_cbmi ) {
234 updateOptions( getOptions() );
236 else if ( o == _show_branch_length_values_cbmi ) {
237 updateOptions( getOptions() );
239 else if ( o == _label_direction_cbmi ) {
240 updateOptions( getOptions() );
242 else if ( o == _show_overview_cbmi ) {
243 updateOptions( getOptions() );
244 if ( getCurrentTreePanel() != null ) {
245 getCurrentTreePanel().updateOvSizes();
248 else if ( ( o == _rectangular_type_cbmi ) || ( o == _triangular_type_cbmi ) || ( o == _curved_type_cbmi )
249 || ( o == _convex_type_cbmi ) || ( o == _rounded_type_cbmi ) || ( o == _euro_type_cbmi )
250 || ( o == _unrooted_type_cbmi ) || ( o == _circular_type_cbmi ) ) {
253 else if ( o == _screen_antialias_cbmi ) {
254 updateOptions( getOptions() );
255 setupScreenTextAntialias( getMainPanel().getTreePanels(), isScreenAntialias() );
257 else if ( o == _background_gradient_cbmi ) {
258 updateOptions( getOptions() );
260 else if ( o == _show_domain_labels ) {
261 updateOptions( getOptions() );
263 else if ( o == _color_labels_same_as_parent_branch ) {
264 updateOptions( getOptions() );
266 else if ( o == _show_default_node_shapes_cbmi ) {
267 updateOptions( getOptions() );
269 else if ( o == _taxonomy_colorize_node_shapes_cbmi ) {
270 updateOptions( getOptions() );
272 else if ( o == _about_item ) {
275 else if ( o == _help_item ) {
276 MainFrame.help( getConfiguration().getWebLinks() );
278 else if ( o == _website_item ) {
280 Util.openWebsite( Constants.APTX_WEB_SITE, true, this );
282 catch ( final IOException e1 ) {
283 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
286 else if ( o == _phyloxml_website_item ) {
288 Util.openWebsite( Constants.PHYLOXML_WEB_SITE, true, this );
290 catch ( final IOException e1 ) {
291 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
294 else if ( o == _aptx_ref_item ) {
296 Util.openWebsite( Constants.APTX_REFERENCE_URL, true, this );
298 catch ( final IOException e1 ) {
299 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
302 else if ( o == _phyloxml_ref_item ) {
304 Util.openWebsite( Constants.PHYLOXML_REFERENCE_URL, true, this );
306 catch ( final IOException e1 ) {
307 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
314 * This method returns the current phylogeny as a string in the chosen format
316 * @param format must be NH, NHX, NEXUS or PHYLOXML
317 * @return the phylogeny string
318 * @author Herve Menager
320 public String getCurrentPhylogeny( final String format ) {
322 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
323 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
326 switch ( ForesterConstants.PhylogeneticTreeFormats.valueOf( format ) ) {
328 return getMainPanel().getCurrentPhylogeny().toNewHampshire();
330 return getMainPanel().getCurrentPhylogeny().toNewHampshireX();
332 return getMainPanel().getCurrentPhylogeny().toNexus();
334 return getMainPanel().getCurrentPhylogeny().toPhyloXML( -1 );
342 * This method returns a view of the current phylogeny in a chosen
343 * graphics format, base64-encoded in a string so that in can be used
346 * @param format must be GraphicsExportType (gif, jpg, pdf, png, tif, bmp)
347 * @return the phylogeny string
348 * @author Herve Menager
350 public String getCurrentPhylogenyGraphicsAsBase64EncodedString( final String format ) {
351 ByteArrayOutputStream baos = new ByteArrayOutputStream();
353 Util.writePhylogenyToGraphicsByteArrayOutputStream( baos,
354 _main_panel.getWidth(),
355 _main_panel.getHeight(),
356 this.getCurrentTreePanel(),
357 getCurrentTreePanel().getControlPanel(),
358 GraphicsExportType.valueOf(format),
360 }catch(IOException ioe){
361 ForesterUtil.printErrorMessage( NAME, ioe.toString() );
362 ioe.printStackTrace();
363 JOptionPane.showMessageDialog( this,
364 NAME + ": Failed to generate graphics: " + "\nException: " + ioe,
365 "Failed to generate graphics",
366 JOptionPane.ERROR_MESSAGE );
369 byte[] bytes = baos.toByteArray();
370 String dataImg = Base64.encodeBase64String(bytes);
374 void buildFontSizeMenu() {
375 _font_size_menu = MainFrame.createMenu( MainFrame.FONT_SIZE_MENU_LABEL, getConfiguration() );
376 _font_size_menu.add( _super_tiny_fonts_mi = new JMenuItem( "Super tiny fonts" ) );
377 _font_size_menu.add( _tiny_fonts_mi = new JMenuItem( "Tiny fonts" ) );
378 _font_size_menu.add( _small_fonts_mi = new JMenuItem( "Small fonts" ) );
379 _font_size_menu.add( _medium_fonts_mi = new JMenuItem( "Medium fonts" ) );
380 _font_size_menu.add( _large_fonts_mi = new JMenuItem( "Large fonts" ) );
381 customizeJMenuItem( _super_tiny_fonts_mi );
382 customizeJMenuItem( _tiny_fonts_mi );
383 customizeJMenuItem( _small_fonts_mi );
384 customizeJMenuItem( _medium_fonts_mi );
385 customizeJMenuItem( _large_fonts_mi );
386 _jmenubar.add( _font_size_menu );
389 void buildHelpMenu() {
390 _help_jmenu = MainFrame.createMenu( "Help", getConfiguration() );
391 _help_jmenu.add( _help_item = new JMenuItem( "Help" ) );
392 _help_jmenu.add( _website_item = new JMenuItem( "Archaeopteryx Home" ) );
393 _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" );
394 _help_jmenu.add( _phyloxml_website_item = new JMenuItem( "phyloXML Home" ) );
395 _help_jmenu.add( _phyloxml_ref_item = new JMenuItem( "phyloXML Reference" ) );
396 _help_jmenu.addSeparator();
397 _help_jmenu.add( _about_item = new JMenuItem( "About" ) );
398 customizeJMenuItem( _help_item );
399 customizeJMenuItem( _website_item );
400 customizeJMenuItem( _phyloxml_website_item );
401 customizeJMenuItem( _aptx_ref_item );
402 customizeJMenuItem( _phyloxml_ref_item );
403 customizeJMenuItem( _about_item );
404 _phyloxml_ref_item.setToolTipText( MainFrame.PHYLOXML_REF_TOOL_TIP );
405 _aptx_ref_item.setToolTipText( MainFrame.APTX_REF_TOOL_TIP );
406 _jmenubar.add( _help_jmenu );
409 void buildOptionsMenu() {
410 _options_jmenu = MainFrame.createMenu( MainFrame.OPTIONS_HEADER, getConfiguration() );
411 _options_jmenu.addChangeListener( new ChangeListener() {
414 public void stateChanged( final ChangeEvent e ) {
415 MainFrame.setOvPlacementColorChooseMenuItem( _overview_placment_mi, getOptions() );
416 MainFrame.setTextColorChooseMenuItem( _switch_colors_mi, getCurrentTreePanel() );
418 .setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() );
419 MainFrame.setTextForFontChooserMenuItem( _choose_font_mi, MainFrame
420 .createCurrentFontDesc( getMainPanel().getTreeFontSet() ) );
421 MainFrame.updateOptionsMenuDependingOnPhylogenyType( getMainPanel(),
423 _show_branch_length_values_cbmi,
424 _non_lined_up_cladograms_rbmi,
425 _uniform_cladograms_rbmi,
426 _ext_node_dependent_cladogram_rbmi,
427 _label_direction_cbmi );
428 MainFrame.setCycleNodeFillMenuItem( _cycle_node_fill_mi, getOptions() );
429 MainFrame.setCycleNodeShapeMenuItem( _cycle_node_shape_mi, getOptions() );
430 MainFrame.setTextNodeSizeMenuItem( _choose_node_size_mi, getOptions() );
433 _options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.DISPLAY_SUBHEADER ),
434 getConfiguration() ) );
436 .add( _ext_node_dependent_cladogram_rbmi = new JRadioButtonMenuItem( MainFrame.NONUNIFORM_CLADOGRAMS_LABEL ) );
437 _options_jmenu.add( _uniform_cladograms_rbmi = new JRadioButtonMenuItem( MainFrame.UNIFORM_CLADOGRAMS_LABEL ) );
439 .add( _non_lined_up_cladograms_rbmi = new JRadioButtonMenuItem( MainFrame.NON_LINED_UP_CLADOGRAMS_LABEL ) );
440 _radio_group_1 = new ButtonGroup();
441 _radio_group_1.add( _ext_node_dependent_cladogram_rbmi );
442 _radio_group_1.add( _uniform_cladograms_rbmi );
443 _radio_group_1.add( _non_lined_up_cladograms_rbmi );
446 .add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL ) );
448 .add( _taxonomy_colorize_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.TAXONOMY_COLORIZE_NODE_SHAPES_LABEL ) );
449 _options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
450 _options_jmenu.add( _cycle_node_fill_mi = new JMenuItem( MainFrame.CYCLE_NODE_FILL_LABEL ) );
451 _options_jmenu.add( _choose_node_size_mi = new JMenuItem( MainFrame.CHOOSE_NODE_SIZE_LABEL ) );
453 _options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_SCALE_LABEL ) );
455 .add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
456 _options_jmenu.add( _show_overview_cbmi = new JCheckBoxMenuItem( MainFrame.SHOW_OVERVIEW_LABEL ) );
457 _options_jmenu.add( _label_direction_cbmi = new JCheckBoxMenuItem( MainFrame.LABEL_DIRECTION_LABEL ) );
459 .add( _color_labels_same_as_parent_branch = new JCheckBoxMenuItem( MainFrame.COLOR_LABELS_LABEL ) );
460 _color_labels_same_as_parent_branch.setToolTipText( MainFrame.COLOR_LABELS_TIP );
461 _options_jmenu.add( _abbreviate_scientific_names = new JCheckBoxMenuItem( MainFrame.ABBREV_SN_LABEL ) );
462 _label_direction_cbmi.setToolTipText( MainFrame.LABEL_DIRECTION_TIP );
463 _options_jmenu.add( _screen_antialias_cbmi = new JCheckBoxMenuItem( MainFrame.SCREEN_ANTIALIAS_LABEL ) );
464 _options_jmenu.add( _background_gradient_cbmi = new JCheckBoxMenuItem( MainFrame.BG_GRAD_LABEL ) );
465 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
466 _options_jmenu.add( _show_domain_labels = new JCheckBoxMenuItem( MainFrame.SHOW_DOMAIN_LABELS_LABEL ) );
468 _options_jmenu.add( _choose_minimal_confidence_mi = new JMenuItem( "" ) );
469 _options_jmenu.add( _overview_placment_mi = new JMenuItem( "" ) );
470 _options_jmenu.add( _switch_colors_mi = new JMenuItem( "" ) );
471 _options_jmenu.add( _choose_font_mi = new JMenuItem( "" ) );
472 _options_jmenu.addSeparator();
473 _options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.SEARCH_SUBHEADER ),
474 getConfiguration() ) );
476 .add( _search_case_senstive_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_CASE_SENSITIVE_LABEL ) );
477 _options_jmenu.add( _search_whole_words_only_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_TERMS_ONLY_LABEL ) );
479 .add( _inverse_search_result_cbmi = new JCheckBoxMenuItem( MainFrame.INVERSE_SEARCH_RESULT_LABEL ) );
480 customizeJMenuItem( _choose_font_mi );
481 customizeJMenuItem( _choose_minimal_confidence_mi );
482 customizeJMenuItem( _switch_colors_mi );
483 customizeJMenuItem( _overview_placment_mi );
484 customizeCheckBoxMenuItem( _label_direction_cbmi,
485 getOptions().getNodeLabelDirection() == NODE_LABEL_DIRECTION.RADIAL );
486 customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() );
487 customizeCheckBoxMenuItem( _background_gradient_cbmi, getOptions().isBackgroundColorGradient() );
488 customizeCheckBoxMenuItem( _show_domain_labels, getOptions().isShowDomainLabels() );
489 customizeCheckBoxMenuItem( _abbreviate_scientific_names, getOptions().isAbbreviateScientificTaxonNames() );
490 customizeCheckBoxMenuItem( _show_default_node_shapes_cbmi, getOptions().isShowDefaultNodeShapes() );
491 customizeCheckBoxMenuItem( _taxonomy_colorize_node_shapes_cbmi, getOptions().isTaxonomyColorizeNodeShapes() );
492 customizeJMenuItem( _cycle_node_shape_mi );
493 customizeJMenuItem( _cycle_node_fill_mi );
494 customizeJMenuItem( _choose_node_size_mi );
495 customizeCheckBoxMenuItem( _color_labels_same_as_parent_branch, getOptions().isColorLabelsSameAsParentBranch() );
496 customizeCheckBoxMenuItem( _search_case_senstive_cbmi, getOptions().isSearchCaseSensitive() );
497 customizeCheckBoxMenuItem( _show_scale_cbmi, getOptions().isShowScale() );
498 customizeRadioButtonMenuItem( _non_lined_up_cladograms_rbmi,
499 getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP );
500 customizeRadioButtonMenuItem( _uniform_cladograms_rbmi,
501 getOptions().getCladogramType() == CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
502 customizeRadioButtonMenuItem( _ext_node_dependent_cladogram_rbmi,
503 getOptions().getCladogramType() == CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
504 customizeCheckBoxMenuItem( _show_branch_length_values_cbmi, getOptions().isShowBranchLengthValues() );
505 customizeCheckBoxMenuItem( _show_overview_cbmi, getOptions().isShowOverview() );
506 customizeCheckBoxMenuItem( _search_whole_words_only_cbmi, getOptions().isMatchWholeTermsOnly() );
507 customizeCheckBoxMenuItem( _inverse_search_result_cbmi, getOptions().isInverseSearchResult() );
508 _jmenubar.add( _options_jmenu );
511 void buildToolsMenu() {
512 _tools_menu = MainFrame.createMenu( "Tools", getConfiguration() );
513 _tools_menu.add( _confcolor_item = new JMenuItem( "Colorize Branches Depending on Confidence" ) );
514 customizeJMenuItem( _confcolor_item );
515 _tools_menu.add( _taxcolor_item = new JMenuItem( "Taxonomy Colorize Branches" ) );
516 customizeJMenuItem( _taxcolor_item );
517 _tools_menu.add( _remove_branch_color_item = new JMenuItem( "Delete Branch Colors" ) );
518 _remove_branch_color_item.setToolTipText( "To delete branch color values from the current phylogeny." );
519 customizeJMenuItem( _remove_branch_color_item );
520 _tools_menu.addSeparator();
521 _tools_menu.add( _midpoint_root_item = new JMenuItem( "Midpoint-Root" ) );
522 customizeJMenuItem( _midpoint_root_item );
523 _tools_menu.addSeparator();
525 .add( _infer_common_sn_names_item = new JMenuItem( "Infer Common Parts of Internal Scientific Names" ) );
526 customizeJMenuItem( _infer_common_sn_names_item );
527 _tools_menu.add( _collapse_species_specific_subtrees = new JMenuItem( "Collapse Species-Specific Subtrees" ) );
528 customizeJMenuItem( _collapse_species_specific_subtrees );
529 _jmenubar.add( _tools_menu );
532 void buildTypeMenu() {
533 _type_menu = MainFrame.createMenu( MainFrame.TYPE_MENU_HEADER, getConfiguration() );
534 _type_menu.add( _rectangular_type_cbmi = new JCheckBoxMenuItem( MainFrame.RECTANGULAR_TYPE_CBMI_LABEL ) );
535 _type_menu.add( _euro_type_cbmi = new JCheckBoxMenuItem( MainFrame.EURO_TYPE_CBMI_LABEL ) );
536 _type_menu.add( _rounded_type_cbmi = new JCheckBoxMenuItem( MainFrame.ROUNDED_TYPE_CBMI_LABEL ) );
537 _type_menu.add( _curved_type_cbmi = new JCheckBoxMenuItem( MainFrame.CURVED_TYPE_CBMI_LABEL ) );
538 _type_menu.add( _triangular_type_cbmi = new JCheckBoxMenuItem( MainFrame.TRIANGULAR_TYPE_CBMI_LABEL ) );
539 _type_menu.add( _convex_type_cbmi = new JCheckBoxMenuItem( MainFrame.CONVEX_TYPE_CBMI_LABEL ) );
540 _type_menu.add( _unrooted_type_cbmi = new JCheckBoxMenuItem( MainFrame.UNROOTED_TYPE_CBMI_LABEL ) );
541 _type_menu.add( _circular_type_cbmi = new JCheckBoxMenuItem( MainFrame.CIRCULAR_TYPE_CBMI_LABEL ) );
542 customizeCheckBoxMenuItem( _rectangular_type_cbmi, false );
543 customizeCheckBoxMenuItem( _triangular_type_cbmi, false );
544 customizeCheckBoxMenuItem( _euro_type_cbmi, false );
545 customizeCheckBoxMenuItem( _rounded_type_cbmi, false );
546 customizeCheckBoxMenuItem( _curved_type_cbmi, false );
547 customizeCheckBoxMenuItem( _convex_type_cbmi, false );
548 customizeCheckBoxMenuItem( _unrooted_type_cbmi, false );
549 customizeCheckBoxMenuItem( _circular_type_cbmi, false );
550 _unrooted_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
551 _circular_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
552 initializeTypeMenu( getOptions() );
553 _jmenubar.add( _type_menu );
556 void buildViewMenu() {
557 _view_jmenu = MainFrame.createMenu( "View as Text", getConfiguration() );
558 _view_jmenu.add( _view_as_XML_item = new JMenuItem( "View as phyloXML" ) );
559 _view_jmenu.add( _view_as_NH_item = new JMenuItem( "View as Newick" ) );
560 _view_jmenu.add( _view_as_NHX_item = new JMenuItem( "View as NHX" ) );
561 _view_jmenu.add( _view_as_nexus_item = new JMenuItem( "View as Nexus" ) );
562 customizeJMenuItem( _view_as_NH_item );
563 customizeJMenuItem( _view_as_NHX_item );
564 customizeJMenuItem( _view_as_XML_item );
565 customizeJMenuItem( _view_as_nexus_item );
566 _jmenubar.add( _view_jmenu );
569 private void chooseFont() {
570 final FontChooser fc = new FontChooser();
571 fc.setFont( getMainPanel().getTreeFontSet().getLargeFont() );
572 fc.showDialog( this, "Select the Base Font" );
573 getMainPanel().getTreeFontSet().setBaseFont( fc.getFont() );
576 private void chooseMinimalConfidence() {
577 final String s = ( String ) JOptionPane
578 .showInputDialog( this,
579 "Please the minimum for confidence values to be displayed.\n" + "[current value: "
580 + getOptions().getMinConfidenceValue() + "]\n",
581 "Minimal Confidence Value",
582 JOptionPane.QUESTION_MESSAGE,
585 getOptions().getMinConfidenceValue() );
586 if ( !ForesterUtil.isEmpty( s ) ) {
587 boolean success = true;
589 final String m_str = s.trim();
590 if ( !ForesterUtil.isEmpty( m_str ) ) {
592 m = Double.parseDouble( m_str );
594 catch ( final Exception ex ) {
601 if ( success && ( m >= 0.0 ) ) {
602 getOptions().setMinConfidenceValue( m );
607 void customizeCheckBoxMenuItem( final JCheckBoxMenuItem item, final boolean is_selected ) {
608 if ( item != null ) {
609 item.setFont( MainFrame.menu_font );
610 if ( !getConfiguration().isUseNativeUI() ) {
611 item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
612 item.setForeground( getConfiguration().getGuiMenuTextColor() );
614 item.setSelected( is_selected );
615 item.addActionListener( this );
619 void customizeJMenuItem( final JMenuItem jmi ) {
620 jmi.setFont( MainFrame.menu_font );
621 if ( !getConfiguration().isUseNativeUI() ) {
622 jmi.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
623 jmi.setForeground( getConfiguration().getGuiMenuTextColor() );
625 jmi.addActionListener( this );
628 private void customizeRadioButtonMenuItem( final JRadioButtonMenuItem item, final boolean is_selected ) {
629 if ( item != null ) {
630 item.setFont( MainFrame.menu_font );
631 if ( !getConfiguration().isUseNativeUI() ) {
632 item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
633 item.setForeground( getConfiguration().getGuiMenuTextColor() );
635 item.setSelected( is_selected );
636 item.addActionListener( this );
641 public void destroy() {
642 Util.printAppletMessage( NAME, "going to be destroyed " );
644 if ( getMainPanel() != null ) {
645 getMainPanel().terminate();
649 Configuration getConfiguration() {
650 return _configuration;
653 TreePanel getCurrentTreePanel() {
654 return getMainPanel().getCurrentTreePanel();
657 JCheckBoxMenuItem getlabelDirectionCbmi() {
658 return _label_direction_cbmi;
661 private MainPanel getMainPanel() {
665 public Options getOptions() {
669 Options getOtions() {
675 final String config_filename = getParameter( Constants.APPLET_PARAM_NAME_FOR_CONFIG_FILE_URL );
676 Util.printAppletMessage( NAME, "URL for configuration file is: " + config_filename );
677 final Configuration configuration = new Configuration( config_filename, true, true );
678 setConfiguration( configuration );
679 setOptions( Options.createInstance( configuration ) );
682 Phylogeny[] phys = null;
683 final String phys_url_string = getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
684 Util.printAppletMessage( NAME, "URL for phylogenies is " + phys_url_string );
685 // Get URL to tree file
686 if ( phys_url_string != null ) {
688 phys_url = new URL( phys_url_string );
690 catch ( final Exception e ) {
691 ForesterUtil.printErrorMessage( NAME, "error: " + e );
693 JOptionPane.showMessageDialog( this, NAME + ": Could not create URL from: \"" + phys_url_string
694 + "\"\nException: " + e, "Failed to create URL", JOptionPane.ERROR_MESSAGE );
697 // Load the tree from URL
698 if ( phys_url != null ) {
700 phys = Util.readPhylogeniesFromUrl( phys_url, getConfiguration().isValidatePhyloXmlAgainstSchema() );
702 catch ( final Exception e ) {
703 ForesterUtil.printErrorMessage( NAME, e.toString() );
705 JOptionPane.showMessageDialog( this,
706 NAME + ": Failed to read phylogenies: " + "\nException: " + e,
707 "Failed to read phylogenies",
708 JOptionPane.ERROR_MESSAGE );
711 if ( ( phys == null ) || ( phys.length < 1 ) ) {
712 ForesterUtil.printErrorMessage( NAME, "phylogenies from [" + phys_url + "] are null or empty" );
713 JOptionPane.showMessageDialog( this,
714 NAME + ": phylogenies from [" + phys_url + "] are null or empty",
715 "Failed to read phylogenies",
716 JOptionPane.ERROR_MESSAGE );
720 Util.printAppletMessage( NAME, "loaded " + phys.length + " phylogenies from: " + phys_url );
723 setMainPanel( new MainPanelApplets( getConfiguration(), this ) );
724 _jmenubar = new JMenuBar();
725 if ( !getConfiguration().isHideControlPanelAndMenubar() ) {
726 if ( !getConfiguration().isUseNativeUI() ) {
727 _jmenubar.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
735 setJMenuBar( _jmenubar );
737 final Container contentpane = getContentPane();
738 contentpane.setLayout( new BorderLayout() );
739 contentpane.add( getMainPanel(), BorderLayout.CENTER );
740 addComponentListener( new ComponentAdapter() {
743 public void componentResized( final ComponentEvent e ) {
744 if ( getMainPanel().getCurrentTreePanel() != null ) {
745 getMainPanel().getCurrentTreePanel().setParametersForPainting( getMainPanel().getCurrentTreePanel()
747 getMainPanel().getCurrentTreePanel()
753 if ( getConfiguration().isUseTabbedDisplay() ) {
754 Util.printAppletMessage( NAME, "using tabbed display" );
755 Util.addPhylogeniesToTabs( phys,
756 new File( phys_url.getFile() ).getName(),
762 Util.printAppletMessage( NAME, "not using tabbed display" );
763 Util.addPhylogenyToPanel( phys, getConfiguration(), getMainPanel() );
767 getMainPanel().getControlPanel().showWholeAll();
768 getMainPanel().getControlPanel().showWhole();
770 Util.printAppletMessage( NAME, "successfully initialized" );
772 getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().removeAllItems();
773 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
774 .getRelevantSequenceRelationTypes() ) {
775 getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().addItem( type );
777 final String default_relation = getParameter( Constants.APPLET_PARAM_NAME_FOR_DEFAULT_SEQUENCE_RELATION_TYPE );
778 if ( default_relation != null ) {
779 getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().setSelectedItem( default_relation );
781 final String default_sequence = getParameter( Constants.APPLET_PARAM_NAME_FOR_DEFAULT_QUERY_SEQUENCE );
782 if ( default_sequence != null ) {
783 getCurrentTreePanel().getControlPanel().getSequenceRelationBox().setSelectedItem( default_sequence );
789 void initializeTypeMenu( final Options options ) {
790 setTypeMenuToAllUnselected();
792 switch ( options.getPhylogenyGraphicsType() ) {
794 _convex_type_cbmi.setSelected( true );
797 _curved_type_cbmi.setSelected( true );
800 _euro_type_cbmi.setSelected( true );
803 _rounded_type_cbmi.setSelected( true );
806 _triangular_type_cbmi.setSelected( true );
809 _unrooted_type_cbmi.setSelected( true );
812 _circular_type_cbmi.setSelected( true );
815 _rectangular_type_cbmi.setSelected( true );
819 catch ( final NullPointerException np ) {
820 // In all likelihood, this is caused by menu-less display.
824 private boolean isScreenAntialias() {
828 private void removeBranchColors() {
829 if ( getMainPanel().getCurrentPhylogeny() != null ) {
830 Util.removeBranchColors( getMainPanel().getCurrentPhylogeny() );
834 void removeTextFrame() {
835 if ( _textframe != null ) {
841 void setConfiguration( final Configuration configuration ) {
842 _configuration = configuration;
845 private void setMainPanel( final MainPanelApplets main_panel ) {
846 _main_panel = main_panel;
849 void setOptions( final Options options ) {
853 void setSelectedTypeInTypeMenu( final PHYLOGENY_GRAPHICS_TYPE type ) {
854 setTypeMenuToAllUnselected();
858 _circular_type_cbmi.setSelected( true );
861 _convex_type_cbmi.setSelected( true );
864 _curved_type_cbmi.setSelected( true );
867 _euro_type_cbmi.setSelected( true );
870 _rounded_type_cbmi.setSelected( true );
873 _rectangular_type_cbmi.setSelected( true );
876 _triangular_type_cbmi.setSelected( true );
879 _unrooted_type_cbmi.setSelected( true );
882 throw new IllegalArgumentException( "unknown type: " + type );
885 catch ( final NullPointerException np ) {
886 // In all likelihood, this is caused by menu-less display.
890 void setTypeMenuToAllUnselected() {
891 if ( _convex_type_cbmi != null ) {
892 _convex_type_cbmi.setSelected( false );
894 if ( _curved_type_cbmi != null ) {
895 _curved_type_cbmi.setSelected( false );
897 if ( _euro_type_cbmi != null ) {
898 _euro_type_cbmi.setSelected( false );
900 if ( _rounded_type_cbmi != null ) {
901 _rounded_type_cbmi.setSelected( false );
903 if ( _triangular_type_cbmi != null ) {
904 _triangular_type_cbmi.setSelected( false );
906 if ( _rectangular_type_cbmi != null ) {
907 _rectangular_type_cbmi.setSelected( false );
909 if ( _unrooted_type_cbmi != null ) {
910 _unrooted_type_cbmi.setSelected( false );
912 if ( _circular_type_cbmi != null ) {
913 _circular_type_cbmi.setSelected( false );
917 private void setupUI() {
919 if ( getConfiguration().isUseNativeUI() ) {
920 UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
923 UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );
926 catch ( final UnsupportedLookAndFeelException e ) {
927 Util.dieWithSystemError( "UnsupportedLookAndFeelException: " + e.toString() );
929 catch ( final ClassNotFoundException e ) {
930 Util.dieWithSystemError( "ClassNotFoundException: " + e.toString() );
932 catch ( final InstantiationException e ) {
933 Util.dieWithSystemError( "InstantiationException: " + e.toString() );
935 catch ( final IllegalAccessException e ) {
936 Util.dieWithSystemError( "IllegalAccessException: " + e.toString() );
938 catch ( final Exception e ) {
939 Util.dieWithSystemError( e.toString() );
944 public void start() {
945 if ( getMainPanel() != null ) {
946 getMainPanel().validate();
949 requestFocusInWindow();
951 Util.printAppletMessage( NAME, "started" );
954 void switchColors() {
955 final TreeColorSet colorset = getMainPanel().getCurrentTreePanel().getTreeColorSet();
956 final ColorSchemeChooser csc = new ColorSchemeChooser( getMainPanel(), colorset );
957 csc.setVisible( true );
958 getMainPanel().setTreeColorSet( colorset );
961 void typeChanged( final Object o ) {
962 updateTypeCheckboxes( getOptions(), o );
963 updateOptions( getOptions() );
964 if ( getCurrentTreePanel() != null ) {
965 final PHYLOGENY_GRAPHICS_TYPE previous_type = getCurrentTreePanel().getPhylogenyGraphicsType();
966 final PHYLOGENY_GRAPHICS_TYPE new_type = getOptions().getPhylogenyGraphicsType();
967 if ( ( ( previous_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) && ( new_type != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) )
968 || ( ( previous_type == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) && ( new_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) )
969 || ( ( previous_type != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) && ( new_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) )
970 || ( ( previous_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) && ( new_type == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) ) {
971 getCurrentTreePanel().getControlPanel().showWhole();
973 if ( getCurrentTreePanel().isPhyHasBranchLengths() && ( new_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
974 getCurrentTreePanel().getControlPanel().setDrawPhylogramEnabled( true );
977 getCurrentTreePanel().getControlPanel().setDrawPhylogramEnabled( false );
979 getCurrentTreePanel().setPhylogenyGraphicsType( getOptions().getPhylogenyGraphicsType() );
980 MainFrame.updateScreenTextAntialias( getMainPanel().getTreePanels() );
984 void updateOptions( final Options options ) {
985 options.setAntialiasScreen( ( _screen_antialias_cbmi != null ) && _screen_antialias_cbmi.isSelected() );
986 options.setBackgroundColorGradient( ( _background_gradient_cbmi != null )
987 && _background_gradient_cbmi.isSelected() );
988 options.setShowDomainLabels( ( _show_domain_labels != null ) && _show_domain_labels.isSelected() );
989 options.setAbbreviateScientificTaxonNames( ( _abbreviate_scientific_names != null )
990 && _abbreviate_scientific_names.isSelected() );
991 options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )
992 && _color_labels_same_as_parent_branch.isSelected() );
993 options.setShowDefaultNodeShapes( ( _show_default_node_shapes_cbmi != null )
994 && _show_default_node_shapes_cbmi.isSelected() );
995 options.setTaxonomyColorizeNodeShapes( ( _taxonomy_colorize_node_shapes_cbmi != null )
996 && _taxonomy_colorize_node_shapes_cbmi.isSelected() );
997 if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {
998 options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );
1000 else if ( ( _uniform_cladograms_rbmi != null ) && ( _uniform_cladograms_rbmi.isSelected() ) ) {
1001 options.setCladogramType( CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
1003 else if ( ( _ext_node_dependent_cladogram_rbmi != null ) && ( _ext_node_dependent_cladogram_rbmi.isSelected() ) ) {
1004 options.setCladogramType( CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
1006 options.setSearchCaseSensitive( ( _search_case_senstive_cbmi != null )
1007 && _search_case_senstive_cbmi.isSelected() );
1008 if ( ( _show_scale_cbmi != null ) && _show_scale_cbmi.isEnabled() ) {
1009 options.setShowScale( _show_scale_cbmi.isSelected() );
1011 if ( _label_direction_cbmi != null ) {
1012 if ( _label_direction_cbmi.isSelected() ) {
1013 options.setNodeLabelDirection( NODE_LABEL_DIRECTION.RADIAL );
1016 options.setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
1019 options.setShowOverview( ( _show_overview_cbmi != null ) && _show_overview_cbmi.isSelected() );
1020 if ( ( _show_branch_length_values_cbmi != null ) && _show_branch_length_values_cbmi.isEnabled() ) {
1021 options.setShowBranchLengthValues( _show_branch_length_values_cbmi.isSelected() );
1023 options.setMatchWholeTermsOnly( ( _search_whole_words_only_cbmi != null )
1024 && _search_whole_words_only_cbmi.isSelected() );
1025 options.setInverseSearchResult( ( _inverse_search_result_cbmi != null )
1026 && _inverse_search_result_cbmi.isSelected() );
1027 if ( ( _rectangular_type_cbmi != null ) && _rectangular_type_cbmi.isSelected() ) {
1028 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
1030 else if ( ( _triangular_type_cbmi != null ) && _triangular_type_cbmi.isSelected() ) {
1031 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR );
1033 else if ( ( _curved_type_cbmi != null ) && _curved_type_cbmi.isSelected() ) {
1034 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CURVED );
1036 else if ( ( _convex_type_cbmi != null ) && _convex_type_cbmi.isSelected() ) {
1037 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CONVEX );
1039 else if ( ( _euro_type_cbmi != null ) && _euro_type_cbmi.isSelected() ) {
1040 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE );
1042 else if ( ( _rounded_type_cbmi != null ) && _rounded_type_cbmi.isSelected() ) {
1043 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.ROUNDED );
1045 else if ( ( _unrooted_type_cbmi != null ) && _unrooted_type_cbmi.isSelected() ) {
1046 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.UNROOTED );
1048 else if ( ( _circular_type_cbmi != null ) && _circular_type_cbmi.isSelected() ) {
1049 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR );
1053 void updateTypeCheckboxes( final Options options, final Object o ) {
1054 setTypeMenuToAllUnselected();
1055 ( ( JCheckBoxMenuItem ) o ).setSelected( true );
1058 void viewAsNexus() {
1060 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
1061 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
1064 _textframe = TextFrame.instantiate( getMainPanel().getCurrentPhylogeny().toNexus() );
1069 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
1070 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
1073 _textframe = TextFrame.instantiate( getMainPanel().getCurrentPhylogeny().toNewHampshire( false ) );
1078 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
1079 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
1082 _textframe = TextFrame.instantiate( getMainPanel().getCurrentPhylogeny().toNewHampshireX() );
1087 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
1088 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
1091 _textframe = TextFrame.instantiate( getMainPanel().getCurrentPhylogeny().toPhyloXML( 0 ) );
1094 static void setupScreenTextAntialias( final List<TreePanel> treepanels, final boolean antialias ) {
1095 for( final TreePanel tree_panel : treepanels ) {
1096 tree_panel.setTextAntialias();