regex search
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 15 Oct 2014 00:06:59 +0000 (00:06 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 15 Oct 2014 00:06:59 +0000 (00:06 +0000)
forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java
forester/java/src/org/forester/archaeopteryx/Constants.java
forester/java/src/org/forester/archaeopteryx/ControlPanel.java
forester/java/src/org/forester/archaeopteryx/MainFrame.java
forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java
forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java
forester/java/src/org/forester/util/ForesterConstants.java

index 36afa08..d89bccc 100644 (file)
@@ -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 );
index 43e576a..1a63bcf 100644 (file)
@@ -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"  };
index cffdfea..29e4578 100644 (file)
@@ -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<PhylogenyNode> 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<PhylogenyNode> 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(),
index 84d6185..aa4b40e 100644 (file)
@@ -77,7 +77,7 @@ import org.forester.util.ForesterUtil;
 public abstract class MainFrame extends JFrame implements ActionListener {\r
 \r
     static final String         USE_MOUSEWHEEL_SHIFT_TO_ROTATE          = "In this display type, use mousewheel + Shift to rotate [or A and S]";\r
-    static final String         PHYLOXML_REF_TOOL_TIP                   = Constants.PHYLOXML_REFERENCE;                                                                                                                                       //TODO //FIXME\r
+    static final String         PHYLOXML_REF_TOOL_TIP                   = Constants.PHYLOXML_REFERENCE;                                                                                                                                         //TODO //FIXME\r
     static final String         APTX_REF_TOOL_TIP                       = Constants.APTX_REFERENCE;\r
     private static final long   serialVersionUID                        = 3655000897845508358L;\r
     final static Font           menu_font                               = new Font( Configuration.getDefaultFontFamilyName(),\r
@@ -90,8 +90,8 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     static final String         TRIANGULAR_TYPE_CBMI_LABEL              = "Triangular";\r
     static final String         CONVEX_TYPE_CBMI_LABEL                  = "Convex";\r
     static final String         ROUNDED_TYPE_CBMI_LABEL                 = "Rounded";\r
-    static final String         UNROOTED_TYPE_CBMI_LABEL                = "Unrooted (alpha)";                                                                                                                                                 //TODO\r
-    static final String         CIRCULAR_TYPE_CBMI_LABEL                = "Circular (alpha)";                                                                                                                                                 //TODO\r
+    static final String         UNROOTED_TYPE_CBMI_LABEL                = "Unrooted (alpha)";                                                                                                                                                   //TODO\r
+    static final String         CIRCULAR_TYPE_CBMI_LABEL                = "Circular (alpha)";                                                                                                                                                   //TODO\r
     static final String         OPTIONS_HEADER                          = "Options";\r
     static final String         SEARCH_SUBHEADER                        = "Search:";\r
     static final String         DISPLAY_SUBHEADER                       = "Display:";\r
@@ -105,6 +105,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     static final String         UNIFORM_CLADOGRAMS_LABEL                = "Total Node Sum Dependent Cladograms";\r
     static final String         LABEL_DIRECTION_LABEL                   = "Radial Labels";\r
     static final String         LABEL_DIRECTION_TIP                     = "To use radial node labels in radial and unrooted display types";\r
+    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.";\r
     static final String         SCREEN_ANTIALIAS_LABEL                  = "Antialias";\r
     static final String         COLOR_LABELS_LABEL                      = "Colorize Labels Same as Parent Branch";\r
     static final String         BG_GRAD_LABEL                           = "Background Color Gradient";\r
@@ -185,7 +186,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     JRadioButtonMenuItem        _uniform_cladograms_rbmi;\r
     JRadioButtonMenuItem        _ext_node_dependent_cladogram_rbmi;\r
     JCheckBoxMenuItem           _color_by_taxonomic_group_cbmi;\r
-    JCheckBoxMenuItem           _show_scale_cbmi;                                                                                                                                                                                             //TODO fix me\r
+    JCheckBoxMenuItem           _show_scale_cbmi;                                                                                                                                                                                               //TODO fix me\r
     JCheckBoxMenuItem           _show_overview_cbmi;\r
     JCheckBoxMenuItem           _show_domain_labels;\r
     JCheckBoxMenuItem           _show_annotation_ref_source;\r
@@ -252,7 +253,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     // Handy pointers to child components:\r
     MainPanel                   _mainpanel;\r
     Container                   _contentpane;\r
-    final LinkedList<TextFrame> _textframes                             = new LinkedList<TextFrame>();                                                                                                                                         ;\r
+    final LinkedList<TextFrame> _textframes                             = new LinkedList<TextFrame>();                                                                                                                                           ;\r
     Configuration               _configuration;\r
     Options                     _options;\r
     private Phylogeny           _species_tree;\r
index 863bd08..c2196ac 100644 (file)
@@ -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 );
index cc6fbe5..e6d6092 100644 (file)
@@ -936,6 +936,7 @@ public final class MainFrameApplication extends MainFrame {
         _options_jmenu.add( _search_case_senstive_cbmi = new JCheckBoxMenuItem( SEARCH_CASE_SENSITIVE_LABEL ) );\r
         _options_jmenu.add( _search_whole_words_only_cbmi = new JCheckBoxMenuItem( SEARCH_TERMS_ONLY_LABEL ) );\r
         _options_jmenu.add( _search_with_regex_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_REGEX_LABEL ) );\r
+        _search_with_regex_cbmi.setToolTipText( MainFrame.SEARCH_WITH_REGEX_TIP );\r
         _options_jmenu.add( _inverse_search_result_cbmi = new JCheckBoxMenuItem( INVERSE_SEARCH_RESULT_LABEL ) );\r
         _options_jmenu.addSeparator();\r
         _options_jmenu.add( customizeMenuItemAsLabel( new JMenuItem( "Graphics Export & Printing:" ),\r
index cf3fd8e..ba2346d 100644 (file)
@@ -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";