initial GUI for search history (no actions yet)

This commit is contained in:
adam-m 2012-01-17 12:52:48 -05:00
parent 9bdcdf7246
commit ce2e83a6e3
4 changed files with 470 additions and 1 deletions

View File

@ -1,9 +1,12 @@
CTL_KeywordSearchHistoryAction=Keyword Search History
CTL_KeywordSearchHistoryTopComponent=Keyword Search History Window
CTL_KeywordSearchListAction=List
CTL_KeywordSearchListImportExportAction=Keyword Search List Import Export
CTL_KeywordSearchListImportExportTopComponent=Keyword Search List Import Export Window
CTL_KeywordSearchListTopComponent=List
CTL_KeywordSearchTabsTopComponentAction=Keyword Search
CTL_KeywordSearchTabsTopComponentTopComponent=Keyword Search
HINT_KeywordSearchHistoryTopComponent=This is a Keyword Search History window
HINT_KeywordSearchListImportExportTopComponent=Keyword Search List Import Export window
HINT_KeywordSearchListTopComponent=Keyword Search List
HINT_KeywordSearchTabsTopComponentTopComponent=Keyword Search window
@ -47,3 +50,8 @@ KeywordSearchListImportExportTopComponent.filesIndexedValLabel.text=-
KeywordSearchListTopComponent.curListNameLabel.text=Loaded list name:
KeywordSearchListTopComponent.curListValLabel.text=-
KeywordSearchListTopComponent.importButton.text=Import
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:

View File

@ -0,0 +1,140 @@
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane2" alignment="0" min="-2" pref="275" max="-2" attributes="0"/>
<Component id="jScrollPane1" alignment="0" min="-2" pref="275" max="-2" attributes="0"/>
<Component id="topLabel" min="-2" max="-2" attributes="0"/>
<Component id="withHitsLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="noHitsLabel" 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" pref="72" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="15" 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 min="-2" pref="23" max="-2" attributes="0"/>
<Component id="topLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
<Component id="withHitsLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="229" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
<Component id="noHitsLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane2" min="-2" pref="234" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="35" 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="34" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="topLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchHistoryTopComponent.topLabel.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">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchHistoryTopComponent.filesIndexedNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="filesIndexedValLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchHistoryTopComponent.filesIndexedValLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="withHitsLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchHistoryTopComponent.withHitsLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="noHitsLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchHistoryTopComponent.noHitsLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<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.JTable" name="hitsTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="2" rowCount="4">
<Column editable="false" title="Keyword" type="java.lang.String"/>
<Column editable="false" title="#Hits" type="java.lang.Integer"/>
</Table>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="false" resizingAllowed="true"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<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.JTable" name="nohitsTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="1" rowCount="4">
<Column editable="false" title="Keyword" type="java.lang.String"/>
</Table>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="false" resizingAllowed="true"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,320 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.keywordsearch;
import java.awt.Component;
import java.awt.event.ActionListener;
import java.util.Map;
import java.util.logging.Logger;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableColumn;
import org.openide.util.NbBundle;
import org.openide.windows.TopComponent;
import org.netbeans.api.settings.ConvertAsProperties;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
/**
* Top component with saved searches viewer
*/
@ConvertAsProperties(dtd = "-//org.sleuthkit.autopsy.keywordsearch//KeywordSearchHistory//EN",
autostore = false)
@TopComponent.Description(preferredID = "KeywordSearchHistoryTopComponent",
//iconBase="SET/PATH/TO/ICON/HERE",
persistenceType = TopComponent.PERSISTENCE_NEVER)
@TopComponent.Registration(mode = "explorer", openAtStartup = false)
@ActionID(category = "Window", id = "org.sleuthkit.autopsy.keywordsearch.KeywordSearchHistoryTopComponent")
@ActionReference(path = "Menu/Window" /*, position = 333 */)
@TopComponent.OpenActionRegistration(displayName = "#CTL_KeywordSearchHistoryAction",
preferredID = "KeywordSearchHistoryTopComponent")
public final class KeywordSearchHistoryTopComponent extends TopComponent implements KeywordSearchTopComponentInterface {
private Logger logger = Logger.getLogger(KeywordSearchHistoryTopComponent.class.getName());
public KeywordSearchHistoryTopComponent() {
initComponents();
customizeComponents();
setName(NbBundle.getMessage(KeywordSearchHistoryTopComponent.class, "CTL_KeywordSearchHistoryTopComponent"));
setToolTipText(NbBundle.getMessage(KeywordSearchHistoryTopComponent.class, "HINT_KeywordSearchHistoryTopComponent"));
putClientProperty(TopComponent.PROP_UNDOCKING_DISABLED, Boolean.TRUE);
}
private void customizeComponents() {
hitsTable.setToolTipText("Saved searches with hits: click on the row to view search results.");
nohitsTable.setToolTipText("Saved searches without hits.");
hitsTable.setAutoscrolls(true);
hitsTable.setShowHorizontalLines(false);
hitsTable.setShowVerticalLines(false);
hitsTable.getParent().setBackground(hitsTable.getBackground());
//customize column witdhs
hitsTable.setSize(260, 200);
final int width = hitsTable.getSize().width;
TableColumn column = null;
for (int i = 0; i < 2; i++) {
column = hitsTable.getColumnModel().getColumn(i);
switch (i) {
case 0:
column.setCellRenderer(new CellTooltipRenderer());
column.setPreferredWidth(((int) (width * 0.80)));
column.setResizable(true);
break;
case 1:
column.setPreferredWidth(((int) (width * 0.15)));
column.setResizable(false);
break;
default:
break;
}
}
hitsTable.setCellSelectionEnabled(false);
nohitsTable.setAutoscrolls(true);
nohitsTable.setShowHorizontalLines(false);
nohitsTable.setShowVerticalLines(false);
nohitsTable.getParent().setBackground(nohitsTable.getBackground());
//customize column witdhs
nohitsTable.setSize(260, 200);
column = nohitsTable.getColumnModel().getColumn(0);
column.setCellRenderer(new CellTooltipRenderer());
nohitsTable.setCellSelectionEnabled(false);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
topLabel = new javax.swing.JLabel();
filesIndexedNameLabel = new javax.swing.JLabel();
filesIndexedValLabel = new javax.swing.JLabel();
withHitsLabel = new javax.swing.JLabel();
noHitsLabel = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
hitsTable = new javax.swing.JTable();
jScrollPane2 = new javax.swing.JScrollPane();
nohitsTable = new javax.swing.JTable();
org.openide.awt.Mnemonics.setLocalizedText(topLabel, org.openide.util.NbBundle.getMessage(KeywordSearchHistoryTopComponent.class, "KeywordSearchHistoryTopComponent.topLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(filesIndexedNameLabel, org.openide.util.NbBundle.getMessage(KeywordSearchHistoryTopComponent.class, "KeywordSearchHistoryTopComponent.filesIndexedNameLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(filesIndexedValLabel, org.openide.util.NbBundle.getMessage(KeywordSearchHistoryTopComponent.class, "KeywordSearchHistoryTopComponent.filesIndexedValLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(withHitsLabel, org.openide.util.NbBundle.getMessage(KeywordSearchHistoryTopComponent.class, "KeywordSearchHistoryTopComponent.withHitsLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(noHitsLabel, org.openide.util.NbBundle.getMessage(KeywordSearchHistoryTopComponent.class, "KeywordSearchHistoryTopComponent.noHitsLabel.text")); // NOI18N
hitsTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null},
{null, null},
{null, null},
{null, null}
},
new String [] {
"Keyword", "#Hits"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.Integer.class
};
boolean[] canEdit = new boolean [] {
false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
hitsTable.getTableHeader().setReorderingAllowed(false);
jScrollPane1.setViewportView(hitsTable);
nohitsTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null},
{null},
{null},
{null}
},
new String [] {
"Keyword"
}
) {
Class[] types = new Class [] {
java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
nohitsTable.getTableHeader().setReorderingAllowed(false);
jScrollPane2.setViewportView(nohitsTable);
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(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(topLabel)
.addComponent(withHitsLabel)
.addComponent(noHitsLabel)
.addGroup(layout.createSequentialGroup()
.addComponent(filesIndexedNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(filesIndexedValLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(15, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(topLabel)
.addGap(27, 27, 27)
.addComponent(withHitsLabel)
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(30, 30, 30)
.addComponent(noHitsLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(35, 35, 35)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(filesIndexedNameLabel)
.addComponent(filesIndexedValLabel))
.addContainerGap(34, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel filesIndexedNameLabel;
private javax.swing.JLabel filesIndexedValLabel;
private javax.swing.JTable hitsTable;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JLabel noHitsLabel;
private javax.swing.JTable nohitsTable;
private javax.swing.JLabel topLabel;
private javax.swing.JLabel withHitsLabel;
// End of variables declaration//GEN-END:variables
@Override
public void componentOpened() {
}
@Override
public void componentClosed() {
}
void writeProperties(java.util.Properties p) {
// better to version settings since initial version as advocated at
// http://wiki.apidesign.org/wiki/PropertyFiles
p.setProperty("version", "1.0");
}
void readProperties(java.util.Properties p) {
}
@Override
public void addSearchButtonListener(ActionListener l) {
}
@Override
public Map<String, Boolean> getQueryList() {
return null;
}
@Override
public String getQueryText() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isLuceneQuerySelected() {
return false;
}
@Override
public boolean isMultiwordQuery() {
return false;
}
@Override
public boolean isRegexQuerySelected() {
return false;
}
@Override
public void setFilesIndexed(int filesIndexed) {
filesIndexedValLabel.setText(Integer.toString(filesIndexed));
}
/**
* tooltips that show text
*/
private static class CellTooltipRenderer extends DefaultTableCellRenderer {
@Override
public Component getTableCellRendererComponent(
JTable table, Object value,
boolean isSelected, boolean hasFocus,
int row, int column) {
if (column == 0) {
String val = (String) table.getModel().getValueAt(row, column);
setToolTipText(val);
setText(val);
} else if (column == 1) {
Integer ival = (Integer) table.getModel().getValueAt(row, column);
String val = Integer.toString(ival);
setToolTipText(val);
setText(val);
}
return this;
}
}
}

View File

@ -50,7 +50,7 @@ public final class KeywordSearchTabsTopComponent extends TopComponent implements
private Logger logger = Logger.getLogger(KeywordSearchTabsTopComponent.class.getName());
private PropertyChangeListener serverChangeListener;
public enum TABS{Simple, List, Lists};
public enum TABS{Simple, List, Lists, History};
public KeywordSearchTabsTopComponent() {
initComponents();
@ -95,6 +95,7 @@ public final class KeywordSearchTabsTopComponent extends TopComponent implements
tabs.addTab(TABS.Simple.name(), null, new KeywordSearchSimpleTopComponent(), "Single keyword or regex search");
tabs.addTab(TABS.List.name(), null, new KeywordSearchListTopComponent(), "Search for or load a saved list of keywords.");
tabs.addTab(TABS.Lists.name(), null, new KeywordSearchListImportExportTopComponent(), "Manage (import, export, delete) lists of keywords.");
//tabs.addTab(TABS.History.name(), null, new KeywordSearchHistoryTopComponent(), "Review keyword search history and saved search results."); //TODO
}
@Override