diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AbstractKeywordSearchPerformer.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AbstractKeywordSearchPerformer.java new file mode 100644 index 0000000000..853bd77107 --- /dev/null +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AbstractKeywordSearchPerformer.java @@ -0,0 +1,106 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit 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.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.List; +import org.sleuthkit.autopsy.keywordsearch.KeywordSearch.QueryType; +import org.sleuthkit.autopsy.keywordsearch.KeywordSearchQueryManager.Presentation; + +/** + * + * @author dfickling + */ +abstract class AbstractKeywordSearchPerformer extends javax.swing.JPanel implements KeywordSearchPerformerInterface{ + + int filesIndexed; + + AbstractKeywordSearchPerformer() { + initListeners(); + } + + private void initListeners() { + KeywordSearch.changeSupport.addPropertyChangeListener(KeywordSearch.NUM_FILES_CHANGE_EVT, + new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent evt) { + String changed = evt.getPropertyName(); + Object oldValue = evt.getOldValue(); + Object newValue = evt.getNewValue(); + + if (changed.equals(KeywordSearch.NUM_FILES_CHANGE_EVT)) { + int newFilesIndexed = ((Integer) newValue).intValue(); + filesIndexed = newFilesIndexed; + } + } + }); + } + + @Override + public abstract boolean isMultiwordQuery(); + + @Override + public abstract boolean isLuceneQuerySelected(); + + @Override + public abstract String getQueryText(); + + @Override + public abstract List getQueryList(); + + @Override + public void setFilesIndexed(int filesIndexed) { + this.filesIndexed = filesIndexed; + } + + @Override + public void search() { + KeywordSearchQueryManager man = null; + if (isMultiwordQuery()) { + final List keywords = 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 (isLuceneQuerySelected()) { + queryType = QueryType.WORD; + } else { + queryType = QueryType.REGEX; + } + final String queryText = 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(getQueryText(), queryType, Presentation.COLLAPSE); + } + + if (man.validate()) { + man.execute(); + } else { + KeywordSearchUtil.displayDialog("Keyword Search Error", "Invalid query syntax.", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.ERROR); + } + } + +} diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties index 42e72d79b7..3c7f21cd04 100755 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties @@ -76,3 +76,9 @@ KeywordSearchEditListPanel.deleteListButton.text=Delete List KeywordSearchListsManagementPanel.newListButton.text=New List KeywordSearchEditListPanel.useForIngestCheckbox.text=Use during triage / ingest KeywordSearchListsManagementPanel.importButton.text=Import List +KeywordSearchPanel.searchBox.text=Search... +KeywordSearchPanel.regExCheckboxMenuItem.text=Use Regular Expressions +KeywordSearchPanel.settingsLabel.text= +KeywordSearchPanel.listsButton.text=Watch Lists +KeywordSearchListsViewerPanel.searchAddButton.text=Search +KeywordSearchListsViewerPanel.manageListsButton.text=Manage Lists diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchAction.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchAction.java new file mode 100644 index 0000000000..e05edb48d1 --- /dev/null +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchAction.java @@ -0,0 +1,36 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit 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.ActionEvent; +import javax.swing.AbstractAction; +import org.openide.util.actions.Presenter; + +public final class KeywordSearchAction extends AbstractAction implements Presenter.Toolbar { + + @Override + public void actionPerformed(ActionEvent e) { + } + + @Override + public Component getToolbarPresenter() { + return new KeywordSearchPanel(); + } +} diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.form index 8b6021da8b..aa5854b796 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.form @@ -173,9 +173,6 @@ - - - diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.java index 580aa15d99..fa724f96e4 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.java @@ -92,7 +92,7 @@ public class KeywordSearchEditListPanel extends javax.swing.JPanel implements Li //customize column witdhs final int width = jScrollPane1.getPreferredSize().width; TableColumn column = null; - for (int i = 0; i < 2; i++) { + for (int i = 0; i < keywordTable.getColumnCount(); i++) { column = keywordTable.getColumnModel().getColumn(i); if (i == 0) { column.setPreferredWidth(((int) (width * 0.85))); @@ -140,17 +140,17 @@ public class KeywordSearchEditListPanel extends javax.swing.JPanel implements Li } private void initButtons() { - //initialize save buttons - if(currentKeywordList == null) { - saveListButton.setEnabled(false); - exportButton.setEnabled(false); - deleteListButton.setEnabled(false); - deleteWordButton.setEnabled(false); - } else { - saveListButton.setEnabled(true); - exportButton.setEnabled(true); - deleteListButton.setEnabled(true); - } + //initialize buttons + boolean listSet = (currentKeywordList != null); + addWordButton.setEnabled(listSet); + addWordField.setEnabled(listSet); + chRegex.setEnabled(listSet); + useForIngestCheckbox.setEnabled(listSet); + saveListButton.setEnabled(listSet); + exportButton.setEnabled(listSet); + deleteListButton.setEnabled(listSet); + deleteWordButton.setEnabled(listSet); + if (getAllKeywords().isEmpty()) { saveListButton.setEnabled(false); exportButton.setEnabled(false); @@ -220,11 +220,6 @@ public class KeywordSearchEditListPanel extends javax.swing.JPanel implements Li }); useForIngestCheckbox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.useForIngestCheckbox.text")); // NOI18N - useForIngestCheckbox.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - useForIngestCheckboxActionPerformed(evt); - } - }); addWordButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.addWordButton.text")); // NOI18N addWordButton.addActionListener(new java.awt.event.ActionListener() { @@ -496,12 +491,6 @@ public class KeywordSearchEditListPanel extends javax.swing.JPanel implements Li deleter.deleteList(toDelete); }//GEN-LAST:event_deleteListButtonActionPerformed - private void useForIngestCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useForIngestCheckboxActionPerformed - KeywordSearchListsXML loader = KeywordSearchListsXML.getCurrent(); - KeywordSearchList currentList = loader.getList(currentKeywordList); - currentList.setUseForIngest(useForIngestCheckbox.isSelected()); - }//GEN-LAST:event_useForIngestCheckboxActionPerformed - // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel addKeywordPanel; private javax.swing.JButton addWordButton; @@ -536,6 +525,10 @@ public class KeywordSearchEditListPanel extends javax.swing.JPanel implements Li currentKeywordList = listsPanel.getAllLists().get(index); tableModel.resync(currentKeywordList); initButtons(); + } else { + currentKeywordList = null; + tableModel.deleteAll(); + initButtons(); } } @@ -556,15 +549,17 @@ public class KeywordSearchEditListPanel extends javax.swing.JPanel implements Li KeywordSearchListsXML loader = KeywordSearchListsXML.getCurrent(); KeywordSearchList oldList = loader.getList(currentKeywordList); List oldKeywords = oldList.getKeywords(); + boolean oldIngest = oldList.getUseForIngest(); List newKeywords = getAllKeywords(); + boolean newIngest = useForIngestCheckbox.isSelected(); - if (!oldKeywords.equals(newKeywords)) { + if (!oldKeywords.equals(newKeywords) || oldIngest != newIngest) { /*boolean save = KeywordSearchUtil.displayConfirmDialog("Save List Changes", "Do you want to save the changes you made to list " + currentKeywordList + "?", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);*/ boolean save = true; if (save) { - loader.addList(currentKeywordList, newKeywords); + loader.addList(currentKeywordList, newKeywords, newIngest); } } } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListImportExportTopComponent.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListImportExportTopComponent.java index c4f6d59419..b5ce55a481 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListImportExportTopComponent.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListImportExportTopComponent.java @@ -46,16 +46,16 @@ import org.openide.awt.ActionReference; /** * Top component which displays something. */ -@ConvertAsProperties(dtd = "-//org.sleuthkit.autopsy.keywordsearch//KeywordSearchListImportExport//EN", -autostore = false) -@TopComponent.Description(preferredID = "KeywordSearchListImportExportTopComponent", -//iconBase="SET/PATH/TO/ICON/HERE", -persistenceType = TopComponent.PERSISTENCE_NEVER) -@TopComponent.Registration(mode = "explorer", openAtStartup = false) -@ActionID(category = "Window", id = "org.sleuthkit.autopsy.keywordsearch.KeywordSearchListImportExportTopComponent") -@ActionReference(path = "Menu/Window" /*, position = 333 */) -@TopComponent.OpenActionRegistration(displayName = "#CTL_KeywordSearchListImportExportAction", -preferredID = "KeywordSearchListImportExportTopComponent") +//@ConvertAsProperties(dtd = "-//org.sleuthkit.autopsy.keywordsearch//KeywordSearchListImportExport//EN", +//autostore = false) +//@TopComponent.Description(preferredID = "KeywordSearchListImportExportTopComponent", +////iconBase="SET/PATH/TO/ICON/HERE", +//persistenceType = TopComponent.PERSISTENCE_NEVER) +//@TopComponent.Registration(mode = "explorer", openAtStartup = false) +//@ActionID(category = "Window", id = "org.sleuthkit.autopsy.keywordsearch.KeywordSearchListImportExportTopComponent") +//@ActionReference(path = "Menu/Window" /*, position = 333 */) +//@TopComponent.OpenActionRegistration(displayName = "#CTL_KeywordSearchListImportExportAction", +//preferredID = "KeywordSearchListImportExportTopComponent") public final class KeywordSearchListImportExportTopComponent extends TopComponent { private Logger logger = Logger.getLogger(KeywordSearchListImportExportTopComponent.class.getName()); diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsManagementPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsManagementPanel.java index ea49b707ab..b2b3ea7461 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsManagementPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsManagementPanel.java @@ -41,7 +41,6 @@ import javax.swing.event.ListSelectionListener; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.TableColumn; /** * @@ -97,6 +96,8 @@ public class KeywordSearchListsManagementPanel extends javax.swing.JPanel { tableModel.resync(); if(listsTable.getRowCount() > 0) listsTable.getSelectionModel().setSelectionInterval(0, 0); + else + listsTable.getSelectionModel().clearSelection(); } else if (evt.getPropertyName().equals(KeywordSearchListsXML.ListsEvt.LIST_UPDATED.toString())) { tableModel.resync((String) evt.getNewValue()); //changed list name } @@ -294,35 +295,18 @@ public class KeywordSearchListsManagementPanel extends javax.swing.JPanel { @Override public String getColumnName(int column) { - String colName = null; - switch (column) { - case 0: - colName = "Name"; - break; - default: - ; - - } - return colName; + return "Name"; } @Override public Object getValueAt(int rowIndex, int columnIndex) { - Object ret = null; TableEntry entry = null; //iterate until row Iterator it = listData.iterator(); for (int i = 0; i <= rowIndex; ++i) { entry = it.next(); } - switch (columnIndex) { - case 0: - ret = (Object) entry.name; - break; - default: - break; - } - return ret; + return (Object) entry.name; } @Override diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.form new file mode 100644 index 0000000000..5143f1118c --- /dev/null +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.form @@ -0,0 +1,125 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.java new file mode 100644 index 0000000000..bfb8620f42 --- /dev/null +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsViewerPanel.java @@ -0,0 +1,620 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit 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. + */ + +/* + * KeywordSearchListsViewerPanel.java + * + * Created on Feb 17, 2012, 1:45:38 PM + */ +package org.sleuthkit.autopsy.keywordsearch; + +import java.awt.Cursor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; +import java.util.logging.Logger; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableColumn; +import org.openide.util.actions.SystemAction; +import org.sleuthkit.autopsy.ingest.IngestManager; + +/** + * + * @author dfickling + */ +public class KeywordSearchListsViewerPanel extends AbstractKeywordSearchPerformer { + + private static final Logger logger = Logger.getLogger(KeywordSearchListsViewerPanel.class.getName()); + private static KeywordSearchListsViewerPanel instance; + private KeywordSearchListsXML loader; + private KeywordListsTableModel listsTableModel; + private KeywordsTableModel keywordsTableModel; + private ActionListener ingestListener; + private ActionListener searchListener; + private boolean ingestRunning; + + /** Creates new form KeywordSearchListsViewerPanel */ + private KeywordSearchListsViewerPanel() { + listsTableModel = new KeywordListsTableModel(); + keywordsTableModel = new KeywordsTableModel(); + initComponents(); + customizeComponents(); + } + + public static KeywordSearchListsViewerPanel getDefault() { + if (instance == null) + return new KeywordSearchListsViewerPanel(); + else + return instance; + } + + private void customizeComponents() { + listsTableModel.resync(); + + listsTable.setTableHeader(null); + //customize column witdhs + final int leftWidth = leftPane.getPreferredSize().width; + TableColumn column = null; + for (int i = 0; i < listsTable.getColumnCount(); i++) { + column = listsTable.getColumnModel().getColumn(i); + if (i == 0) { + column.setPreferredWidth(((int) (leftWidth * 0.10))); + } else { + column.setPreferredWidth(((int) (leftWidth * 0.89))); + } + } + final int rightWidth = rightPane.getPreferredSize().width; + for (int i = 0; i < keywordsTable.getColumnCount(); i++) { + column = keywordsTable.getColumnModel().getColumn(i); + if (i == 0) { + column.setPreferredWidth(((int) (rightWidth * 0.84))); + } else { + column.setPreferredWidth(((int) (rightWidth * 0.15))); + } + } + + loader = KeywordSearchListsXML.getCurrent(); + loader.addPropertyChangeListener(new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent evt) { + String changed = evt.getPropertyName(); + Object oldValue = evt.getOldValue(); + Object newValue = evt.getNewValue(); + + if (changed.equals(KeywordSearchListsXML.ListsEvt.LIST_ADDED.toString())) { + listsTableModel.resync(); + } else if (changed.equals(KeywordSearchListsXML.ListsEvt.LIST_DELETED.toString())) { + listsTableModel.resync(); + if(listsTable.getRowCount() > 0) + listsTable.getSelectionModel().setSelectionInterval(0, 0); + else + listsTable.getSelectionModel().clearSelection(); + } else if (changed.equals(KeywordSearchListsXML.ListsEvt.LIST_UPDATED.toString())) { + listsTableModel.resync(); + } + } + }); + listsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + + @Override + public void valueChanged(ListSelectionEvent e) { + ListSelectionModel listSelectionModel = (ListSelectionModel) e.getSource(); + if (!listSelectionModel.isSelectionEmpty()) { + int index = listSelectionModel.getMinSelectionIndex(); + KeywordSearchList list = listsTableModel.getListAt(index); + keywordsTableModel.resync(list); + } else { + keywordsTableModel.deleteAll(); + } + } + }); + ingestListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + addToIngestAction(e); + } + }; + searchListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + searchAction(e); + } + }; + + if(IngestManager.getDefault().isFileIngestRunning()) + initIngest(0); + else + initIngest(1); + + IngestManager.addPropertyChangeListener(new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent evt) { + String changed = evt.getPropertyName(); + Object oldValue = evt.getOldValue(); + if(changed.equals(IngestManager.SERVICE_COMPLETED_EVT) && + ((String) oldValue).equals(KeywordSearchIngestService.MODULE_NAME)) + initIngest(1); + else if(changed.equals(IngestManager.SERVICE_STARTED_EVT) && + ((String) oldValue).equals(KeywordSearchIngestService.MODULE_NAME)) + initIngest(0); + } + + }); + } + + /** + * Initialize this panel depending on whether ingest is running + * @param running + * case 0: ingest running + * case 1: ingest not running + * case 2: ingest completed + * case 3: ingest started + */ + private void initIngest(int running) { + ActionListener[] current = searchAddButton.getActionListeners(); + for(int i = 0; i < current.length; i++) { + if(current[i].equals(ingestListener) || current[i].equals(searchListener)) + searchAddButton.removeActionListener(current[i]); + } + switch (running) { + case 0: + ingestRunning = true; + searchAddButton.setText("Add to Ingest"); + searchAddButton.addActionListener(ingestListener); + listsTableModel.resync(); + break; + case 1: + ingestRunning = false; + searchAddButton.setText("Search"); + searchAddButton.addActionListener(searchListener); + listsTableModel.resync(); + break; + case 2: + ingestRunning = false; + break; + case 3: + ingestRunning = true; + break; + } + } + + /** 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. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jSplitPane1 = new javax.swing.JSplitPane(); + leftPane = new javax.swing.JScrollPane(); + listsTable = new javax.swing.JTable(); + rightPane = new javax.swing.JScrollPane(); + keywordsTable = new javax.swing.JTable(); + manageListsButton = new javax.swing.JButton(); + searchAddButton = new javax.swing.JButton(); + + leftPane.setBackground(new java.awt.Color(204, 204, 204)); + leftPane.setMinimumSize(new java.awt.Dimension(150, 23)); + + listsTable.setBackground(new java.awt.Color(240, 240, 240)); + listsTable.setModel(listsTableModel); + listsTable.setShowHorizontalLines(false); + listsTable.setShowVerticalLines(false); + listsTable.getTableHeader().setReorderingAllowed(false); + leftPane.setViewportView(listsTable); + + jSplitPane1.setLeftComponent(leftPane); + + keywordsTable.setBackground(new java.awt.Color(240, 240, 240)); + keywordsTable.setModel(keywordsTableModel); + keywordsTable.setShowHorizontalLines(false); + keywordsTable.setShowVerticalLines(false); + rightPane.setViewportView(keywordsTable); + + jSplitPane1.setRightComponent(rightPane); + + manageListsButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.manageListsButton.text")); // NOI18N + manageListsButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + manageListsButtonActionPerformed(evt); + } + }); + + searchAddButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchListsViewerPanel.class, "KeywordSearchListsViewerPanel.searchAddButton.text")); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(searchAddButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 220, Short.MAX_VALUE) + .addComponent(manageListsButton) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(manageListsButton) + .addComponent(searchAddButton)) + .addContainerGap()) + ); + }// //GEN-END:initComponents + + private void manageListsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageListsButtonActionPerformed + SystemAction.get(KeywordSearchConfigurationAction.class).performAction(); + }//GEN-LAST:event_manageListsButtonActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JSplitPane jSplitPane1; + private javax.swing.JTable keywordsTable; + private javax.swing.JScrollPane leftPane; + private javax.swing.JTable listsTable; + private javax.swing.JButton manageListsButton; + private javax.swing.JScrollPane rightPane; + private javax.swing.JButton searchAddButton; + // End of variables declaration//GEN-END:variables + + + private void searchAction(ActionEvent e) { + if (filesIndexed == 0) + return; + + setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + try { + search(); + } finally { + setCursor(null); + } + } + + private void addToIngestAction(ActionEvent e) { + //TODO: something + } + + @Override + public List getQueryList() { + List ret = new ArrayList(); + for(KeywordSearchList list : getSelectedLists()) { + ret.addAll(list.getKeywords()); + } + return ret; + } + + private List getSelectedLists() { + return listsTableModel.getSelectedListsL(); + } + + @Override + public boolean isMultiwordQuery() { + return true; + } + + @Override + public boolean isLuceneQuerySelected() { + throw new UnsupportedOperationException("Not supported for multi-word queries."); + } + + @Override + public String getQueryText() { + throw new UnsupportedOperationException("Not supported for multi-word queries."); + } + + void addSearchButtonActionListener(ActionListener al) { + searchAddButton.addActionListener(al); + } + + private class KeywordListsTableModel extends AbstractTableModel { + //data + + private KeywordSearchListsXML listsHandle = KeywordSearchListsXML.getCurrent(); + private Set listData = new TreeSet(); + + @Override + public int getColumnCount() { + return 2; + } + + @Override + public int getRowCount() { + return listData.size(); + } + + @Override + public String getColumnName(int column) { + String ret = null; + switch(column) { + case 0: + ret = "Selected"; + break; + case 1: + ret = "Name"; + break; + default: + break; + } + return ret; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + Object ret = null; + ListTableEntry entry = null; + //iterate until row + Iterator it = listData.iterator(); + for (int i = 0; i <= rowIndex; ++i) { + entry = it.next(); + } + switch (columnIndex) { + case 0: + ret = (Object) entry.selected; + break; + case 1: + ret = (Object) entry.name; + break; + default: + break; + } + return ret; + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + return columnIndex == 0; + } + + @Override + public void setValueAt(Object aValue, int rowIndex, int columnIndex) { + if(columnIndex == 0){ + ListTableEntry entry = null; + Iterator it = listData.iterator(); + for(int i = 0; i <= rowIndex; i++) { + entry = it.next(); + } + if(entry != null) { + entry.selected = (Boolean) aValue; + if(ingestRunning) { + updateUseForIngest(getListAt(rowIndex), (Boolean) aValue); + } + } + + } + } + + @Override + public Class getColumnClass(int c) { + return getValueAt(0, c).getClass(); + } + + private void updateUseForIngest(KeywordSearchList list, boolean selected) { + listsHandle.addList(list.getName(), list.getKeywords(), selected); + } + + List getAllLists() { + List ret = new ArrayList(); + for (ListTableEntry e : listData) { + ret.add(e.name); + } + return ret; + } + + KeywordSearchList getListAt(int rowIndex) { + return listsHandle.getList((String)getValueAt(rowIndex, 1)); + } + + List getSelectedLists() { + List ret = new ArrayList(); + for(ListTableEntry e : listData) { + if(e.selected) + ret.add(e.name); + } + return ret; + } + + List getSelectedListsL() { + List ret = new ArrayList(); + for(String s : getSelectedLists()) { + ret.add(listsHandle.getList(s)); + } + return ret; + } + + boolean listExists(String list) { + List all = getAllLists(); + return all.contains(list); + } + + //resync model from handle, then update table + void resync() { + listData.clear(); + addLists(listsHandle.getListsL()); + fireTableDataChanged(); + } + + //resync single model entry from handle, then update table + void resync(String listName) { + ListTableEntry found = null; + for (ListTableEntry e : listData) { + if (e.name.equals(listName)) { + found = e; + break; + } + } + if (found != null) { + listData.remove(found); + addList(listsHandle.getList(listName)); + } + fireTableDataChanged(); + } + + //add list to the model + private void addList(KeywordSearchList list) { + if (!listExists(list.getName())) { + listData.add(new ListTableEntry(list, ingestRunning)); + } + } + + //add lists to the model + private void addLists(List lists) { + for (KeywordSearchList list : lists) { + if (!listExists(list.getName())) { + listData.add(new ListTableEntry(list, ingestRunning)); + } + } + } + + //single model entry + private class ListTableEntry implements Comparable { + + String name; + Boolean selected; + + ListTableEntry(KeywordSearchList list, boolean ingestRunning) { + this.name = list.getName(); + if(ingestRunning) + this.selected = list.getUseForIngest(); + else + this.selected = false; + } + + @Override + public int compareTo(Object o) { + return this.name.compareTo(((ListTableEntry) o).name); + } + } + } + + private class KeywordsTableModel extends AbstractTableModel { + + Set listData = new TreeSet(); + + @Override + public int getRowCount() { + return listData.size(); + } + + @Override + public int getColumnCount() { + return 2; + } + + @Override + public String getColumnName(int column) { + String ret = null; + switch(column) { + case 0: + ret = "Name"; + break; + case 1: + ret = "RegEx"; + break; + default: + break; + } + return ret; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + Object ret = null; + KeywordTableEntry entry = null; + //iterate until row + Iterator it = listData.iterator(); + for (int i = 0; i <= rowIndex; ++i) { + entry = it.next(); + } + switch (columnIndex) { + case 0: + ret = (Object) entry.name; + break; + case 1: + ret = (Object) entry.regex; + break; + default: + break; + } + return ret; + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + return false; + } + + @Override + public void setValueAt(Object aValue, int rowIndex, int columnIndex) { + } + + @Override + public Class getColumnClass(int c) { + return getValueAt(0, c).getClass(); + } + + void resync(KeywordSearchList list) { + listData.clear(); + for(Keyword k : list.getKeywords()) { + listData.add(new KeywordTableEntry(k)); + } + fireTableDataChanged(); + } + + void deleteAll() { + listData.clear(); + fireTableDataChanged(); + } + + //single model entry + private class KeywordTableEntry implements Comparable { + + String name; + Boolean regex; + + KeywordTableEntry(Keyword keyword) { + this.name = keyword.getQuery(); + this.regex = !keyword.isLiteral(); + } + + @Override + public int compareTo(Object o) { + return this.name.compareTo(((KeywordTableEntry) o).name); + } + } + } + + +} diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsXML.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsXML.java index b3cee85f77..77473e0a21 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsXML.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchListsXML.java @@ -182,8 +182,27 @@ public class KeywordSearchListsXML { * replacing old one if exists with the same name * @param name the name of the new list or list to replace * @param newList list of keywords + * @param useForIngest should this list be used for ingest * @return true if old list was replaced */ + boolean addList(String name, List newList, boolean useForIngest) { + boolean replaced = false; + KeywordSearchList curList = getList(name); + final Date now = new Date(); + if (curList == null) { + theLists.put(name, new KeywordSearchList(name, now, now, useForIngest, newList)); + save(); + changeSupport.firePropertyChange(ListsEvt.LIST_ADDED.toString(), null, name); + } else { + theLists.put(name, new KeywordSearchList(name, curList.getDateCreated(), now, useForIngest, newList)); + save(); + replaced = true; + changeSupport.firePropertyChange(ListsEvt.LIST_UPDATED.toString(), null, name); + } + + return replaced; + } + boolean addList(String name, List newList) { boolean replaced = false; KeywordSearchList curList = getList(name); diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPanel.form new file mode 100644 index 0000000000..9bf87620c2 --- /dev/null +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPanel.form @@ -0,0 +1,171 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPanel.java new file mode 100644 index 0000000000..3486f6f4d0 --- /dev/null +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPanel.java @@ -0,0 +1,312 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit 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. + */ + +/* + * KeywordSearchPanel + * + */ +package org.sleuthkit.autopsy.keywordsearch; + +import java.awt.Color; +import java.awt.Cursor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.MouseEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.SwingUtilities; +import org.apache.solr.client.solrj.SolrServerException; +import org.sleuthkit.autopsy.casemodule.Case; + +/** + * + * @author dfickling + */ +public class KeywordSearchPanel extends AbstractKeywordSearchPerformer{ + + private static final Logger logger = Logger.getLogger(KeywordSearchPanel.class.getName()); + private KeywordPropertyChangeListener listener; + private boolean active = false; + + /** Creates new form KeywordSearchPanel */ + public KeywordSearchPanel() { + initComponents(); + customizeComponents(); + } + + private void customizeComponents() { + + listener = new KeywordPropertyChangeListener(); + + KeywordSearch.getServer().addServerActionListener(listener); + + Case.addPropertyChangeListener(listener); + + searchBox.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + if (searchBox.getText().equals("Search...")) { + searchBox.setText(""); + searchBox.setForeground(Color.BLACK); + } + } + @Override + public void focusLost(FocusEvent e) { + if (searchBox.getText().equals("")) { + resetSearchBox(); + } + } + }); + KeywordSearchListsViewerPanel listsPanel = KeywordSearchListsViewerPanel.getDefault(); + listsPanel.addSearchButtonActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + listsMenu.setVisible(false); + } + + }); + listsMenu.add(listsPanel); + + } + + private void resetSearchBox() { + searchBox.setEditable(true); + searchBox.setText("Search..."); + searchBox.setForeground(Color.LIGHT_GRAY); + regExCheckboxMenuItem.setEnabled(true); + } + + /** 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. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + settingsMenu = new javax.swing.JPopupMenu(); + regExCheckboxMenuItem = new javax.swing.JCheckBoxMenuItem(); + listsMenu = new javax.swing.JPopupMenu(); + searchBoxPanel = new javax.swing.JPanel(); + searchBox = new javax.swing.JTextField(); + settingsLabel = new javax.swing.JLabel(); + listsButton = new javax.swing.JButton(); + + regExCheckboxMenuItem.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.regExCheckboxMenuItem.text")); // NOI18N + settingsMenu.add(regExCheckboxMenuItem); + + setOpaque(false); + setPreferredSize(new java.awt.Dimension(2000, 23)); + + searchBoxPanel.setBorder(new javax.swing.border.LineBorder(java.awt.Color.lightGray, 1, true)); + searchBoxPanel.setPreferredSize(new java.awt.Dimension(255, 18)); + + searchBox.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N + searchBox.setForeground(java.awt.Color.lightGray); + searchBox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.searchBox.text")); // NOI18N + searchBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 3, 4, 1)); + searchBox.setEnabled(false); + searchBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + searchBoxActionPerformed(evt); + } + }); + + settingsLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/search-icon.png"))); // NOI18N + settingsLabel.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.settingsLabel.text")); // NOI18N + settingsLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 2, 1, 2)); + settingsLabel.setMaximumSize(new java.awt.Dimension(23, 20)); + settingsLabel.setMinimumSize(new java.awt.Dimension(23, 20)); + settingsLabel.setPreferredSize(new java.awt.Dimension(23, 20)); + settingsLabel.addMouseListener(new java.awt.event.MouseAdapter() { + public void mousePressed(java.awt.event.MouseEvent evt) { + settingsLabelMousePressed(evt); + } + }); + + javax.swing.GroupLayout searchBoxPanelLayout = new javax.swing.GroupLayout(searchBoxPanel); + searchBoxPanel.setLayout(searchBoxPanelLayout); + searchBoxPanelLayout.setHorizontalGroup( + searchBoxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(searchBoxPanelLayout.createSequentialGroup() + .addComponent(settingsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, 0) + .addComponent(searchBox, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE) + .addGap(3, 3, 3)) + ); + searchBoxPanelLayout.setVerticalGroup( + searchBoxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(searchBoxPanelLayout.createSequentialGroup() + .addGroup(searchBoxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(searchBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(settingsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + listsButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchPanel.class, "KeywordSearchPanel.listsButton.text")); // NOI18N + listsButton.setEnabled(false); + listsButton.addMouseListener(new java.awt.event.MouseAdapter() { + public void mousePressed(java.awt.event.MouseEvent evt) { + listsButtonMousePressed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(1648, Short.MAX_VALUE) + .addComponent(listsButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(searchBoxPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, 0)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(searchBoxPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(listsButton)) + .addGap(0, 0, 0)) + ); + }// //GEN-END:initComponents + + private void searchBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchBoxActionPerformed + if (filesIndexed == 0) + return; + + setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + try { + search(); + } finally { + setCursor(null); + } + }//GEN-LAST:event_searchBoxActionPerformed + + private void settingsLabelMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_settingsLabelMousePressed + maybeShowSettingsPopup(evt); + }//GEN-LAST:event_settingsLabelMousePressed + + private void listsButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listsButtonMousePressed + maybeShowListsPopup(evt); + }//GEN-LAST:event_listsButtonMousePressed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton listsButton; + private javax.swing.JPopupMenu listsMenu; + private javax.swing.JCheckBoxMenuItem regExCheckboxMenuItem; + private javax.swing.JTextField searchBox; + private javax.swing.JPanel searchBoxPanel; + private javax.swing.JLabel settingsLabel; + private javax.swing.JPopupMenu settingsMenu; + // End of variables declaration//GEN-END:variables + + @Override + public String getQueryText() { + return searchBox.getText(); + } + + @Override + public boolean isLuceneQuerySelected() { + return !regExCheckboxMenuItem.isSelected(); + } + + @Override + public boolean isMultiwordQuery() { + return false; + } + + @Override + public List getQueryList() { + throw new UnsupportedOperationException("No list for single-keyword search"); + } + + private class KeywordPropertyChangeListener implements PropertyChangeListener { + + @Override + public void propertyChange(PropertyChangeEvent evt) { + String changed = evt.getPropertyName(); + Object oldValue = evt.getOldValue(); + Object newValue = evt.getNewValue(); + + if (changed.equals(Case.CASE_CURRENT_CASE)) { + if (newValue == null) { + setFields(false); + } else { + setFields(true); + } + } else if (changed.equals(Server.CORE_EVT)) { + final Server.CORE_EVT_STATES state = (Server.CORE_EVT_STATES) newValue; + switch (state) { + case STARTED: + try { + final int numIndexedFiles = KeywordSearch.getServer().getCore().queryNumIndexedFiles(); + KeywordSearch.changeSupport.firePropertyChange(KeywordSearch.NUM_FILES_CHANGE_EVT, null, new Integer(numIndexedFiles)); + //setFilesIndexed(numIndexedFiles); + } catch (SolrServerException se) { + logger.log(Level.SEVERE, "Error executing Solr query, " + se.getMessage()); + } + break; + case STOPPED: + break; + default: + } + } + } + + private void setFields(boolean enabled){ + searchBox.setEnabled(enabled); + regExCheckboxMenuItem.setEnabled(enabled); + settingsLabel.setEnabled(enabled); + listsButton.setEnabled(enabled); + active = enabled; + } + } + + private void maybeShowSettingsPopup (MouseEvent evt) { + if(!active) { + return; + } + if (evt != null && !SwingUtilities.isLeftMouseButton(evt)) { + return; + } + + settingsMenu.show(searchBoxPanel, 0, searchBoxPanel.getHeight()); + } + + private void maybeShowListsPopup (MouseEvent evt) { + if(!active) { + return; + } + if (evt != null && !SwingUtilities.isLeftMouseButton(evt)) { + return; + } + + listsMenu.show(listsButton, listsButton.getWidth()-listsMenu.getWidth(), listsButton.getHeight()); + } +} diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPerformerInterface.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPerformerInterface.java new file mode 100644 index 0000000000..366dba7ef7 --- /dev/null +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchPerformerInterface.java @@ -0,0 +1,37 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit 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.util.List; + + +/** + * common methods for the KeywordSearch performers + * + */ +interface KeywordSearchPerformerInterface { + + boolean isMultiwordQuery(); + boolean isLuceneQuerySelected(); + String getQueryText(); + List getQueryList(); + void setFilesIndexed(int filesIndexed); + void search(); + +} diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/filter-icon.png b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/filter-icon.png new file mode 100644 index 0000000000..a9ca77f107 Binary files /dev/null and b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/filter-icon.png differ diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/layer.xml b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/layer.xml index ad0b007c09..b2bf894094 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/layer.xml +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/layer.xml @@ -17,6 +17,10 @@ + @@ -24,10 +28,18 @@ - + + + + + + + + + diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/search-icon.png b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/search-icon.png new file mode 100644 index 0000000000..73aa08f431 Binary files /dev/null and b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/search-icon.png differ