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.Options.CLADOGRAM_TYPE;
31 import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
32 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
33 import org.forester.archaeopteryx.Util.GraphicsExportType;
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;
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 final ByteArrayOutputStream baos = new ByteArrayOutputStream();
353 Util.writePhylogenyToGraphicsByteArrayOutputStream( baos,
354 _main_panel.getWidth(),
355 _main_panel.getHeight(),
356 getCurrentTreePanel(),
357 getCurrentTreePanel().getControlPanel(),
358 GraphicsExportType.valueOf( format ),
361 catch ( final IOException ioe ) {
362 ForesterUtil.printErrorMessage( NAME, ioe.toString() );
363 ioe.printStackTrace();
364 JOptionPane.showMessageDialog( this,
365 NAME + ": Failed to generate graphics: " + "\nException: " + ioe,
366 "Failed to generate graphics",
367 JOptionPane.ERROR_MESSAGE );
370 final byte[] bytes = baos.toByteArray();
371 final String dataImg = Base64.encodeBase64String( bytes );
375 void buildFontSizeMenu() {
376 _font_size_menu = MainFrame.createMenu( MainFrame.FONT_SIZE_MENU_LABEL, getConfiguration() );
377 _font_size_menu.add( _super_tiny_fonts_mi = new JMenuItem( "Super tiny fonts" ) );
378 _font_size_menu.add( _tiny_fonts_mi = new JMenuItem( "Tiny fonts" ) );
379 _font_size_menu.add( _small_fonts_mi = new JMenuItem( "Small fonts" ) );
380 _font_size_menu.add( _medium_fonts_mi = new JMenuItem( "Medium fonts" ) );
381 _font_size_menu.add( _large_fonts_mi = new JMenuItem( "Large fonts" ) );
382 customizeJMenuItem( _super_tiny_fonts_mi );
383 customizeJMenuItem( _tiny_fonts_mi );
384 customizeJMenuItem( _small_fonts_mi );
385 customizeJMenuItem( _medium_fonts_mi );
386 customizeJMenuItem( _large_fonts_mi );
387 _jmenubar.add( _font_size_menu );
390 void buildHelpMenu() {
391 _help_jmenu = MainFrame.createMenu( "Help", getConfiguration() );
392 _help_jmenu.add( _help_item = new JMenuItem( "Help" ) );
393 _help_jmenu.add( _website_item = new JMenuItem( "Archaeopteryx Home" ) );
394 _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" );
395 _help_jmenu.add( _phyloxml_website_item = new JMenuItem( "phyloXML Home" ) );
396 _help_jmenu.add( _phyloxml_ref_item = new JMenuItem( "phyloXML Reference" ) );
397 _help_jmenu.addSeparator();
398 _help_jmenu.add( _about_item = new JMenuItem( "About" ) );
399 customizeJMenuItem( _help_item );
400 customizeJMenuItem( _website_item );
401 customizeJMenuItem( _phyloxml_website_item );
402 customizeJMenuItem( _aptx_ref_item );
403 customizeJMenuItem( _phyloxml_ref_item );
404 customizeJMenuItem( _about_item );
405 _phyloxml_ref_item.setToolTipText( MainFrame.PHYLOXML_REF_TOOL_TIP );
406 _aptx_ref_item.setToolTipText( MainFrame.APTX_REF_TOOL_TIP );
407 _jmenubar.add( _help_jmenu );
410 void buildOptionsMenu() {
411 _options_jmenu = MainFrame.createMenu( MainFrame.OPTIONS_HEADER, getConfiguration() );
412 _options_jmenu.addChangeListener( new ChangeListener() {
415 public void stateChanged( final ChangeEvent e ) {
416 MainFrame.setOvPlacementColorChooseMenuItem( _overview_placment_mi, getOptions() );
417 MainFrame.setTextColorChooseMenuItem( _switch_colors_mi, getCurrentTreePanel() );
419 .setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() );
420 MainFrame.setTextForFontChooserMenuItem( _choose_font_mi, MainFrame
421 .createCurrentFontDesc( getMainPanel().getTreeFontSet() ) );
422 MainFrame.updateOptionsMenuDependingOnPhylogenyType( getMainPanel(),
424 _show_branch_length_values_cbmi,
425 _non_lined_up_cladograms_rbmi,
426 _uniform_cladograms_rbmi,
427 _ext_node_dependent_cladogram_rbmi,
428 _label_direction_cbmi );
429 MainFrame.setCycleNodeFillMenuItem( _cycle_node_fill_mi, getOptions() );
430 MainFrame.setCycleNodeShapeMenuItem( _cycle_node_shape_mi, getOptions() );
431 MainFrame.setTextNodeSizeMenuItem( _choose_node_size_mi, getOptions() );
434 _options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.DISPLAY_SUBHEADER ),
435 getConfiguration() ) );
437 .add( _ext_node_dependent_cladogram_rbmi = new JRadioButtonMenuItem( MainFrame.NONUNIFORM_CLADOGRAMS_LABEL ) );
438 _options_jmenu.add( _uniform_cladograms_rbmi = new JRadioButtonMenuItem( MainFrame.UNIFORM_CLADOGRAMS_LABEL ) );
440 .add( _non_lined_up_cladograms_rbmi = new JRadioButtonMenuItem( MainFrame.NON_LINED_UP_CLADOGRAMS_LABEL ) );
441 _radio_group_1 = new ButtonGroup();
442 _radio_group_1.add( _ext_node_dependent_cladogram_rbmi );
443 _radio_group_1.add( _uniform_cladograms_rbmi );
444 _radio_group_1.add( _non_lined_up_cladograms_rbmi );
447 .add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL ) );
449 .add( _taxonomy_colorize_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.TAXONOMY_COLORIZE_NODE_SHAPES_LABEL ) );
450 _options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
451 _options_jmenu.add( _cycle_node_fill_mi = new JMenuItem( MainFrame.CYCLE_NODE_FILL_LABEL ) );
452 _options_jmenu.add( _choose_node_size_mi = new JMenuItem( MainFrame.CHOOSE_NODE_SIZE_LABEL ) );
454 _options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_SCALE_LABEL ) );
456 .add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
457 _options_jmenu.add( _show_overview_cbmi = new JCheckBoxMenuItem( MainFrame.SHOW_OVERVIEW_LABEL ) );
458 _options_jmenu.add( _label_direction_cbmi = new JCheckBoxMenuItem( MainFrame.LABEL_DIRECTION_LABEL ) );
460 .add( _color_labels_same_as_parent_branch = new JCheckBoxMenuItem( MainFrame.COLOR_LABELS_LABEL ) );
461 _color_labels_same_as_parent_branch.setToolTipText( MainFrame.COLOR_LABELS_TIP );
462 _options_jmenu.add( _abbreviate_scientific_names = new JCheckBoxMenuItem( MainFrame.ABBREV_SN_LABEL ) );
463 _label_direction_cbmi.setToolTipText( MainFrame.LABEL_DIRECTION_TIP );
464 _options_jmenu.add( _screen_antialias_cbmi = new JCheckBoxMenuItem( MainFrame.SCREEN_ANTIALIAS_LABEL ) );
465 _options_jmenu.add( _background_gradient_cbmi = new JCheckBoxMenuItem( MainFrame.BG_GRAD_LABEL ) );
466 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
467 _options_jmenu.add( _show_domain_labels = new JCheckBoxMenuItem( MainFrame.SHOW_DOMAIN_LABELS_LABEL ) );
469 _options_jmenu.add( _choose_minimal_confidence_mi = new JMenuItem( "" ) );
470 _options_jmenu.add( _overview_placment_mi = new JMenuItem( "" ) );
471 _options_jmenu.add( _switch_colors_mi = new JMenuItem( "" ) );
472 _options_jmenu.add( _choose_font_mi = new JMenuItem( "" ) );
473 _options_jmenu.addSeparator();
474 _options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.SEARCH_SUBHEADER ),
475 getConfiguration() ) );
477 .add( _search_case_senstive_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_CASE_SENSITIVE_LABEL ) );
478 _options_jmenu.add( _search_whole_words_only_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_TERMS_ONLY_LABEL ) );
480 .add( _inverse_search_result_cbmi = new JCheckBoxMenuItem( MainFrame.INVERSE_SEARCH_RESULT_LABEL ) );
481 customizeJMenuItem( _choose_font_mi );
482 customizeJMenuItem( _choose_minimal_confidence_mi );
483 customizeJMenuItem( _switch_colors_mi );
484 customizeJMenuItem( _overview_placment_mi );
485 customizeCheckBoxMenuItem( _label_direction_cbmi,
486 getOptions().getNodeLabelDirection() == NODE_LABEL_DIRECTION.RADIAL );
487 customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() );
488 customizeCheckBoxMenuItem( _background_gradient_cbmi, getOptions().isBackgroundColorGradient() );
489 customizeCheckBoxMenuItem( _show_domain_labels, getOptions().isShowDomainLabels() );
490 customizeCheckBoxMenuItem( _abbreviate_scientific_names, getOptions().isAbbreviateScientificTaxonNames() );
491 customizeCheckBoxMenuItem( _show_default_node_shapes_cbmi, getOptions().isShowDefaultNodeShapes() );
492 customizeCheckBoxMenuItem( _taxonomy_colorize_node_shapes_cbmi, getOptions().isTaxonomyColorizeNodeShapes() );
493 customizeJMenuItem( _cycle_node_shape_mi );
494 customizeJMenuItem( _cycle_node_fill_mi );
495 customizeJMenuItem( _choose_node_size_mi );
496 customizeCheckBoxMenuItem( _color_labels_same_as_parent_branch, getOptions().isColorLabelsSameAsParentBranch() );
497 customizeCheckBoxMenuItem( _search_case_senstive_cbmi, getOptions().isSearchCaseSensitive() );
498 customizeCheckBoxMenuItem( _show_scale_cbmi, getOptions().isShowScale() );
499 customizeRadioButtonMenuItem( _non_lined_up_cladograms_rbmi,
500 getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP );
501 customizeRadioButtonMenuItem( _uniform_cladograms_rbmi,
502 getOptions().getCladogramType() == CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
503 customizeRadioButtonMenuItem( _ext_node_dependent_cladogram_rbmi,
504 getOptions().getCladogramType() == CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
505 customizeCheckBoxMenuItem( _show_branch_length_values_cbmi, getOptions().isShowBranchLengthValues() );
506 customizeCheckBoxMenuItem( _show_overview_cbmi, getOptions().isShowOverview() );
507 customizeCheckBoxMenuItem( _search_whole_words_only_cbmi, getOptions().isMatchWholeTermsOnly() );
508 customizeCheckBoxMenuItem( _inverse_search_result_cbmi, getOptions().isInverseSearchResult() );
509 _jmenubar.add( _options_jmenu );
512 void buildToolsMenu() {
513 _tools_menu = MainFrame.createMenu( "Tools", getConfiguration() );
514 _tools_menu.add( _confcolor_item = new JMenuItem( "Colorize Branches Depending on Confidence" ) );
515 customizeJMenuItem( _confcolor_item );
516 _tools_menu.add( _taxcolor_item = new JMenuItem( "Taxonomy Colorize Branches" ) );
517 customizeJMenuItem( _taxcolor_item );
518 _tools_menu.add( _remove_branch_color_item = new JMenuItem( "Delete Branch Colors" ) );
519 _remove_branch_color_item.setToolTipText( "To delete branch color values from the current phylogeny." );
520 customizeJMenuItem( _remove_branch_color_item );
521 _tools_menu.addSeparator();
522 _tools_menu.add( _midpoint_root_item = new JMenuItem( "Midpoint-Root" ) );
523 customizeJMenuItem( _midpoint_root_item );
524 _tools_menu.addSeparator();
526 .add( _infer_common_sn_names_item = new JMenuItem( "Infer Common Parts of Internal Scientific Names" ) );
527 customizeJMenuItem( _infer_common_sn_names_item );
528 _tools_menu.add( _collapse_species_specific_subtrees = new JMenuItem( "Collapse Species-Specific Subtrees" ) );
529 customizeJMenuItem( _collapse_species_specific_subtrees );
530 _jmenubar.add( _tools_menu );
533 void buildTypeMenu() {
534 _type_menu = MainFrame.createMenu( MainFrame.TYPE_MENU_HEADER, getConfiguration() );
535 _type_menu.add( _rectangular_type_cbmi = new JCheckBoxMenuItem( MainFrame.RECTANGULAR_TYPE_CBMI_LABEL ) );
536 _type_menu.add( _euro_type_cbmi = new JCheckBoxMenuItem( MainFrame.EURO_TYPE_CBMI_LABEL ) );
537 _type_menu.add( _rounded_type_cbmi = new JCheckBoxMenuItem( MainFrame.ROUNDED_TYPE_CBMI_LABEL ) );
538 _type_menu.add( _curved_type_cbmi = new JCheckBoxMenuItem( MainFrame.CURVED_TYPE_CBMI_LABEL ) );
539 _type_menu.add( _triangular_type_cbmi = new JCheckBoxMenuItem( MainFrame.TRIANGULAR_TYPE_CBMI_LABEL ) );
540 _type_menu.add( _convex_type_cbmi = new JCheckBoxMenuItem( MainFrame.CONVEX_TYPE_CBMI_LABEL ) );
541 _type_menu.add( _unrooted_type_cbmi = new JCheckBoxMenuItem( MainFrame.UNROOTED_TYPE_CBMI_LABEL ) );
542 _type_menu.add( _circular_type_cbmi = new JCheckBoxMenuItem( MainFrame.CIRCULAR_TYPE_CBMI_LABEL ) );
543 customizeCheckBoxMenuItem( _rectangular_type_cbmi, false );
544 customizeCheckBoxMenuItem( _triangular_type_cbmi, false );
545 customizeCheckBoxMenuItem( _euro_type_cbmi, false );
546 customizeCheckBoxMenuItem( _rounded_type_cbmi, false );
547 customizeCheckBoxMenuItem( _curved_type_cbmi, false );
548 customizeCheckBoxMenuItem( _convex_type_cbmi, false );
549 customizeCheckBoxMenuItem( _unrooted_type_cbmi, false );
550 customizeCheckBoxMenuItem( _circular_type_cbmi, false );
551 _unrooted_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
552 _circular_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
553 initializeTypeMenu( getOptions() );
554 _jmenubar.add( _type_menu );
557 void buildViewMenu() {
558 _view_jmenu = MainFrame.createMenu( "View as Text", getConfiguration() );
559 _view_jmenu.add( _view_as_XML_item = new JMenuItem( "View as phyloXML" ) );
560 _view_jmenu.add( _view_as_NH_item = new JMenuItem( "View as Newick" ) );
561 _view_jmenu.add( _view_as_NHX_item = new JMenuItem( "View as NHX" ) );
562 _view_jmenu.add( _view_as_nexus_item = new JMenuItem( "View as Nexus" ) );
563 customizeJMenuItem( _view_as_NH_item );
564 customizeJMenuItem( _view_as_NHX_item );
565 customizeJMenuItem( _view_as_XML_item );
566 customizeJMenuItem( _view_as_nexus_item );
567 _jmenubar.add( _view_jmenu );
570 private void chooseFont() {
571 final FontChooser fc = new FontChooser();
572 fc.setFont( getMainPanel().getTreeFontSet().getLargeFont() );
573 fc.showDialog( this, "Select the Base Font" );
574 getMainPanel().getTreeFontSet().setBaseFont( fc.getFont() );
577 private void chooseMinimalConfidence() {
578 final String s = ( String ) JOptionPane
579 .showInputDialog( this,
580 "Please the minimum for confidence values to be displayed.\n" + "[current value: "
581 + getOptions().getMinConfidenceValue() + "]\n",
582 "Minimal Confidence Value",
583 JOptionPane.QUESTION_MESSAGE,
586 getOptions().getMinConfidenceValue() );
587 if ( !ForesterUtil.isEmpty( s ) ) {
588 boolean success = true;
590 final String m_str = s.trim();
591 if ( !ForesterUtil.isEmpty( m_str ) ) {
593 m = Double.parseDouble( m_str );
595 catch ( final Exception ex ) {
602 if ( success && ( m >= 0.0 ) ) {
603 getOptions().setMinConfidenceValue( m );
608 void customizeCheckBoxMenuItem( final JCheckBoxMenuItem item, final boolean is_selected ) {
609 if ( item != null ) {
610 item.setFont( MainFrame.menu_font );
611 if ( !getConfiguration().isUseNativeUI() ) {
612 item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
613 item.setForeground( getConfiguration().getGuiMenuTextColor() );
615 item.setSelected( is_selected );
616 item.addActionListener( this );
620 void customizeJMenuItem( final JMenuItem jmi ) {
621 jmi.setFont( MainFrame.menu_font );
622 if ( !getConfiguration().isUseNativeUI() ) {
623 jmi.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
624 jmi.setForeground( getConfiguration().getGuiMenuTextColor() );
626 jmi.addActionListener( this );
629 private void customizeRadioButtonMenuItem( final JRadioButtonMenuItem item, final boolean is_selected ) {
630 if ( item != null ) {
631 item.setFont( MainFrame.menu_font );
632 if ( !getConfiguration().isUseNativeUI() ) {
633 item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
634 item.setForeground( getConfiguration().getGuiMenuTextColor() );
636 item.setSelected( is_selected );
637 item.addActionListener( this );
642 public void destroy() {
643 Util.printAppletMessage( NAME, "going to be destroyed " );
645 if ( getMainPanel() != null ) {
646 getMainPanel().terminate();
650 Configuration getConfiguration() {
651 return _configuration;
654 TreePanel getCurrentTreePanel() {
655 return getMainPanel().getCurrentTreePanel();
658 JCheckBoxMenuItem getlabelDirectionCbmi() {
659 return _label_direction_cbmi;
662 private MainPanel getMainPanel() {
666 public Options getOptions() {
670 Options getOtions() {
676 final String config_filename = getParameter( Constants.APPLET_PARAM_NAME_FOR_CONFIG_FILE_URL );
677 Util.printAppletMessage( NAME, "URL for configuration file is: " + config_filename );
678 final Configuration configuration = new Configuration( config_filename, true, true );
679 setConfiguration( configuration );
680 setOptions( Options.createInstance( configuration ) );
683 Phylogeny[] phys = null;
684 final String phys_url_string = getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
685 Util.printAppletMessage( NAME, "URL for phylogenies is " + phys_url_string );
686 // Get URL to tree file
687 if ( phys_url_string != null ) {
689 phys_url = new URL( phys_url_string );
691 catch ( final Exception e ) {
692 ForesterUtil.printErrorMessage( NAME, "error: " + e );
694 JOptionPane.showMessageDialog( this, NAME + ": Could not create URL from: \"" + phys_url_string
695 + "\"\nException: " + e, "Failed to create URL", JOptionPane.ERROR_MESSAGE );
698 // Load the tree from URL
699 if ( phys_url != null ) {
701 phys = Util.readPhylogeniesFromUrl( phys_url, getConfiguration().isValidatePhyloXmlAgainstSchema() );
703 catch ( final Exception e ) {
704 ForesterUtil.printErrorMessage( NAME, e.toString() );
706 JOptionPane.showMessageDialog( this,
707 NAME + ": Failed to read phylogenies: " + "\nException: " + e,
708 "Failed to read phylogenies",
709 JOptionPane.ERROR_MESSAGE );
712 if ( ( phys == null ) || ( phys.length < 1 ) ) {
713 ForesterUtil.printErrorMessage( NAME, "phylogenies from [" + phys_url + "] are null or empty" );
714 JOptionPane.showMessageDialog( this,
715 NAME + ": phylogenies from [" + phys_url + "] are null or empty",
716 "Failed to read phylogenies",
717 JOptionPane.ERROR_MESSAGE );
721 Util.printAppletMessage( NAME, "loaded " + phys.length + " phylogenies from: " + phys_url );
724 setMainPanel( new MainPanelApplets( getConfiguration(), this ) );
725 _jmenubar = new JMenuBar();
726 if ( !getConfiguration().isHideControlPanelAndMenubar() ) {
727 if ( !getConfiguration().isUseNativeUI() ) {
728 _jmenubar.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
736 setJMenuBar( _jmenubar );
738 final Container contentpane = getContentPane();
739 contentpane.setLayout( new BorderLayout() );
740 contentpane.add( getMainPanel(), BorderLayout.CENTER );
741 addComponentListener( new ComponentAdapter() {
744 public void componentResized( final ComponentEvent e ) {
745 if ( getMainPanel().getCurrentTreePanel() != null ) {
746 getMainPanel().getCurrentTreePanel().setParametersForPainting( getMainPanel().getCurrentTreePanel()
748 getMainPanel().getCurrentTreePanel()
754 if ( getConfiguration().isUseTabbedDisplay() ) {
755 Util.printAppletMessage( NAME, "using tabbed display" );
756 Util.addPhylogeniesToTabs( phys,
757 new File( phys_url.getFile() ).getName(),
763 Util.printAppletMessage( NAME, "not using tabbed display" );
764 Util.addPhylogenyToPanel( phys, getConfiguration(), getMainPanel() );
768 getMainPanel().getControlPanel().showWholeAll();
769 getMainPanel().getControlPanel().showWhole();
771 Util.printAppletMessage( NAME, "successfully initialized" );
773 getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().removeAllItems();
774 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
775 .getRelevantSequenceRelationTypes() ) {
776 getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().addItem( type );
778 final String default_relation = getParameter( Constants.APPLET_PARAM_NAME_FOR_DEFAULT_SEQUENCE_RELATION_TYPE );
779 if ( default_relation != null ) {
780 getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().setSelectedItem( default_relation );
782 final String default_sequence = getParameter( Constants.APPLET_PARAM_NAME_FOR_DEFAULT_QUERY_SEQUENCE );
783 if ( default_sequence != null ) {
784 getCurrentTreePanel().getControlPanel().getSequenceRelationBox().setSelectedItem( default_sequence );
790 void initializeTypeMenu( final Options options ) {
791 setTypeMenuToAllUnselected();
793 switch ( options.getPhylogenyGraphicsType() ) {
795 _convex_type_cbmi.setSelected( true );
798 _curved_type_cbmi.setSelected( true );
801 _euro_type_cbmi.setSelected( true );
804 _rounded_type_cbmi.setSelected( true );
807 _triangular_type_cbmi.setSelected( true );
810 _unrooted_type_cbmi.setSelected( true );
813 _circular_type_cbmi.setSelected( true );
816 _rectangular_type_cbmi.setSelected( true );
820 catch ( final NullPointerException np ) {
821 // In all likelihood, this is caused by menu-less display.
825 private boolean isScreenAntialias() {
829 private void removeBranchColors() {
830 if ( getMainPanel().getCurrentPhylogeny() != null ) {
831 Util.removeBranchColors( getMainPanel().getCurrentPhylogeny() );
835 void removeTextFrame() {
836 if ( _textframe != null ) {
842 void setConfiguration( final Configuration configuration ) {
843 _configuration = configuration;
846 private void setMainPanel( final MainPanelApplets main_panel ) {
847 _main_panel = main_panel;
850 void setOptions( final Options options ) {
854 void setSelectedTypeInTypeMenu( final PHYLOGENY_GRAPHICS_TYPE type ) {
855 setTypeMenuToAllUnselected();
859 _circular_type_cbmi.setSelected( true );
862 _convex_type_cbmi.setSelected( true );
865 _curved_type_cbmi.setSelected( true );
868 _euro_type_cbmi.setSelected( true );
871 _rounded_type_cbmi.setSelected( true );
874 _rectangular_type_cbmi.setSelected( true );
877 _triangular_type_cbmi.setSelected( true );
880 _unrooted_type_cbmi.setSelected( true );
883 throw new IllegalArgumentException( "unknown type: " + type );
886 catch ( final NullPointerException np ) {
887 // In all likelihood, this is caused by menu-less display.
891 void setTypeMenuToAllUnselected() {
892 if ( _convex_type_cbmi != null ) {
893 _convex_type_cbmi.setSelected( false );
895 if ( _curved_type_cbmi != null ) {
896 _curved_type_cbmi.setSelected( false );
898 if ( _euro_type_cbmi != null ) {
899 _euro_type_cbmi.setSelected( false );
901 if ( _rounded_type_cbmi != null ) {
902 _rounded_type_cbmi.setSelected( false );
904 if ( _triangular_type_cbmi != null ) {
905 _triangular_type_cbmi.setSelected( false );
907 if ( _rectangular_type_cbmi != null ) {
908 _rectangular_type_cbmi.setSelected( false );
910 if ( _unrooted_type_cbmi != null ) {
911 _unrooted_type_cbmi.setSelected( false );
913 if ( _circular_type_cbmi != null ) {
914 _circular_type_cbmi.setSelected( false );
918 private void setupUI() {
920 if ( getConfiguration().isUseNativeUI() ) {
921 UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
924 UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );
927 catch ( final UnsupportedLookAndFeelException e ) {
928 Util.dieWithSystemError( "UnsupportedLookAndFeelException: " + e.toString() );
930 catch ( final ClassNotFoundException e ) {
931 Util.dieWithSystemError( "ClassNotFoundException: " + e.toString() );
933 catch ( final InstantiationException e ) {
934 Util.dieWithSystemError( "InstantiationException: " + e.toString() );
936 catch ( final IllegalAccessException e ) {
937 Util.dieWithSystemError( "IllegalAccessException: " + e.toString() );
939 catch ( final Exception e ) {
940 Util.dieWithSystemError( e.toString() );
945 public void start() {
946 if ( getMainPanel() != null ) {
947 getMainPanel().validate();
950 requestFocusInWindow();
952 Util.printAppletMessage( NAME, "started" );
955 void switchColors() {
956 final TreeColorSet colorset = getMainPanel().getCurrentTreePanel().getTreeColorSet();
957 final ColorSchemeChooser csc = new ColorSchemeChooser( getMainPanel(), colorset );
958 csc.setVisible( true );
959 getMainPanel().setTreeColorSet( colorset );
962 void typeChanged( final Object o ) {
963 updateTypeCheckboxes( getOptions(), o );
964 updateOptions( getOptions() );
965 if ( getCurrentTreePanel() != null ) {
966 final PHYLOGENY_GRAPHICS_TYPE previous_type = getCurrentTreePanel().getPhylogenyGraphicsType();
967 final PHYLOGENY_GRAPHICS_TYPE new_type = getOptions().getPhylogenyGraphicsType();
968 if ( ( ( previous_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) && ( new_type != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) )
969 || ( ( previous_type == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) && ( new_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) )
970 || ( ( previous_type != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) && ( new_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) )
971 || ( ( previous_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) && ( new_type == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) ) {
972 getCurrentTreePanel().getControlPanel().showWhole();
974 if ( getCurrentTreePanel().isPhyHasBranchLengths() && ( new_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
975 getCurrentTreePanel().getControlPanel().setDrawPhylogramEnabled( true );
978 getCurrentTreePanel().getControlPanel().setDrawPhylogramEnabled( false );
980 getCurrentTreePanel().setPhylogenyGraphicsType( getOptions().getPhylogenyGraphicsType() );
981 MainFrame.updateScreenTextAntialias( getMainPanel().getTreePanels() );
985 void updateOptions( final Options options ) {
986 options.setAntialiasScreen( ( _screen_antialias_cbmi != null ) && _screen_antialias_cbmi.isSelected() );
987 options.setBackgroundColorGradient( ( _background_gradient_cbmi != null )
988 && _background_gradient_cbmi.isSelected() );
989 options.setShowDomainLabels( ( _show_domain_labels != null ) && _show_domain_labels.isSelected() );
990 options.setAbbreviateScientificTaxonNames( ( _abbreviate_scientific_names != null )
991 && _abbreviate_scientific_names.isSelected() );
992 options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )
993 && _color_labels_same_as_parent_branch.isSelected() );
994 options.setShowDefaultNodeShapes( ( _show_default_node_shapes_cbmi != null )
995 && _show_default_node_shapes_cbmi.isSelected() );
996 options.setTaxonomyColorizeNodeShapes( ( _taxonomy_colorize_node_shapes_cbmi != null )
997 && _taxonomy_colorize_node_shapes_cbmi.isSelected() );
998 if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {
999 options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );
1001 else if ( ( _uniform_cladograms_rbmi != null ) && ( _uniform_cladograms_rbmi.isSelected() ) ) {
1002 options.setCladogramType( CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
1004 else if ( ( _ext_node_dependent_cladogram_rbmi != null ) && ( _ext_node_dependent_cladogram_rbmi.isSelected() ) ) {
1005 options.setCladogramType( CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
1007 options.setSearchCaseSensitive( ( _search_case_senstive_cbmi != null )
1008 && _search_case_senstive_cbmi.isSelected() );
1009 if ( ( _show_scale_cbmi != null ) && _show_scale_cbmi.isEnabled() ) {
1010 options.setShowScale( _show_scale_cbmi.isSelected() );
1012 if ( _label_direction_cbmi != null ) {
1013 if ( _label_direction_cbmi.isSelected() ) {
1014 options.setNodeLabelDirection( NODE_LABEL_DIRECTION.RADIAL );
1017 options.setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
1020 options.setShowOverview( ( _show_overview_cbmi != null ) && _show_overview_cbmi.isSelected() );
1021 if ( ( _show_branch_length_values_cbmi != null ) && _show_branch_length_values_cbmi.isEnabled() ) {
1022 options.setShowBranchLengthValues( _show_branch_length_values_cbmi.isSelected() );
1024 options.setMatchWholeTermsOnly( ( _search_whole_words_only_cbmi != null )
1025 && _search_whole_words_only_cbmi.isSelected() );
1026 options.setInverseSearchResult( ( _inverse_search_result_cbmi != null )
1027 && _inverse_search_result_cbmi.isSelected() );
1028 if ( ( _rectangular_type_cbmi != null ) && _rectangular_type_cbmi.isSelected() ) {
1029 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
1031 else if ( ( _triangular_type_cbmi != null ) && _triangular_type_cbmi.isSelected() ) {
1032 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR );
1034 else if ( ( _curved_type_cbmi != null ) && _curved_type_cbmi.isSelected() ) {
1035 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CURVED );
1037 else if ( ( _convex_type_cbmi != null ) && _convex_type_cbmi.isSelected() ) {
1038 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CONVEX );
1040 else if ( ( _euro_type_cbmi != null ) && _euro_type_cbmi.isSelected() ) {
1041 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE );
1043 else if ( ( _rounded_type_cbmi != null ) && _rounded_type_cbmi.isSelected() ) {
1044 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.ROUNDED );
1046 else if ( ( _unrooted_type_cbmi != null ) && _unrooted_type_cbmi.isSelected() ) {
1047 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.UNROOTED );
1049 else if ( ( _circular_type_cbmi != null ) && _circular_type_cbmi.isSelected() ) {
1050 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR );
1054 void updateTypeCheckboxes( final Options options, final Object o ) {
1055 setTypeMenuToAllUnselected();
1056 ( ( JCheckBoxMenuItem ) o ).setSelected( true );
1059 void viewAsNexus() {
1061 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
1062 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
1065 _textframe = TextFrame.instantiate( getMainPanel().getCurrentPhylogeny().toNexus() );
1070 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
1071 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
1074 _textframe = TextFrame.instantiate( getMainPanel().getCurrentPhylogeny().toNewHampshire( false ) );
1079 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
1080 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
1083 _textframe = TextFrame.instantiate( getMainPanel().getCurrentPhylogeny().toNewHampshireX() );
1088 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
1089 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
1092 _textframe = TextFrame.instantiate( getMainPanel().getCurrentPhylogeny().toPhyloXML( 0 ) );
1095 static void setupScreenTextAntialias( final List<TreePanel> treepanels, final boolean antialias ) {
1096 for( final TreePanel tree_panel : treepanels ) {
1097 tree_panel.setTextAntialias();