diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 88de28993b..979d52c648 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -26,11 +26,8 @@ FilesSetRulePanel.messages.invalidNameRegex=The name regular expression is not v FilesSetRulePanel.messages.invalidCharInName=The name cannot contain \\, /, :, *, ?, \", <, or > unless it is a regular expression. FilesSetRulePanel.messages.invalidCharInPath=The path cannot contain \\, :, *, ?, \", <, or > unless it is a regular expression. FilesSetRulePanel.messages.invalidPathRegex=The path regular expression is not valid:\n\n{0} -FilesSetRulePanel.dirsRadioButton.text=Directories -FilesSetRulePanel.filesRadioButton.text=Files InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text=Rule set with name {0} already exists. FilesSetRulePanel.pathSeparatorInfoLabel.text=Use / as path separator -FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories FilesIdentifierIngestJobSettingsPanel.border.title=Select interesting files sets to enable during ingest: FilesSetRulePanel.jLabel1.text=Type: FilesSetRulePanel.jLabel5.text=Enter information about files that you want to find. @@ -64,4 +61,6 @@ InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=Regex FilesSetRulePanel.nameCheck.text=Name Pattern: FilesSetRulePanel.pathCheck.text=Path Pattern: FilesSetRulePanel.mimeCheck.text=MIME Type: -FilesSetRulePanel.fileCheck.text=File Size: +FilesSetRulePanel.filesCheck.text=Files +FilesSetRulePanel.directoriesCheck.text=Directories +FilesSetRulePanel.fileSizeCheck.text=File Size: diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index 146458ca0b..1cc779b485 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -5,10 +5,7 @@ FilesSetPanel.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb FilesSetPanel.messages.filesSetsMustBeNamed=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8\u306f\u540d\u524d\u304c\u5fc5\u8981\u3067\u3059\u3002 FilesSetPanel.nameLabel.text=\u30bb\u30c3\u30c8\u540d\uff1a FilesSetPanel.title=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8 -FilesSetRulePanel.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea FilesSetRulePanel.extensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f -FilesSetRulePanel.filesAndDirsRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea -FilesSetRulePanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb FilesSetRulePanel.fullNameRadioButton.text=\u30d5\u30eb\u30cd\u30fc\u30e0 FilesSetRulePanel.jLabel1.text=\u30bf\u30a4\u30d7*\uff1a FilesSetRulePanel.messages.emptyNameFilter=\u3053\u306e\u30eb\u30fc\u30eb\u306f\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3\u3092\u7279\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form index ba8ac2492b..4c2f046fbb 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form @@ -27,24 +27,24 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -81,7 +81,7 @@ - + @@ -107,9 +107,8 @@ - - - + + @@ -142,7 +141,7 @@ - + @@ -179,45 +178,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -298,9 +258,12 @@ + + + - + @@ -366,14 +329,35 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index 537c67008c..3843a27c14 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -18,8 +18,9 @@ */ package org.sleuthkit.autopsy.modules.interestingitems; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.ArrayList; -import java.util.Enumeration; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -27,7 +28,9 @@ import java.util.SortedSet; import java.util.logging.Level; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import javax.swing.AbstractButton; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JOptionPane; import org.apache.tika.mime.MediaType; import org.apache.tika.mime.MimeTypes; import org.openide.DialogDisplayer; @@ -55,6 +58,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { private static final String SLEUTHKIT_PATH_SEPARATOR = "/"; // NON-NLS private static final List ILLEGAL_FILE_NAME_CHARS = InterestingItemDefsManager.getIllegalFileNameChars(); private static final List ILLEGAL_FILE_PATH_CHARS = InterestingItemDefsManager.getIllegalFilePathChars(); + private JButton okButton; + private JButton cancelButton; /** * Constructs a files set rule panel in create rule mode. @@ -83,7 +88,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * Populates the UI components with default values. */ private void populateComponentsWithDefaultValues() { - this.filesRadioButton.setSelected(true); + this.filesCheck.setSelected(true); this.fullNameRadioButton.setSelected(true); this.equalitySymbolComboBox.setSelectedIndex(2); this.fileSizeComboBox.setSelectedIndex(1); @@ -117,6 +122,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { for (String file : toSort) { mimeTypeComboBox.addItem(file); } + this.setOkButton(); } /** @@ -128,6 +134,55 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.ruleNameTextField.setText(rule.getName()); } + private void setOkButton() { + if (this.okButton != null) { + if (!(this.filesCheck.isSelected() || this.directoriesCheck.isSelected()) + || !(this.fileSizeCheck.isSelected() || this.mimeCheck.isSelected() + || this.nameCheck.isSelected() || this.pathCheck.isSelected())) { + this.okButton.setEnabled(false); + } + else { + this.okButton.setEnabled(true); + } + } + } + + private JOptionPane getOptionPane(JComponent parent) { + JOptionPane pane = null; + if (!(parent instanceof JOptionPane)) { + pane = getOptionPane((JComponent) parent.getParent()); + } else { + pane = (JOptionPane) parent; + } + return pane; + } + + /** + * Sets the buttons for ending the panel + * + * @param ok The ok button + * @param cancel The cancel button + */ + public void setButtons(JButton ok, JButton cancel) { + this.okButton = ok; + this.cancelButton = cancel; + okButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JOptionPane pane = getOptionPane(okButton); + pane.setValue(okButton); + } + }); + cancelButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JOptionPane pane = getOptionPane(cancelButton); + pane.setValue(cancelButton); + } + }); + this.setOkButton(); + } + /** * Populates the UI components that display the meta-type condition for a * rule. @@ -138,13 +193,14 @@ final class FilesSetRulePanel extends javax.swing.JPanel { FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition(); switch (typeCondition.getMetaType()) { case FILES: - this.filesRadioButton.setSelected(true); + this.filesCheck.setSelected(true); break; case DIRECTORIES: - this.dirsRadioButton.setSelected(true); + this.directoriesCheck.setSelected(true); break; case FILES_AND_DIRECTORIES: - this.filesAndDirsRadioButton.setSelected(true); + this.filesCheck.setSelected(true); + this.directoriesCheck.setSelected(true); break; } } @@ -335,9 +391,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * @return A type condition. */ FilesSet.Rule.MetaTypeCondition getMetaTypeCondition() { - if (this.filesRadioButton.isSelected()) { + if (this.filesCheck.isSelected() && !this.directoriesCheck.isSelected()) { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); - } else if (this.dirsRadioButton.isSelected()) { + } else if (this.directoriesCheck.isSelected() && !this.filesCheck.isSelected()) { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES); } else { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES); @@ -407,7 +463,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * state of the UI components in the type button group. */ private void setComponentsForSearchType() { - if (!this.filesRadioButton.isSelected()) { + if (this.directoriesCheck.isSelected()) { this.fullNameRadioButton.setSelected(true); this.extensionRadioButton.setEnabled(false); this.mimeTypeComboBox.setEnabled(false); @@ -416,14 +472,14 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.fileSizeComboBox.setEnabled(false); this.fileSizeSpinner.setEnabled(false); this.fileSizeSpinner.setValue(0); - this.fileCheck.setEnabled(false); - this.fileCheck.setSelected(false); + this.fileSizeCheck.setEnabled(false); + this.fileSizeCheck.setSelected(false); this.mimeCheck.setEnabled(false); this.mimeCheck.setSelected(false); } else { this.extensionRadioButton.setEnabled(true); - this.fileCheck.setEnabled(true); + this.fileSizeCheck.setEnabled(true); this.mimeCheck.setEnabled(true); } } @@ -442,9 +498,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel { ruleNameLabel = new javax.swing.JLabel(); ruleNameTextField = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); - dirsRadioButton = new javax.swing.JRadioButton(); - filesRadioButton = new javax.swing.JRadioButton(); - filesAndDirsRadioButton = new javax.swing.JRadioButton(); nameTextField = new javax.swing.JTextField(); fullNameRadioButton = new javax.swing.JRadioButton(); extensionRadioButton = new javax.swing.JRadioButton(); @@ -460,7 +513,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel { nameCheck = new javax.swing.JCheckBox(); pathCheck = new javax.swing.JCheckBox(); mimeCheck = new javax.swing.JCheckBox(); - fileCheck = new javax.swing.JCheckBox(); + fileSizeCheck = new javax.swing.JCheckBox(); + filesCheck = new javax.swing.JCheckBox(); + directoriesCheck = new javax.swing.JCheckBox(); org.openide.awt.Mnemonics.setLocalizedText(ruleNameLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleNameLabel.text")); // NOI18N @@ -473,30 +528,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel1.text")); // NOI18N - typeButtonGroup.add(dirsRadioButton); - org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.dirsRadioButton.text")); // NOI18N - dirsRadioButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - dirsRadioButtonActionPerformed(evt); - } - }); - - typeButtonGroup.add(filesRadioButton); - org.openide.awt.Mnemonics.setLocalizedText(filesRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesRadioButton.text")); // NOI18N - filesRadioButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - filesRadioButtonActionPerformed(evt); - } - }); - - typeButtonGroup.add(filesAndDirsRadioButton); - org.openide.awt.Mnemonics.setLocalizedText(filesAndDirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesAndDirsRadioButton.text")); // NOI18N - filesAndDirsRadioButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - filesAndDirsRadioButtonActionPerformed(evt); - } - }); - nameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.nameTextField.text")); // NOI18N nameTextField.setEnabled(false); @@ -526,6 +557,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel { mimeTypeComboBox.setEditable(true); mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); mimeTypeComboBox.setEnabled(false); + mimeTypeComboBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + mimeTypeComboBoxActionPerformed(evt); + } + }); equalitySymbolComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); equalitySymbolComboBox.setEnabled(false); @@ -557,10 +593,25 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } }); - org.openide.awt.Mnemonics.setLocalizedText(fileCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.fileCheck.text")); // NOI18N - fileCheck.addActionListener(new java.awt.event.ActionListener() { + org.openide.awt.Mnemonics.setLocalizedText(fileSizeCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.fileSizeCheck.text")); // NOI18N + fileSizeCheck.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - fileCheckActionPerformed(evt); + fileSizeCheckActionPerformed(evt); + } + }); + + filesCheck.setSelected(true); + org.openide.awt.Mnemonics.setLocalizedText(filesCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesCheck.text")); // NOI18N + filesCheck.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + filesCheckActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(directoriesCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.directoriesCheck.text")); // NOI18N + directoriesCheck.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + directoriesCheckActionPerformed(evt); } }); @@ -573,21 +624,20 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addGap(8, 8, 8) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(jLabel1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(filesRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(dirsRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(filesAndDirsRadioButton)) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabel5) - .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(ruleNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1) + .addGap(64, 64, 64) + .addComponent(filesCheck) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(directoriesCheck)) + .addComponent(jLabel5)) + .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(nameCheck) @@ -616,7 +666,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(mimeCheck) - .addComponent(fileCheck)) + .addComponent(fileSizeCheck)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() @@ -635,9 +685,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) - .addComponent(filesRadioButton) - .addComponent(dirsRadioButton) - .addComponent(filesAndDirsRadioButton)) + .addComponent(filesCheck) + .addComponent(directoriesCheck)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -664,7 +713,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addComponent(equalitySymbolComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(fileCheck)) + .addComponent(fileSizeCheck)) .addGap(15, 15, 15) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -673,18 +722,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel { ); }// //GEN-END:initComponents - private void filesAndDirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesAndDirsRadioButtonActionPerformed - setComponentsForSearchType(); - }//GEN-LAST:event_filesAndDirsRadioButtonActionPerformed - - private void dirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioButtonActionPerformed - setComponentsForSearchType(); - }//GEN-LAST:event_dirsRadioButtonActionPerformed - - private void filesRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesRadioButtonActionPerformed - setComponentsForSearchType(); - }//GEN-LAST:event_filesRadioButtonActionPerformed - private void ruleNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ruleNameTextFieldActionPerformed // TODO add your handling code here: }//GEN-LAST:event_ruleNameTextFieldActionPerformed @@ -702,6 +739,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.extensionRadioButton.setEnabled(true); this.nameRegexCheckbox.setEnabled(true); } + this.setOkButton(); }//GEN-LAST:event_nameCheckActionPerformed private void pathCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathCheckActionPerformed @@ -715,6 +753,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.pathRegexCheckBox.setEnabled(true); this.pathSeparatorInfoLabel.setEnabled(true); } + this.setOkButton(); }//GEN-LAST:event_pathCheckActionPerformed private void mimeCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mimeCheckActionPerformed @@ -724,10 +763,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } else { this.mimeTypeComboBox.setEnabled(true); } + this.setOkButton(); }//GEN-LAST:event_mimeCheckActionPerformed - private void fileCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileCheckActionPerformed - if (!this.fileCheck.isSelected()) { + private void fileSizeCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSizeCheckActionPerformed + if (!this.fileSizeCheck.isSelected()) { this.fileSizeComboBox.setEnabled(false); this.fileSizeSpinner.setEnabled(false); this.fileSizeSpinner.setValue(0); @@ -737,22 +777,36 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.fileSizeSpinner.setEnabled(true); this.equalitySymbolComboBox.setEnabled(true); } - }//GEN-LAST:event_fileCheckActionPerformed + this.setOkButton(); + }//GEN-LAST:event_fileSizeCheckActionPerformed + + private void filesCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesCheckActionPerformed + this.setComponentsForSearchType(); + this.setOkButton(); + }//GEN-LAST:event_filesCheckActionPerformed + + private void directoriesCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_directoriesCheckActionPerformed + this.setComponentsForSearchType(); + this.setOkButton(); + }//GEN-LAST:event_directoriesCheckActionPerformed + + private void mimeTypeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mimeTypeComboBoxActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_mimeTypeComboBoxActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JRadioButton dirsRadioButton; + private javax.swing.JCheckBox directoriesCheck; private javax.swing.JComboBox equalitySymbolComboBox; private javax.swing.JRadioButton extensionRadioButton; - private javax.swing.JCheckBox fileCheck; + private javax.swing.JCheckBox fileSizeCheck; private javax.swing.JComboBox fileSizeComboBox; private javax.swing.JSpinner fileSizeSpinner; - private javax.swing.JRadioButton filesAndDirsRadioButton; - private javax.swing.JRadioButton filesRadioButton; + private javax.swing.JCheckBox filesCheck; private javax.swing.JRadioButton fullNameRadioButton; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel5; private javax.swing.JCheckBox mimeCheck; - private javax.swing.JComboBox mimeTypeComboBox; + private javax.swing.JComboBox mimeTypeComboBox; private javax.swing.ButtonGroup nameButtonGroup; private javax.swing.JCheckBox nameCheck; private javax.swing.JCheckBox nameRegexCheckbox; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form index 3a09c7c846..1c099595bd 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form @@ -293,7 +293,6 @@ - diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index c6bacc0bb1..f727ae11f4 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -30,6 +30,7 @@ import java.util.SortedSet; import java.util.TreeMap; import java.util.logging.Level; import javax.swing.DefaultListModel; +import javax.swing.JButton; import javax.swing.JOptionPane; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @@ -43,22 +44,24 @@ import org.apache.tika.mime.MediaType; import org.apache.tika.mime.MimeTypes; import org.sleuthkit.autopsy.coreutils.Logger; - /** * A panel that allows a user to make interesting item definitions. */ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { + @NbBundle.Messages({ - "InterestingItemDefsPanel.bytes=Bytes", - "InterestingItemDefsPanel.kiloBytes=Kilobytes", - "InterestingItemDefsPanel.megaBytes=Megabytes", - "InterestingItemDefsPanel.gigaBytes=Gigabytes" - }) + "InterestingItemDefsPanel.bytes=Bytes", + "InterestingItemDefsPanel.kiloBytes=Kilobytes", + "InterestingItemDefsPanel.megaBytes=Megabytes", + "InterestingItemDefsPanel.gigaBytes=Gigabytes" + }) private static final SortedSet mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes(); private final DefaultListModel setsListModel = new DefaultListModel<>(); private final DefaultListModel rulesListModel = new DefaultListModel<>(); private final Logger logger = Logger.getLogger(InterestingItemDefsPanel.class.getName()); + private JButton okButton = new JButton("OK"); + private JButton cancelButton = new JButton("Cancel"); // The following is a map of interesting files set names to interesting // files set definitions. It is a snapshot of the files set definitions @@ -80,7 +83,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp this.rulesList.setModel(rulesListModel); this.rulesList.addListSelectionListener(new InterestingItemDefsPanel.RulesListSelectionListener()); } - + private void customInit() { Set fileTypesCollated = new HashSet<>(); for (MediaType mediaType : mediaTypes) { @@ -290,8 +293,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * respond to user interactions with the dialog. * * @param selectedSet The currently selected files set, may be null to - * indicate a new interesting files set definition is to - * be created. + * indicate a new interesting files set definition is to be created. */ private void doFileSetsDialog(FilesSet selectedSet) { // Create a files set defintion panle. @@ -338,7 +340,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * dialog box and respond to user interactions with the dialog. * * @param selectedRule The currently selected rule, may be null to indicate - * a new rule definition is to be created. + * a new rule definition is to be created. */ private void doFilesSetRuleDialog(FilesSet.Rule selectedRule) { // Create a files set rule panel. @@ -350,13 +352,13 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // Creating a new rule definition. panel = new FilesSetRulePanel(); } - + panel.setButtons(okButton, cancelButton); // Do a dialog box with the files set panel until the user either enters // a valid definition or cancels. Note that the panel gives the user // feedback when isValidDefinition() is called. int option = JOptionPane.OK_OPTION; do { - option = JOptionPane.showConfirmDialog(null, panel, NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); + option = JOptionPane.showOptionDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{okButton, cancelButton}, okButton); } while (option == JOptionPane.OK_OPTION && !panel.isValidRuleDefinition()); if (option == JOptionPane.OK_OPTION) { @@ -392,13 +394,12 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * owned by this panel. If there is a definition with the same name, it will * be replaced, so this is an add/edit operation. * - * @param oldSet A set to replace, null if the new set is not a - * replacement. - * @param name The name of the files set. - * @param description The description of the files set. + * @param oldSet A set to replace, null if the new set is not a replacement. + * @param name The name of the files set. + * @param description The description of the files set. * @param ignoresKnownFiles Whether or not the files set ignores known - * files. - * @param rules The set membership rules for the set. + * files. + * @param rules The set membership rules for the set. */ void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, Map rules) { if (oldSet != null) { @@ -489,7 +490,6 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp newRuleButton.setFont(newRuleButton.getFont().deriveFont(newRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); newRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(newRuleButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.newRuleButton.text")); // NOI18N - newRuleButton.setEnabled(false); newRuleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newRuleButtonActionPerformed(evt);