X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FMainFrame.java;h=505918e7e984a5cd15d14464cf26f48a17cc771c;hb=4d33637f6bc5a76ca65dea7e21c9e2f7267ab2a3;hp=2a5029674ccd583251df0122763c09c87f4a6ec6;hpb=bf4f34e0511813622f68e54ffb783e4e6d92bfa4;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrame.java b/forester/java/src/org/forester/archaeopteryx/MainFrame.java index 2a50296..505918e 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrame.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrame.java @@ -65,6 +65,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; @@ -77,7 +78,7 @@ import org.forester.util.ForesterUtil; 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(), @@ -90,26 +91,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"; @@ -125,8 +128,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 Node Diagrams"; + 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; @@ -155,7 +158,6 @@ public abstract class MainFrame extends JFrame implements ActionListener { 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 +186,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,12 +197,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; + JCheckBoxMenuItem _right_line_up_domains_cbmi; + JCheckBoxMenuItem _line_up_renderable_data_cbmi; // _ print JCheckBoxMenuItem _graphics_export_visible_only_cbmi; JCheckBoxMenuItem _antialias_print_cbmi; @@ -224,6 +227,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; @@ -251,7 +255,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { // 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; @@ -346,7 +350,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(); @@ -400,10 +406,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() ); @@ -430,6 +439,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(); @@ -448,6 +460,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(); @@ -457,10 +472,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 ) { @@ -502,14 +525,11 @@ public abstract class MainFrame extends JFrame implements ActionListener { } 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(); } @@ -553,7 +573,6 @@ public abstract class MainFrame extends JFrame implements ActionListener { ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() ); } } - else { if ( _load_phylogeny_from_webservice_menu_items != null ) { for( int i = 0; i < _load_phylogeny_from_webservice_menu_items.length; ++i ) { @@ -566,31 +585,30 @@ public abstract class MainFrame extends JFrame implements ActionListener { _contentpane.repaint(); } - private void deleteSelectedNodes( boolean delete ) { + 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(); @@ -607,8 +625,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(); @@ -662,7 +680,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() { @@ -977,8 +995,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, @@ -990,8 +1008,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 ); } } @@ -1050,8 +1068,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, @@ -1061,8 +1079,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 ); } } @@ -1106,8 +1124,6 @@ public abstract class MainFrame extends JFrame implements ActionListener { return _species_tree; } - - void initializeTypeMenu( final Options options ) { setTypeMenuToAllUnselected(); switch ( options.getPhylogenyGraphicsType() ) { @@ -1172,10 +1188,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; } } @@ -1307,18 +1323,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 ); } @@ -1329,7 +1347,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() ); } @@ -1343,17 +1361,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() ) { @@ -1367,9 +1382,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 ); } @@ -1383,13 +1398,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 ) ) { @@ -1426,7 +1442,6 @@ public abstract class MainFrame extends JFrame implements ActionListener { } 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() ); @@ -1456,8 +1471,8 @@ public abstract class MainFrame extends JFrame implements ActionListener { title = "\"" + getMainPanel().getCurrentPhylogeny().getName() + "\" in " + title; } showTextFrame( _mainpanel.getCurrentPhylogeny().toNewHampshire( getOptions() - .getNhConversionSupportValueStyle() ), - title ); + .getNhConversionSupportValueStyle() ), + title ); } } @@ -1480,10 +1495,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(); @@ -1502,7 +1517,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(); @@ -1529,7 +1544,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 ); } @@ -1554,11 +1569,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; @@ -1666,11 +1681,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; @@ -1721,7 +1736,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 ); @@ -1737,7 +1752,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 ); @@ -1750,6 +1765,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: @@ -1792,6 +1843,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() + ")" ); @@ -1804,7 +1865,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..." ); @@ -1832,84 +1893,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();