X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FMainFrame.java;h=e8d28e04019e929fdb5f075214a019560548dd2e;hb=df8e9950662eaab9427f6873dcd0072f0d28f690;hp=f9ed538e9893afebe369ab78933d5014c7cca450;hpb=187777133416c347dd7da371d7edf7ce20ebe56b;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrame.java b/forester/java/src/org/forester/archaeopteryx/MainFrame.java index f9ed538..e8d28e0 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrame.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrame.java @@ -33,16 +33,15 @@ import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.util.ArrayList; -import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.NoSuchElementException; -import java.util.Set; import javax.swing.Box; import javax.swing.JApplet; import javax.swing.JCheckBoxMenuItem; +import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; @@ -60,6 +59,8 @@ import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE; import org.forester.archaeopteryx.tools.InferenceManager; import org.forester.archaeopteryx.tools.ProcessPool; import org.forester.archaeopteryx.tools.ProcessRunning; +import org.forester.archaeopteryx.webservices.PhylogeniesWebserviceClient; +import org.forester.archaeopteryx.webservices.WebservicesManager; import org.forester.io.parsers.nhx.NHXParser.TAXONOMY_EXTRACTION; import org.forester.phylogeny.Phylogeny; import org.forester.phylogeny.PhylogenyMethods; @@ -67,6 +68,7 @@ import org.forester.phylogeny.PhylogenyMethods.DESCENDANT_SORT_PRIORITY; import org.forester.phylogeny.PhylogenyNode; import org.forester.phylogeny.PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE; import org.forester.phylogeny.data.Annotation; +import org.forester.phylogeny.data.NodeDataField; import org.forester.phylogeny.data.NodeVisualData.NodeFill; import org.forester.phylogeny.data.NodeVisualData.NodeShape; import org.forester.phylogeny.iterators.PhylogenyNodeIterator; @@ -75,11 +77,12 @@ import org.forester.sdi.GSDIR; import org.forester.sdi.SDIException; import org.forester.util.ForesterConstants; import org.forester.util.ForesterUtil; +import org.forester.util.WindowsUtils; public abstract class MainFrame extends JFrame implements ActionListener { static final String USE_MOUSEWHEEL_SHIFT_TO_ROTATE = "In this display type, use mousewheel + Shift to rotate [or A and S]"; - static final String PHYLOXML_REF_TOOL_TIP = Constants.PHYLOXML_REFERENCE; //TODO //FIXME + static final String PHYLOXML_REF_TOOL_TIP = Constants.PHYLOXML_REFERENCE; //TODO //FIXME static final String APTX_REF_TOOL_TIP = Constants.APTX_REFERENCE; private static final long serialVersionUID = 3655000897845508358L; final static Font menu_font = new Font( Configuration.getDefaultFontFamilyName(), @@ -92,26 +95,28 @@ public abstract class MainFrame extends JFrame implements ActionListener { static final String TRIANGULAR_TYPE_CBMI_LABEL = "Triangular"; static final String CONVEX_TYPE_CBMI_LABEL = "Convex"; static final String ROUNDED_TYPE_CBMI_LABEL = "Rounded"; - static final String UNROOTED_TYPE_CBMI_LABEL = "Unrooted (alpha)"; //TODO - static final String CIRCULAR_TYPE_CBMI_LABEL = "Circular (alpha)"; //TODO + static final String UNROOTED_TYPE_CBMI_LABEL = "Unrooted (alpha)"; //TODO + static final String CIRCULAR_TYPE_CBMI_LABEL = "Circular (alpha)"; //TODO static final String OPTIONS_HEADER = "Options"; static final String SEARCH_SUBHEADER = "Search:"; static final String DISPLAY_SUBHEADER = "Display:"; static final String SEARCH_TERMS_ONLY_LABEL = "Match Complete Terms Only"; + static final String SEARCH_REGEX_LABEL = "Search with Regular Expressions"; static final String SEARCH_CASE_SENSITIVE_LABEL = "Case Sensitive"; static final String INVERSE_SEARCH_RESULT_LABEL = "Negate Result"; - static final String DISPLAY_BRANCH_LENGTH_VALUES_LABEL = "Branch Length Values"; static final String COLOR_BY_TAXONOMIC_GROUP = "Colorize by Taxonomic Group"; static final String DISPLAY_SCALE_LABEL = "Scale"; static final String NON_LINED_UP_CLADOGRAMS_LABEL = "Non-Lined Up Cladograms"; static final String UNIFORM_CLADOGRAMS_LABEL = "Total Node Sum Dependent Cladograms"; static final String LABEL_DIRECTION_LABEL = "Radial Labels"; static final String LABEL_DIRECTION_TIP = "To use radial node labels in radial and unrooted display types"; + static final String SEARCH_WITH_REGEX_TIP = "To search using regular expressions (~Java/Perl syntax). For example, use \"^B.+\\d{2,}$\" to search for everything starting with a B and ending with at least two digits."; static final String SCREEN_ANTIALIAS_LABEL = "Antialias"; static final String COLOR_LABELS_LABEL = "Colorize Labels Same as Parent Branch"; static final String BG_GRAD_LABEL = "Background Color Gradient"; - static final String DISPLAY_NODE_BOXES_LABEL_EXT = "External Node Shapes"; - static final String DISPLAY_NODE_BOXES_LABEL_INT = "Internal Node Shapes"; + static final String DISPLAY_NODE_BOXES_LABEL_EXT = "Shapes for External Nodes"; + static final String DISPLAY_NODE_BOXES_LABEL_INT = "Shapes for Internal Nodes"; + static final String DISPLAY_NODE_BOXES_LABEL_MARKED = "Shapes for Nodes with Visual Data"; static final String SHOW_OVERVIEW_LABEL = "Overview"; static final String FONT_SIZE_MENU_LABEL = "Font Size"; static final String NONUNIFORM_CLADOGRAMS_LABEL = "External Node Sum Dependent Cladograms"; @@ -127,6 +132,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { static final String USE_BRACKETS_FOR_CONF_IN_NH_LABEL = "Use Brackets for Confidence Values"; static final String USE_INTERNAL_NAMES_FOR_CONF_IN_NH_LABEL = "Use Internal Node Names for Confidence Values"; static final String SHOW_BASIC_TREE_INFORMATION_LABEL = "Basic Tree Information"; + static final String RIGHT_LINE_UP_DOMAINS = "Right-align Domain Architectures"; + static final String LINE_UP_RENDERABLE_DATA = "Line Up Diagrams (such as Domain Architectures)"; JMenuBar _jmenubar; JMenu _file_jmenu; JMenu _tools_menu; @@ -149,13 +156,19 @@ public abstract class MainFrame extends JFrame implements ActionListener { JMenuItem _close_item; JMenuItem _exit_item; JMenuItem _new_item; + JMenuItem _print_item; + JMenuItem _write_to_pdf_item; + JMenuItem _write_to_jpg_item; + JMenuItem _write_to_gif_item; + JMenuItem _write_to_tif_item; + JMenuItem _write_to_png_item; + JMenuItem _write_to_bmp_item; // tools menu: JMenuItem _midpoint_root_item; JMenuItem _taxcolor_item; JMenuItem _confcolor_item; JMenuItem _color_rank_jmi; JMenuItem _collapse_species_specific_subtrees; - JMenuItem _collapse_below_threshold; //TODO implememt me JMenuItem _obtain_detailed_taxonomic_information_jmi; JMenuItem _obtain_detailed_taxonomic_information_deleting_jmi; JMenuItem _obtain_seq_information_jmi; @@ -184,9 +197,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { JRadioButtonMenuItem _non_lined_up_cladograms_rbmi; JRadioButtonMenuItem _uniform_cladograms_rbmi; JRadioButtonMenuItem _ext_node_dependent_cladogram_rbmi; - JCheckBoxMenuItem _show_branch_length_values_cbmi; JCheckBoxMenuItem _color_by_taxonomic_group_cbmi; - JCheckBoxMenuItem _show_scale_cbmi; //TODO fix me + JCheckBoxMenuItem _show_scale_cbmi; //TODO fix me JCheckBoxMenuItem _show_overview_cbmi; JCheckBoxMenuItem _show_domain_labels; JCheckBoxMenuItem _show_annotation_ref_source; @@ -196,10 +208,14 @@ public abstract class MainFrame extends JFrame implements ActionListener { JMenuItem _choose_minimal_confidence_mi; JCheckBoxMenuItem _show_default_node_shapes_internal_cbmi; JCheckBoxMenuItem _show_default_node_shapes_external_cbmi; + JCheckBoxMenuItem _show_default_node_shapes_for_marked_cbmi; JMenuItem _cycle_node_shape_mi; JMenuItem _cycle_node_fill_mi; JMenuItem _choose_node_size_mi; + JMenuItem _cycle_data_return; JCheckBoxMenuItem _show_confidence_stddev_cbmi; + JCheckBoxMenuItem _right_line_up_domains_cbmi; + JCheckBoxMenuItem _line_up_renderable_data_cbmi; // _ print JCheckBoxMenuItem _graphics_export_visible_only_cbmi; JCheckBoxMenuItem _antialias_print_cbmi; @@ -222,6 +238,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { JCheckBoxMenuItem _search_case_senstive_cbmi; JCheckBoxMenuItem _search_whole_words_only_cbmi; JCheckBoxMenuItem _inverse_search_result_cbmi; + JCheckBoxMenuItem _search_with_regex_cbmi; // type menu: JMenu _type_menu; JCheckBoxMenuItem _rectangular_type_cbmi; @@ -244,12 +261,16 @@ public abstract class MainFrame extends JFrame implements ActionListener { JMenuItem _phyloxml_website_item; JMenuItem _phyloxml_ref_item; JMenuItem _aptx_ref_item; + // + JFileChooser _writetopdf_filechooser; + File _current_dir; + // process menu: JMenu _process_menu; // Handy pointers to child components: MainPanel _mainpanel; Container _contentpane; - final LinkedList _textframes = new LinkedList(); ; + final LinkedList _textframes = new LinkedList(); ; Configuration _configuration; Options _options; private Phylogeny _species_tree; @@ -259,6 +280,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { MainFrame() { _process_pool = ProcessPool.createInstance(); + _writetopdf_filechooser = new JFileChooser(); } /** @@ -344,7 +366,9 @@ public abstract class MainFrame extends JFrame implements ActionListener { switchColors(); } else if ( o == _display_basic_information_item ) { - displayBasicInformation( getCurrentTreePanel().getTreeFile() ); + if ( getCurrentTreePanel() != null ) { + displayBasicInformation( getCurrentTreePanel().getTreeFile() ); + } } else if ( o == _view_as_NH_item ) { viewAsNH(); @@ -398,10 +422,13 @@ public abstract class MainFrame extends JFrame implements ActionListener { MainFrame.cycleOverview( getOptions(), getCurrentTreePanel() ); } else if ( o == _cycle_node_fill_mi ) { - MainFrame.cycleNodeFill( getOptions(), getCurrentTreePanel() ); + MainFrame.cycleNodeFill( getOptions() ); } else if ( o == _cycle_node_shape_mi ) { - MainFrame.cycleNodeShape( getOptions(), getCurrentTreePanel() ); + MainFrame.cycleNodeShape( getOptions() ); + } + else if ( o == _cycle_data_return ) { + MainFrame.cycleNodeDataReturn( getOptions(), getConfiguration() ); } else if ( o == _screen_antialias_cbmi ) { updateOptions( getOptions() ); @@ -428,6 +455,9 @@ public abstract class MainFrame extends JFrame implements ActionListener { else if ( o == _show_default_node_shapes_external_cbmi ) { updateOptions( getOptions() ); } + else if ( o == _show_default_node_shapes_for_marked_cbmi ) { + updateOptions( getOptions() ); + } else if ( o == _non_lined_up_cladograms_rbmi ) { updateOptions( getOptions() ); showWhole(); @@ -446,6 +476,9 @@ public abstract class MainFrame extends JFrame implements ActionListener { getMainPanel().getControlPanel().search1(); } else if ( o == _search_whole_words_only_cbmi ) { + if ( ( _search_with_regex_cbmi != null ) && _search_whole_words_only_cbmi.isSelected() ) { + _search_with_regex_cbmi.setSelected( false ); + } updateOptions( getOptions() ); getMainPanel().getControlPanel().search0(); getMainPanel().getControlPanel().search1(); @@ -455,10 +488,18 @@ public abstract class MainFrame extends JFrame implements ActionListener { getMainPanel().getControlPanel().search0(); getMainPanel().getControlPanel().search1(); } - else if ( o == _show_scale_cbmi ) { + else if ( o == _search_with_regex_cbmi ) { + if ( ( _search_whole_words_only_cbmi != null ) && _search_with_regex_cbmi.isSelected() ) { + _search_whole_words_only_cbmi.setSelected( false ); + } + if ( ( _search_case_senstive_cbmi != null ) && _search_with_regex_cbmi.isSelected() ) { + _search_case_senstive_cbmi.setSelected( true ); + } updateOptions( getOptions() ); + getMainPanel().getControlPanel().search0(); + getMainPanel().getControlPanel().search1(); } - else if ( o == _show_branch_length_values_cbmi ) { + else if ( o == _show_scale_cbmi ) { updateOptions( getOptions() ); } else if ( o == _color_by_taxonomic_group_cbmi ) { @@ -488,17 +529,33 @@ public abstract class MainFrame extends JFrame implements ActionListener { getCurrentTreePanel().updateOvSizes(); } } + else if ( o == _line_up_renderable_data_cbmi ) { + if ( !_line_up_renderable_data_cbmi.isSelected() ) { + _right_line_up_domains_cbmi.setSelected( false ); + } + updateOptions( getOptions() ); + } + else if ( o == _right_line_up_domains_cbmi ) { + if ( _right_line_up_domains_cbmi.isSelected() ) { + _line_up_renderable_data_cbmi.setSelected( true ); + } + updateOptions( getOptions() ); + } else if ( ( o == _rectangular_type_cbmi ) || ( o == _triangular_type_cbmi ) || ( o == _curved_type_cbmi ) || ( o == _convex_type_cbmi ) || ( o == _euro_type_cbmi ) || ( o == _rounded_type_cbmi ) || ( o == _unrooted_type_cbmi ) || ( o == _circular_type_cbmi ) ) { typeChanged( o ); } - else if ( o == _about_item ) { about(); } else if ( o == _help_item ) { - help(); + try { + AptxUtil.openWebsite( Constants.APTX_DOC_SITE, is_applet, applet ); + } + catch ( final IOException e1 ) { + ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() ); + } } else if ( o == _website_item ) { try { @@ -532,6 +589,9 @@ public abstract class MainFrame extends JFrame implements ActionListener { ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() ); } } + else if ( o == _write_to_pdf_item ) { + writeToPdf( _mainpanel.getCurrentPhylogeny() ); + } else { if ( _load_phylogeny_from_webservice_menu_items != null ) { for( int i = 0; i < _load_phylogeny_from_webservice_menu_items.length; ++i ) { @@ -544,31 +604,146 @@ public abstract class MainFrame extends JFrame implements ActionListener { _contentpane.repaint(); } - private void deleteSelectedNodes( boolean delete ) { + + void setCurrentDir( final File current_dir ) { + _current_dir = current_dir; + } + + void writeToPdf( final Phylogeny t ) { + if ( ( t == null ) || t.isEmpty() ) { + return; + } + String initial_filename = ""; + if ( getMainPanel().getCurrentTreePanel().getTreeFile() != null ) { + initial_filename = getMainPanel().getCurrentTreePanel().getTreeFile().toString(); + } + if ( initial_filename.indexOf( '.' ) > 0 ) { + initial_filename = initial_filename.substring( 0, initial_filename.lastIndexOf( '.' ) ); + } + initial_filename = initial_filename + ".pdf"; + _writetopdf_filechooser.setSelectedFile( new File( initial_filename ) ); + final File my_dir = getCurrentDir(); + if ( my_dir != null ) { + _writetopdf_filechooser.setCurrentDirectory( my_dir ); + } + final int result = _writetopdf_filechooser.showSaveDialog( _contentpane ); + File file = _writetopdf_filechooser.getSelectedFile(); + setCurrentDir( _writetopdf_filechooser.getCurrentDirectory() ); + if ( ( file != null ) && ( result == JFileChooser.APPROVE_OPTION ) ) { + if ( !file.toString().toLowerCase().endsWith( ".pdf" ) ) { + file = new File( file.toString() + ".pdf" ); + } + if ( file.exists() ) { + final int i = JOptionPane.showConfirmDialog( this, + file + " already exists. Overwrite?", + "WARNING", + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE ); + if ( i != JOptionPane.OK_OPTION ) { + return; + } + } + printPhylogenyToPdf( file.toString() ); + } + } + + + void printPhylogenyToPdf( final String file_name ) { + if ( !getOptions().isPrintUsingActualSize() ) { + getCurrentTreePanel() + .calcParametersForPainting( getOptions().getPrintSizeX(), getOptions().getPrintSizeY() ); + getCurrentTreePanel().resetPreferredSize(); + getCurrentTreePanel().repaint(); + } + String pdf_written_to = ""; + boolean error = false; + try { + if ( getOptions().isPrintUsingActualSize() ) { + pdf_written_to = PdfExporter.writePhylogenyToPdf( file_name, + getCurrentTreePanel(), + getCurrentTreePanel().getWidth(), + getCurrentTreePanel().getHeight() ); + } + else { + pdf_written_to = PdfExporter.writePhylogenyToPdf( file_name, getCurrentTreePanel(), getOptions() + .getPrintSizeX(), getOptions().getPrintSizeY() ); + } + } + catch ( final IOException e ) { + error = true; + JOptionPane.showMessageDialog( this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE ); + } + if ( !error ) { + if ( !ForesterUtil.isEmpty( pdf_written_to ) ) { + JOptionPane.showMessageDialog( this, + "Wrote PDF to: " + pdf_written_to, + "Information", + JOptionPane.INFORMATION_MESSAGE ); + } + else { + JOptionPane.showMessageDialog( this, + "There was an unknown problem when attempting to write to PDF file: \"" + + file_name + "\"", + "Error", + JOptionPane.ERROR_MESSAGE ); + } + } + if ( !getOptions().isPrintUsingActualSize() ) { + getControlPanel().showWhole(); + } + } + + ControlPanel getControlPanel() { + return getMainPanel().getControlPanel(); + } + + + File getCurrentDir() { + if ( ( _current_dir == null ) || !_current_dir.canRead() ) { + if ( ForesterUtil.isWindows() ) { + try { + _current_dir = new File( WindowsUtils.getCurrentUserDesktopPath() ); + } + catch ( final Exception e ) { + _current_dir = null; + } + } + } + if ( ( _current_dir == null ) || !_current_dir.canRead() ) { + if ( System.getProperty( "user.home" ) != null ) { + _current_dir = new File( System.getProperty( "user.home" ) ); + } + else if ( System.getProperty( "user.dir" ) != null ) { + _current_dir = new File( System.getProperty( "user.dir" ) ); + } + } + return _current_dir; + } + + private void deleteSelectedNodes( final boolean delete ) { final Phylogeny phy = getMainPanel().getCurrentPhylogeny(); - if ( phy == null || phy.getNumberOfExternalNodes() < 2 ) { + if ( ( phy == null ) || ( phy.getNumberOfExternalNodes() < 2 ) ) { return; } - List nodes = new ArrayList(); + final List nodes = new ArrayList(); if ( ( getCurrentTreePanel().getFoundNodes0() != null ) || ( getCurrentTreePanel().getFoundNodes1() != null ) ) { - final List all_selected_nodes = getCurrentTreePanel().getFoundNodesAsListOfPhylogenyNodes(); + final List all_selected_nodes = getCurrentTreePanel().getFoundNodesAsListOfPhylogenyNodes(); for( final PhylogenyNode n : all_selected_nodes ) { if ( n.isExternal() ) { nodes.add( n ); } } } - String function = "Retain"; if ( delete ) { function = "Delete"; } if ( ( nodes == null ) || nodes.isEmpty() ) { JOptionPane - .showMessageDialog( this, - "Need to select external nodes, either via direct selection or via the \"Search\" function", - "No external nodes selected to " + function.toLowerCase(), - JOptionPane.ERROR_MESSAGE ); + .showMessageDialog( this, + "Need to select external nodes, either via direct selection or via the \"Search\" function", + "No external nodes selected to " + function.toLowerCase(), + JOptionPane.ERROR_MESSAGE ); return; } final int todo = nodes.size(); @@ -585,8 +760,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { return; } final int result = JOptionPane.showConfirmDialog( null, function + " " + todo - + " external node(s), from a total of " + ext + " external nodes," + "\nresulting in tree with " + res - + " nodes?", function + " external nodes", JOptionPane.OK_CANCEL_OPTION ); + + " external node(s), from a total of " + ext + " external nodes," + "\nresulting in tree with " + res + + " nodes?", function + " external nodes", JOptionPane.OK_CANCEL_OPTION ); if ( result == JOptionPane.OK_OPTION ) { if ( !delete ) { final List to_delete = new ArrayList(); @@ -640,7 +815,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { * has been selected by the user by clicking the "Return ..." * menu item. This method is expected to be called from Javascript or * something like it. - * + * * @return current external node data as String */ public String getCurrentExternalNodesDataBuffer() { @@ -701,9 +876,50 @@ public abstract class MainFrame extends JFrame implements ActionListener { } } +// void buildFileMenu() { +// _file_jmenu = createMenu( "File", getConfiguration() ); +// _file_jmenu.add( _exit_item = new JMenuItem( "Exit" ) ); +// customizeJMenuItem( _exit_item ); +// _jmenubar.add( _file_jmenu ); +// } + void buildFileMenu() { - _file_jmenu = createMenu( "File", getConfiguration() ); + _file_jmenu = MainFrame.createMenu( "File", getConfiguration() ); + + // _file_jmenu.add( _save_item = new JMenuItem( "Save Tree As..." ) ); + // _file_jmenu.add( _save_all_item = new JMenuItem( "Save All Trees As..." ) ); + // _save_all_item.setToolTipText( "Write all phylogenies to one file." ); + // _save_all_item.setEnabled( false ); + // _file_jmenu.addSeparator(); + _file_jmenu.add( _write_to_pdf_item = new JMenuItem( "Export to PDF file ..." ) ); +// if ( AptxUtil.canWriteFormat( "tif" ) || AptxUtil.canWriteFormat( "tiff" ) || AptxUtil.canWriteFormat( "TIF" ) ) { +// _file_jmenu.add( _write_to_tif_item = new JMenuItem( "Export to TIFF file..." ) ); +// } +// _file_jmenu.add( _write_to_png_item = new JMenuItem( "Export to PNG file..." ) ); +// _file_jmenu.add( _write_to_jpg_item = new JMenuItem( "Export to JPG file..." ) ); +// if ( AptxUtil.canWriteFormat( "gif" ) ) { +// _file_jmenu.add( _write_to_gif_item = new JMenuItem( "Export to GIF file..." ) ); +// } +// if ( AptxUtil.canWriteFormat( "bmp" ) ) { +// _file_jmenu.add( _write_to_bmp_item = new JMenuItem( "Export to BMP file..." ) ); +// } + // _file_jmenu.addSeparator(); + // _file_jmenu.add( _print_item = new JMenuItem( "Print..." ) ); + _file_jmenu.addSeparator(); + _file_jmenu.add( _exit_item = new JMenuItem( "Exit" ) ); + + customizeJMenuItem( _save_item ); + +// customizeJMenuItem( _close_item ); + //customizeJMenuItem( _save_all_item ); + customizeJMenuItem( _write_to_pdf_item ); +// customizeJMenuItem( _write_to_png_item ); +// customizeJMenuItem( _write_to_jpg_item ); +// customizeJMenuItem( _write_to_gif_item ); +// customizeJMenuItem( _write_to_tif_item ); +// customizeJMenuItem( _write_to_bmp_item ); +// customizeJMenuItem( _print_item ); customizeJMenuItem( _exit_item ); _jmenubar.add( _file_jmenu ); } @@ -725,9 +941,10 @@ public abstract class MainFrame extends JFrame implements ActionListener { void buildHelpMenu() { _help_jmenu = createMenu( "Help", getConfiguration() ); - _help_jmenu.add( _help_item = new JMenuItem( "Help" ) ); + _help_jmenu.add( _help_item = new JMenuItem( "Documentation" ) ); + _help_jmenu.addSeparator(); _help_jmenu.add( _website_item = new JMenuItem( "Archaeopteryx Home" ) ); - _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" ); + _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" ); //TODO need to add this... _help_jmenu.add( _phyloxml_website_item = new JMenuItem( "phyloXML Home" ) ); _help_jmenu.add( _phyloxml_ref_item = new JMenuItem( "phyloXML Reference" ) ); _help_jmenu.addSeparator(); @@ -954,8 +1171,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { + gsdi.getStrippedExternalGeneTreeNodes().size() + "\n" + "Taxonomy linkage based on: " + gsdi.getTaxCompBase() + "\n" + "Number of polytomies in species tree used: " + poly + "\n", - "GSDI successfully completed", - JOptionPane.WARNING_MESSAGE ); + "GSDI successfully completed", + JOptionPane.WARNING_MESSAGE ); } else { JOptionPane.showMessageDialog( this, @@ -967,8 +1184,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { + gsdi.getStrippedExternalGeneTreeNodes().size() + "\n" + "Taxonomy linkage based on: " + gsdi.getTaxCompBase() + "\n" + "Number of polytomies in species tree used: " + poly + "\n", - "GSDI successfully completed", - JOptionPane.INFORMATION_MESSAGE ); + "GSDI successfully completed", + JOptionPane.INFORMATION_MESSAGE ); } } @@ -1027,8 +1244,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { + gsdir.getStrippedExternalGeneTreeNodes().size() + "\n" + "Taxonomy linkage based on: " + gsdir.getTaxCompBase() + "\n" + "Number of polytomies in species tree used: " + poly + "\n", - "GSDIR successfully completed", - JOptionPane.WARNING_MESSAGE ); + "GSDIR successfully completed", + JOptionPane.WARNING_MESSAGE ); } else { JOptionPane.showMessageDialog( this, @@ -1038,8 +1255,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { + gsdir.getStrippedExternalGeneTreeNodes().size() + "\n" + "Taxonomy linkage based on: " + gsdir.getTaxCompBase() + "\n" + "Number of polytomies in species tree used: " + poly + "\n", - "GSDIR successfully completed", - JOptionPane.INFORMATION_MESSAGE ); + "GSDIR successfully completed", + JOptionPane.INFORMATION_MESSAGE ); } } @@ -1083,96 +1300,6 @@ public abstract class MainFrame extends JFrame implements ActionListener { return _species_tree; } - void help() { - final StringBuilder sb = new StringBuilder(); - sb.append( "Display options\n" ); - sb.append( "-------------------\n" ); - sb.append( "Use the checkboxes to select types of information to display on the tree.\n\n" ); - sb.append( "Clickable tree nodes\n" ); - sb.append( "--------------------\n" ); - sb.append( "Tree nodes can be clicked, the action is determined by the 'click on node to' menu\n" ); - sb.append( "or by right clicking:\n" ); - sb.append( "o Display Node Data -- display information for a node\n" ); - sb.append( "o Collapse/Uncollapse -- collapse and uncollapse subtree from clicked node\n" ); - sb.append( "o Root/Reroot -- change tree root to clicked node\n" ); - sb.append( "o Sub/Super Tree -- toggle between subtree from clicked node and whole tree\n" ); - sb.append( "o Swap Descendants -- switch descendant on either side of clicked node\n" ); - sb.append( "o Colorize Subtree -- color a subtree\n" ); - sb.append( "o Open Sequence Web -- launch a web browser to display sequence information\n" ); - sb.append( "o Open Taxonomy Web -- launch a web browser to display taxonomy information\n" ); - sb.append( "- there may be additional choices depending on this particular setup\n\n" ); - sb.append( "Right clicking on a node always displays the information of a node.\n\n" ); - sb.append( "Zooming\n" ); - sb.append( "---------\n" ); - sb.append( "The mouse wheel and the plus and minus keys control zooming.\n" ); - sb.append( "Mouse wheel+Ctrl changes the text size.\n" ); - sb.append( "Mouse wheel+Shift controls zooming in vertical direction only.\n" ); - sb.append( "Use the buttons on the control panel to zoom the tree in and out, horizontally or vertically.\n" ); - sb.append( "The entire tree can be fitted into the window by clicking the \"F\" button, or by pressing F, Delete, or Home.\n" ); - sb.append( "The up, down, left, and right keys can be used to move the visible part (if zoomed in).\n" ); - sb.append( "Up, down, left, and right+Shift can be used to control zooming horizontally and vertically.\n" ); - sb.append( "Plus and minus keys+Ctrl change the text size; F+Ctrl, Delete+Ctrl, or Home+Ctrl resets it.\n\n" ); - sb.append( "Quick tree manipulation:\n" ); - sb.append( "------------------------\n" ); - sb.append( "Order Subtrees -- order the tree by branch length\n" ); - sb.append( "Uncollapse All -- uncollapse any and all collapsed branches\n\n" ); - sb.append( "Memory problems (Java heap space error)\n" ); - sb.append( "---------------------------------------\n" ); - sb.append( "Since the Java default memory allocation is quite small, it might by necessary (for trees\n" ); - sb.append( "with more than approximately 5000 external nodes) to increase the memory which Java can use, with\n" ); - sb.append( "the '-Xmx' Java command line option. For example:\n" ); - sb.append( "java -Xmx1024m -cp path\\to\\forester.jar org.forester.archaeopteryx.Archaeopteryx\n\n" ); - // + "General remarks\n" - // + "---------------\n" - // + - // "o The application version permits copying to the clipboard \n" - // + - // " in the \"View\"|\"View as ...\" frame (either by control-c or button press).\n" - // + - // "o Changes made to a subtree affect this subtree and its subtrees,\n" - // + " but not any of its parent tree(s).\n" - // + - // "o Archaeopteryx tries to detect whether the numerical values in a NH tree\n" - // + - // " are likely to be bootstrap values instead of branch length values.\n\n" - // + - // " Remarks regarding SDI (Speciation Duplication Inference):\n" - // + - // "o Each external node of the gene tree (in display) needs to be associated with\n" - // + - // " a species: either directly through the \"Species\" field, or the species\n" - // + - // " is part of the sequence name in the form \"XXXX_SPECIES\"\n" - // + - // " (e.g. \"ACON_DROME\" or \"ACON_DROME/123-4489\" which is also acceptable).\n" - // + - // "o A species tree for each species of the gene tree needs to be loaded with\n" - // + - // " \"SDI\"|\"Load species tree\" prior the SDI execution.\n" - // + - // "o !External nodes of the gene tree associated with species not present in\n" - // + - // " the species tree are REMOVED prior to SDI execution!\n" - // + - // "o Both the gene tree and the species tree must be completely binary.\n" - // + - // "o Duplications and speciations are a function of the position of the root.\n" - // + - // " Hence, after each manual \"Root/Reroot\"ing some duplications will be\n" - // + " incorrect and need to be inferred again\n" - // + - // " with: \"SDI\"|\"SDI (Speciation Duplication Inference)\n\n" - sb.append( "phyloXML\n" ); - sb.append( "-------------------\n" ); - sb.append( "Reference: " + Constants.PHYLOXML_REFERENCE + "\n" ); - sb.append( "Website: " + Constants.PHYLOXML_WEB_SITE + "\n" ); - sb.append( "Version: " + ForesterConstants.PHYLO_XML_VERSION + "\n" ); - sb.append( "\n" ); - sb.append( "For more information: https://sites.google.com/site/cmzmasek/home/software/archaeopteryx\n" ); - sb.append( "Email: " + Constants.AUTHOR_EMAIL + "\n\n" ); - TextFrame.instantiate( sb.toString(), "Help", _textframes ); - } - void initializeTypeMenu( final Options options ) { setTypeMenuToAllUnselected(); switch ( options.getPhylogenyGraphicsType() ) { @@ -1237,10 +1364,10 @@ public abstract class MainFrame extends JFrame implements ActionListener { if ( getCurrentTreePanel() != null ) { if ( getCurrentTreePanel().isCurrentTreeIsSubtree() ) { JOptionPane - .showMessageDialog( this, - "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.", - "Operation can not be exectuted on a sub-tree", - JOptionPane.WARNING_MESSAGE ); + .showMessageDialog( this, + "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.", + "Operation can not be exectuted on a sub-tree", + JOptionPane.WARNING_MESSAGE ); return true; } } @@ -1372,18 +1499,20 @@ public abstract class MainFrame extends JFrame implements ActionListener { void updateOptions( final Options options ) { options.setAntialiasScreen( ( _screen_antialias_cbmi != null ) && _screen_antialias_cbmi.isSelected() ); options.setBackgroundColorGradient( ( _background_gradient_cbmi != null ) - && _background_gradient_cbmi.isSelected() ); + && _background_gradient_cbmi.isSelected() ); options.setShowDomainLabels( ( _show_domain_labels != null ) && _show_domain_labels.isSelected() ); options.setShowAnnotationRefSource( ( _show_annotation_ref_source != null ) - && _show_annotation_ref_source.isSelected() ); + && _show_annotation_ref_source.isSelected() ); options.setAbbreviateScientificTaxonNames( ( _abbreviate_scientific_names != null ) - && _abbreviate_scientific_names.isSelected() ); + && _abbreviate_scientific_names.isSelected() ); options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null ) - && _color_labels_same_as_parent_branch.isSelected() ); + && _color_labels_same_as_parent_branch.isSelected() ); options.setShowDefaultNodeShapesInternal( ( _show_default_node_shapes_internal_cbmi != null ) - && _show_default_node_shapes_internal_cbmi.isSelected() ); + && _show_default_node_shapes_internal_cbmi.isSelected() ); options.setShowDefaultNodeShapesExternal( ( _show_default_node_shapes_external_cbmi != null ) - && _show_default_node_shapes_external_cbmi.isSelected() ); + && _show_default_node_shapes_external_cbmi.isSelected() ); + options.setShowDefaultNodeShapesForMarkedNodes( ( _show_default_node_shapes_for_marked_cbmi != null ) + && _show_default_node_shapes_for_marked_cbmi.isSelected() ); if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) { options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP ); } @@ -1394,7 +1523,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { options.setCladogramType( CLADOGRAM_TYPE.EXT_NODE_SUM_DEP ); } options.setSearchCaseSensitive( ( _search_case_senstive_cbmi != null ) - && _search_case_senstive_cbmi.isSelected() ); + && _search_case_senstive_cbmi.isSelected() ); if ( ( _show_scale_cbmi != null ) && _show_scale_cbmi.isEnabled() ) { options.setShowScale( _show_scale_cbmi.isSelected() ); } @@ -1408,17 +1537,14 @@ public abstract class MainFrame extends JFrame implements ActionListener { } options.setShowOverview( ( _show_overview_cbmi != null ) && _show_overview_cbmi.isSelected() ); options.setShowConfidenceStddev( ( _show_confidence_stddev_cbmi != null ) - && _show_confidence_stddev_cbmi.isSelected() ); - if ( ( _show_branch_length_values_cbmi != null ) && _show_branch_length_values_cbmi.isEnabled() ) { - options.setShowBranchLengthValues( _show_branch_length_values_cbmi.isSelected() ); - } + && _show_confidence_stddev_cbmi.isSelected() ); if ( ( _color_by_taxonomic_group_cbmi != null ) && _color_by_taxonomic_group_cbmi.isEnabled() ) { options.setColorByTaxonomicGroup( _color_by_taxonomic_group_cbmi.isSelected() ); } options.setPrintUsingActualSize( ( _print_using_actual_size_cbmi != null ) - && ( _print_using_actual_size_cbmi.isSelected() ) ); + && ( _print_using_actual_size_cbmi.isSelected() ) ); options.setGraphicsExportUsingActualSize( ( _graphics_export_using_actual_size_cbmi != null ) - && ( _graphics_export_using_actual_size_cbmi.isSelected() ) ); + && ( _graphics_export_using_actual_size_cbmi.isSelected() ) ); options.setAntialiasPrint( ( _antialias_print_cbmi != null ) && _antialias_print_cbmi.isSelected() ); if ( ( _use_brackets_for_conf_in_nh_export_cbmi != null ) && _use_brackets_for_conf_in_nh_export_cbmi.isSelected() ) { @@ -1432,9 +1558,9 @@ public abstract class MainFrame extends JFrame implements ActionListener { options.setNhConversionSupportValueStyle( NH_CONVERSION_SUPPORT_VALUE_STYLE.NONE ); } options.setPrintBlackAndWhite( ( _print_black_and_white_cbmi != null ) - && _print_black_and_white_cbmi.isSelected() ); + && _print_black_and_white_cbmi.isSelected() ); options.setInternalNumberAreConfidenceForNhParsing( ( _internal_number_are_confidence_for_nh_parsing_cbmi != null ) - && _internal_number_are_confidence_for_nh_parsing_cbmi.isSelected() ); + && _internal_number_are_confidence_for_nh_parsing_cbmi.isSelected() ); if ( ( _extract_taxonomy_pfam_strict_rbmi != null ) && _extract_taxonomy_pfam_strict_rbmi.isSelected() ) { options.setTaxonomyExtraction( TAXONOMY_EXTRACTION.PFAM_STYLE_STRICT ); } @@ -1448,13 +1574,14 @@ public abstract class MainFrame extends JFrame implements ActionListener { options.setTaxonomyExtraction( TAXONOMY_EXTRACTION.NO ); } options.setReplaceUnderscoresInNhParsing( ( _replace_underscores_cbmi != null ) - && _replace_underscores_cbmi.isSelected() ); + && _replace_underscores_cbmi.isSelected() ); options.setAllowErrorsInDistanceToParent( ( _allow_errors_in_distance_to_parent_cbmi != null ) - && _allow_errors_in_distance_to_parent_cbmi.isSelected() ); + && _allow_errors_in_distance_to_parent_cbmi.isSelected() ); options.setMatchWholeTermsOnly( ( _search_whole_words_only_cbmi != null ) - && _search_whole_words_only_cbmi.isSelected() ); + && _search_whole_words_only_cbmi.isSelected() ); + options.setSearchWithRegex( ( _search_with_regex_cbmi != null ) && _search_with_regex_cbmi.isSelected() ); options.setInverseSearchResult( ( _inverse_search_result_cbmi != null ) - && _inverse_search_result_cbmi.isSelected() ); + && _inverse_search_result_cbmi.isSelected() ); if ( _graphics_export_visible_only_cbmi != null ) { options.setGraphicsExportVisibleOnly( _graphics_export_visible_only_cbmi.isSelected() ); if ( _graphics_export_visible_only_cbmi.isSelected() && ( _graphics_export_using_actual_size_cbmi != null ) ) { @@ -1489,6 +1616,12 @@ public abstract class MainFrame extends JFrame implements ActionListener { else if ( ( _circular_type_cbmi != null ) && _circular_type_cbmi.isSelected() ) { options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ); } + if ( ( _right_line_up_domains_cbmi != null ) && _right_line_up_domains_cbmi.isEnabled() ) { + options.setRightLineUpDomains( _right_line_up_domains_cbmi.isSelected() ); + } + if ( ( _line_up_renderable_data_cbmi != null ) && _line_up_renderable_data_cbmi.isEnabled() ) { + options.setLineUpRendarableNodeData( _line_up_renderable_data_cbmi.isSelected() ); + } } void updateTypeCheckboxes( final Options options, final Object o ) { @@ -1514,8 +1647,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { title = "\"" + getMainPanel().getCurrentPhylogeny().getName() + "\" in " + title; } showTextFrame( _mainpanel.getCurrentPhylogeny().toNewHampshire( getOptions() - .getNhConversionSupportValueStyle() ), - title ); + .getNhConversionSupportValueStyle() ), + title ); } } @@ -1538,10 +1671,10 @@ public abstract class MainFrame extends JFrame implements ActionListener { } if ( ( nodes == null ) || nodes.isEmpty() ) { JOptionPane - .showMessageDialog( this, - "Need to select nodes, either via direct selection or via the \"Search\" function", - "No nodes selected for annotation", - JOptionPane.ERROR_MESSAGE ); + .showMessageDialog( this, + "Need to select nodes, either via direct selection or via the \"Search\" function", + "No nodes selected for annotation", + JOptionPane.ERROR_MESSAGE ); return; } final Phylogeny phy = getMainPanel().getCurrentPhylogeny(); @@ -1560,7 +1693,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { my_panel, "Enter the sequence annotation(s) for the " + nodes.size() + " selected nodes", - JOptionPane.OK_CANCEL_OPTION ); + JOptionPane.OK_CANCEL_OPTION ); if ( result == JOptionPane.OK_OPTION ) { String ref = ref_field.getText(); String desc = desc_filed.getText(); @@ -1587,7 +1720,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { for( final PhylogenyNode n : nodes ) { ForesterUtil.ensurePresenceOfSequence( n ); final Annotation ann = ForesterUtil.isEmpty( ref ) ? new Annotation() - : new Annotation( ref ); + : new Annotation( ref ); if ( !ForesterUtil.isEmpty( desc ) ) { ann.setDesc( desc ); } @@ -1612,11 +1745,11 @@ public abstract class MainFrame extends JFrame implements ActionListener { .showInputDialog( this, "Please enter the minimum for confidence values to be displayed.\n" + "[current value: " + getOptions().getMinConfidenceValue() + "]\n", - "Minimal Confidence Value", - JOptionPane.QUESTION_MESSAGE, - null, - null, - getOptions().getMinConfidenceValue() ); + "Minimal Confidence Value", + JOptionPane.QUESTION_MESSAGE, + null, + null, + getOptions().getMinConfidenceValue() ); if ( !ForesterUtil.isEmpty( s ) ) { boolean success = true; double m = 0.0; @@ -1689,7 +1822,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { */ static void about() { final StringBuffer about = new StringBuffer( "Archaeopteryx\nVersion " + Constants.VERSION + "\n" ); - about.append( "Copyright (C) 2013 Christian M. Zmasek\n" ); + about.append( "Copyright (C) 2014 Christian M Zmasek\n" ); about.append( "All Rights Reserved\n" ); about.append( "License: GNU Lesser General Public License (LGPL)\n" ); about.append( "Last modified: " + Constants.PRG_DATE + "\n" ); @@ -1713,6 +1846,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { about.append( Constants.PHYLOXML_REFERENCE_SHORT + "\n" ); about.append( "For more information & download:\n" ); about.append( Constants.APTX_WEB_SITE + "\n" ); + about.append( "Documentation:\n" ); + about.append( Constants.APTX_DOC_SITE + "\n" ); about.append( "Comments: " + Constants.AUTHOR_EMAIL ); JOptionPane.showMessageDialog( null, about, Constants.PRG_NAME, JOptionPane.PLAIN_MESSAGE ); } @@ -1722,11 +1857,11 @@ public abstract class MainFrame extends JFrame implements ActionListener { "Please enter the default size for node shapes.\n" + "[current value: " + options.getDefaultNodeShapeSize() + "]\n", - "Node Shape Size", - JOptionPane.QUESTION_MESSAGE, - null, - null, - options.getDefaultNodeShapeSize() ); + "Node Shape Size", + JOptionPane.QUESTION_MESSAGE, + null, + null, + options.getDefaultNodeShapeSize() ); if ( !ForesterUtil.isEmpty( s ) ) { boolean success = true; double m = 0.0; @@ -1777,7 +1912,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { return label; } - static void cycleNodeFill( final Options op, final TreePanel tree_panel ) { + static void cycleNodeFill( final Options op ) { switch ( op.getDefaultNodeFill() ) { case GRADIENT: op.setDefaultNodeFill( NodeFill.SOLID ); @@ -1793,7 +1928,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { } } - static void cycleNodeShape( final Options op, final TreePanel tree_panel ) { + static void cycleNodeShape( final Options op ) { switch ( op.getDefaultNodeShape() ) { case CIRCLE: op.setDefaultNodeShape( NodeShape.RECTANGLE ); @@ -1806,6 +1941,42 @@ public abstract class MainFrame extends JFrame implements ActionListener { } } + private static void cycleNodeDataReturn( final Options op, Configuration conf ) { + switch ( op.getExtDescNodeDataToReturn() ) { + case UNKNOWN: + op.setExtDescNodeDataToReturn( NodeDataField.DOMAINS_ALL ); + break; + case DOMAINS_ALL: + op.setExtDescNodeDataToReturn( NodeDataField.DOMAINS_COLLAPSED_PER_PROTEIN ); + break; + case DOMAINS_COLLAPSED_PER_PROTEIN: + op.setExtDescNodeDataToReturn( NodeDataField.SEQ_ANNOTATIONS ); + break; + case SEQ_ANNOTATIONS: + op.setExtDescNodeDataToReturn( NodeDataField.GO_TERM_IDS ); + break; + case GO_TERM_IDS: + op.setExtDescNodeDataToReturn( NodeDataField.SEQUENCE_MOL_SEQ_FASTA ); + break; + case SEQUENCE_MOL_SEQ_FASTA: + if ( conf != null && conf.getExtDescNodeDataToReturn() != null + && conf.getExtDescNodeDataToReturn() != NodeDataField.DOMAINS_ALL + && conf.getExtDescNodeDataToReturn() != NodeDataField.DOMAINS_COLLAPSED_PER_PROTEIN + && conf.getExtDescNodeDataToReturn() != NodeDataField.SEQ_ANNOTATIONS + && conf.getExtDescNodeDataToReturn() != NodeDataField.GO_TERM_IDS + && conf.getExtDescNodeDataToReturn() != NodeDataField.SEQUENCE_MOL_SEQ_FASTA + ) { + op.setExtDescNodeDataToReturn( conf.getExtDescNodeDataToReturn() ); + } + else { + op.setExtDescNodeDataToReturn( NodeDataField.UNKNOWN ); + } + break; + default: + op.setExtDescNodeDataToReturn( NodeDataField.UNKNOWN ); + } + } + static void cycleOverview( final Options op, final TreePanel tree_panel ) { switch ( op.getOvPlacement() ) { case LOWER_LEFT: @@ -1848,6 +2019,16 @@ public abstract class MainFrame extends JFrame implements ActionListener { } } + static void setCycleDataReturnMenuItem( final JMenuItem mi, final Options options ) { + if ( ( options != null ) && ( options.getExtDescNodeDataToReturn() != null ) ) { + mi.setText( "Cycle Node Return Data... (current: " + + options.getExtDescNodeDataToReturn().toString() + ")" ); + } + else { + mi.setText( "Cycle Node Return Data..." ); + } + } + static void setOvPlacementColorChooseMenuItem( final JMenuItem mi, final Options options ) { if ( ( options != null ) && ( options.getOvPlacement() != null ) ) { mi.setText( "Cycle Overview Placement... (current: " + options.getOvPlacement() + ")" ); @@ -1860,7 +2041,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { static void setTextColorChooseMenuItem( final JMenuItem mi, final TreePanel tree_panel ) { if ( ( tree_panel != null ) && ( tree_panel.getTreeColorSet() != null ) ) { mi.setText( "Select Color Scheme... (current: " + tree_panel.getTreeColorSet().getCurrentColorSchemeName() - + ")" ); + + ")" ); } else { mi.setText( "Select Color Scheme..." ); @@ -1888,84 +2069,6 @@ public abstract class MainFrame extends JFrame implements ActionListener { mi.setText( "Enter Default Node Shape Size... (current: " + options.getDefaultNodeShapeSize() + ")" ); } - static void updateOptionsMenuDependingOnPhylogenyType( final MainPanel main_panel, - final JCheckBoxMenuItem scale, - final JCheckBoxMenuItem branch_lengths, - final JRadioButtonMenuItem non_lined_up, - final JRadioButtonMenuItem uniform_clado, - final JRadioButtonMenuItem nonuniform_clado, - final JCheckBoxMenuItem label_direction_cbmi ) { - final TreePanel tree_panel = main_panel.getCurrentTreePanel(); - final ControlPanel control = main_panel.getControlPanel(); - final Options options = main_panel.getOptions(); - scale.setSelected( options.isShowScale() ); - branch_lengths.setSelected( options.isShowBranchLengthValues() ); - // non_lined_up.setSelected( options.isNonLinedUpCladogram() ); - if ( ( tree_panel != null ) && ( !tree_panel.isPhyHasBranchLengths() ) ) { - scale.setSelected( false ); - scale.setEnabled( false ); - branch_lengths.setSelected( false ); - branch_lengths.setEnabled( false ); - } - else if ( ( tree_panel != null ) && !control.isDrawPhylogram() ) { - scale.setSelected( false ); - scale.setEnabled( false ); - branch_lengths.setEnabled( true ); - } - else { - scale.setEnabled( true ); - branch_lengths.setEnabled( true ); - } - if ( ( tree_panel != null ) - && ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.ROUNDED ) - && ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE ) && ( tree_panel - .getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR ) ) ) { - branch_lengths.setSelected( false ); - branch_lengths.setEnabled( false ); - } - if ( tree_panel != null ) { - if ( ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) - || ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) { - non_lined_up.setEnabled( false ); - uniform_clado.setEnabled( false ); - nonuniform_clado.setEnabled( false ); - } - else { - non_lined_up.setEnabled( true ); - uniform_clado.setEnabled( true ); - nonuniform_clado.setEnabled( true ); - } - } - else { - if ( ( tree_panel != null ) - && ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.EURO_STYLE ) && ( tree_panel - .getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR ) ) ) { - branch_lengths.setSelected( false ); - branch_lengths.setEnabled( false ); - } - if ( ( tree_panel != null ) - && ( ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( tree_panel - .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) { - non_lined_up.setEnabled( false ); - } - else { - // non_lined_up.setSelected( options.isNonLinedUpCladogram() ); - non_lined_up.setEnabled( true ); - } - } - label_direction_cbmi.setEnabled( true ); - if ( tree_panel != null ) { - if ( ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) - && ( tree_panel.getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) { - label_direction_cbmi.setEnabled( false ); - } - if ( tree_panel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) { - scale.setSelected( false ); - scale.setEnabled( false ); - } - } - } - static void updateScreenTextAntialias( final List treepanels ) { for( final TreePanel tree_panel : treepanels ) { tree_panel.setTextAntialias();