From 5c4dc1fb4a38c45f03ef67541592bac5113a2a6f Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Wed, 15 Oct 2014 00:06:59 +0000 Subject: [PATCH] regex search --- .../org/forester/archaeopteryx/ArchaeopteryxE.java | 1 + .../src/org/forester/archaeopteryx/Constants.java | 4 ++-- .../src/org/forester/archaeopteryx/ControlPanel.java | 17 ++++++++--------- .../src/org/forester/archaeopteryx/MainFrame.java | 11 ++++++----- .../org/forester/archaeopteryx/MainFrameApplet.java | 1 + .../forester/archaeopteryx/MainFrameApplication.java | 1 + .../java/src/org/forester/util/ForesterConstants.java | 4 ++-- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java b/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java index 36afa08..d89bccc 100644 --- a/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java +++ b/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java @@ -806,6 +806,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener { .add( _search_case_senstive_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_CASE_SENSITIVE_LABEL ) ); _options_jmenu.add( _search_whole_words_only_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_TERMS_ONLY_LABEL ) ); _options_jmenu.add( _search_with_regex_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_REGEX_LABEL ) ); + _search_with_regex_cbmi.setToolTipText( MainFrame.SEARCH_WITH_REGEX_TIP ); _options_jmenu .add( _inverse_search_result_cbmi = new JCheckBoxMenuItem( MainFrame.INVERSE_SEARCH_RESULT_LABEL ) ); customizeJMenuItem( _choose_font_mi ); diff --git a/forester/java/src/org/forester/archaeopteryx/Constants.java b/forester/java/src/org/forester/archaeopteryx/Constants.java index 43e576a..1a63bcf 100644 --- a/forester/java/src/org/forester/archaeopteryx/Constants.java +++ b/forester/java/src/org/forester/archaeopteryx/Constants.java @@ -42,8 +42,8 @@ public final class Constants { public final static boolean __SYNTH_LF = false; // TODO remove me public final static boolean ALLOW_DDBJ_BLAST = false; public final static String PRG_NAME = "Archaeopteryx"; - final static String VERSION = "0.9900 beta"; - final static String PRG_DATE = "141013"; + final static String VERSION = "0.9901 beta"; + final static String PRG_DATE = "141014"; final static String DEFAULT_CONFIGURATION_FILE_NAME = "_aptx_configuration_file"; final static String[] DEFAULT_FONT_CHOICES = { "Arial", "Helvetica", "Verdana", "Tahoma", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans" }; diff --git a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java index cffdfea..29e4578 100644 --- a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java +++ b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java @@ -81,6 +81,7 @@ final class ControlPanel extends JPanel implements ActionListener { Font.PLAIN, 9 ); private static final String RETURN_TO_SUPER_TREE_TEXT = "Back to Super Tree"; + private static final String SEARCH_TIP_TEXT = "Enter text to search for. Use ',' for logical OR and '+' for logical AND (not used in this manner for regular expression searches)."; private static final long serialVersionUID = -8463483932821545633L; private NodeClickAction _action_when_node_clicked; private int _add_new_node_item; @@ -1361,14 +1362,13 @@ final class ControlPanel extends JPanel implements ActionListener { } void setupSearchTools0() { - final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND."; final JLabel search_label = new JLabel( "Search (A):" ); search_label.setFont( ControlPanel.jcb_bold_font ); if ( !getConfiguration().isUseNativeUI() ) { search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() ); } add( search_label ); - search_label.setToolTipText( tip ); + search_label.setToolTipText( SEARCH_TIP_TEXT ); _search_found_label_0 = new JLabel(); getSearchFoundCountsLabel0().setVisible( false ); _search_found_label_0.setFont( ControlPanel.jcb_bold_font ); @@ -1376,7 +1376,7 @@ final class ControlPanel extends JPanel implements ActionListener { _search_found_label_0.setForeground( getConfiguration().getGuiCheckboxTextColor() ); } _search_tf_0 = new JTextField( 3 ); - _search_tf_0.setToolTipText( tip ); + _search_tf_0.setToolTipText( SEARCH_TIP_TEXT ); _search_tf_0.setEditable( true ); if ( !getConfiguration().isUseNativeUI() ) { _search_tf_0.setForeground( getConfiguration().getGuiMenuBackgroundColor() ); @@ -1422,14 +1422,13 @@ final class ControlPanel extends JPanel implements ActionListener { } void setupSearchTools1() { - final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND."; final JLabel search_label = new JLabel( "Search (B):" ); search_label.setFont( ControlPanel.jcb_bold_font ); if ( !getConfiguration().isUseNativeUI() ) { search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() ); } add( search_label ); - search_label.setToolTipText( tip ); + search_label.setToolTipText( SEARCH_TIP_TEXT ); _search_found_label_1 = new JLabel(); getSearchFoundCountsLabel1().setVisible( false ); _search_found_label_1.setFont( ControlPanel.jcb_bold_font ); @@ -1437,7 +1436,7 @@ final class ControlPanel extends JPanel implements ActionListener { _search_found_label_1.setForeground( getConfiguration().getGuiCheckboxTextColor() ); } _search_tf_1 = new JTextField( 3 ); - _search_tf_1.setToolTipText( tip ); + _search_tf_1.setToolTipText( SEARCH_TIP_TEXT ); _search_tf_1.setEditable( true ); if ( !getConfiguration().isUseNativeUI() ) { _search_tf_1.setForeground( getConfiguration().getGuiMenuBackgroundColor() ); @@ -1808,7 +1807,7 @@ final class ControlPanel extends JPanel implements ActionListener { getSearchResetButton0().setVisible( true ); String[] queries = null; List nodes = null; - if ( query_str.indexOf( ',' ) >= 0 ) { + if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) { queries = query_str.split( ",+" ); } else { @@ -1863,7 +1862,7 @@ final class ControlPanel extends JPanel implements ActionListener { getSearchResetButton1().setVisible( true ); String[] queries = null; List nodes = null; - if ( query_str.indexOf( ',' ) >= 0 ) { + if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) { queries = query_str.split( ",+" ); } else { @@ -1877,7 +1876,7 @@ final class ControlPanel extends JPanel implements ActionListener { continue; } query = query.trim(); - if ( query.indexOf( '+' ) >= 0 ) { + if ( ( query.indexOf( '+' ) >= 0 ) && !getOptions().isSearchWithRegex() ) { nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ), tree, getOptions().isSearchCaseSensitive(), diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrame.java b/forester/java/src/org/forester/archaeopteryx/MainFrame.java index 84d6185..aa4b40e 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrame.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrame.java @@ -77,7 +77,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,8 +90,8 @@ 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:"; @@ -105,6 +105,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { 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 style). 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"; @@ -185,7 +186,7 @@ public abstract class MainFrame extends JFrame implements ActionListener { JRadioButtonMenuItem _uniform_cladograms_rbmi; JRadioButtonMenuItem _ext_node_dependent_cladogram_rbmi; 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; @@ -252,7 +253,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; diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java index 863bd08..c2196ac 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java @@ -247,6 +247,7 @@ public final class MainFrameApplet extends MainFrame { .add( _search_case_senstive_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_CASE_SENSITIVE_LABEL ) ); _options_jmenu.add( _search_whole_words_only_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_TERMS_ONLY_LABEL ) ); _options_jmenu.add( _search_with_regex_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_REGEX_LABEL ) ); + _search_with_regex_cbmi.setToolTipText( MainFrame.SEARCH_WITH_REGEX_TIP ); _options_jmenu.add( _inverse_search_result_cbmi = new JCheckBoxMenuItem( INVERSE_SEARCH_RESULT_LABEL ) ); customizeJMenuItem( _choose_font_mi ); customizeJMenuItem( _switch_colors_mi ); diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index cc6fbe5..e6d6092 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -936,6 +936,7 @@ public final class MainFrameApplication extends MainFrame { _options_jmenu.add( _search_case_senstive_cbmi = new JCheckBoxMenuItem( SEARCH_CASE_SENSITIVE_LABEL ) ); _options_jmenu.add( _search_whole_words_only_cbmi = new JCheckBoxMenuItem( SEARCH_TERMS_ONLY_LABEL ) ); _options_jmenu.add( _search_with_regex_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_REGEX_LABEL ) ); + _search_with_regex_cbmi.setToolTipText( MainFrame.SEARCH_WITH_REGEX_TIP ); _options_jmenu.add( _inverse_search_result_cbmi = new JCheckBoxMenuItem( INVERSE_SEARCH_RESULT_LABEL ) ); _options_jmenu.addSeparator(); _options_jmenu.add( customizeMenuItemAsLabel( new JMenuItem( "Graphics Export & Printing:" ), diff --git a/forester/java/src/org/forester/util/ForesterConstants.java b/forester/java/src/org/forester/util/ForesterConstants.java index cf3fd8e..ba2346d 100644 --- a/forester/java/src/org/forester/util/ForesterConstants.java +++ b/forester/java/src/org/forester/util/ForesterConstants.java @@ -27,8 +27,8 @@ package org.forester.util; public final class ForesterConstants { - public final static String FORESTER_VERSION = "1.037"; - public final static String FORESTER_DATE = "140923"; + public final static String FORESTER_VERSION = "1.038"; + public final static String FORESTER_DATE = "141014"; public final static String PHYLO_XML_VERSION = "1.10"; public final static String PHYLO_XML_LOCATION = "http://www.phyloxml.org"; public final static String PHYLO_XML_XSD = "phyloxml.xsd"; -- 1.7.10.2