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 JMenuItem _display_basic_information_item;
76 private JMenu _type_menu;
77 private JCheckBoxMenuItem _rectangular_type_cbmi;
78 private JCheckBoxMenuItem _triangular_type_cbmi;
79 private JCheckBoxMenuItem _curved_type_cbmi;
80 private JCheckBoxMenuItem _convex_type_cbmi;
81 private JCheckBoxMenuItem _euro_type_cbmi;
82 private JCheckBoxMenuItem _rounded_type_cbmi;
83 private JCheckBoxMenuItem _unrooted_type_cbmi;
84 private JCheckBoxMenuItem _circular_type_cbmi;
85 private JMenuItem _help_item;
86 private JMenuItem _about_item;
87 private JMenu _help_jmenu;
88 private JMenuItem _website_item;
89 private JMenuItem _phyloxml_website_item;
90 private JMenuItem _phyloxml_ref_item;
91 private JMenuItem _aptx_ref_item;
92 private JMenuItem _remove_branch_color_item;
93 private JMenuItem _infer_common_sn_names_item;
94 private JCheckBoxMenuItem _show_domain_labels;
95 private JCheckBoxMenuItem _color_labels_same_as_parent_branch;
96 private JCheckBoxMenuItem _abbreviate_scientific_names;
97 private JCheckBoxMenuItem _screen_antialias_cbmi;
98 private JCheckBoxMenuItem _background_gradient_cbmi;
99 private JRadioButtonMenuItem _non_lined_up_cladograms_rbmi;
100 private JRadioButtonMenuItem _uniform_cladograms_rbmi;
101 private JRadioButtonMenuItem _ext_node_dependent_cladogram_rbmi;
102 private Options _options;
103 private JMenuItem _choose_font_mi;
104 private JMenuItem _switch_colors_mi;
105 JCheckBoxMenuItem _label_direction_cbmi;
106 private JCheckBoxMenuItem _show_scale_cbmi;
107 private JCheckBoxMenuItem _search_case_senstive_cbmi;
108 private JCheckBoxMenuItem _search_whole_words_only_cbmi;
109 private JCheckBoxMenuItem _inverse_search_result_cbmi;
110 private JCheckBoxMenuItem _show_overview_cbmi;
111 private JMenuItem _choose_minimal_confidence_mi;
112 private JCheckBoxMenuItem _show_branch_length_values_cbmi;
113 private JMenuItem _collapse_species_specific_subtrees;
114 private JMenuItem _overview_placment_mi;
115 private ButtonGroup _radio_group_1;
116 private JCheckBoxMenuItem _show_default_node_shapes_cbmi;
117 private JMenuItem _cycle_node_shape_mi;
118 private JMenuItem _cycle_node_fill_mi;
119 private JMenuItem _choose_node_size_mi;
120 private JCheckBoxMenuItem _taxonomy_colorize_node_shapes_cbmi;
121 private JCheckBoxMenuItem _show_confidence_stddev_cbmi;
124 public void actionPerformed( final ActionEvent e ) {
125 final Object o = e.getSource();
126 if ( o == _midpoint_root_item ) {
127 getMainPanel().getCurrentTreePanel().midpointRoot();
129 else if ( o == _taxcolor_item ) {
130 getMainPanel().getCurrentTreePanel().taxColor();
132 else if ( o == _confcolor_item ) {
133 getMainPanel().getCurrentTreePanel().confColor();
135 else if ( o == _infer_common_sn_names_item ) {
136 if ( getCurrentTreePanel() != null ) {
137 getCurrentTreePanel().inferCommonPartOfScientificNames();
140 else if ( o == _collapse_species_specific_subtrees ) {
141 if ( getCurrentTreePanel() != null ) {
142 getCurrentTreePanel().collapseSpeciesSpecificSubtrees();
145 else if ( o == _remove_branch_color_item ) {
146 removeBranchColors();
148 else if ( o == _switch_colors_mi ) {
151 else if ( o == _display_basic_information_item ) {
152 displayBasicInformation();
154 else if ( o == _view_as_NH_item ) {
157 else if ( o == _view_as_NHX_item ) {
160 else if ( o == _view_as_XML_item ) {
163 else if ( o == _view_as_nexus_item ) {
166 else if ( o == _super_tiny_fonts_mi ) {
167 if ( getCurrentTreePanel() != null ) {
168 getCurrentTreePanel().setSuperTinyFonts();
169 getCurrentTreePanel().repaint();
172 else if ( o == _tiny_fonts_mi ) {
173 if ( getCurrentTreePanel() != null ) {
174 getCurrentTreePanel().setTinyFonts();
175 getCurrentTreePanel().repaint();
178 else if ( o == _small_fonts_mi ) {
179 if ( getCurrentTreePanel() != null ) {
180 getCurrentTreePanel().setSmallFonts();
181 getCurrentTreePanel().repaint();
184 else if ( o == _medium_fonts_mi ) {
185 if ( getCurrentTreePanel() != null ) {
186 getCurrentTreePanel().setMediumFonts();
187 getCurrentTreePanel().repaint();
190 else if ( o == _large_fonts_mi ) {
191 if ( getCurrentTreePanel() != null ) {
192 getCurrentTreePanel().setLargeFonts();
193 getCurrentTreePanel().repaint();
196 else if ( o == _choose_font_mi ) {
199 else if ( o == _choose_minimal_confidence_mi ) {
200 chooseMinimalConfidence();
202 else if ( o == _choose_node_size_mi ) {
203 MainFrame.chooseNodeSize( getOptions(), this );
205 else if ( o == _overview_placment_mi ) {
206 MainFrame.cycleOverview( getOptions(), getCurrentTreePanel() );
208 else if ( o == _cycle_node_fill_mi ) {
209 MainFrame.cycleNodeFill( getOptions(), getCurrentTreePanel() );
211 else if ( o == _cycle_node_shape_mi ) {
212 MainFrame.cycleNodeShape( getOptions(), getCurrentTreePanel() );
214 else if ( o == _non_lined_up_cladograms_rbmi ) {
215 updateOptions( getOptions() );
216 _main_panel.getControlPanel().showWhole();
218 else if ( o == _uniform_cladograms_rbmi ) {
219 updateOptions( getOptions() );
220 _main_panel.getControlPanel().showWhole();
222 else if ( o == _ext_node_dependent_cladogram_rbmi ) {
223 updateOptions( getOptions() );
224 _main_panel.getControlPanel().showWhole();
226 else if ( o == _search_case_senstive_cbmi ) {
227 updateOptions( getOptions() );
228 getMainPanel().getControlPanel().search();
230 else if ( o == _search_whole_words_only_cbmi ) {
231 updateOptions( getOptions() );
232 getMainPanel().getControlPanel().search();
234 else if ( o == _inverse_search_result_cbmi ) {
235 updateOptions( getOptions() );
236 getMainPanel().getControlPanel().search();
238 else if ( o == _show_scale_cbmi ) {
239 updateOptions( getOptions() );
241 else if ( o == _show_branch_length_values_cbmi ) {
242 updateOptions( getOptions() );
244 else if ( o == _show_confidence_stddev_cbmi ) {
245 updateOptions( getOptions() );
247 else if ( o == _label_direction_cbmi ) {
248 updateOptions( getOptions() );
250 else if ( o == _show_overview_cbmi ) {
251 updateOptions( getOptions() );
252 if ( getCurrentTreePanel() != null ) {
253 getCurrentTreePanel().updateOvSizes();
256 else if ( ( o == _rectangular_type_cbmi ) || ( o == _triangular_type_cbmi ) || ( o == _curved_type_cbmi )
257 || ( o == _convex_type_cbmi ) || ( o == _rounded_type_cbmi ) || ( o == _euro_type_cbmi )
258 || ( o == _unrooted_type_cbmi ) || ( o == _circular_type_cbmi ) ) {
261 else if ( o == _screen_antialias_cbmi ) {
262 updateOptions( getOptions() );
263 setupScreenTextAntialias( getMainPanel().getTreePanels(), isScreenAntialias() );
265 else if ( o == _background_gradient_cbmi ) {
266 updateOptions( getOptions() );
268 else if ( o == _show_domain_labels ) {
269 updateOptions( getOptions() );
271 else if ( o == _color_labels_same_as_parent_branch ) {
272 updateOptions( getOptions() );
274 else if ( o == _show_default_node_shapes_cbmi ) {
275 updateOptions( getOptions() );
277 else if ( o == _taxonomy_colorize_node_shapes_cbmi ) {
278 updateOptions( getOptions() );
280 else if ( o == _about_item ) {
283 else if ( o == _help_item ) {
284 MainFrame.help( getConfiguration().getWebLinks() );
286 else if ( o == _website_item ) {
288 AptxUtil.openWebsite( Constants.APTX_WEB_SITE, true, this );
290 catch ( final IOException e1 ) {
291 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
294 else if ( o == _phyloxml_website_item ) {
296 AptxUtil.openWebsite( Constants.PHYLOXML_WEB_SITE, true, this );
298 catch ( final IOException e1 ) {
299 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
302 else if ( o == _aptx_ref_item ) {
304 AptxUtil.openWebsite( Constants.APTX_REFERENCE_URL, true, this );
306 catch ( final IOException e1 ) {
307 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
310 else if ( o == _phyloxml_ref_item ) {
312 AptxUtil.openWebsite( Constants.PHYLOXML_REFERENCE_URL, true, this );
314 catch ( final IOException e1 ) {
315 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
322 * This method returns the current phylogeny as a string in the chosen format
324 * @param format must be NH, NHX, NEXUS or PHYLOXML
325 * @return the phylogeny string
326 * @author Herve Menager
328 public String getCurrentPhylogeny( final String format ) {
330 if ( ( getMainPanel().getCurrentPhylogeny() == null ) || getMainPanel().getCurrentPhylogeny().isEmpty()
331 || ( getMainPanel().getCurrentPhylogeny().getNumberOfExternalNodes() > 10000 ) ) {
334 switch ( ForesterConstants.PhylogeneticTreeFormats.valueOf( format ) ) {
336 return getMainPanel().getCurrentPhylogeny().toNewHampshire();
338 return getMainPanel().getCurrentPhylogeny().toNewHampshireX();
340 return getMainPanel().getCurrentPhylogeny().toNexus();
342 return getMainPanel().getCurrentPhylogeny().toPhyloXML( -1 );
350 * This method returns a view of the current phylogeny in a chosen
351 * graphics format, base64-encoded in a string so that in can be used
354 * @param format must be GraphicsExportType (gif, jpg, pdf, png, tif, bmp)
355 * @return the phylogeny string
356 * @author Herve Menager
358 public String getCurrentPhylogenyGraphicsAsBase64EncodedString( final String format ) {
359 final ByteArrayOutputStream baos = new ByteArrayOutputStream();
361 AptxUtil.writePhylogenyToGraphicsByteArrayOutputStream( baos,
362 _main_panel.getWidth(),
363 _main_panel.getHeight(),
364 getCurrentTreePanel(),
365 getCurrentTreePanel().getControlPanel(),
366 GraphicsExportType.valueOf( format ),
369 catch ( final IOException ioe ) {
370 ForesterUtil.printErrorMessage( NAME, ioe.toString() );
371 ioe.printStackTrace();
372 JOptionPane.showMessageDialog( this,
373 NAME + ": Failed to generate graphics: " + "\nException: " + ioe,
374 "Failed to generate graphics",
375 JOptionPane.ERROR_MESSAGE );
378 final byte[] bytes = baos.toByteArray();
379 final String dataImg = Base64.encodeBase64String( bytes );
383 void buildFontSizeMenu() {
384 _font_size_menu = MainFrame.createMenu( MainFrame.FONT_SIZE_MENU_LABEL, getConfiguration() );
385 _font_size_menu.add( _super_tiny_fonts_mi = new JMenuItem( "Super tiny fonts" ) );
386 _font_size_menu.add( _tiny_fonts_mi = new JMenuItem( "Tiny fonts" ) );
387 _font_size_menu.add( _small_fonts_mi = new JMenuItem( "Small fonts" ) );
388 _font_size_menu.add( _medium_fonts_mi = new JMenuItem( "Medium fonts" ) );
389 _font_size_menu.add( _large_fonts_mi = new JMenuItem( "Large fonts" ) );
390 customizeJMenuItem( _super_tiny_fonts_mi );
391 customizeJMenuItem( _tiny_fonts_mi );
392 customizeJMenuItem( _small_fonts_mi );
393 customizeJMenuItem( _medium_fonts_mi );
394 customizeJMenuItem( _large_fonts_mi );
395 _jmenubar.add( _font_size_menu );
398 void buildHelpMenu() {
399 _help_jmenu = MainFrame.createMenu( "Help", getConfiguration() );
400 _help_jmenu.add( _help_item = new JMenuItem( "Help" ) );
401 _help_jmenu.add( _website_item = new JMenuItem( "Archaeopteryx Home" ) );
402 _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" );
403 _help_jmenu.add( _phyloxml_website_item = new JMenuItem( "phyloXML Home" ) );
404 _help_jmenu.add( _phyloxml_ref_item = new JMenuItem( "phyloXML Reference" ) );
405 _help_jmenu.addSeparator();
406 _help_jmenu.add( _about_item = new JMenuItem( "About" ) );
407 customizeJMenuItem( _help_item );
408 customizeJMenuItem( _website_item );
409 customizeJMenuItem( _phyloxml_website_item );
410 customizeJMenuItem( _aptx_ref_item );
411 customizeJMenuItem( _phyloxml_ref_item );
412 customizeJMenuItem( _about_item );
413 _phyloxml_ref_item.setToolTipText( MainFrame.PHYLOXML_REF_TOOL_TIP );
414 _aptx_ref_item.setToolTipText( MainFrame.APTX_REF_TOOL_TIP );
415 _jmenubar.add( _help_jmenu );
418 void buildOptionsMenu() {
419 _options_jmenu = MainFrame.createMenu( MainFrame.OPTIONS_HEADER, getConfiguration() );
420 _options_jmenu.addChangeListener( new ChangeListener() {
423 public void stateChanged( final ChangeEvent e ) {
424 MainFrame.setOvPlacementColorChooseMenuItem( _overview_placment_mi, getOptions() );
425 MainFrame.setTextColorChooseMenuItem( _switch_colors_mi, getCurrentTreePanel() );
427 .setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() );
428 MainFrame.setTextForFontChooserMenuItem( _choose_font_mi, MainFrame
429 .createCurrentFontDesc( getMainPanel().getTreeFontSet() ) );
430 MainFrame.updateOptionsMenuDependingOnPhylogenyType( getMainPanel(),
432 _show_branch_length_values_cbmi,
433 _non_lined_up_cladograms_rbmi,
434 _uniform_cladograms_rbmi,
435 _ext_node_dependent_cladogram_rbmi,
436 _label_direction_cbmi );
437 MainFrame.setCycleNodeFillMenuItem( _cycle_node_fill_mi, getOptions() );
438 MainFrame.setCycleNodeShapeMenuItem( _cycle_node_shape_mi, getOptions() );
439 MainFrame.setTextNodeSizeMenuItem( _choose_node_size_mi, getOptions() );
442 _options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.DISPLAY_SUBHEADER ),
443 getConfiguration() ) );
445 .add( _ext_node_dependent_cladogram_rbmi = new JRadioButtonMenuItem( MainFrame.NONUNIFORM_CLADOGRAMS_LABEL ) );
446 _options_jmenu.add( _uniform_cladograms_rbmi = new JRadioButtonMenuItem( MainFrame.UNIFORM_CLADOGRAMS_LABEL ) );
448 .add( _non_lined_up_cladograms_rbmi = new JRadioButtonMenuItem( MainFrame.NON_LINED_UP_CLADOGRAMS_LABEL ) );
449 _radio_group_1 = new ButtonGroup();
450 _radio_group_1.add( _ext_node_dependent_cladogram_rbmi );
451 _radio_group_1.add( _uniform_cladograms_rbmi );
452 _radio_group_1.add( _non_lined_up_cladograms_rbmi );
453 _options_jmenu.add( _show_overview_cbmi = new JCheckBoxMenuItem( MainFrame.SHOW_OVERVIEW_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_confidence_stddev_cbmi = new JCheckBoxMenuItem( MainFrame.SHOW_CONF_STDDEV_LABEL ) );
459 .add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL ) );
461 .add( _taxonomy_colorize_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.TAXONOMY_COLORIZE_NODE_SHAPES_LABEL ) );
462 _options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
463 _options_jmenu.add( _cycle_node_fill_mi = new JMenuItem( MainFrame.CYCLE_NODE_FILL_LABEL ) );
464 _options_jmenu.add( _choose_node_size_mi = new JMenuItem( MainFrame.CHOOSE_NODE_SIZE_LABEL ) );
465 _options_jmenu.add( _label_direction_cbmi = new JCheckBoxMenuItem( MainFrame.LABEL_DIRECTION_LABEL ) );
467 .add( _color_labels_same_as_parent_branch = new JCheckBoxMenuItem( MainFrame.COLOR_LABELS_LABEL ) );
468 _color_labels_same_as_parent_branch.setToolTipText( MainFrame.COLOR_LABELS_TIP );
469 _options_jmenu.add( _abbreviate_scientific_names = new JCheckBoxMenuItem( MainFrame.ABBREV_SN_LABEL ) );
470 _label_direction_cbmi.setToolTipText( MainFrame.LABEL_DIRECTION_TIP );
471 _options_jmenu.add( _screen_antialias_cbmi = new JCheckBoxMenuItem( MainFrame.SCREEN_ANTIALIAS_LABEL ) );
472 _options_jmenu.add( _background_gradient_cbmi = new JCheckBoxMenuItem( MainFrame.BG_GRAD_LABEL ) );
473 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
474 _options_jmenu.add( _show_domain_labels = new JCheckBoxMenuItem( MainFrame.SHOW_DOMAIN_LABELS_LABEL ) );
476 _options_jmenu.add( _choose_minimal_confidence_mi = new JMenuItem( "" ) );
477 _options_jmenu.add( _overview_placment_mi = new JMenuItem( "" ) );
478 _options_jmenu.add( _switch_colors_mi = new JMenuItem( "" ) );
479 _options_jmenu.add( _choose_font_mi = new JMenuItem( "" ) );
480 _options_jmenu.addSeparator();
481 _options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.SEARCH_SUBHEADER ),
482 getConfiguration() ) );
484 .add( _search_case_senstive_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_CASE_SENSITIVE_LABEL ) );
485 _options_jmenu.add( _search_whole_words_only_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_TERMS_ONLY_LABEL ) );
487 .add( _inverse_search_result_cbmi = new JCheckBoxMenuItem( MainFrame.INVERSE_SEARCH_RESULT_LABEL ) );
488 customizeJMenuItem( _choose_font_mi );
489 customizeJMenuItem( _choose_minimal_confidence_mi );
490 customizeJMenuItem( _switch_colors_mi );
491 customizeJMenuItem( _overview_placment_mi );
492 customizeCheckBoxMenuItem( _label_direction_cbmi,
493 getOptions().getNodeLabelDirection() == NODE_LABEL_DIRECTION.RADIAL );
494 customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() );
495 customizeCheckBoxMenuItem( _background_gradient_cbmi, getOptions().isBackgroundColorGradient() );
496 customizeCheckBoxMenuItem( _show_domain_labels, getOptions().isShowDomainLabels() );
497 customizeCheckBoxMenuItem( _abbreviate_scientific_names, getOptions().isAbbreviateScientificTaxonNames() );
498 customizeCheckBoxMenuItem( _show_default_node_shapes_cbmi, getOptions().isShowDefaultNodeShapes() );
499 customizeCheckBoxMenuItem( _taxonomy_colorize_node_shapes_cbmi, getOptions().isTaxonomyColorizeNodeShapes() );
500 customizeJMenuItem( _cycle_node_shape_mi );
501 customizeJMenuItem( _cycle_node_fill_mi );
502 customizeJMenuItem( _choose_node_size_mi );
503 customizeCheckBoxMenuItem( _color_labels_same_as_parent_branch, getOptions().isColorLabelsSameAsParentBranch() );
504 customizeCheckBoxMenuItem( _search_case_senstive_cbmi, getOptions().isSearchCaseSensitive() );
505 customizeCheckBoxMenuItem( _show_scale_cbmi, getOptions().isShowScale() );
506 customizeRadioButtonMenuItem( _non_lined_up_cladograms_rbmi,
507 getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP );
508 customizeRadioButtonMenuItem( _uniform_cladograms_rbmi,
509 getOptions().getCladogramType() == CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
510 customizeRadioButtonMenuItem( _ext_node_dependent_cladogram_rbmi,
511 getOptions().getCladogramType() == CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
512 customizeCheckBoxMenuItem( _show_branch_length_values_cbmi, getOptions().isShowBranchLengthValues() );
513 customizeCheckBoxMenuItem( _show_overview_cbmi, getOptions().isShowOverview() );
514 customizeCheckBoxMenuItem( _search_whole_words_only_cbmi, getOptions().isMatchWholeTermsOnly() );
515 customizeCheckBoxMenuItem( _inverse_search_result_cbmi, getOptions().isInverseSearchResult() );
516 customizeCheckBoxMenuItem( _show_confidence_stddev_cbmi, getOptions().isShowConfidenceStddev() );
517 _jmenubar.add( _options_jmenu );
520 void buildToolsMenu() {
521 _tools_menu = MainFrame.createMenu( "Tools", getConfiguration() );
522 _tools_menu.add( _confcolor_item = new JMenuItem( "Colorize Branches Depending on Confidence" ) );
523 customizeJMenuItem( _confcolor_item );
524 _tools_menu.add( _taxcolor_item = new JMenuItem( "Taxonomy Colorize Branches" ) );
525 customizeJMenuItem( _taxcolor_item );
526 _tools_menu.add( _remove_branch_color_item = new JMenuItem( "Delete Branch Colors" ) );
527 _remove_branch_color_item.setToolTipText( "To delete branch color values from the current phylogeny." );
528 customizeJMenuItem( _remove_branch_color_item );
529 _tools_menu.addSeparator();
530 _tools_menu.add( _midpoint_root_item = new JMenuItem( "Midpoint-Root" ) );
531 customizeJMenuItem( _midpoint_root_item );
532 _tools_menu.addSeparator();
534 .add( _infer_common_sn_names_item = new JMenuItem( "Infer Common Parts of Internal Scientific Names" ) );
535 customizeJMenuItem( _infer_common_sn_names_item );
536 _tools_menu.add( _collapse_species_specific_subtrees = new JMenuItem( "Collapse Species-Specific Subtrees" ) );
537 customizeJMenuItem( _collapse_species_specific_subtrees );
538 _jmenubar.add( _tools_menu );
541 void buildTypeMenu() {
542 _type_menu = MainFrame.createMenu( MainFrame.TYPE_MENU_HEADER, getConfiguration() );
543 _type_menu.add( _rectangular_type_cbmi = new JCheckBoxMenuItem( MainFrame.RECTANGULAR_TYPE_CBMI_LABEL ) );
544 _type_menu.add( _euro_type_cbmi = new JCheckBoxMenuItem( MainFrame.EURO_TYPE_CBMI_LABEL ) );
545 _type_menu.add( _rounded_type_cbmi = new JCheckBoxMenuItem( MainFrame.ROUNDED_TYPE_CBMI_LABEL ) );
546 _type_menu.add( _curved_type_cbmi = new JCheckBoxMenuItem( MainFrame.CURVED_TYPE_CBMI_LABEL ) );
547 _type_menu.add( _triangular_type_cbmi = new JCheckBoxMenuItem( MainFrame.TRIANGULAR_TYPE_CBMI_LABEL ) );
548 _type_menu.add( _convex_type_cbmi = new JCheckBoxMenuItem( MainFrame.CONVEX_TYPE_CBMI_LABEL ) );
549 _type_menu.add( _unrooted_type_cbmi = new JCheckBoxMenuItem( MainFrame.UNROOTED_TYPE_CBMI_LABEL ) );
550 _type_menu.add( _circular_type_cbmi = new JCheckBoxMenuItem( MainFrame.CIRCULAR_TYPE_CBMI_LABEL ) );
551 customizeCheckBoxMenuItem( _rectangular_type_cbmi, false );
552 customizeCheckBoxMenuItem( _triangular_type_cbmi, false );
553 customizeCheckBoxMenuItem( _euro_type_cbmi, false );
554 customizeCheckBoxMenuItem( _rounded_type_cbmi, false );
555 customizeCheckBoxMenuItem( _curved_type_cbmi, false );
556 customizeCheckBoxMenuItem( _convex_type_cbmi, false );
557 customizeCheckBoxMenuItem( _unrooted_type_cbmi, false );
558 customizeCheckBoxMenuItem( _circular_type_cbmi, false );
559 _unrooted_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
560 _circular_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
561 initializeTypeMenu( getOptions() );
562 _jmenubar.add( _type_menu );
565 void buildViewMenu() {
566 _view_jmenu = MainFrame.createMenu( "View", getConfiguration() );
567 _view_jmenu.add( _display_basic_information_item = new JMenuItem( "Display Basic Information" ) );
568 _view_jmenu.addSeparator();
569 _view_jmenu.add( _view_as_XML_item = new JMenuItem( "View as phyloXML" ) );
570 _view_jmenu.add( _view_as_NH_item = new JMenuItem( "View as Newick" ) );
571 _view_jmenu.add( _view_as_NHX_item = new JMenuItem( "View as NHX" ) );
572 _view_jmenu.add( _view_as_nexus_item = new JMenuItem( "View as Nexus" ) );
573 customizeJMenuItem( _display_basic_information_item );
574 customizeJMenuItem( _view_as_NH_item );
575 customizeJMenuItem( _view_as_NHX_item );
576 customizeJMenuItem( _view_as_XML_item );
577 customizeJMenuItem( _view_as_nexus_item );
578 _jmenubar.add( _view_jmenu );
581 private void chooseFont() {
582 final FontChooser fc = new FontChooser();
583 fc.setFont( getMainPanel().getTreeFontSet().getLargeFont() );
584 fc.showDialog( this, "Select the Base Font" );
585 getMainPanel().getTreeFontSet().setBaseFont( fc.getFont() );
588 private void chooseMinimalConfidence() {
589 final String s = ( String ) JOptionPane
590 .showInputDialog( this,
591 "Please the minimum for confidence values to be displayed.\n" + "[current value: "
592 + getOptions().getMinConfidenceValue() + "]\n",
593 "Minimal Confidence Value",
594 JOptionPane.QUESTION_MESSAGE,
597 getOptions().getMinConfidenceValue() );
598 if ( !ForesterUtil.isEmpty( s ) ) {
599 boolean success = true;
601 final String m_str = s.trim();
602 if ( !ForesterUtil.isEmpty( m_str ) ) {
604 m = Double.parseDouble( m_str );
606 catch ( final Exception ex ) {
613 if ( success && ( m >= 0.0 ) ) {
614 getOptions().setMinConfidenceValue( m );
619 void customizeCheckBoxMenuItem( final JCheckBoxMenuItem item, final boolean is_selected ) {
620 if ( item != null ) {
621 item.setFont( MainFrame.menu_font );
622 if ( !getConfiguration().isUseNativeUI() ) {
623 item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
624 item.setForeground( getConfiguration().getGuiMenuTextColor() );
626 item.setSelected( is_selected );
627 item.addActionListener( this );
631 void customizeJMenuItem( final JMenuItem jmi ) {
632 jmi.setFont( MainFrame.menu_font );
633 if ( !getConfiguration().isUseNativeUI() ) {
634 jmi.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
635 jmi.setForeground( getConfiguration().getGuiMenuTextColor() );
637 jmi.addActionListener( this );
640 private void customizeRadioButtonMenuItem( final JRadioButtonMenuItem item, final boolean is_selected ) {
641 if ( item != null ) {
642 item.setFont( MainFrame.menu_font );
643 if ( !getConfiguration().isUseNativeUI() ) {
644 item.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
645 item.setForeground( getConfiguration().getGuiMenuTextColor() );
647 item.setSelected( is_selected );
648 item.addActionListener( this );
653 public void destroy() {
654 AptxUtil.printAppletMessage( NAME, "going to be destroyed " );
656 if ( getMainPanel() != null ) {
657 getMainPanel().terminate();
661 Configuration getConfiguration() {
662 return _configuration;
665 TreePanel getCurrentTreePanel() {
666 return getMainPanel().getCurrentTreePanel();
669 JCheckBoxMenuItem getlabelDirectionCbmi() {
670 return _label_direction_cbmi;
673 private MainPanel getMainPanel() {
677 public Options getOptions() {
681 Options getOtions() {
687 final String config_filename = getParameter( Constants.APPLET_PARAM_NAME_FOR_CONFIG_FILE_URL );
688 AptxUtil.printAppletMessage( NAME, "URL for configuration file is: " + config_filename );
689 final Configuration configuration = new Configuration( config_filename, true, true, true );
690 setConfiguration( configuration );
691 setOptions( Options.createInstance( configuration ) );
694 Phylogeny[] phys = null;
695 final String phys_url_string = getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
696 AptxUtil.printAppletMessage( NAME, "URL for phylogenies is " + phys_url_string );
697 // Get URL to tree file
698 if ( phys_url_string != null ) {
700 phys_url = new URL( phys_url_string );
702 catch ( final Exception e ) {
703 ForesterUtil.printErrorMessage( NAME, "error: " + e );
705 JOptionPane.showMessageDialog( this, NAME + ": Could not create URL from: \"" + phys_url_string
706 + "\"\nException: " + e, "Failed to create URL", JOptionPane.ERROR_MESSAGE );
709 // Load the tree from URL
710 if ( phys_url != null ) {
712 phys = AptxUtil.readPhylogeniesFromUrl( phys_url, getConfiguration().isValidatePhyloXmlAgainstSchema() );
714 catch ( final Exception e ) {
715 ForesterUtil.printErrorMessage( NAME, e.toString() );
717 JOptionPane.showMessageDialog( this,
718 NAME + ": Failed to read phylogenies: " + "\nException: " + e,
719 "Failed to read phylogenies",
720 JOptionPane.ERROR_MESSAGE );
723 if ( ( phys == null ) || ( phys.length < 1 ) ) {
724 ForesterUtil.printErrorMessage( NAME, "phylogenies from [" + phys_url + "] are null or empty" );
725 JOptionPane.showMessageDialog( this,
726 NAME + ": phylogenies from [" + phys_url + "] are null or empty",
727 "Failed to read phylogenies",
728 JOptionPane.ERROR_MESSAGE );
732 AptxUtil.printAppletMessage( NAME, "loaded " + phys.length + " phylogenies from: " + phys_url );
735 setMainPanel( new MainPanelApplets( getConfiguration(), this ) );
736 _jmenubar = new JMenuBar();
737 if ( !getConfiguration().isHideControlPanelAndMenubar() ) {
738 if ( !getConfiguration().isUseNativeUI() ) {
739 _jmenubar.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
747 setJMenuBar( _jmenubar );
749 final Container contentpane = getContentPane();
750 contentpane.setLayout( new BorderLayout() );
751 contentpane.add( getMainPanel(), BorderLayout.CENTER );
752 addComponentListener( new ComponentAdapter() {
755 public void componentResized( final ComponentEvent e ) {
756 if ( getMainPanel().getCurrentTreePanel() != null ) {
757 getMainPanel().getCurrentTreePanel().setParametersForPainting( getMainPanel().getCurrentTreePanel()
759 getMainPanel().getCurrentTreePanel()
765 if ( getConfiguration().isUseTabbedDisplay() ) {
766 AptxUtil.printAppletMessage( NAME, "using tabbed display" );
767 AptxUtil.addPhylogeniesToTabs( phys,
768 new File( phys_url.getFile() ).getName(),
774 AptxUtil.printAppletMessage( NAME, "not using tabbed display" );
775 AptxUtil.addPhylogenyToPanel( phys, getConfiguration(), getMainPanel() );
779 getMainPanel().getControlPanel().showWholeAll();
780 getMainPanel().getControlPanel().showWhole();
782 AptxUtil.printAppletMessage( NAME, "successfully initialized" );
784 getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().removeAllItems();
785 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
786 .getRelevantSequenceRelationTypes() ) {
787 getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().addItem( type );
789 final String default_relation = getParameter( Constants.APPLET_PARAM_NAME_FOR_DEFAULT_SEQUENCE_RELATION_TYPE );
790 if ( default_relation != null ) {
791 getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().setSelectedItem( default_relation );
793 final String default_sequence = getParameter( Constants.APPLET_PARAM_NAME_FOR_DEFAULT_QUERY_SEQUENCE );
794 if ( default_sequence != null ) {
795 getCurrentTreePanel().getControlPanel().getSequenceRelationBox().setSelectedItem( default_sequence );
801 void initializeTypeMenu( final Options options ) {
802 setTypeMenuToAllUnselected();
804 switch ( options.getPhylogenyGraphicsType() ) {
806 _convex_type_cbmi.setSelected( true );
809 _curved_type_cbmi.setSelected( true );
812 _euro_type_cbmi.setSelected( true );
815 _rounded_type_cbmi.setSelected( true );
818 _triangular_type_cbmi.setSelected( true );
821 _unrooted_type_cbmi.setSelected( true );
824 _circular_type_cbmi.setSelected( true );
827 _rectangular_type_cbmi.setSelected( true );
831 catch ( final NullPointerException np ) {
832 // In all likelihood, this is caused by menu-less display.
836 private boolean isScreenAntialias() {
840 private void removeBranchColors() {
841 if ( getMainPanel().getCurrentPhylogeny() != null ) {
842 AptxUtil.removeBranchColors( getMainPanel().getCurrentPhylogeny() );
846 void removeTextFrame() {
847 if ( _textframe != null ) {
853 void setConfiguration( final Configuration configuration ) {
854 _configuration = configuration;
857 private void setMainPanel( final MainPanelApplets main_panel ) {
858 _main_panel = main_panel;
861 void setOptions( final Options options ) {
865 void setSelectedTypeInTypeMenu( final PHYLOGENY_GRAPHICS_TYPE type ) {
866 setTypeMenuToAllUnselected();
870 _circular_type_cbmi.setSelected( true );
873 _convex_type_cbmi.setSelected( true );
876 _curved_type_cbmi.setSelected( true );
879 _euro_type_cbmi.setSelected( true );
882 _rounded_type_cbmi.setSelected( true );
885 _rectangular_type_cbmi.setSelected( true );
888 _triangular_type_cbmi.setSelected( true );
891 _unrooted_type_cbmi.setSelected( true );
894 throw new IllegalArgumentException( "unknown type: " + type );
897 catch ( final NullPointerException np ) {
898 // In all likelihood, this is caused by menu-less display.
902 void setTypeMenuToAllUnselected() {
903 if ( _convex_type_cbmi != null ) {
904 _convex_type_cbmi.setSelected( false );
906 if ( _curved_type_cbmi != null ) {
907 _curved_type_cbmi.setSelected( false );
909 if ( _euro_type_cbmi != null ) {
910 _euro_type_cbmi.setSelected( false );
912 if ( _rounded_type_cbmi != null ) {
913 _rounded_type_cbmi.setSelected( false );
915 if ( _triangular_type_cbmi != null ) {
916 _triangular_type_cbmi.setSelected( false );
918 if ( _rectangular_type_cbmi != null ) {
919 _rectangular_type_cbmi.setSelected( false );
921 if ( _unrooted_type_cbmi != null ) {
922 _unrooted_type_cbmi.setSelected( false );
924 if ( _circular_type_cbmi != null ) {
925 _circular_type_cbmi.setSelected( false );
929 private void setupUI() {
931 if ( getConfiguration().isUseNativeUI() ) {
932 UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
935 UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );
938 catch ( final UnsupportedLookAndFeelException e ) {
939 AptxUtil.dieWithSystemError( "UnsupportedLookAndFeelException: " + e.toString() );
941 catch ( final ClassNotFoundException e ) {
942 AptxUtil.dieWithSystemError( "ClassNotFoundException: " + e.toString() );
944 catch ( final InstantiationException e ) {
945 AptxUtil.dieWithSystemError( "InstantiationException: " + e.toString() );
947 catch ( final IllegalAccessException e ) {
948 AptxUtil.dieWithSystemError( "IllegalAccessException: " + e.toString() );
950 catch ( final Exception e ) {
951 AptxUtil.dieWithSystemError( e.toString() );
956 public void start() {
957 if ( getMainPanel() != null ) {
958 getMainPanel().validate();
961 requestFocusInWindow();
963 AptxUtil.printAppletMessage( NAME, "started" );
966 void switchColors() {
967 final TreeColorSet colorset = getMainPanel().getCurrentTreePanel().getTreeColorSet();
968 final ColorSchemeChooser csc = new ColorSchemeChooser( getMainPanel(), colorset );
969 csc.setVisible( true );
970 getMainPanel().setTreeColorSet( colorset );
973 void typeChanged( final Object o ) {
974 updateTypeCheckboxes( getOptions(), o );
975 updateOptions( getOptions() );
976 if ( getCurrentTreePanel() != null ) {
977 final PHYLOGENY_GRAPHICS_TYPE previous_type = getCurrentTreePanel().getPhylogenyGraphicsType();
978 final PHYLOGENY_GRAPHICS_TYPE new_type = getOptions().getPhylogenyGraphicsType();
979 if ( ( ( previous_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) && ( new_type != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) )
980 || ( ( previous_type == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) && ( new_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) )
981 || ( ( previous_type != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) && ( new_type == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) )
982 || ( ( previous_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) && ( new_type == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) ) {
983 getCurrentTreePanel().getControlPanel().showWhole();
985 if ( getCurrentTreePanel().isPhyHasBranchLengths() && ( new_type != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
986 getCurrentTreePanel().getControlPanel().setDrawPhylogramEnabled( true );
989 getCurrentTreePanel().getControlPanel().setDrawPhylogramEnabled( false );
991 getCurrentTreePanel().setPhylogenyGraphicsType( getOptions().getPhylogenyGraphicsType() );
992 MainFrame.updateScreenTextAntialias( getMainPanel().getTreePanels() );
996 void updateOptions( final Options options ) {
997 options.setAntialiasScreen( ( _screen_antialias_cbmi != null ) && _screen_antialias_cbmi.isSelected() );
998 options.setBackgroundColorGradient( ( _background_gradient_cbmi != null )
999 && _background_gradient_cbmi.isSelected() );
1000 options.setShowDomainLabels( ( _show_domain_labels != null ) && _show_domain_labels.isSelected() );
1001 options.setAbbreviateScientificTaxonNames( ( _abbreviate_scientific_names != null )
1002 && _abbreviate_scientific_names.isSelected() );
1003 options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )
1004 && _color_labels_same_as_parent_branch.isSelected() );
1005 options.setShowDefaultNodeShapes( ( _show_default_node_shapes_cbmi != null )
1006 && _show_default_node_shapes_cbmi.isSelected() );
1007 options.setTaxonomyColorizeNodeShapes( ( _taxonomy_colorize_node_shapes_cbmi != null )
1008 && _taxonomy_colorize_node_shapes_cbmi.isSelected() );
1009 if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {
1010 options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );
1012 else if ( ( _uniform_cladograms_rbmi != null ) && ( _uniform_cladograms_rbmi.isSelected() ) ) {
1013 options.setCladogramType( CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
1015 else if ( ( _ext_node_dependent_cladogram_rbmi != null ) && ( _ext_node_dependent_cladogram_rbmi.isSelected() ) ) {
1016 options.setCladogramType( CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
1018 options.setSearchCaseSensitive( ( _search_case_senstive_cbmi != null )
1019 && _search_case_senstive_cbmi.isSelected() );
1020 if ( ( _show_scale_cbmi != null ) && _show_scale_cbmi.isEnabled() ) {
1021 options.setShowScale( _show_scale_cbmi.isSelected() );
1023 if ( _label_direction_cbmi != null ) {
1024 if ( _label_direction_cbmi.isSelected() ) {
1025 options.setNodeLabelDirection( NODE_LABEL_DIRECTION.RADIAL );
1028 options.setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
1031 options.setShowOverview( ( _show_overview_cbmi != null ) && _show_overview_cbmi.isSelected() );
1032 options.setShowConfidenceStddev( ( _show_confidence_stddev_cbmi != null )
1033 && _show_confidence_stddev_cbmi.isSelected() );
1034 if ( ( _show_branch_length_values_cbmi != null ) && _show_branch_length_values_cbmi.isEnabled() ) {
1035 options.setShowBranchLengthValues( _show_branch_length_values_cbmi.isSelected() );
1037 options.setMatchWholeTermsOnly( ( _search_whole_words_only_cbmi != null )
1038 && _search_whole_words_only_cbmi.isSelected() );
1039 options.setInverseSearchResult( ( _inverse_search_result_cbmi != null )
1040 && _inverse_search_result_cbmi.isSelected() );
1041 if ( ( _rectangular_type_cbmi != null ) && _rectangular_type_cbmi.isSelected() ) {
1042 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
1044 else if ( ( _triangular_type_cbmi != null ) && _triangular_type_cbmi.isSelected() ) {
1045 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.TRIANGULAR );
1047 else if ( ( _curved_type_cbmi != null ) && _curved_type_cbmi.isSelected() ) {
1048 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CURVED );
1050 else if ( ( _convex_type_cbmi != null ) && _convex_type_cbmi.isSelected() ) {
1051 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CONVEX );
1053 else if ( ( _euro_type_cbmi != null ) && _euro_type_cbmi.isSelected() ) {
1054 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE );
1056 else if ( ( _rounded_type_cbmi != null ) && _rounded_type_cbmi.isSelected() ) {
1057 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.ROUNDED );
1059 else if ( ( _unrooted_type_cbmi != null ) && _unrooted_type_cbmi.isSelected() ) {
1060 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.UNROOTED );
1062 else if ( ( _circular_type_cbmi != null ) && _circular_type_cbmi.isSelected() ) {
1063 options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR );
1067 void updateTypeCheckboxes( final Options options, final Object o ) {
1068 setTypeMenuToAllUnselected();
1069 ( ( JCheckBoxMenuItem ) o ).setSelected( true );
1072 void viewAsNexus() {
1073 if ( ( getMainPanel().getCurrentPhylogeny() != null ) && !getMainPanel().getCurrentPhylogeny().isEmpty() ) {
1074 showTextFrame( getMainPanel().getCurrentPhylogeny().toNexus( getOptions()
1075 .getNhConversionSupportValueStyle() ) );
1080 if ( ( getMainPanel().getCurrentPhylogeny() != null ) && !getMainPanel().getCurrentPhylogeny().isEmpty() ) {
1081 showTextFrame( getMainPanel().getCurrentPhylogeny().toNewHampshire() );
1086 if ( ( getMainPanel().getCurrentPhylogeny() != null ) && !getMainPanel().getCurrentPhylogeny().isEmpty() ) {
1087 showTextFrame( getMainPanel().getCurrentPhylogeny().toNewHampshireX() );
1092 if ( ( getMainPanel().getCurrentPhylogeny() != null ) && !getMainPanel().getCurrentPhylogeny().isEmpty() ) {
1093 showTextFrame( getMainPanel().getCurrentPhylogeny().toPhyloXML( 0 ) );
1097 void displayBasicInformation() {
1098 if ( ( getMainPanel().getCurrentPhylogeny() != null ) && !getMainPanel().getCurrentPhylogeny().isEmpty() ) {
1099 showTextFrame( AptxUtil.createBasicInformation( getMainPanel().getCurrentPhylogeny() ) );
1103 public void showTextFrame( final String s ) {
1105 _textframe = TextFrame.instantiate( s );
1108 static void setupScreenTextAntialias( final List<TreePanel> treepanels, final boolean antialias ) {
1109 for( final TreePanel tree_panel : treepanels ) {
1110 tree_panel.setTextAntialias();