diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties index 43ba62c3c6..d80c86bd7d 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties @@ -313,3 +313,8 @@ GlobalEditListPanel.keywordDupesSkipped.text={0} keyword was already in the list GlobalEditListPanel.keywordDupesSkippedPlural.text={0} keywords were already in the list. GlobalEditListPanel.keywordErrors.text={0} keyword could not be parsed. Please review and try again. GlobalEditListPanel.keywordErrorsPlural.text={0} keywords could not be parsed. Please review and try again. +GlobalListsManagementPanel.exportButton.text=Export List +GlobalListsManagementPanel.deleteListButton.text=Delete List +GlobalListsManagementPanel.copyListButton.text=Copy List +GlobalListsManagementPanel.jButton1.text=Rename List +GlobalEditListPanel.jButton1.text=Edit keyword diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle_ja.properties b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle_ja.properties index b96be19429..5c68a9fe45 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle_ja.properties +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle_ja.properties @@ -279,3 +279,6 @@ SolrConnectionCheck.Hostname=hostname\u304c\u7121\u52b9\u3067\u3059\u3002 SolrConnectionCheck.Port=\u30dd\u30fc\u30c8\u756a\u53f7\u304c\u7121\u52b9\u3067\u3059\u3002 SolrConnectionCheck.MissingHostname=hostname\u304c\u6b20\u3051\u3066\u307e\u3059\u3002 RawText.getText.error.msg=\u30c6\u30ad\u30b9\u30c8\u3092\u53d6\u5f97\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f +GlobalListsManagementPanel.exportButton.text=\u30ea\u30b9\u30c8\u3092\u30a8\u30af\u30b9\u30dd\u30fc\u30c8 +GlobalListsManagementPanel.deleteListButton.text=\u30ea\u30b9\u30c8\u3092\u524a\u9664 +GlobalListsManagementPanel.copyListButton.text=\u30ea\u30b9\u30c8\u3092\u30b3\u30d4\u30fc diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.form index c43b029272..0f9fe9c8e9 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.form @@ -44,52 +44,34 @@ - - + + - - - - + + + + + - - - - - - - - - - - - - - + - - - - - - - - - - - - - + + + + + + + - + @@ -98,34 +80,17 @@ - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + + - + + + @@ -162,61 +127,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -238,60 +148,42 @@ - + + + + - + + + + - - - - - - - - - - - - + - + - + - + - + - + - - - - - - - - - - - - - diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.java index 8c8262ecdf..9fb450d8cd 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalEditListPanel.java @@ -19,22 +19,17 @@ package org.sleuthkit.autopsy.keywordsearch; import java.awt.EventQueue; -import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.io.File; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.logging.Level; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import javax.swing.JFileChooser; import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumn; import org.netbeans.spi.options.OptionsPanelController; @@ -64,8 +59,6 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis private void customizeComponents() { newKeywordsButton.setToolTipText((NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.addWordToolTip"))); - exportButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.exportToFile")); - saveListButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.saveCurrentWIthNewNameToolTip")); deleteWordButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.removeSelectedMsg")); keywordTable.getParent().setBackground(keywordTable.getBackground()); @@ -118,26 +111,16 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis boolean canEditList = ((isListSelected == true) && (isIngestRunning == false)); ingestMessagesCheckbox.setEnabled(canEditList); ingestMessagesCheckbox.setSelected(currentKeywordList != null && currentKeywordList.getIngestMessages()); - listOptionsLabel.setEnabled(canEditList); - listOptionsSeparator.setEnabled(canEditList); // items that need an unlocked list w/out ingest running boolean isListLocked = ((isListSelected == false) || (currentKeywordList.isEditable())); boolean canAddWord = isListSelected && !isIngestRunning && !isListLocked; newKeywordsButton.setEnabled(canAddWord); - keywordOptionsLabel.setEnabled(canAddWord); - keywordOptionsSeparator.setEnabled(canAddWord); - deleteListButton.setEnabled(canAddWord); + // items that need a non-empty list if ((currentKeywordList == null) || (currentKeywordList.getKeywords().isEmpty())) { - saveListButton.setEnabled(false); - exportButton.setEnabled(false); deleteWordButton.setEnabled(false); - } else { - saveListButton.setEnabled(true); - exportButton.setEnabled(true); - // We do not set deleteWordButton because it will be set by the list select model code when a word is selected. } } @@ -153,18 +136,11 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis listEditorPanel = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); keywordTable = new javax.swing.JTable(); - addKeywordPanel = new javax.swing.JPanel(); - deleteWordButton = new javax.swing.JButton(); - newKeywordsButton = new javax.swing.JButton(); ingestMessagesCheckbox = new javax.swing.JCheckBox(); keywordsLabel = new javax.swing.JLabel(); - keywordOptionsLabel = new javax.swing.JLabel(); - listOptionsLabel = new javax.swing.JLabel(); - keywordOptionsSeparator = new javax.swing.JSeparator(); - listOptionsSeparator = new javax.swing.JSeparator(); - deleteListButton = new javax.swing.JButton(); - saveListButton = new javax.swing.JButton(); - exportButton = new javax.swing.JButton(); + newKeywordsButton = new javax.swing.JButton(); + deleteWordButton = new javax.swing.JButton(); + jButton1 = new javax.swing.JButton(); setMinimumSize(new java.awt.Dimension(0, 0)); @@ -179,42 +155,6 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis keywordTable.getTableHeader().setReorderingAllowed(false); jScrollPane1.setViewportView(keywordTable); - deleteWordButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/delete16.png"))); // NOI18N - deleteWordButton.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.deleteWordButton.text")); // NOI18N - deleteWordButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - deleteWordButtonActionPerformed(evt); - } - }); - - newKeywordsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/new16.png"))); // NOI18N - newKeywordsButton.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.newKeywordsButton.text")); // NOI18N - newKeywordsButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - newKeywordsButtonActionPerformed(evt); - } - }); - - javax.swing.GroupLayout addKeywordPanelLayout = new javax.swing.GroupLayout(addKeywordPanel); - addKeywordPanel.setLayout(addKeywordPanelLayout); - addKeywordPanelLayout.setHorizontalGroup( - addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(addKeywordPanelLayout.createSequentialGroup() - .addComponent(newKeywordsButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(deleteWordButton) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - addKeywordPanelLayout.setVerticalGroup( - addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(addKeywordPanelLayout.createSequentialGroup() - .addGap(0, 0, 0) - .addGroup(addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(deleteWordButton) - .addComponent(newKeywordsButton)) - .addGap(72, 72, 72)) - ); - ingestMessagesCheckbox.setSelected(true); ingestMessagesCheckbox.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.ingestMessagesCheckbox.text")); // NOI18N ingestMessagesCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.ingestMessagesCheckbox.toolTipText")); // NOI18N @@ -226,29 +166,25 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis keywordsLabel.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.keywordsLabel.text")); // NOI18N - keywordOptionsLabel.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.keywordOptionsLabel.text")); // NOI18N - - listOptionsLabel.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.listOptionsLabel.text")); // NOI18N - - deleteListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/delete16.png"))); // NOI18N - deleteListButton.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.deleteListButton.text")); // NOI18N - deleteListButton.addActionListener(new java.awt.event.ActionListener() { + newKeywordsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/new16.png"))); // NOI18N + newKeywordsButton.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.newKeywordsButton.text")); // NOI18N + newKeywordsButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - deleteListButtonActionPerformed(evt); + newKeywordsButtonActionPerformed(evt); } }); - saveListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/save16.png"))); // NOI18N - saveListButton.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.saveListButton.text")); // NOI18N - - exportButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/export16.png"))); // NOI18N - exportButton.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.exportButton.text")); // NOI18N - exportButton.addActionListener(new java.awt.event.ActionListener() { + deleteWordButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/delete16.png"))); // NOI18N + deleteWordButton.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "KeywordSearchEditListPanel.deleteWordButton.text")); // NOI18N + deleteWordButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - exportButtonActionPerformed(evt); + deleteWordButtonActionPerformed(evt); } }); + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/edit16.png"))); // NOI18N + jButton1.setText(org.openide.util.NbBundle.getMessage(GlobalEditListPanel.class, "GlobalEditListPanel.jButton1.text")); // NOI18N + javax.swing.GroupLayout listEditorPanelLayout = new javax.swing.GroupLayout(listEditorPanel); listEditorPanel.setLayout(listEditorPanelLayout); listEditorPanelLayout.setHorizontalGroup( @@ -257,65 +193,42 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis .addContainerGap() .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(listEditorPanelLayout.createSequentialGroup() - .addGap(10, 10, 10) - .addComponent(addKeywordPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(keywordsLabel) + .addGap(0, 0, Short.MAX_VALUE)) .addGroup(listEditorPanelLayout.createSequentialGroup() + .addGap(10, 10, 10) .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(listEditorPanelLayout.createSequentialGroup() - .addComponent(listOptionsLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(listOptionsSeparator)) - .addGroup(listEditorPanelLayout.createSequentialGroup() - .addComponent(keywordOptionsLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(keywordOptionsSeparator)) - .addGroup(listEditorPanelLayout.createSequentialGroup() - .addGap(10, 10, 10) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 482, Short.MAX_VALUE)) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 483, Short.MAX_VALUE) .addGroup(listEditorPanelLayout.createSequentialGroup() .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(keywordsLabel) + .addComponent(ingestMessagesCheckbox) .addGroup(listEditorPanelLayout.createSequentialGroup() - .addGap(10, 10, 10) - .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(ingestMessagesCheckbox) - .addGroup(listEditorPanelLayout.createSequentialGroup() - .addComponent(exportButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(saveListButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(deleteListButton))))) - .addGap(0, 0, Short.MAX_VALUE))) - .addContainerGap()))) + .addComponent(newKeywordsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(14, 14, 14) + .addComponent(deleteWordButton, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(0, 0, Short.MAX_VALUE))))) + .addContainerGap()) ); + + listEditorPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteWordButton, jButton1, newKeywordsButton}); + listEditorPanelLayout.setVerticalGroup( listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, listEditorPanelLayout.createSequentialGroup() .addContainerGap() .addComponent(keywordsLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE) - .addGap(10, 10, 10) - .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(listEditorPanelLayout.createSequentialGroup() - .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(keywordOptionsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(keywordOptionsLabel)) - .addGap(7, 7, 7) - .addComponent(addKeywordPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, 0) - .addComponent(listOptionsLabel)) - .addGroup(listEditorPanelLayout.createSequentialGroup() - .addGap(123, 123, 123) - .addComponent(listOptionsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(ingestMessagesCheckbox) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(listEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(exportButton) - .addComponent(saveListButton) - .addComponent(deleteListButton)) - .addContainerGap()) + .addComponent(deleteWordButton) + .addComponent(newKeywordsButton) + .addComponent(jButton1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(ingestMessagesCheckbox) + .addGap(9, 9, 9)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); @@ -342,57 +255,6 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis } }//GEN-LAST:event_deleteWordButtonActionPerformed - private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed - - final String FEATURE_NAME = NbBundle.getMessage(this.getClass(), - "KeywordSearchEditListPanel.exportButtonAction.featureName.text"); - - JFileChooser chooser = new JFileChooser(); - final String EXTENSION = "xml"; //NON-NLS - FileNameExtensionFilter filter = new FileNameExtensionFilter( - NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel"), EXTENSION); - chooser.setFileFilter(filter); - chooser.setSelectedFile(new File(currentKeywordList.getName())); - chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - - int returnVal = chooser.showSaveDialog(this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - File selFile = chooser.getSelectedFile(); - if (selFile == null) { - return; - } - - //force append extension if not given - String fileAbs = selFile.getAbsolutePath(); - if (!fileAbs.endsWith("." + EXTENSION)) { - fileAbs = fileAbs + "." + EXTENSION; - selFile = new File(fileAbs); - } - - boolean shouldWrite = true; - if (selFile.exists()) { - shouldWrite = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME, - NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt", - selFile.getName()), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN); - } - if (!shouldWrite) { - return; - } - - XmlKeywordSearchList reader = XmlKeywordSearchList.getCurrent(); - - List toWrite = new ArrayList<>(); - toWrite.add(reader.getList(currentKeywordList.getName())); - final XmlKeywordSearchList exporter = new XmlKeywordSearchList(fileAbs); - boolean written = exporter.saveLists(toWrite); - if (written) { - KeywordSearchUtil.displayDialog(FEATURE_NAME, - NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.kwListExportedMsg"), - KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO); - } - } - }//GEN-LAST:event_exportButtonActionPerformed - private void ingestMessagesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ingestMessagesCheckboxActionPerformed currentKeywordList.setIngestMessages(ingestMessagesCheckbox.isSelected()); XmlKeywordSearchList updater = XmlKeywordSearchList.getCurrent(); @@ -400,10 +262,6 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); }//GEN-LAST:event_ingestMessagesCheckboxActionPerformed - private void deleteListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteListButtonActionPerformed - firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); - }//GEN-LAST:event_deleteListButtonActionPerformed - private void newKeywordsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newKeywordsButtonActionPerformed String keywordsToRedisplay = ""; AddKeywordsDialog dialog = new AddKeywordsDialog(); @@ -499,21 +357,14 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis }//GEN-LAST:event_newKeywordsButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel addKeywordPanel; - private javax.swing.JButton deleteListButton; private javax.swing.JButton deleteWordButton; - private javax.swing.JButton exportButton; private javax.swing.JCheckBox ingestMessagesCheckbox; + private javax.swing.JButton jButton1; private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JLabel keywordOptionsLabel; - private javax.swing.JSeparator keywordOptionsSeparator; private javax.swing.JTable keywordTable; private javax.swing.JLabel keywordsLabel; private javax.swing.JPanel listEditorPanel; - private javax.swing.JLabel listOptionsLabel; - private javax.swing.JSeparator listOptionsSeparator; private javax.swing.JButton newKeywordsButton; - private javax.swing.JButton saveListButton; // End of variables declaration//GEN-END:variables @Override @@ -554,14 +405,6 @@ class GlobalEditListPanel extends javax.swing.JPanel implements ListSelectionLis currentKeywordList = list; } - void addDeleteButtonActionPerformed(ActionListener l) { - deleteListButton.addActionListener(l); - } - - void addSaveButtonActionPerformed(ActionListener l) { - saveListButton.addActionListener(l); - } - private class KeywordTableModel extends AbstractTableModel { @Override diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.form index 4ba5f92a52..2984e1a481 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.form @@ -41,13 +41,18 @@ - + + + + + + @@ -57,7 +62,7 @@ - + @@ -82,7 +87,7 @@ - + diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java index bac57fc76d..081fb2f328 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java @@ -41,7 +41,7 @@ final class GlobalListSettingsPanel extends javax.swing.JPanel implements Option private void customizeComponents() { listsManagementPanel.addListSelectionListener(editListPanel); - editListPanel.addDeleteButtonActionPerformed(new ActionListener() { + listsManagementPanel.addDeleteButtonActionPerformed(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (KeywordSearchUtil.displayConfirmDialog(NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel1.customizeComponents.title"), NbBundle.getMessage(this.getClass(), "KeywordSearchConfigurationPanel1.customizeComponents.body"), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN)) { @@ -55,7 +55,7 @@ final class GlobalListSettingsPanel extends javax.swing.JPanel implements Option } }); - editListPanel.addSaveButtonActionPerformed(new ActionListener() { + listsManagementPanel.addSaveButtonActionPerformed(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final String FEATURE_NAME = NbBundle.getMessage(this.getClass(), @@ -159,14 +159,16 @@ final class GlobalListSettingsPanel extends javax.swing.JPanel implements Option rightPanel = new javax.swing.JPanel(); mainSplitPane.setBorder(null); - mainSplitPane.setDividerLocation(275); + mainSplitPane.setDividerLocation(287); mainSplitPane.setDividerSize(1); + leftPanel.setPreferredSize(new java.awt.Dimension(287, 327)); + javax.swing.GroupLayout leftPanelLayout = new javax.swing.GroupLayout(leftPanel); leftPanel.setLayout(leftPanelLayout); leftPanelLayout.setHorizontalGroup( leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 275, Short.MAX_VALUE) + .addGap(0, 287, Short.MAX_VALUE) ); leftPanelLayout.setVerticalGroup( leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -181,7 +183,7 @@ final class GlobalListSettingsPanel extends javax.swing.JPanel implements Option rightPanel.setLayout(rightPanelLayout); rightPanelLayout.setHorizontalGroup( rightPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 397, Short.MAX_VALUE) + .addGap(0, 385, Short.MAX_VALUE) ); rightPanelLayout.setVerticalGroup( rightPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.form index 3bbbe3f390..dd4eadf3e9 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.form @@ -21,17 +21,28 @@ - + - + - - - + + + + + + + + + + + + + + @@ -46,14 +57,21 @@ - - - + + + - - + + + - + + + + + + + @@ -94,6 +112,10 @@ + + + + @@ -107,6 +129,10 @@ + + + + @@ -119,5 +145,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.java index abc9a0bebd..0e18561796 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * + * * Copyright 2011-2016 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. @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.keywordsearch; +import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.io.File; import java.util.ArrayList; @@ -32,6 +33,7 @@ import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.corecomponents.OptionsPanel; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.ingest.IngestManager; /** * A panel to manage all keyword lists created/imported in Autopsy. @@ -56,7 +58,8 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa listsTable.setTableHeader(null); listsTable.setShowHorizontalLines(false); listsTable.setShowVerticalLines(false); - + exportButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.exportToFile")); + copyListButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.customizeComponents.saveCurrentWIthNewNameToolTip")); listsTable.getParent().setBackground(listsTable.getBackground()); listsTable.setCellSelectionEnabled(false); @@ -87,6 +90,38 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa */ } + void addDeleteButtonActionPerformed(ActionListener l) { + deleteListButton.addActionListener(l); + } + + void addSaveButtonActionPerformed(ActionListener l) { + copyListButton.addActionListener(l); + } + + void setButtonStates() { + String currentKeywordList = null; + boolean isIngestRunning = IngestManager.getInstance().isIngestRunning(); + boolean isListSelected = currentKeywordList != null; + + // items that only need a selected list + boolean canEditList = ((isListSelected == true) && (isIngestRunning == false)); + + // items that need an unlocked list w/out ingest running || (currentKeywordList.isEditable()) + boolean isListLocked = ((isListSelected == false)); + boolean canAddWord = isListSelected && !isIngestRunning && !isListLocked; + deleteListButton.setEnabled(canAddWord); + + // items that need a non-empty list|| (currentKeywordList.getKeywords().isEmpty()) + if ((currentKeywordList == null) ) { + copyListButton.setEnabled(false); + exportButton.setEnabled(false); + } else { + copyListButton.setEnabled(true); + exportButton.setEnabled(true); + // We do not set deleteWordButton because it will be set by the list select model code when a word is selected. + } + } + /** * 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 @@ -101,6 +136,10 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa newListButton = new javax.swing.JButton(); importButton = new javax.swing.JButton(); keywordListsLabel = new javax.swing.JLabel(); + exportButton = new javax.swing.JButton(); + copyListButton = new javax.swing.JButton(); + deleteListButton = new javax.swing.JButton(); + jButton1 = new javax.swing.JButton(); setMinimumSize(new java.awt.Dimension(250, 0)); @@ -118,6 +157,8 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa newListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/new16.png"))); // NOI18N newListButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, "GlobalListsManagementPanel.newListButton.text")); // NOI18N + newListButton.setIconTextGap(2); + newListButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); newListButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newListButtonActionPerformed(evt); @@ -126,6 +167,8 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa importButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/import16.png"))); // NOI18N importButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, "GlobalListsManagementPanel.importButton.text")); // NOI18N + importButton.setIconTextGap(2); + importButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); importButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { importButtonActionPerformed(evt); @@ -134,6 +177,41 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa keywordListsLabel.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, "GlobalListsManagementPanel.keywordListsLabel.text")); // NOI18N + exportButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/export16.png"))); // NOI18N + exportButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, "GlobalListsManagementPanel.exportButton.text")); // NOI18N + exportButton.setIconTextGap(2); + exportButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); + exportButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + exportButtonActionPerformed(evt); + } + }); + + copyListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/save16.png"))); // NOI18N + copyListButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, "GlobalListsManagementPanel.copyListButton.text")); // NOI18N + copyListButton.setIconTextGap(2); + copyListButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); + copyListButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + copyListButtonActionPerformed(evt); + } + }); + + deleteListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/delete16.png"))); // NOI18N + deleteListButton.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, "GlobalListsManagementPanel.deleteListButton.text")); // NOI18N + deleteListButton.setIconTextGap(2); + deleteListButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); + deleteListButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + deleteListButtonActionPerformed(evt); + } + }); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/edit16.png"))); // NOI18N + jButton1.setText(org.openide.util.NbBundle.getMessage(GlobalListsManagementPanel.class, "GlobalListsManagementPanel.jButton1.text")); // NOI18N + jButton1.setIconTextGap(2); + jButton1.setMargin(new java.awt.Insets(2, 2, 2, 2)); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -141,30 +219,50 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(keywordListsLabel) .addGroup(layout.createSequentialGroup() - .addComponent(newListButton, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(importButton, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(newListButton, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(copyListButton, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 75, Short.MAX_VALUE) + .addComponent(importButton, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)) + .addGap(6, 6, 6) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(exportButton, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(deleteListButton, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)))) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {copyListButton, deleteListButton, exportButton, importButton, jButton1, newListButton}); + layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addComponent(keywordListsLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 355, Short.MAX_VALUE) - .addGap(5, 5, 5) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 329, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(newListButton) - .addComponent(importButton)) + .addComponent(deleteListButton) + .addComponent(jButton1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(copyListButton) + .addComponent(importButton) + .addComponent(exportButton)) .addContainerGap()) ); + + layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {copyListButton, deleteListButton, exportButton, importButton, jButton1, newListButton}); + }// //GEN-END:initComponents private void newListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newListButtonActionPerformed @@ -321,8 +419,71 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa tableModel.resync(); }//GEN-LAST:event_listsTableKeyPressed + private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed + + final String FEATURE_NAME = NbBundle.getMessage(this.getClass(), + "KeywordSearchEditListPanel.exportButtonAction.featureName.text"); + + JFileChooser chooser = new JFileChooser(); + final String EXTENSION = "xml"; //NON-NLS + FileNameExtensionFilter filter = new FileNameExtensionFilter( + NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.fileFilterLabel"), EXTENSION); + chooser.setFileFilter(filter);//currentKeywordList.getName() + chooser.setSelectedFile(new File("nameWJS-TODO")); + chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + + int returnVal = chooser.showSaveDialog(this); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File selFile = chooser.getSelectedFile(); + if (selFile == null) { + return; + } + + //force append extension if not given + String fileAbs = selFile.getAbsolutePath(); + if (!fileAbs.endsWith("." + EXTENSION)) { + fileAbs = fileAbs + "." + EXTENSION; + selFile = new File(fileAbs); + } + + boolean shouldWrite = true; + if (selFile.exists()) { + shouldWrite = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME, + NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.fileExistPrompt", + selFile.getName()), KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN); + } + if (!shouldWrite) { + return; + } + + XmlKeywordSearchList reader = XmlKeywordSearchList.getCurrent(); + + List toWrite = new ArrayList<>();//currentKeywordList.getName() + toWrite.add(reader.getList("nameWJS-TODO")); + final XmlKeywordSearchList exporter = new XmlKeywordSearchList(fileAbs); + boolean written = exporter.saveLists(toWrite); + if (written) { + KeywordSearchUtil.displayDialog(FEATURE_NAME, + NbBundle.getMessage(this.getClass(), "KeywordSearchEditListPanel.exportButtonActionPerformed.kwListExportedMsg"), + KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO); + } + } + }//GEN-LAST:event_exportButtonActionPerformed + + private void copyListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copyListButtonActionPerformed + firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); + }//GEN-LAST:event_copyListButtonActionPerformed + + private void deleteListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteListButtonActionPerformed + firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); + }//GEN-LAST:event_deleteListButtonActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton copyListButton; + private javax.swing.JButton deleteListButton; + private javax.swing.JButton exportButton; private javax.swing.JButton importButton; + private javax.swing.JButton jButton1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JLabel keywordListsLabel; private javax.swing.JTable listsTable; diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/edit16.png b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/edit16.png new file mode 100644 index 0000000000..7be65127b7 Binary files /dev/null and b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/edit16.png differ