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=
KeywordSearchSimpleTopComponent.filesIndexedValLabel.text=-
KeywordSearchSimpleTopComponent.filesIndexedNameLabel.text=Files indexed:
KeywordSearchSimpleTopComponent.queryLabel.text=Query:
KeywordSearchSimpleTopComponent.searchButton.text=Search
KeywordSearchListTopComponent.searchButton.text=Search
KeywordSearchListTopComponent.filesIndexedNameLabel.text=Files indexed:
KeywordSearchListTopComponent.filesIndexedValLabel.text=-
KeywordSearchListTopComponent.titleLabel.text=Search for or load a saved list of keywords
KeywordSearchListTopComponent.listLabel.text=Current list of keywords:
KeywordSearchListTopComponent.addWordButton.text=Add
KeywordSearchListTopComponent.loadListButton.text=Load
KeywordSearchListTopComponent.loadListButton.text=Load List
KeywordSearchListTopComponent.addWordField.text=
KeywordSearchListTopComponent.saveListButton.text=Save
KeywordSearchListTopComponent.chLiteralWord.text=Literal
KeywordSearchListTopComponent.addWordLabel.text=Add a new keyword:
KeywordSearchListTopComponent.deleteWordButton.text=Delete
KeywordSearchListTopComponent.deleteAllWordsButton.text=Delete All
KeywordSearchSimpleTopComponent.chRegex.text=RegEx
KeywordSearchListTopComponent.saveListButton.text=Save List
KeywordSearchListTopComponent.deleteWordButton.text=Remove
KeywordSearchListTopComponent.deleteAllWordsButton.text=Remove All
KeywordSearchSimpleTopComponent.chRegex.text=Regular Expression
KeywordSearchListImportExportTopComponent.topLabel.text=Manage (import, export, delete) lists of keywords
KeywordSearchListImportExportTopComponent.curKeywordsLabel.text=Current lists:
KeywordSearchListImportExportTopComponent.importButton.text=Import
@ -47,11 +43,14 @@ KeywordSearchListImportExportTopComponent.exportButton.text=Export
KeywordSearchListImportExportTopComponent.deleteButton.text=Delete
KeywordSearchListImportExportTopComponent.filesIndexedNameLabel.text=Files indexed:
KeywordSearchListImportExportTopComponent.filesIndexedValLabel.text=-
KeywordSearchListTopComponent.curListNameLabel.text=Loaded list name:
KeywordSearchListTopComponent.curListNameLabel.text=Loaded list:
KeywordSearchListTopComponent.curListValLabel.text=-
KeywordSearchListTopComponent.importButton.text=Import
KeywordSearchListTopComponent.importButton.text=Import List
KeywordSearchHistoryTopComponent.topLabel.text=Review keyword search history and saved results
KeywordSearchHistoryTopComponent.filesIndexedNameLabel.text=Files indexed:
KeywordSearchHistoryTopComponent.filesIndexedValLabel.text=-
KeywordSearchHistoryTopComponent.withHitsLabel.text=Keyword searches with 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.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Map;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataExplorer;
import org.sleuthkit.autopsy.keywordsearch.KeywordSearch.QueryType;
@ -73,7 +74,12 @@ public class KeywordSearchDataExplorer implements DataExplorer {
private void search() {
KeywordSearchQueryManager man = null;
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 {
QueryType queryType = null;
if (tc.isLuceneQuerySelected()) {
@ -81,6 +87,11 @@ public class KeywordSearchDataExplorer implements DataExplorer {
} else {
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);
}

View File

@ -16,47 +16,64 @@
<Layout>
<DimensionLayout dim="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"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="chLiteralWord" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="curListLabel" 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"/>
<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">
<Component id="loadListButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="importButton" min="-2" max="-2" attributes="0"/>
</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"/>
<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>
<EmptySpace pref="15" max="32767" attributes="0"/>
<EmptySpace pref="47" max="32767" attributes="0"/>
</Group>
<Component id="jSeparator1" alignment="0" pref="329" max="32767" attributes="0"/>
<Component id="jSeparator2" alignment="0" pref="329" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@ -69,38 +86,40 @@
<Component id="loadListButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="importButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
<Component id="addWordLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
<Component id="jSeparator2" min="-2" pref="10" 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">
<Component id="addWordField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="addWordButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="chLiteralWord" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
<Component id="listLabel" min="-2" max="-2" attributes="0"/>
<Component id="chRegex" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="220" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="210" max="-2" attributes="0"/>
<EmptySpace max="-2" 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="deleteWordButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="saveListButton" alignment="3" min="-2" max="-2" attributes="0"/>
</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"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="curListNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="curListValLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="filesIndexedNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="filesIndexedValLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="46" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="71" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -137,13 +156,6 @@
</Property>
</Properties>
</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">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -151,13 +163,6 @@
</Property>
</Properties>
</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">
<Properties>
<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"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="chLiteralWord">
<Component class="javax.swing.JCheckBox" name="chRegex">
<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.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>
</Properties>
<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>
</Component>
<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"/>
</Events>
</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>
</Form>

View File

@ -83,7 +83,7 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
}
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"));
addWordField.setToolTipText("Enter a new word or regex to search");
@ -117,7 +117,7 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
}
keywordTable.setCellSelectionEnabled(false);
loadDefaultKeywords();
//loadDefaultKeywords();
KeywordSearchListsXML.getCurrent().addPropertyChangeListener(new PropertyChangeListener() {
@ -173,20 +173,21 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
filesIndexedNameLabel = new javax.swing.JLabel();
filesIndexedValLabel = new javax.swing.JLabel();
titleLabel = new javax.swing.JLabel();
listLabel = new javax.swing.JLabel();
addWordField = new javax.swing.JTextField();
addWordLabel = new javax.swing.JLabel();
addWordButton = new javax.swing.JButton();
loadListButton = new javax.swing.JButton();
deleteWordButton = new javax.swing.JButton();
deleteAllWordsButton = new javax.swing.JButton();
saveListButton = new javax.swing.JButton();
chLiteralWord = new javax.swing.JCheckBox();
chRegex = new javax.swing.JCheckBox();
jScrollPane1 = new javax.swing.JScrollPane();
keywordTable = new javax.swing.JTable();
curListNameLabel = new javax.swing.JLabel();
curListValLabel = new javax.swing.JLabel();
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
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(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
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
addWordButton.addActionListener(new java.awt.event.ActionListener() {
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
chLiteralWord.addActionListener(new java.awt.event.ActionListener() {
org.openide.awt.Mnemonics.setLocalizedText(chRegex, org.openide.util.NbBundle.getMessage(KeywordSearchListTopComponent.class, "KeywordSearchListTopComponent.chRegex.text")); // NOI18N
chRegex.addActionListener(new java.awt.event.ActionListener() {
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);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(chLiteralWord)
.addComponent(titleLabel)
.addGroup(layout.createSequentialGroup()
.addComponent(curListLabel)
.addContainerGap(263, Short.MAX_VALUE))
.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)
.addGap(18, 18, 18)
.addComponent(importButton))
.addComponent(addWordLabel)
.addGroup(layout.createSequentialGroup()
.addComponent(addWordField, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(31, 31, 31)
.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))
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(47, Short.MAX_VALUE))
.addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)
.addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)
);
layout.setVerticalGroup(
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)
.addComponent(loadListButton)
.addComponent(importButton))
.addGap(19, 19, 19)
.addComponent(addWordLabel)
.addGap(18, 18, 18)
.addGap(8, 8, 8)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(curListLabel)
.addGap(14, 14, 14)
.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(addWordButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(chLiteralWord)
.addGap(9, 9, 9)
.addComponent(listLabel)
.addComponent(chRegex)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(deleteWordButton)
.addComponent(deleteAllWordsButton)
.addComponent(deleteWordButton)
.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)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(curListNameLabel)
.addComponent(curListValLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(filesIndexedNameLabel)
.addComponent(filesIndexedValLabel))
.addGap(46, 46, 46))
.addGap(71, 71, 71))
);
}// </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
String newWord = addWordField.getText();
String newWord = addWordField.getText().trim();
String newWordEscaped = Pattern.quote(newWord);
if (newWord.trim().equals("")) {
if (newWord.equals("")) {
return;
} else if (keywordExists(newWord) || keywordExists(newWordEscaped)) {
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;
if (chLiteralWord.isSelected()) {
if (! chRegex.isSelected()) {
toAdd = newWordEscaped;
} else {
toAdd = newWord;
@ -381,7 +397,7 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
}
//add & reset checkbox
chLiteralWord.setSelected(false);
chRegex.setSelected(false);
tableModel.addKeyword(toAdd);
addWordField.setText("");
@ -427,8 +443,8 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
}//GEN-LAST:event_saveListButtonActionPerformed
private void chLiteralWordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chLiteralWordActionPerformed
}//GEN-LAST:event_chLiteralWordActionPerformed
private void chRegexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chRegexActionPerformed
}//GEN-LAST:event_chRegexActionPerformed
private void deleteWordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteWordButtonActionPerformed
tableModel.deleteSelected();
@ -471,8 +487,8 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton addWordButton;
private javax.swing.JTextField addWordField;
private javax.swing.JLabel addWordLabel;
private javax.swing.JCheckBox chLiteralWord;
private javax.swing.JCheckBox chRegex;
private javax.swing.JLabel curListLabel;
private javax.swing.JLabel curListNameLabel;
private javax.swing.JLabel curListValLabel;
private javax.swing.JButton deleteAllWordsButton;
@ -481,8 +497,9 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
private javax.swing.JLabel filesIndexedValLabel;
private javax.swing.JButton importButton;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JTable keywordTable;
private javax.swing.JLabel listLabel;
private javax.swing.JButton loadListButton;
private javax.swing.JButton saveListButton;
private javax.swing.JButton searchButton;

View File

@ -1,6 +1,9 @@
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="autoscrolls" type="boolean" value="true"/>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
@ -19,65 +22,39 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" 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>
<Component id="chRegex" 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 max="-2" attributes="0"/>
<Component id="filesIndexedValLabel" min="-2" max="-2" attributes="0"/>
</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>
<EmptySpace pref="125" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="queryLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="chRegex" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
<Component id="queryTextField" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="chRegex" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" 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">
<Component id="filesIndexedNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="filesIndexedValLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="106" max="32767" attributes="0"/>
<EmptySpace pref="87" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<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">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -85,13 +62,6 @@
</Property>
</Properties>
</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">
<Properties>
<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"/>
</Events>
</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>
</Form>

View File

@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.keywordsearch;
import java.awt.event.ActionListener;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.windows.TopComponent;
@ -39,10 +40,10 @@ public class KeywordSearchSimpleTopComponent extends TopComponent implements Key
private void customizeComponents() {
searchButton.setToolTipText("Execute a keyword search using the query specified.");
chRegex.setToolTipText("Select if query is a regular expression");
queryTextArea.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 />"
+ "Examples of regex (in double-quotes): \"\\d\\d\\d-\\d\\d\\d\" \\d{8,10} \"phone\" \"ftp|sftp|ssh|http|https|www\".<br />"
chRegex.setToolTipText("Select if keyword is a regular expression");
queryTextField.setToolTipText("<html>For non-regex search enter one or more keywords separated by white-space.<br />"
+ "For a regular expression search, enter a valid regular expression.<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>");
}
@ -55,23 +56,16 @@ public class KeywordSearchSimpleTopComponent extends TopComponent implements Key
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jScrollPane1 = new javax.swing.JScrollPane();
queryTextArea = new javax.swing.JTextArea();
searchButton = new javax.swing.JButton();
queryLabel = new javax.swing.JLabel();
filesIndexedNameLabel = new javax.swing.JLabel();
filesIndexedValLabel = new javax.swing.JLabel();
chRegex = new javax.swing.JCheckBox();
queryTextField = new javax.swing.JTextField();
queryTextArea.setColumns(20);
queryTextArea.setRows(5);
jScrollPane1.setViewportView(queryTextArea);
setAutoscrolls(true);
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
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);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -90,36 +92,29 @@ public class KeywordSearchSimpleTopComponent extends TopComponent implements Key
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.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())
.addComponent(chRegex)
.addGroup(layout.createSequentialGroup()
.addComponent(filesIndexedNameLabel)
.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.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(queryLabel)
.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(32, 32, 32)
.addComponent(queryTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(chRegex)
.addGap(18, 18, 18)
.addComponent(searchButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGap(49, 49, 49)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(filesIndexedNameLabel)
.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
@ -127,23 +122,25 @@ public class KeywordSearchSimpleTopComponent extends TopComponent implements Key
}// </editor-fold>//GEN-END:initComponents
private void chRegexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chRegexActionPerformed
// TODO add your handling code here:
}//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
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JCheckBox chRegex;
private javax.swing.JLabel filesIndexedNameLabel;
private javax.swing.JLabel filesIndexedValLabel;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel queryLabel;
private javax.swing.JTextArea queryTextArea;
private javax.swing.JTextField queryTextField;
private javax.swing.JButton searchButton;
// End of variables declaration//GEN-END:variables
@Override
protected void componentOpened() {
// clear old search
queryTextArea.setText("");
queryTextField.setText("");
}
@Override
@ -154,11 +151,12 @@ public class KeywordSearchSimpleTopComponent extends TopComponent implements Key
@Override
public void addSearchButtonListener(ActionListener l) {
searchButton.addActionListener(l);
queryTextField.addActionListener(l);
}
@Override
public String getQueryText() {
return queryTextArea.getText();
return queryTextField.getText().trim();
}
@Override