tweaks to keyword search GUI:

Simple
OK * "Query" should be renamed to "Keyword"
OK * Text area should be a single line (like google / yahoo)
OK * RegExp should be moved below text area and be named "Regular Expression"
OK * If you press the enter key, then it does the search.
OK * Pressing "Search" with no keyword should cause an error message to display and not open a new DataResultViewer
OK * trim keyword if user entered whitespaces
List
OK * Rename "Load" to "Load List" and "Import List"
OK * In general, group more and reduce white space
OK * Box around "Add keyword down to above search"
OK * In top of box, have "Current Keyword List"
OK * Remove "Add a new Keyword: "
OK * Change "LIteral" to "Regular Expression" (??)
OK * Remove "Current list of keyword"
OK * Similarly, rename "Delete All" to "Remove All"
OK * REname "Save" to "Save List"
OK * Remove white space between list an "Delete" buttons
OK * Lots of words were already in there
OK * Reword "Current list of keywords" to "Current List"
This commit is contained in:
adam-m 2012-01-18 16:21:29 -05:00
parent 77ff6f7828
commit 3f15599344
6 changed files with 238 additions and 216 deletions

View File

@ -24,22 +24,18 @@ ExtractedContentPanel.hitPreviousButton.text=
ExtractedContentPanel.hitNextButton.text= ExtractedContentPanel.hitNextButton.text=
KeywordSearchSimpleTopComponent.filesIndexedValLabel.text=- KeywordSearchSimpleTopComponent.filesIndexedValLabel.text=-
KeywordSearchSimpleTopComponent.filesIndexedNameLabel.text=Files indexed: KeywordSearchSimpleTopComponent.filesIndexedNameLabel.text=Files indexed:
KeywordSearchSimpleTopComponent.queryLabel.text=Query:
KeywordSearchSimpleTopComponent.searchButton.text=Search KeywordSearchSimpleTopComponent.searchButton.text=Search
KeywordSearchListTopComponent.searchButton.text=Search KeywordSearchListTopComponent.searchButton.text=Search
KeywordSearchListTopComponent.filesIndexedNameLabel.text=Files indexed: KeywordSearchListTopComponent.filesIndexedNameLabel.text=Files indexed:
KeywordSearchListTopComponent.filesIndexedValLabel.text=- KeywordSearchListTopComponent.filesIndexedValLabel.text=-
KeywordSearchListTopComponent.titleLabel.text=Search for or load a saved list of keywords KeywordSearchListTopComponent.titleLabel.text=Search for or load a saved list of keywords
KeywordSearchListTopComponent.listLabel.text=Current list of keywords:
KeywordSearchListTopComponent.addWordButton.text=Add KeywordSearchListTopComponent.addWordButton.text=Add
KeywordSearchListTopComponent.loadListButton.text=Load KeywordSearchListTopComponent.loadListButton.text=Load List
KeywordSearchListTopComponent.addWordField.text= KeywordSearchListTopComponent.addWordField.text=
KeywordSearchListTopComponent.saveListButton.text=Save KeywordSearchListTopComponent.saveListButton.text=Save List
KeywordSearchListTopComponent.chLiteralWord.text=Literal KeywordSearchListTopComponent.deleteWordButton.text=Remove
KeywordSearchListTopComponent.addWordLabel.text=Add a new keyword: KeywordSearchListTopComponent.deleteAllWordsButton.text=Remove All
KeywordSearchListTopComponent.deleteWordButton.text=Delete KeywordSearchSimpleTopComponent.chRegex.text=Regular Expression
KeywordSearchListTopComponent.deleteAllWordsButton.text=Delete All
KeywordSearchSimpleTopComponent.chRegex.text=RegEx
KeywordSearchListImportExportTopComponent.topLabel.text=Manage (import, export, delete) lists of keywords KeywordSearchListImportExportTopComponent.topLabel.text=Manage (import, export, delete) lists of keywords
KeywordSearchListImportExportTopComponent.curKeywordsLabel.text=Current lists: KeywordSearchListImportExportTopComponent.curKeywordsLabel.text=Current lists:
KeywordSearchListImportExportTopComponent.importButton.text=Import KeywordSearchListImportExportTopComponent.importButton.text=Import
@ -47,11 +43,14 @@ KeywordSearchListImportExportTopComponent.exportButton.text=Export
KeywordSearchListImportExportTopComponent.deleteButton.text=Delete KeywordSearchListImportExportTopComponent.deleteButton.text=Delete
KeywordSearchListImportExportTopComponent.filesIndexedNameLabel.text=Files indexed: KeywordSearchListImportExportTopComponent.filesIndexedNameLabel.text=Files indexed:
KeywordSearchListImportExportTopComponent.filesIndexedValLabel.text=- KeywordSearchListImportExportTopComponent.filesIndexedValLabel.text=-
KeywordSearchListTopComponent.curListNameLabel.text=Loaded list name: KeywordSearchListTopComponent.curListNameLabel.text=Loaded list:
KeywordSearchListTopComponent.curListValLabel.text=- KeywordSearchListTopComponent.curListValLabel.text=-
KeywordSearchListTopComponent.importButton.text=Import KeywordSearchListTopComponent.importButton.text=Import List
KeywordSearchHistoryTopComponent.topLabel.text=Review keyword search history and saved results KeywordSearchHistoryTopComponent.topLabel.text=Review keyword search history and saved results
KeywordSearchHistoryTopComponent.filesIndexedNameLabel.text=Files indexed: KeywordSearchHistoryTopComponent.filesIndexedNameLabel.text=Files indexed:
KeywordSearchHistoryTopComponent.filesIndexedValLabel.text=- KeywordSearchHistoryTopComponent.filesIndexedValLabel.text=-
KeywordSearchHistoryTopComponent.withHitsLabel.text=Keyword searches with hits: KeywordSearchHistoryTopComponent.withHitsLabel.text=Keyword searches with hits:
KeywordSearchHistoryTopComponent.noHitsLabel.text=Keyword searches without hits: KeywordSearchHistoryTopComponent.noHitsLabel.text=Keyword searches without hits:
KeywordSearchSimpleTopComponent.queryTextField.text=
KeywordSearchListTopComponent.curListLabel.text=Current List
KeywordSearchListTopComponent.chRegex.text=Regular Expression

View File

@ -23,6 +23,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.util.Map;
import org.openide.util.lookup.ServiceProvider; import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataExplorer; import org.sleuthkit.autopsy.corecomponentinterfaces.DataExplorer;
import org.sleuthkit.autopsy.keywordsearch.KeywordSearch.QueryType; import org.sleuthkit.autopsy.keywordsearch.KeywordSearch.QueryType;
@ -73,7 +74,12 @@ public class KeywordSearchDataExplorer implements DataExplorer {
private void search() { private void search() {
KeywordSearchQueryManager man = null; KeywordSearchQueryManager man = null;
if (tc.isMultiwordQuery()) { if (tc.isMultiwordQuery()) {
man = new KeywordSearchQueryManager(tc.getQueryList(), Presentation.COLLAPSE); final Map<String, Boolean> keywords = tc.getQueryList();
if (keywords.isEmpty()) {
KeywordSearchUtil.displayDialog("Keyword Search Error", "Keyword list is empty, please add at least one keyword to the list", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
return;
}
man = new KeywordSearchQueryManager(keywords, Presentation.COLLAPSE);
} else { } else {
QueryType queryType = null; QueryType queryType = null;
if (tc.isLuceneQuerySelected()) { if (tc.isLuceneQuerySelected()) {
@ -81,6 +87,11 @@ public class KeywordSearchDataExplorer implements DataExplorer {
} else { } else {
queryType = QueryType.REGEX; queryType = QueryType.REGEX;
} }
final String queryText = tc.getQueryText();
if (queryText == null || queryText.trim().equals("")) {
KeywordSearchUtil.displayDialog("Keyword Search Error", "Please enter a keyword to search for", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR);
return;
}
man = new KeywordSearchQueryManager(tc.getQueryText(), queryType, Presentation.COLLAPSE); man = new KeywordSearchQueryManager(tc.getQueryText(), queryType, Presentation.COLLAPSE);
} }

View File

@ -16,47 +16,64 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Component id="curListLabel" min="-2" max="-2" attributes="0"/>
<Component id="chLiteralWord" alignment="0" min="-2" max="-2" attributes="0"/> <EmptySpace pref="263" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
<Component id="curListNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="curListValLabel" pref="84" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="163" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="deleteWordButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Component id="deleteAllWordsButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="saveListButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="52" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="filesIndexedNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="filesIndexedValLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="243" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="searchButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="254" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="chRegex" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="206" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="titleLabel" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="titleLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="addWordField" min="-2" pref="152" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="addWordButton" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="loadListButton" min="-2" max="-2" attributes="0"/> <Component id="loadListButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="importButton" min="-2" max="-2" attributes="0"/> <Component id="importButton" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Component id="addWordLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="addWordField" min="-2" pref="152" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
<Component id="addWordButton" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="listLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="searchButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="filesIndexedNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="filesIndexedValLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane1" alignment="0" min="-2" pref="272" max="-2" attributes="0"/> <Component id="jScrollPane1" alignment="0" min="-2" pref="272" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="1">
<Component id="curListNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="curListValLabel" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="1">
<Component id="deleteWordButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="deleteAllWordsButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="saveListButton" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group> </Group>
<EmptySpace pref="15" max="32767" attributes="0"/> <EmptySpace pref="47" max="32767" attributes="0"/>
</Group> </Group>
<Component id="jSeparator1" alignment="0" pref="329" max="32767" attributes="0"/>
<Component id="jSeparator2" alignment="0" pref="329" max="32767" attributes="0"/>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
@ -69,38 +86,40 @@
<Component id="loadListButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="loadListButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="importButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="importButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/> <EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
<Component id="addWordLabel" min="-2" max="-2" attributes="0"/> <Component id="jSeparator2" min="-2" pref="10" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="curListLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="addWordField" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="addWordField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="addWordButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="addWordButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="chLiteralWord" min="-2" max="-2" attributes="0"/> <Component id="chRegex" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
<Component id="listLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="220" max="-2" attributes="0"/> <Component id="jScrollPane1" min="-2" pref="210" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="deleteWordButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="deleteAllWordsButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="deleteAllWordsButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="deleteWordButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="saveListButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="saveListButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace min="-2" pref="29" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jSeparator1" min="-2" pref="10" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Component id="searchButton" min="-2" max="-2" attributes="0"/> <Component id="searchButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="curListNameLabel" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="curListNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="curListValLabel" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="curListValLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="filesIndexedNameLabel" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="filesIndexedNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="filesIndexedValLabel" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="filesIndexedValLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace min="-2" pref="46" max="-2" attributes="0"/> <EmptySpace min="-2" pref="71" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -137,13 +156,6 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="listLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.listLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="addWordField"> <Component class="javax.swing.JTextField" name="addWordField">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -151,13 +163,6 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="addWordLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.addWordLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="addWordButton"> <Component class="javax.swing.JButton" name="addWordButton">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -208,14 +213,14 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="saveListButtonActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="saveListButtonActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JCheckBox" name="chLiteralWord"> <Component class="javax.swing.JCheckBox" name="chRegex">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.chLiteralWord.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.chRegex.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chLiteralWordActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chRegexActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1"> <Container class="javax.swing.JScrollPane" name="jScrollPane1">
@ -261,5 +266,16 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="importButtonActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="importButtonActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JLabel" name="curListLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchListTopComponent.curListLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator1">
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator2">
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -83,7 +83,7 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
} }
private void customizeComponents() { private void customizeComponents() {
chLiteralWord.setToolTipText("Literal word (auto-escape special characters)"); chRegex.setToolTipText("Keyword is a regular expression");
addWordButton.setToolTipText(("Add a new word to the keyword search list")); addWordButton.setToolTipText(("Add a new word to the keyword search list"));
addWordField.setToolTipText("Enter a new word or regex to search"); addWordField.setToolTipText("Enter a new word or regex to search");
@ -117,7 +117,7 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
} }
keywordTable.setCellSelectionEnabled(false); keywordTable.setCellSelectionEnabled(false);
loadDefaultKeywords(); //loadDefaultKeywords();
KeywordSearchListsXML.getCurrent().addPropertyChangeListener(new PropertyChangeListener() { KeywordSearchListsXML.getCurrent().addPropertyChangeListener(new PropertyChangeListener() {
@ -173,20 +173,21 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
filesIndexedNameLabel = new javax.swing.JLabel(); filesIndexedNameLabel = new javax.swing.JLabel();
filesIndexedValLabel = new javax.swing.JLabel(); filesIndexedValLabel = new javax.swing.JLabel();
titleLabel = new javax.swing.JLabel(); titleLabel = new javax.swing.JLabel();
listLabel = new javax.swing.JLabel();
addWordField = new javax.swing.JTextField(); addWordField = new javax.swing.JTextField();
addWordLabel = new javax.swing.JLabel();
addWordButton = new javax.swing.JButton(); addWordButton = new javax.swing.JButton();
loadListButton = new javax.swing.JButton(); loadListButton = new javax.swing.JButton();
deleteWordButton = new javax.swing.JButton(); deleteWordButton = new javax.swing.JButton();
deleteAllWordsButton = new javax.swing.JButton(); deleteAllWordsButton = new javax.swing.JButton();
saveListButton = new javax.swing.JButton(); saveListButton = new javax.swing.JButton();
chLiteralWord = new javax.swing.JCheckBox(); chRegex = new javax.swing.JCheckBox();
jScrollPane1 = new javax.swing.JScrollPane(); jScrollPane1 = new javax.swing.JScrollPane();
keywordTable = new javax.swing.JTable(); keywordTable = new javax.swing.JTable();
curListNameLabel = new javax.swing.JLabel(); curListNameLabel = new javax.swing.JLabel();
curListValLabel = new javax.swing.JLabel(); curListValLabel = new javax.swing.JLabel();
importButton = new javax.swing.JButton(); importButton = new javax.swing.JButton();
curListLabel = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jSeparator2 = new javax.swing.JSeparator();
org.openide.awt.Mnemonics.setLocalizedText(searchButton, org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.searchButton.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(searchButton, org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.searchButton.text")); // NOI18N
searchButton.addActionListener(new java.awt.event.ActionListener() { searchButton.addActionListener(new java.awt.event.ActionListener() {
@ -201,12 +202,8 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
org.openide.awt.Mnemonics.setLocalizedText(titleLabel, org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.titleLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(titleLabel, org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.titleLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(listLabel, org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.listLabel.text")); // NOI18N
addWordField.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.addWordField.text")); // NOI18N addWordField.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.addWordField.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(addWordLabel, org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.addWordLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(addWordButton, org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.addWordButton.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(addWordButton, org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.addWordButton.text")); // NOI18N
addWordButton.addActionListener(new java.awt.event.ActionListener() { addWordButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -242,10 +239,10 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
} }
}); });
org.openide.awt.Mnemonics.setLocalizedText(chLiteralWord, org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.chLiteralWord.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(chRegex, org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.chRegex.text")); // NOI18N
chLiteralWord.addActionListener(new java.awt.event.ActionListener() { chRegex.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
chLiteralWordActionPerformed(evt); chRegexActionPerformed(evt);
} }
}); });
@ -266,43 +263,60 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
} }
}); });
org.openide.awt.Mnemonics.setLocalizedText(curListLabel, org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.curListLabel.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(curListLabel)
.addComponent(chLiteralWord) .addContainerGap(263, Short.MAX_VALUE))
.addComponent(titleLabel) .addGroup(layout.createSequentialGroup()
.addGroup(layout.createSequentialGroup() .addGap(9, 9, 9)
.addComponent(curListNameLabel)
.addGap(18, 18, 18)
.addComponent(curListValLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE)
.addGap(163, 163, 163))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(deleteWordButton)
.addGap(18, 18, 18)
.addComponent(deleteAllWordsButton)
.addGap(18, 18, 18)
.addComponent(saveListButton)
.addContainerGap(52, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(filesIndexedNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(filesIndexedValLabel)
.addContainerGap(243, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(searchButton)
.addContainerGap(254, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(chRegex)
.addContainerGap(206, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(titleLabel, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(addWordField, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(addWordButton))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(loadListButton) .addComponent(loadListButton)
.addGap(18, 18, 18) .addGap(18, 18, 18)
.addComponent(importButton)) .addComponent(importButton))
.addComponent(addWordLabel) .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup() .addContainerGap(47, Short.MAX_VALUE))
.addComponent(addWordField, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)
.addGap(31, 31, 31) .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)
.addComponent(addWordButton))
.addComponent(listLabel)
.addComponent(searchButton)
.addGroup(layout.createSequentialGroup()
.addComponent(filesIndexedNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(filesIndexedValLabel))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(curListNameLabel)
.addGap(18, 18, 18)
.addComponent(curListValLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(deleteWordButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deleteAllWordsButton)
.addGap(18, 18, 18)
.addComponent(saveListButton))))
.addContainerGap(15, Short.MAX_VALUE))
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -313,34 +327,36 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(loadListButton) .addComponent(loadListButton)
.addComponent(importButton)) .addComponent(importButton))
.addGap(19, 19, 19) .addGap(8, 8, 8)
.addComponent(addWordLabel) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(curListLabel)
.addGap(14, 14, 14)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(addWordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(addWordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(addWordButton)) .addComponent(addWordButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(chLiteralWord) .addComponent(chRegex)
.addGap(9, 9, 9)
.addComponent(listLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(deleteWordButton)
.addComponent(deleteAllWordsButton) .addComponent(deleteAllWordsButton)
.addComponent(deleteWordButton)
.addComponent(saveListButton)) .addComponent(saveListButton))
.addGap(29, 29, 29) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(4, 4, 4)
.addComponent(searchButton) .addComponent(searchButton)
.addGap(18, 18, 18) .addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(curListNameLabel) .addComponent(curListNameLabel)
.addComponent(curListValLabel)) .addComponent(curListValLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(filesIndexedNameLabel) .addComponent(filesIndexedNameLabel)
.addComponent(filesIndexedValLabel)) .addComponent(filesIndexedValLabel))
.addGap(46, 46, 46)) .addGap(71, 71, 71))
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
@ -349,10 +365,10 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
private void addWordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addWordButtonActionPerformed private void addWordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addWordButtonActionPerformed
String newWord = addWordField.getText(); String newWord = addWordField.getText().trim();
String newWordEscaped = Pattern.quote(newWord); String newWordEscaped = Pattern.quote(newWord);
if (newWord.trim().equals("")) { if (newWord.equals("")) {
return; return;
} else if (keywordExists(newWord) || keywordExists(newWordEscaped)) { } else if (keywordExists(newWord) || keywordExists(newWordEscaped)) {
KeywordSearchUtil.displayDialog("New Keyword Entry", "Keyword already exists in the list.", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO); KeywordSearchUtil.displayDialog("New Keyword Entry", "Keyword already exists in the list.", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
@ -360,7 +376,7 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
} }
String toAdd = null; String toAdd = null;
if (chLiteralWord.isSelected()) { if (! chRegex.isSelected()) {
toAdd = newWordEscaped; toAdd = newWordEscaped;
} else { } else {
toAdd = newWord; toAdd = newWord;
@ -381,7 +397,7 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
} }
//add & reset checkbox //add & reset checkbox
chLiteralWord.setSelected(false); chRegex.setSelected(false);
tableModel.addKeyword(toAdd); tableModel.addKeyword(toAdd);
addWordField.setText(""); addWordField.setText("");
@ -427,8 +443,8 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
}//GEN-LAST:event_saveListButtonActionPerformed }//GEN-LAST:event_saveListButtonActionPerformed
private void chLiteralWordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chLiteralWordActionPerformed private void chRegexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chRegexActionPerformed
}//GEN-LAST:event_chLiteralWordActionPerformed }//GEN-LAST:event_chRegexActionPerformed
private void deleteWordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteWordButtonActionPerformed private void deleteWordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteWordButtonActionPerformed
tableModel.deleteSelected(); tableModel.deleteSelected();
@ -471,8 +487,8 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton addWordButton; private javax.swing.JButton addWordButton;
private javax.swing.JTextField addWordField; private javax.swing.JTextField addWordField;
private javax.swing.JLabel addWordLabel; private javax.swing.JCheckBox chRegex;
private javax.swing.JCheckBox chLiteralWord; private javax.swing.JLabel curListLabel;
private javax.swing.JLabel curListNameLabel; private javax.swing.JLabel curListNameLabel;
private javax.swing.JLabel curListValLabel; private javax.swing.JLabel curListValLabel;
private javax.swing.JButton deleteAllWordsButton; private javax.swing.JButton deleteAllWordsButton;
@ -481,8 +497,9 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
private javax.swing.JLabel filesIndexedValLabel; private javax.swing.JLabel filesIndexedValLabel;
private javax.swing.JButton importButton; private javax.swing.JButton importButton;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JTable keywordTable; private javax.swing.JTable keywordTable;
private javax.swing.JLabel listLabel;
private javax.swing.JButton loadListButton; private javax.swing.JButton loadListButton;
private javax.swing.JButton saveListButton; private javax.swing.JButton saveListButton;
private javax.swing.JButton searchButton; private javax.swing.JButton searchButton;

View File

@ -1,6 +1,9 @@
<?xml version="1.1" encoding="UTF-8" ?> <?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="autoscrolls" type="boolean" value="true"/>
</Properties>
<AuxValues> <AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
@ -19,65 +22,39 @@
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Component id="chRegex" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="queryLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="50" max="-2" attributes="0"/>
<Component id="chRegex" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane1" alignment="0" pref="599" max="32767" attributes="0"/>
<Component id="searchButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="filesIndexedNameLabel" min="-2" max="-2" attributes="0"/> <Component id="filesIndexedNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="filesIndexedValLabel" min="-2" max="-2" attributes="0"/> <Component id="filesIndexedValLabel" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Component id="searchButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="queryTextField" alignment="0" min="-2" pref="261" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace pref="125" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Component id="queryTextField" min="-2" max="-2" attributes="0"/>
<Component id="queryLabel" alignment="3" min="-2" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="chRegex" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="chRegex" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="searchButton" min="-2" max="-2" attributes="0"/> <Component id="searchButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace min="-2" pref="49" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="filesIndexedNameLabel" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="filesIndexedNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="filesIndexedValLabel" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="filesIndexedValLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace pref="106" max="32767" attributes="0"/> <EmptySpace pref="87" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>
<SubComponents> <SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="queryTextArea">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="searchButton"> <Component class="javax.swing.JButton" name="searchButton">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -85,13 +62,6 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="queryLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.queryLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="filesIndexedNameLabel"> <Component class="javax.swing.JLabel" name="filesIndexedNameLabel">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -126,5 +96,16 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chRegexActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chRegexActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JTextField" name="queryTextField">
<Properties>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchSimpleTopComponent.queryTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="queryTextFieldActionPerformed"/>
</Events>
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.openide.windows.TopComponent; import org.openide.windows.TopComponent;
@ -39,10 +40,10 @@ public class KeywordSearchSimpleTopComponent extends TopComponent implements Key
private void customizeComponents() { private void customizeComponents() {
searchButton.setToolTipText("Execute a keyword search using the query specified."); searchButton.setToolTipText("Execute a keyword search using the query specified.");
chRegex.setToolTipText("Select if query is a regular expression"); chRegex.setToolTipText("Select if keyword is a regular expression");
queryTextArea.setToolTipText("<html>For non-regex search enter one or more keywords separated by white-space.<br />" queryTextField.setToolTipText("<html>For non-regex search enter one or more keywords separated by white-space.<br />"
+ "For a regex search, enter a Java-supported regular expression.<br />" + "For a regular expression search, enter a valid regular expression.<br />"
+ "Examples of regex (in double-quotes): \"\\d\\d\\d-\\d\\d\\d\" \\d{8,10} \"phone\" \"ftp|sftp|ssh|http|https|www\".<br />" + "Examples (in double-quotes): \"\\d\\d\\d-\\d\\d\\d\" \\d{8,10} \"phone\" \"ftp|sftp|ssh|http|https|www\".<br />"
+ "Note: a word can be also searched using a regex search.<br />Regex containing whitespace [ \\s] matches are currently not supported.</html>"); + "Note: a word can be also searched using a regex search.<br />Regex containing whitespace [ \\s] matches are currently not supported.</html>");
} }
@ -55,23 +56,16 @@ public class KeywordSearchSimpleTopComponent extends TopComponent implements Key
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() { private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jScrollPane1 = new javax.swing.JScrollPane();
queryTextArea = new javax.swing.JTextArea();
searchButton = new javax.swing.JButton(); searchButton = new javax.swing.JButton();
queryLabel = new javax.swing.JLabel();
filesIndexedNameLabel = new javax.swing.JLabel(); filesIndexedNameLabel = new javax.swing.JLabel();
filesIndexedValLabel = new javax.swing.JLabel(); filesIndexedValLabel = new javax.swing.JLabel();
chRegex = new javax.swing.JCheckBox(); chRegex = new javax.swing.JCheckBox();
queryTextField = new javax.swing.JTextField();
queryTextArea.setColumns(20); setAutoscrolls(true);
queryTextArea.setRows(5);
jScrollPane1.setViewportView(queryTextArea);
searchButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.searchButton.text")); // NOI18N searchButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.searchButton.text")); // NOI18N
queryLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.queryLabel.text")); // NOI18N
filesIndexedNameLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.filesIndexedNameLabel.text")); // NOI18N filesIndexedNameLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.filesIndexedNameLabel.text")); // NOI18N
filesIndexedValLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.filesIndexedValLabel.text")); // NOI18N filesIndexedValLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.filesIndexedValLabel.text")); // NOI18N
@ -83,6 +77,14 @@ public class KeywordSearchSimpleTopComponent extends TopComponent implements Key
} }
}); });
queryTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
queryTextField.setText(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchSimpleTopComponent.queryTextField.text")); // NOI18N
queryTextField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
queryTextFieldActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
@ -90,36 +92,29 @@ public class KeywordSearchSimpleTopComponent extends TopComponent implements Key
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addComponent(chRegex)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(queryLabel)
.addGap(50, 50, 50)
.addComponent(chRegex))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 599, Short.MAX_VALUE)
.addComponent(searchButton))
.addContainerGap())
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(filesIndexedNameLabel) .addComponent(filesIndexedNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(filesIndexedValLabel)))) .addComponent(filesIndexedValLabel))
.addComponent(searchButton)
.addComponent(queryTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(125, Short.MAX_VALUE))
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addGap(32, 32, 32)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(queryTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(queryLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(chRegex)) .addComponent(chRegex)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18) .addGap(18, 18, 18)
.addComponent(searchButton) .addComponent(searchButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGap(49, 49, 49)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(filesIndexedNameLabel) .addComponent(filesIndexedNameLabel)
.addComponent(filesIndexedValLabel)) .addComponent(filesIndexedValLabel))
.addContainerGap(106, Short.MAX_VALUE)) .addContainerGap(87, Short.MAX_VALUE))
); );
filesIndexedNameLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchTopComponent.filesIndexedNameLabel.AccessibleContext.accessibleName")); // NOI18N filesIndexedNameLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(KeywordSearchSimpleTopComponent.class, "KeywordSearchTopComponent.filesIndexedNameLabel.AccessibleContext.accessibleName")); // NOI18N
@ -127,23 +122,25 @@ public class KeywordSearchSimpleTopComponent extends TopComponent implements Key
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void chRegexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chRegexActionPerformed private void chRegexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chRegexActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_chRegexActionPerformed }//GEN-LAST:event_chRegexActionPerformed
private void queryTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queryTextFieldActionPerformed
}//GEN-LAST:event_queryTextFieldActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JCheckBox chRegex; private javax.swing.JCheckBox chRegex;
private javax.swing.JLabel filesIndexedNameLabel; private javax.swing.JLabel filesIndexedNameLabel;
private javax.swing.JLabel filesIndexedValLabel; private javax.swing.JLabel filesIndexedValLabel;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextField queryTextField;
private javax.swing.JLabel queryLabel;
private javax.swing.JTextArea queryTextArea;
private javax.swing.JButton searchButton; private javax.swing.JButton searchButton;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
@Override @Override
protected void componentOpened() { protected void componentOpened() {
// clear old search // clear old search
queryTextArea.setText(""); queryTextField.setText("");
} }
@Override @Override
@ -154,11 +151,12 @@ public class KeywordSearchSimpleTopComponent extends TopComponent implements Key
@Override @Override
public void addSearchButtonListener(ActionListener l) { public void addSearchButtonListener(ActionListener l) {
searchButton.addActionListener(l); searchButton.addActionListener(l);
queryTextField.addActionListener(l);
} }
@Override @Override
public String getQueryText() { public String getQueryText() {
return queryTextArea.getText(); return queryTextField.getText().trim();
} }
@Override @Override