Skip to content
Snippets Groups Projects
Commit dd391043 authored by tjc's avatar tjc
Browse files

use boolean search operators

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@9296 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent b36f8ad5
Branches
Tags
No related merge requests found
...@@ -197,6 +197,12 @@ public class FindAndReplace extends JFrame ...@@ -197,6 +197,12 @@ public class FindAndReplace extends JFrame
c.gridy = ++ypos; c.gridy = ++ypos;
panel.add(qualifierValueSubString, c); panel.add(qualifierValueSubString, c);
final JCheckBox qualifierValueUseBoolean = new JCheckBox(
"Use boolean search (and, or, &, |)", false);
c.gridy = ++ypos;
c.gridwidth = 2;
panel.add(qualifierValueUseBoolean, c);
c.gridwidth = 1;
// column 2 // column 2
ypos = 0; ypos = 0;
...@@ -236,9 +242,6 @@ public class FindAndReplace extends JFrame ...@@ -236,9 +242,6 @@ public class FindAndReplace extends JFrame
c.gridy = ++ypos; c.gridy = ++ypos;
panel.add(selectedQualifierButton,c); panel.add(selectedQualifierButton,c);
final JCheckBox qualifierValueUseBoolean = new JCheckBox("Use boolean operator (&, |)", false);
c.gridy = ++ypos;
panel.add(qualifierValueUseBoolean, c);
final JButton findButton = new JButton("Find"); final JButton findButton = new JButton("Find");
findButton.addActionListener(new ActionListener() findButton.addActionListener(new ActionListener()
...@@ -272,15 +275,19 @@ public class FindAndReplace extends JFrame ...@@ -272,15 +275,19 @@ public class FindAndReplace extends JFrame
final FilteredEntryGroup filtered_entry_group = final FilteredEntryGroup filtered_entry_group =
new FilteredEntryGroup(entry_group, predicate, findTextField.getText()); new FilteredEntryGroup(entry_group, predicate, findTextField.getText());
final FeatureListFrame feature_list_frame = if(filtered_entry_group.getAllFeaturesCount() < 1)
new FeatureListFrame("Features Found", JOptionPane.showMessageDialog(FindAndReplace.this, "No matches found.");
selection, else
goto_event_source, filtered_entry_group, {
base_plot_group); final FeatureListFrame feature_list_frame =
new FeatureListFrame("Features Found",
selection,
goto_event_source, filtered_entry_group,
base_plot_group);
feature_list_frame.setVisible(true);
}
setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
feature_list_frame.setVisible(true);
} }
}); });
ypos+=3; ypos+=3;
...@@ -487,12 +494,17 @@ public class FindAndReplace extends JFrame ...@@ -487,12 +494,17 @@ public class FindAndReplace extends JFrame
* @return * @return
*/ */
private FeaturePredicate constructFeaturePredicateFromBooleanList( private FeaturePredicate constructFeaturePredicateFromBooleanList(
final String text, String text,
final Key key, final Key key,
final String qualifierName, final String qualifierName,
final boolean isSubString, final boolean isSubString,
final boolean isCaseInsensitive) final boolean isCaseInsensitive)
{ {
text = text.replaceAll(" && ", " & ");
text = text.replaceAll(" (a|A)(n|N)(d|D) ", " & ");
text = text.replaceAll(" \\|\\| ", " \\| ");
text = text.replaceAll(" (o|O)(r|R) ", " \\| ");
final String valuesAnd[] = text.split("&"); final String valuesAnd[] = text.split("&");
final FeaturePredicateVector andPredicates = new FeaturePredicateVector(); final FeaturePredicateVector andPredicates = new FeaturePredicateVector();
final FeaturePredicateVector orPredicates = new FeaturePredicateVector(); final FeaturePredicateVector orPredicates = new FeaturePredicateVector();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment