Autopsy  4.6.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
FilesSetDefsPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2018 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.modules.interestingitems;
20 
21 import java.awt.EventQueue;
22 import java.io.File;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.HashMap;
26 import java.util.List;
27 import java.util.Map;
28 import java.util.SortedSet;
29 import java.util.TreeMap;
30 import java.util.logging.Level;
31 import javax.swing.DefaultListModel;
32 import javax.swing.JButton;
33 import javax.swing.JFileChooser;
34 import javax.swing.JOptionPane;
35 import javax.swing.event.ListSelectionEvent;
36 import javax.swing.event.ListSelectionListener;
37 import javax.swing.filechooser.FileNameExtensionFilter;
38 import org.netbeans.spi.options.OptionsPanelController;
39 import org.openide.util.NbBundle;
40 import org.openide.windows.WindowManager;
48 
52 public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel {
53 
54  private static final long serialVersionUID = 1L;
55 
56  @NbBundle.Messages({"# {0} - filter name",
57  "# {1} - profile name",
58  "FilesSetDefsPanel.ingest.fileFilterInUseError=The selected file filter, {0}, is being used by a profile, {1}, and cannot be deleted while any profile uses it.",
59  "FilesSetDefsPanel.bytes=Bytes",
60  "FilesSetDefsPanel.kiloBytes=Kilobytes",
61  "FilesSetDefsPanel.megaBytes=Megabytes",
62  "FilesSetDefsPanel.gigaBytes=Gigabytes",
63  "FilesSetDefsPanel.loadError=Error loading interesting files sets from file.",
64  "FilesSetDefsPanel.saveError=Error saving interesting files sets to file.",
65  "FilesSetDefsPanel.interesting.copySetButton.text=Copy Set",
66  "FilesSetDefsPanel.interesting.importSetButton.text=Import Set",
67  "FilesSetDefsPanel.interesting.exportSetButton.text=Export Set"
68  })
69  public static enum PANEL_TYPE {
71  INTERESTING_FILE_SETS
72 
73  }
74  private final DefaultListModel<FilesSet> setsListModel = new DefaultListModel<>();
75  private final DefaultListModel<FilesSet.Rule> rulesListModel = new DefaultListModel<>();
76  private final Logger logger = Logger.getLogger(FilesSetDefsPanel.class.getName());
77  private final JButton okButton = new JButton("OK");
78  private final JButton cancelButton = new JButton("Cancel");
79  private final PANEL_TYPE panelType;
80  private final String filterDialogTitle;
81  private final String ruleDialogTitle;
82  private boolean canBeEnabled = true;
83 
84  // The following is a map of interesting files set names to interesting
85  // files set definitions. It is a snapshot of the files set definitions
86  // obtained from the interesting item definitions manager at the time the
87  // the panel is loaded. When the panel saves or stores its settings, these
88  // definitions, possibly changed, are submitted back to the interesting item
89  // definitions manager. Note that it is a tree map to aid in displaying
90  // files sets in sorted order by name.
91  private TreeMap<String, FilesSet> filesSets;
92 
96  public FilesSetDefsPanel(PANEL_TYPE panelType) {
97  this.panelType = panelType;
98  this.initComponents();
99  this.customInit();
100  this.setsList.setModel(setsListModel);
101  this.setsList.addListSelectionListener(new FilesSetDefsPanel.SetsListSelectionListener());
102  this.rulesList.setModel(rulesListModel);
103  this.rulesList.addListSelectionListener(new FilesSetDefsPanel.RulesListSelectionListener());
104  this.ingestWarningLabel.setVisible(false);
105  if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { //Hide the mimetype settings when this is displaying FileSet rules instead of interesting item rules
106  this.copySetButton.setVisible(false);
107  this.importSetButton.setVisible(false);
108  this.exportSetButton.setVisible(false);
109  this.mimeTypeComboBox.setVisible(false);
110  this.jLabel7.setVisible(false);
111  this.fileSizeUnitComboBox.setVisible(false);
112  this.fileSizeSpinner.setVisible(false);
113  this.filterDialogTitle = "FilesSetPanel.filter.title";
114  this.ruleDialogTitle = "FilesSetPanel.rule.title";
115  this.jLabel8.setVisible(false);
116  this.equalitySignComboBox.setVisible(false);
117  this.ignoreKnownFilesCheckbox.setVisible(false);
118  this.jLabel2.setVisible(false);
119  this.filesRadioButton.setVisible(false);
120  this.dirsRadioButton.setVisible(false);
121  this.allRadioButton.setVisible(false);
122  this.jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.jTextArea1.text")); // NOI18N
123  org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.setsListLabel.text")); // NOI18N
124  org.openide.awt.Mnemonics.setLocalizedText(editSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.editSetButton.text")); // NOI18N
125  org.openide.awt.Mnemonics.setLocalizedText(newSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.newSetButton.text")); // NOI18N
126  org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.deleteSetButton.text")); // NOI18N
127  org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.jLabel6.text")); // NOI18N
128  } else {
129  this.filterDialogTitle = "FilesSetPanel.interesting.title";
130  this.ruleDialogTitle = "FilesSetPanel.interesting.title";
131  this.ingoreUnallocCheckbox.setVisible(false);
132  }
133  }
134 
135  @NbBundle.Messages({"FilesSetDefsPanel.Interesting.Title=Global Interesting Items Settings",
136  "FilesSetDefsPanel.Ingest.Title=File Filter Settings"})
137  private void customInit() {
138  if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) {
139  setName(Bundle.FilesSetDefsPanel_Ingest_Title());
140  } else {
141  setName(Bundle.FilesSetDefsPanel_Interesting_Title());
142  }
143 
144  try {
145  SortedSet<String> detectableMimeTypes = FileTypeDetector.getDetectedTypes();
146  detectableMimeTypes.forEach((type) -> {
147  mimeTypeComboBox.addItem(type);
148  });
150  logger.log(Level.SEVERE, "Unable to get detectable file types", ex);
151  }
152 
153  this.fileSizeUnitComboBox.setSelectedIndex(1);
154  this.equalitySignComboBox.setSelectedIndex(2);
155  }
156 
157  @Override
158  public void saveSettings() {
159  try {
160  if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) {
161  FilesSetsManager.getInstance().setCustomFileIngestFilters(this.filesSets);
162  } else {
163  FilesSetsManager.getInstance().setInterestingFilesSets(this.filesSets);
164  }
165 
167  MessageNotifyUtil.Message.error(Bundle.FilesSetDefsPanel_saveError());
168  logger.log(Level.WARNING, Bundle.FilesSetDefsPanel_saveError(), ex);
169  }
170  }
171 
172  public void enableButtons(boolean isEnabled) {
173  boolean setSelected = (FilesSetDefsPanel.this.setsList.getSelectedValue() != null);
174  boolean ruleSelected = (FilesSetDefsPanel.this.rulesList.getSelectedValue() != null);
175  canBeEnabled = isEnabled;
176  newRuleButton.setEnabled(isEnabled);
177  copySetButton.setEnabled(isEnabled && setSelected);
178  newSetButton.setEnabled(isEnabled);
179  editRuleButton.setEnabled(isEnabled && ruleSelected);
180  editSetButton.setEnabled(isEnabled && setSelected);
181  exportSetButton.setEnabled(setSelected);
182  importSetButton.setEnabled(isEnabled);
183  deleteRuleButton.setEnabled(isEnabled && ruleSelected);
184  deleteSetButton.setEnabled(isEnabled && setSelected);
185  ingestWarningLabel.setVisible(!isEnabled);
186  }
187 
188  @Override
189  public void store() {
190  this.saveSettings();
191  }
192 
193  @Override
194  public void load() {
195  this.resetComponents();
196 
197  try {
198  // Get a working copy of the interesting files set definitions and sort
199  // by set name.
200  if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) {
201  this.filesSets = new TreeMap<>(FilesSetsManager.getInstance().getCustomFileIngestFilters());
202  } else {
203  this.filesSets = new TreeMap<>(FilesSetsManager.getInstance().getInterestingFilesSets());
204  }
205 
207  MessageNotifyUtil.Message.error(Bundle.FilesSetDefsPanel_loadError());
208  logger.log(Level.WARNING, Bundle.FilesSetDefsPanel_loadError(), ex);
209  this.filesSets = new TreeMap<>();
210  }
211 
212  // Populate the list model for the interesting files sets list
213  // component.
214  this.filesSets.values().forEach((set) -> {
215  this.setsListModel.addElement(set);
216  });
217 
218  if (!this.filesSets.isEmpty()) {
219  // Select the first files set by default. The list selections
220  // listeners will then populate the other components.
221  EventQueue.invokeLater(() -> {
222  FilesSetDefsPanel.this.setsList.setSelectedIndex(0);
223  });
224  }
225  }
226 
230  private void resetComponents() {
231  this.resetRuleComponents();
232  this.setsListModel.clear();
233  this.setDescriptionTextArea.setText("");
234  this.ignoreKnownFilesCheckbox.setSelected(true);
235  this.ingoreUnallocCheckbox.setSelected(true);
236  this.newSetButton.setEnabled(true && canBeEnabled);
237  this.editSetButton.setEnabled(false);
238  this.copySetButton.setEnabled(false);
239  this.exportSetButton.setEnabled(false);
240  this.importSetButton.setEnabled(true && canBeEnabled);
241  this.deleteSetButton.setEnabled(false);
242  }
243 
248  private void resetRuleComponents() {
249  this.fileNameTextField.setText("");
250  this.fileNameRadioButton.setSelected(true);
251  this.fileNameRegexCheckbox.setSelected(false);
252  this.filesRadioButton.setSelected(true);
253  this.rulePathConditionTextField.setText("");
254  this.daysIncludedTextField.setText("");
255  this.rulePathConditionRegexCheckBox.setSelected(false);
256  this.mimeTypeComboBox.setSelectedIndex(0);
257  this.equalitySignComboBox.setSelectedIndex(2);
258  this.fileSizeUnitComboBox.setSelectedIndex(1);
259  this.fileSizeSpinner.setValue(0);
260  this.newRuleButton.setEnabled(!this.setsListModel.isEmpty() && canBeEnabled);
261  this.editRuleButton.setEnabled(false);
262  this.deleteRuleButton.setEnabled(false);
263  }
264 
268  private final class SetsListSelectionListener implements ListSelectionListener {
269 
270  @Override
271  public void valueChanged(ListSelectionEvent e) {
272  if (e.getValueIsAdjusting()) {
273  return;
274  }
275  FilesSetDefsPanel.this.rulesListModel.clear();
277  //enable the new button
278  FilesSetDefsPanel.this.newSetButton.setEnabled(canBeEnabled);
279  FilesSetDefsPanel.this.importSetButton.setEnabled(canBeEnabled);
280  // Get the selected interesting files set and populate the set
281  // components.
282  FilesSet selectedSet = FilesSetDefsPanel.this.setsList.getSelectedValue();
283 
284  if (selectedSet != null) {
285  // Populate the components that display the properties of the
286  // selected files set.
287  FilesSetDefsPanel.this.setDescriptionTextArea.setText(selectedSet.getDescription());
288  FilesSetDefsPanel.this.ignoreKnownFilesCheckbox.setSelected(selectedSet.ignoresKnownFiles());
289  FilesSetDefsPanel.this.ingoreUnallocCheckbox.setSelected(selectedSet.ingoresUnallocatedSpace());
290  // Enable the copy, export, edit and delete set buttons.
291  FilesSetDefsPanel.this.editSetButton.setEnabled(canBeEnabled);
292  FilesSetDefsPanel.this.deleteSetButton.setEnabled(canBeEnabled);
293  FilesSetDefsPanel.this.copySetButton.setEnabled(canBeEnabled);
294  FilesSetDefsPanel.this.exportSetButton.setEnabled(true);
295  // Populate the rule definitions list, sorted by name.
296  TreeMap<String, FilesSet.Rule> rules = new TreeMap<>(selectedSet.getRules());
297  rules.values().forEach((rule) -> {
298  FilesSetDefsPanel.this.rulesListModel.addElement(rule);
299  });
300  // Select the first rule by default.
301  if (!FilesSetDefsPanel.this.rulesListModel.isEmpty()) {
302  FilesSetDefsPanel.this.rulesList.setSelectedIndex(0);
303  }
304  }
305  }
306 
307  }
308 
313  private final class RulesListSelectionListener implements ListSelectionListener {
314 
315  @Override
316  public void valueChanged(ListSelectionEvent e) {
317  if (e.getValueIsAdjusting()) {
318  return;
319  }
320 
321  // Get the selected rule and populate the rule components.
322  FilesSet.Rule rule = FilesSetDefsPanel.this.rulesList.getSelectedValue();
323  if (rule != null) {
324  // Get the conditions that make up the rule.
325  FilesSet.Rule.FileNameCondition nameCondition = rule.getFileNameCondition();
326  FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition();
327  FilesSet.Rule.ParentPathCondition pathCondition = rule.getPathCondition();
328  FilesSet.Rule.MimeTypeCondition mimeTypeCondition = rule.getMimeTypeCondition();
329  FilesSet.Rule.FileSizeCondition fileSizeCondition = rule.getFileSizeCondition();
330  FilesSet.Rule.DateCondition dateCondition = rule.getDateCondition();
331  // Populate the components that display the properties of the
332  // selected rule.
333  if (nameCondition != null) {
334  FilesSetDefsPanel.this.fileNameTextField.setText(nameCondition.getTextToMatch());
335  FilesSetDefsPanel.this.fileNameRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.FullNameCondition);
336  FilesSetDefsPanel.this.fileNameExtensionRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.ExtensionCondition);
337  FilesSetDefsPanel.this.fileNameRegexCheckbox.setSelected(nameCondition.isRegex());
338  } else {
339  FilesSetDefsPanel.this.fileNameTextField.setText("");
340  FilesSetDefsPanel.this.fileNameRadioButton.setSelected(true);
341  FilesSetDefsPanel.this.fileNameExtensionRadioButton.setSelected(false);
342  FilesSetDefsPanel.this.fileNameRegexCheckbox.setSelected(false);
343  }
344  switch (typeCondition.getMetaType()) {
345  case FILES:
346  FilesSetDefsPanel.this.filesRadioButton.setSelected(true);
347  break;
348  case DIRECTORIES:
349  FilesSetDefsPanel.this.dirsRadioButton.setSelected(true);
350  break;
351  case FILES_AND_DIRECTORIES:
352  FilesSetDefsPanel.this.allRadioButton.setSelected(true);
353  break;
354  }
355  if (pathCondition != null) {
356  FilesSetDefsPanel.this.rulePathConditionTextField.setText(pathCondition.getTextToMatch());
357  FilesSetDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(pathCondition.isRegex());
358  } else {
360  FilesSetDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(false);
361  }
362  if (mimeTypeCondition != null) {
363  FilesSetDefsPanel.this.mimeTypeComboBox.setSelectedItem(mimeTypeCondition.getMimeType());
364  } else {
365  FilesSetDefsPanel.this.mimeTypeComboBox.setSelectedIndex(0);
366  }
367  if (fileSizeCondition != null) {
368  FilesSetDefsPanel.this.fileSizeUnitComboBox.setSelectedItem(fileSizeCondition.getUnit().getName());
369  FilesSetDefsPanel.this.equalitySignComboBox.setSelectedItem(fileSizeCondition.getComparator().getSymbol());
370  FilesSetDefsPanel.this.fileSizeSpinner.setValue(fileSizeCondition.getSizeValue());
371  } else {
372  FilesSetDefsPanel.this.fileSizeUnitComboBox.setSelectedIndex(1);
373  FilesSetDefsPanel.this.equalitySignComboBox.setSelectedIndex(2);
374  FilesSetDefsPanel.this.fileSizeSpinner.setValue(0);
375  }
376  if (dateCondition != null){
377  FilesSetDefsPanel.this.daysIncludedTextField.setText(Integer.toString(dateCondition.getDaysIncluded()));
378  }
379  else {
380  FilesSetDefsPanel.this.daysIncludedTextField.setText("");
381  }
382  // Enable the new, edit and delete rule buttons.
383  FilesSetDefsPanel.this.newRuleButton.setEnabled(true && canBeEnabled);
384  FilesSetDefsPanel.this.editRuleButton.setEnabled(true && canBeEnabled);
385  FilesSetDefsPanel.this.deleteRuleButton.setEnabled(true && canBeEnabled);
386  } else {
388  }
389  }
390 
391  }
392 
404  private void doFileSetsDialog(FilesSet selectedSet, boolean shouldCreateNew) {
405  // Create a files set defintion panle.
406  FilesSetPanel panel;
407  if (selectedSet != null) {
408  // Editing an existing set definition.
409  panel = new FilesSetPanel(selectedSet, panelType);
410  } else {
411  // Creating a new set definition.
412  panel = new FilesSetPanel(panelType);
413  }
414 
415  // Do a dialog box with the files set panel until the user either enters
416  // a valid definition or cancels. Note that the panel gives the user
417  // feedback when isValidDefinition() is called.
418  int option = JOptionPane.OK_OPTION;
419  do {
420  option = JOptionPane.showConfirmDialog(this, panel, NbBundle.getMessage(FilesSetPanel.class, filterDialogTitle), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
421  } while (option == JOptionPane.OK_OPTION && !panel.isValidDefinition());
422 
423  // While adding new ruleset(selectedSet == null), if rule set with same name already exists, do not add to the filesSets hashMap.
424  // In case of editing an existing ruleset(selectedSet != null), following check is not performed.
425  if (this.filesSets.containsKey(panel.getFilesSetName()) && shouldCreateNew) {
426  MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(),
427  "FilesSetDefsPanel.doFileSetsDialog.duplicateRuleSet.text",
428  panel.getFilesSetName()));
429  return;
430  }
431 
432  if (option == JOptionPane.OK_OPTION) {
433  Map<String, FilesSet.Rule> rules = new HashMap<>();
434  if (selectedSet != null) {
435  // Interesting file sets are immutable for thread safety,
436  // so editing a files set definition is a replacement operation.
437  // Preserve the existing rules from the set being edited.
438  rules.putAll(selectedSet.getRules());
439  }
440  if (shouldCreateNew) {
441  this.replaceFilesSet(null, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), panel.getFileSetIgnoresUnallocatedSpace(), rules);
442  } else {
443  this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), panel.getFileSetIgnoresUnallocatedSpace(), rules);
444  }
445  }
446  }
447 
455  private void doFilesSetRuleDialog(FilesSet.Rule selectedRule) {
456  // Create a files set rule panel.
457  FilesSetRulePanel panel;
458  if (selectedRule != null) {
459  // Editing an existing rule definition.
460  panel = new FilesSetRulePanel(selectedRule, okButton, cancelButton, panelType);
461  } else {
462  // Creating a new rule definition.
463  panel = new FilesSetRulePanel(okButton, cancelButton, panelType);
464  }
465  // Do a dialog box with the files set panel until the user either enters
466  // a valid definition or cancels. Note that the panel gives the user
467  // feedback when isValidDefinition() is called.
468  int option = JOptionPane.OK_OPTION;
469  do {
470  option = JOptionPane.showOptionDialog(this, panel, NbBundle.getMessage(FilesSetPanel.class, ruleDialogTitle), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{okButton, cancelButton}, okButton);
471 
472  } while (option == JOptionPane.OK_OPTION && !panel.isValidRuleDefinition());
473 
474  if (option == JOptionPane.OK_OPTION) {
475  // Interesting file sets are immutable for thread safety,
476  // so editing a files set rule definition is a replacement
477  // operation. Preserve the existing rules from the set being edited.
478  FilesSet selectedSet = this.setsList.getSelectedValue();
479  Map<String, FilesSet.Rule> rules = new HashMap<>(selectedSet.getRules());
480 
481  // Remove the "old" rule definition and add the new/edited
482  // definition.
483  if (selectedRule != null) {
484  rules.remove(selectedRule.getUuid());
485  }
486  FilesSet.Rule newRule = new FilesSet.Rule(panel.getRuleName(), panel.getFileNameCondition(), panel.getMetaTypeCondition(), panel.getPathCondition(), panel.getMimeTypeCondition(), panel.getFileSizeCondition(), panel.getDateCondition());
487  rules.put(newRule.getUuid(), newRule);
488 
489  // Add the new/edited files set definition, replacing any previous
490  // definition with the same name and refreshing the display.
491  this.replaceFilesSet(selectedSet, selectedSet.getName(), selectedSet.getDescription(), selectedSet.ignoresKnownFiles(), selectedSet.ingoresUnallocatedSpace(), rules);
492 
493  // Select the new/edited rule. Queue it up so it happens after the
494  // selection listeners react to the selection of the "new" files
495  // set.
496  EventQueue.invokeLater(() -> {
497  this.rulesList.setSelectedValue(newRule, true);
498  });
499  }
500  }
501 
517  void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, boolean ignoresUnallocatedSpace, Map<String, FilesSet.Rule> rules) {
518  if (oldSet != null) {
519  // Remove the set to be replaced from the working copy if the files
520  // set definitions.
521  this.filesSets.remove(oldSet.getName());
522  }
523 
524  // Make the new/edited set definition and add it to the working copy of
525  // the files set definitions.
526  FilesSet newSet = new FilesSet(name, description, ignoresKnownFiles, ignoresUnallocatedSpace, rules);
527  this.filesSets.put(newSet.getName(), newSet);
528 
529  // Redo the list model for the files set list component, which will make
530  // everything stays sorted as in the working copy tree set.
531  FilesSetDefsPanel.this.setsListModel.clear();
532  this.filesSets.values().forEach((set) -> {
533  this.setsListModel.addElement(set);
534  });
535 
536  // Select the new/edited files set definition in the set definitions
537  // list. This will cause the selection listeners to repopulate the
538  // subordinate components.
539  this.setsList.setSelectedValue(newSet, true);
540  }
541 
547  @SuppressWarnings("unchecked")
548  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
549  private void initComponents() {
550 
551  fileNameButtonGroup = new javax.swing.ButtonGroup();
552  typeButtonGroup = new javax.swing.ButtonGroup();
553  jScrollPane1 = new javax.swing.JScrollPane();
554  jPanel1 = new javax.swing.JPanel();
555  jLabel6 = new javax.swing.JLabel();
556  newRuleButton = new javax.swing.JButton();
557  filesRadioButton = new javax.swing.JRadioButton();
558  editRuleButton = new javax.swing.JButton();
559  rulesListLabel = new javax.swing.JLabel();
560  rulesListScrollPane = new javax.swing.JScrollPane();
561  rulesList = new javax.swing.JList<>();
562  setDescScrollPanel = new javax.swing.JScrollPane();
563  setDescriptionTextArea = new javax.swing.JTextArea();
564  editSetButton = new javax.swing.JButton();
565  setsListScrollPane = new javax.swing.JScrollPane();
566  setsList = new javax.swing.JList<>();
567  fileNameExtensionRadioButton = new javax.swing.JRadioButton();
568  jLabel3 = new javax.swing.JLabel();
569  fileNameTextField = new javax.swing.JTextField();
570  jLabel5 = new javax.swing.JLabel();
571  fileNameRadioButton = new javax.swing.JRadioButton();
572  rulePathConditionTextField = new javax.swing.JTextField();
573  ignoreKnownFilesCheckbox = new javax.swing.JCheckBox();
574  fileNameRegexCheckbox = new javax.swing.JCheckBox();
575  separator = new javax.swing.JSeparator();
576  setsListLabel = new javax.swing.JLabel();
577  allRadioButton = new javax.swing.JRadioButton();
578  deleteSetButton = new javax.swing.JButton();
579  deleteRuleButton = new javax.swing.JButton();
580  newSetButton = new javax.swing.JButton();
581  jLabel2 = new javax.swing.JLabel();
582  dirsRadioButton = new javax.swing.JRadioButton();
583  jLabel1 = new javax.swing.JLabel();
584  jLabel4 = new javax.swing.JLabel();
585  rulePathConditionRegexCheckBox = new javax.swing.JCheckBox();
586  jScrollPane2 = new javax.swing.JScrollPane();
587  jTextArea1 = new javax.swing.JTextArea();
588  jLabel7 = new javax.swing.JLabel();
589  mimeTypeComboBox = new javax.swing.JComboBox<>();
590  jLabel8 = new javax.swing.JLabel();
591  equalitySignComboBox = new javax.swing.JComboBox<String>();
592  fileSizeSpinner = new javax.swing.JSpinner();
593  fileSizeUnitComboBox = new javax.swing.JComboBox<String>();
594  ingoreUnallocCheckbox = new javax.swing.JCheckBox();
595  ingestWarningLabel = new javax.swing.JLabel();
596  copySetButton = new javax.swing.JButton();
597  importSetButton = new javax.swing.JButton();
598  exportSetButton = new javax.swing.JButton();
599  modifiedDateLabel = new javax.swing.JLabel();
600  daysIncludedTextField = new javax.swing.JTextField();
601  daysIncludedLabel = new javax.swing.JLabel();
602 
603  setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD, 11));
604 
605  jScrollPane1.setFont(jScrollPane1.getFont().deriveFont(jScrollPane1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
606 
607  jPanel1.setFont(jPanel1.getFont().deriveFont(jPanel1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
608 
609  jLabel6.setFont(jLabel6.getFont().deriveFont(jLabel6.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
610  org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jLabel6.text")); // NOI18N
611 
612  newRuleButton.setFont(newRuleButton.getFont().deriveFont(newRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
613  newRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N
614  org.openide.awt.Mnemonics.setLocalizedText(newRuleButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.newRuleButton.text")); // NOI18N
615  newRuleButton.addActionListener(new java.awt.event.ActionListener() {
616  public void actionPerformed(java.awt.event.ActionEvent evt) {
618  }
619  });
620 
622  filesRadioButton.setFont(filesRadioButton.getFont().deriveFont(filesRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
623  filesRadioButton.setSelected(true);
624  org.openide.awt.Mnemonics.setLocalizedText(filesRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.filesRadioButton.text")); // NOI18N
625  filesRadioButton.setEnabled(false);
626 
627  editRuleButton.setFont(editRuleButton.getFont().deriveFont(editRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
628  editRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N
629  org.openide.awt.Mnemonics.setLocalizedText(editRuleButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.editRuleButton.text")); // NOI18N
630  editRuleButton.setEnabled(false);
631  editRuleButton.addActionListener(new java.awt.event.ActionListener() {
632  public void actionPerformed(java.awt.event.ActionEvent evt) {
634  }
635  });
636 
637  rulesListLabel.setFont(rulesListLabel.getFont().deriveFont(rulesListLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
638  org.openide.awt.Mnemonics.setLocalizedText(rulesListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.rulesListLabel.text")); // NOI18N
639 
640  rulesListScrollPane.setFont(rulesListScrollPane.getFont().deriveFont(rulesListScrollPane.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
641 
642  rulesList.setFont(rulesList.getFont().deriveFont(rulesList.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
643  rulesList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
644  rulesListScrollPane.setViewportView(rulesList);
645 
646  setDescScrollPanel.setFont(setDescScrollPanel.getFont().deriveFont(setDescScrollPanel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
647  setDescScrollPanel.setMinimumSize(new java.awt.Dimension(10, 22));
648  setDescScrollPanel.setPreferredSize(new java.awt.Dimension(14, 40));
649 
650  setDescriptionTextArea.setEditable(false);
651  setDescriptionTextArea.setBackground(new java.awt.Color(240, 240, 240));
652  setDescriptionTextArea.setColumns(20);
653  setDescriptionTextArea.setFont(setDescriptionTextArea.getFont().deriveFont(setDescriptionTextArea.getFont().getStyle() & ~java.awt.Font.BOLD, 13));
654  setDescriptionTextArea.setLineWrap(true);
655  setDescriptionTextArea.setRows(6);
656  setDescriptionTextArea.setMinimumSize(new java.awt.Dimension(10, 22));
658 
659  editSetButton.setFont(editSetButton.getFont().deriveFont(editSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
660  editSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N
661  org.openide.awt.Mnemonics.setLocalizedText(editSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.editSetButton.text")); // NOI18N
662  editSetButton.setEnabled(false);
663  editSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
664  editSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
665  editSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
666  editSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
667  editSetButton.addActionListener(new java.awt.event.ActionListener() {
668  public void actionPerformed(java.awt.event.ActionEvent evt) {
670  }
671  });
672 
673  setsListScrollPane.setFont(setsListScrollPane.getFont().deriveFont(setsListScrollPane.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
674 
675  setsList.setFont(setsList.getFont().deriveFont(setsList.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
676  setsList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
677  setsListScrollPane.setViewportView(setsList);
678 
680  fileNameExtensionRadioButton.setFont(fileNameExtensionRadioButton.getFont().deriveFont(fileNameExtensionRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
681  org.openide.awt.Mnemonics.setLocalizedText(fileNameExtensionRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameExtensionRadioButton.text")); // NOI18N
682  fileNameExtensionRadioButton.setEnabled(false);
683 
684  jLabel3.setFont(jLabel3.getFont().deriveFont(jLabel3.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
685  org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel3.text")); // NOI18N
686 
687  fileNameTextField.setEditable(false);
688  fileNameTextField.setFont(fileNameTextField.getFont().deriveFont(fileNameTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
689  fileNameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameTextField.text")); // NOI18N
690 
691  jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
692  org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel5.text")); // NOI18N
693 
695  fileNameRadioButton.setFont(fileNameRadioButton.getFont().deriveFont(fileNameRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
696  org.openide.awt.Mnemonics.setLocalizedText(fileNameRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameRadioButton.text")); // NOI18N
697  fileNameRadioButton.setEnabled(false);
698 
699  rulePathConditionTextField.setEditable(false);
700  rulePathConditionTextField.setFont(rulePathConditionTextField.getFont().deriveFont(rulePathConditionTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
701  rulePathConditionTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.rulePathConditionTextField.text")); // NOI18N
702 
703  ignoreKnownFilesCheckbox.setFont(ignoreKnownFilesCheckbox.getFont().deriveFont(ignoreKnownFilesCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
704  org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ignoreKnownFilesCheckbox.text")); // NOI18N
705  ignoreKnownFilesCheckbox.setEnabled(false);
706 
707  fileNameRegexCheckbox.setFont(fileNameRegexCheckbox.getFont().deriveFont(fileNameRegexCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
708  org.openide.awt.Mnemonics.setLocalizedText(fileNameRegexCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameRegexCheckbox.text")); // NOI18N
709  fileNameRegexCheckbox.setEnabled(false);
710  fileNameRegexCheckbox.addActionListener(new java.awt.event.ActionListener() {
711  public void actionPerformed(java.awt.event.ActionEvent evt) {
713  }
714  });
715 
716  separator.setOrientation(javax.swing.SwingConstants.VERTICAL);
717 
718  setsListLabel.setFont(setsListLabel.getFont().deriveFont(setsListLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
719  org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.setsListLabel.text")); // NOI18N
720 
722  allRadioButton.setFont(allRadioButton.getFont().deriveFont(allRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
723  org.openide.awt.Mnemonics.setLocalizedText(allRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.allRadioButton.text")); // NOI18N
724  allRadioButton.setEnabled(false);
725 
726  deleteSetButton.setFont(deleteSetButton.getFont().deriveFont(deleteSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
727  deleteSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N
728  org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.deleteSetButton.text")); // NOI18N
729  deleteSetButton.setEnabled(false);
730  deleteSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
731  deleteSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
732  deleteSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
733  deleteSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
734  deleteSetButton.addActionListener(new java.awt.event.ActionListener() {
735  public void actionPerformed(java.awt.event.ActionEvent evt) {
737  }
738  });
739 
740  deleteRuleButton.setFont(deleteRuleButton.getFont().deriveFont(deleteRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
741  deleteRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N
742  org.openide.awt.Mnemonics.setLocalizedText(deleteRuleButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.deleteRuleButton.text")); // NOI18N
743  deleteRuleButton.setEnabled(false);
744  deleteRuleButton.addActionListener(new java.awt.event.ActionListener() {
745  public void actionPerformed(java.awt.event.ActionEvent evt) {
747  }
748  });
749 
750  newSetButton.setFont(newSetButton.getFont().deriveFont(newSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
751  newSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N
752  org.openide.awt.Mnemonics.setLocalizedText(newSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.newSetButton.text")); // NOI18N
753  newSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
754  newSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
755  newSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
756  newSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
757  newSetButton.addActionListener(new java.awt.event.ActionListener() {
758  public void actionPerformed(java.awt.event.ActionEvent evt) {
760  }
761  });
762 
763  jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
764  org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel2.text")); // NOI18N
765 
767  dirsRadioButton.setFont(dirsRadioButton.getFont().deriveFont(dirsRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
768  org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.dirsRadioButton.text")); // NOI18N
769  dirsRadioButton.setEnabled(false);
770 
771  jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
772  org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel1.text")); // NOI18N
773 
774  jLabel4.setFont(jLabel4.getFont().deriveFont(jLabel4.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
775  org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel4.text")); // NOI18N
776 
777  rulePathConditionRegexCheckBox.setFont(rulePathConditionRegexCheckBox.getFont().deriveFont(rulePathConditionRegexCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
778  org.openide.awt.Mnemonics.setLocalizedText(rulePathConditionRegexCheckBox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.rulePathConditionRegexCheckBox.text")); // NOI18N
779  rulePathConditionRegexCheckBox.setEnabled(false);
780 
781  jScrollPane2.setFont(jScrollPane2.getFont().deriveFont(jScrollPane2.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
782 
783  jTextArea1.setEditable(false);
784  jTextArea1.setBackground(new java.awt.Color(240, 240, 240));
785  jTextArea1.setColumns(20);
786  jTextArea1.setFont(jTextArea1.getFont().deriveFont(jTextArea1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
787  jTextArea1.setLineWrap(true);
788  jTextArea1.setRows(3);
789  jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jTextArea1.text")); // NOI18N
790  jTextArea1.setWrapStyleWord(true);
791  jScrollPane2.setViewportView(jTextArea1);
792 
793  org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel7.text")); // NOI18N
794 
795  mimeTypeComboBox.setBackground(new java.awt.Color(240, 240, 240));
796  mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] {""}));
797  mimeTypeComboBox.setEnabled(false);
798  mimeTypeComboBox.setMinimumSize(new java.awt.Dimension(0, 20));
799  mimeTypeComboBox.setPreferredSize(new java.awt.Dimension(12, 20));
800 
801  org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel8.text")); // NOI18N
802 
803  equalitySignComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "=", ">", "≥", "<", "≤" }));
804  equalitySignComboBox.setEnabled(false);
805 
806  fileSizeSpinner.setEnabled(false);
807  fileSizeSpinner.setMinimumSize(new java.awt.Dimension(2, 20));
808 
809  fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { Bundle.FilesSetDefsPanel_bytes(), Bundle.FilesSetDefsPanel_kiloBytes(), Bundle.FilesSetDefsPanel_megaBytes(), Bundle.FilesSetDefsPanel_gigaBytes() }));
810  fileSizeUnitComboBox.setEnabled(false);
811 
812  org.openide.awt.Mnemonics.setLocalizedText(ingoreUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingoreUnallocCheckbox.text")); // NOI18N
813  ingoreUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingoreUnallocCheckbox.toolTipText")); // NOI18N
814  ingoreUnallocCheckbox.setEnabled(false);
815 
816  ingestWarningLabel.setFont(ingestWarningLabel.getFont().deriveFont(ingestWarningLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
817  ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N
818  org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingestWarningLabel.text")); // NOI18N
819 
820  copySetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/new16.png"))); // NOI18N
821  org.openide.awt.Mnemonics.setLocalizedText(copySetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.copySetButton.text")); // NOI18N
822  copySetButton.setEnabled(false);
823  copySetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
824  copySetButton.setMaximumSize(new java.awt.Dimension(111, 25));
825  copySetButton.setMinimumSize(new java.awt.Dimension(111, 25));
826  copySetButton.setPreferredSize(new java.awt.Dimension(111, 25));
827  copySetButton.addActionListener(new java.awt.event.ActionListener() {
828  public void actionPerformed(java.awt.event.ActionEvent evt) {
830  }
831  });
832 
833  importSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/import16.png"))); // NOI18N
834  org.openide.awt.Mnemonics.setLocalizedText(importSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.importSetButton.text")); // NOI18N
835  importSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
836  importSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
837  importSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
838  importSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
839  importSetButton.addActionListener(new java.awt.event.ActionListener() {
840  public void actionPerformed(java.awt.event.ActionEvent evt) {
842  }
843  });
844 
845  exportSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/export16.png"))); // NOI18N
846  org.openide.awt.Mnemonics.setLocalizedText(exportSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.exportSetButton.text")); // NOI18N
847  exportSetButton.setEnabled(false);
848  exportSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
849  exportSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
850  exportSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
851  exportSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
852  exportSetButton.addActionListener(new java.awt.event.ActionListener() {
853  public void actionPerformed(java.awt.event.ActionEvent evt) {
855  }
856  });
857 
858  org.openide.awt.Mnemonics.setLocalizedText(modifiedDateLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.modifiedDateLabel.text")); // NOI18N
859 
860  daysIncludedTextField.setEditable(false);
861  daysIncludedTextField.setHorizontalAlignment(javax.swing.JTextField.TRAILING);
862  daysIncludedTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.daysIncludedTextField.text")); // NOI18N
863  daysIncludedTextField.setMinimumSize(new java.awt.Dimension(60, 20));
864  daysIncludedTextField.setPreferredSize(new java.awt.Dimension(60, 20));
865 
866  org.openide.awt.Mnemonics.setLocalizedText(daysIncludedLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.daysIncludedLabel.text")); // NOI18N
867  daysIncludedLabel.setEnabled(false);
868 
869  javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
870  jPanel1.setLayout(jPanel1Layout);
871  jPanel1Layout.setHorizontalGroup(
872  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
873  .addGroup(jPanel1Layout.createSequentialGroup()
874  .addContainerGap()
875  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
876  .addGroup(jPanel1Layout.createSequentialGroup()
877  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
878  .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
879  .addComponent(copySetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
880  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
881  .addComponent(importSetButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
882  .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
883  .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
884  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
885  .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
886  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
887  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
888  .addComponent(exportSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
889  .addComponent(deleteSetButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
890  .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE)
891  .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE)
892  .addComponent(setsListLabel))
893  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
894  .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
895  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
896  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
897  .addGroup(jPanel1Layout.createSequentialGroup()
898  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
899  .addComponent(rulesListScrollPane, javax.swing.GroupLayout.Alignment.TRAILING)
900  .addComponent(setDescScrollPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
901  .addGroup(jPanel1Layout.createSequentialGroup()
902  .addGap(16, 16, 16)
903  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
904  .addComponent(jLabel7)
905  .addComponent(jLabel8)
906  .addComponent(jLabel2)
907  .addComponent(jLabel4)
908  .addComponent(modifiedDateLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
909  .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
910  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
911  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
912  .addComponent(rulePathConditionTextField)
913  .addComponent(fileNameTextField, javax.swing.GroupLayout.Alignment.TRAILING)
914  .addComponent(mimeTypeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
915  .addGroup(jPanel1Layout.createSequentialGroup()
916  .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
917  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
918  .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
919  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
920  .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
921  .addGroup(jPanel1Layout.createSequentialGroup()
922  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
923  .addComponent(rulePathConditionRegexCheckBox)
924  .addGroup(jPanel1Layout.createSequentialGroup()
925  .addComponent(daysIncludedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
926  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
927  .addComponent(daysIncludedLabel))
928  .addGroup(jPanel1Layout.createSequentialGroup()
929  .addComponent(filesRadioButton)
930  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
931  .addComponent(dirsRadioButton)
932  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
933  .addComponent(allRadioButton))
934  .addGroup(jPanel1Layout.createSequentialGroup()
935  .addComponent(fileNameRadioButton)
936  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
937  .addComponent(fileNameExtensionRadioButton)
938  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
939  .addComponent(fileNameRegexCheckbox)))
940  .addGap(0, 0, Short.MAX_VALUE)))))
941  .addGap(8, 8, 8))
942  .addGroup(jPanel1Layout.createSequentialGroup()
943  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
944  .addComponent(rulesListLabel)
945  .addGroup(jPanel1Layout.createSequentialGroup()
946  .addComponent(ignoreKnownFilesCheckbox)
947  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
948  .addComponent(ingoreUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
949  .addGroup(jPanel1Layout.createSequentialGroup()
950  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
951  .addComponent(jLabel5)
952  .addComponent(jLabel6))
953  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
954  .addComponent(ingestWarningLabel))
955  .addComponent(jLabel1)
956  .addGroup(jPanel1Layout.createSequentialGroup()
957  .addComponent(newRuleButton)
958  .addGap(18, 18, 18)
959  .addComponent(editRuleButton)
960  .addGap(18, 18, 18)
961  .addComponent(deleteRuleButton)))
962  .addGap(24, 47, Short.MAX_VALUE))))
963  );
964 
965  jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {copySetButton, deleteSetButton, editSetButton, exportSetButton, importSetButton, newSetButton});
966 
967  jPanel1Layout.setVerticalGroup(
968  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
969  .addGroup(jPanel1Layout.createSequentialGroup()
970  .addContainerGap()
971  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
972  .addComponent(separator)
973  .addGroup(jPanel1Layout.createSequentialGroup()
974  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
975  .addGroup(jPanel1Layout.createSequentialGroup()
976  .addComponent(jLabel6)
977  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
978  .addComponent(jLabel5)
979  .addGap(1, 1, 1))
980  .addComponent(ingestWarningLabel, javax.swing.GroupLayout.Alignment.TRAILING))
981  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
982  .addComponent(setDescScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE)
983  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
984  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
985  .addComponent(ignoreKnownFilesCheckbox)
986  .addComponent(ingoreUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
987  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
988  .addComponent(rulesListLabel)
989  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
990  .addComponent(rulesListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
991  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
992  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
993  .addComponent(newRuleButton)
994  .addComponent(editRuleButton)
995  .addComponent(deleteRuleButton))
996  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
997  .addComponent(jLabel1)
998  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
999  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1000  .addComponent(jLabel2)
1001  .addComponent(filesRadioButton)
1002  .addComponent(dirsRadioButton)
1003  .addComponent(allRadioButton))
1004  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1005  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1006  .addComponent(jLabel3)
1007  .addComponent(fileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
1008  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1009  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1010  .addComponent(fileNameRadioButton)
1011  .addComponent(fileNameExtensionRadioButton)
1012  .addComponent(fileNameRegexCheckbox))
1013  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1014  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1015  .addComponent(jLabel4)
1016  .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
1017  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1018  .addComponent(rulePathConditionRegexCheckBox)
1019  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1020  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1021  .addComponent(jLabel7)
1022  .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1023  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1024  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1025  .addComponent(jLabel8)
1026  .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1027  .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1028  .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1029  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1030  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1031  .addComponent(modifiedDateLabel)
1032  .addComponent(daysIncludedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1033  .addComponent(daysIncludedLabel))
1034  .addContainerGap())
1035  .addGroup(jPanel1Layout.createSequentialGroup()
1036  .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1037  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1038  .addComponent(setsListLabel)
1039  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1040  .addComponent(setsListScrollPane)
1041  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1042  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1043  .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1044  .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1045  .addComponent(deleteSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1046  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1047  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1048  .addComponent(copySetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1049  .addComponent(importSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1050  .addComponent(exportSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1051  .addGap(6, 6, 6))))
1052  );
1053 
1054  jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {copySetButton, deleteRuleButton, deleteSetButton, editRuleButton, editSetButton, exportSetButton, importSetButton, newRuleButton, newSetButton});
1055 
1056  jScrollPane1.setViewportView(jPanel1);
1057 
1058  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
1059  this.setLayout(layout);
1060  layout.setHorizontalGroup(
1061  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1062  .addComponent(jScrollPane1)
1063  );
1064  layout.setVerticalGroup(
1065  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1066  .addComponent(jScrollPane1)
1067  );
1068  }// </editor-fold>//GEN-END:initComponents
1069 
1070  private void newSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newSetButtonActionPerformed
1071  this.doFileSetsDialog(null, true);
1072  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1073  }//GEN-LAST:event_newSetButtonActionPerformed
1074 
1075  private void deleteRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteRuleButtonActionPerformed
1076  // Interesting file sets are immutable for thread safety,
1077  // so editing a files set rule definition is a replacement
1078  // operation. Preserve the existing rules from the set being
1079  // edited, except for the deleted rule.
1080  FilesSet oldSet = this.setsList.getSelectedValue();
1081  Map<String, FilesSet.Rule> rules = new HashMap<>(oldSet.getRules());
1082  FilesSet.Rule selectedRule = this.rulesList.getSelectedValue();
1083  rules.remove(selectedRule.getUuid());
1084  this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), oldSet.ingoresUnallocatedSpace(), rules);
1085  if (!this.rulesListModel.isEmpty()) {
1086  this.rulesList.setSelectedIndex(0);
1087  } else {
1088  this.resetRuleComponents();
1089  }
1090  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1091  }//GEN-LAST:event_deleteRuleButtonActionPerformed
1092 
1093  private void deleteSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteSetButtonActionPerformed
1094  FilesSet selectedSet = this.setsList.getSelectedValue();
1095  if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) {
1096  for (IngestProfile profile : IngestProfiles.getIngestProfiles()) {
1097  if (profile.getFileIngestFilter().equals(selectedSet.getName())) {
1098  MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(),
1099  "FilesSetDefsPanel.ingest.fileFilterInUseError",
1100  selectedSet.getName(), profile.toString()));
1101  return;
1102  }
1103  }
1104 
1105  }
1106  this.filesSets.remove(selectedSet.getName());
1107  this.setsListModel.removeElement(selectedSet);
1108  // Select the first of the remaining set definitions. This will cause
1109  // the selection listeners to repopulate the subordinate components.
1110  if (!this.filesSets.isEmpty()) {
1111  this.setsList.setSelectedIndex(0);
1112  } else {
1113  this.resetComponents();
1114  }
1115  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1116  }//GEN-LAST:event_deleteSetButtonActionPerformed
1117 
1118  private void editSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editSetButtonActionPerformed
1119  this.doFileSetsDialog(this.setsList.getSelectedValue(), false);
1120  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1121  }//GEN-LAST:event_editSetButtonActionPerformed
1122 
1123  private void editRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editRuleButtonActionPerformed
1124  this.doFilesSetRuleDialog(this.rulesList.getSelectedValue());
1125  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1126  }//GEN-LAST:event_editRuleButtonActionPerformed
1127 
1128  private void newRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newRuleButtonActionPerformed
1129  this.doFilesSetRuleDialog(null);
1130  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1131  }//GEN-LAST:event_newRuleButtonActionPerformed
1132 
1133  private void copySetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copySetButtonActionPerformed
1134  this.doFileSetsDialog(this.setsList.getSelectedValue(), true);
1135  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1136  }//GEN-LAST:event_copySetButtonActionPerformed
1137  @NbBundle.Messages({
1138  "FilesSetDefsPanel.yesOwMsg=Yes, overwrite",
1139  "FilesSetDefsPanel.noSkipMsg=No, skip",
1140  "FilesSetDefsPanel.cancelImportMsg=Cancel import",
1141  "# {0} - FilesSet name",
1142  "FilesSetDefsPanel.interesting.overwriteSetPrompt=Interesting files set <{0}> already exists locally, overwrite?",
1143  "FilesSetDefsPanel.interesting.importOwConflict=Import Interesting files set conflict",
1144  "FilesSetDefsPanel.interesting.failImportMsg=Interesting files set not imported",
1145  "FilesSetDefsPanel.interesting.fileExtensionFilterLbl=Autopsy Interesting File Set File (xml)",
1146  "FilesSetDefsPanel.interesting.importButtonAction.featureName=Interesting Files Set Import"
1147  })
1148  private void importSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importSetButtonActionPerformed
1149  //save currently selected value as default value to select
1150  FilesSet selectedSet = this.setsList.getSelectedValue();
1151  JFileChooser chooser = new JFileChooser();
1152  final String EXTENSION = "xml"; //NON-NLS
1153  FileNameExtensionFilter autopsyFilter = new FileNameExtensionFilter(
1154  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.fileExtensionFilterLbl"), EXTENSION);
1155  chooser.addChoosableFileFilter(autopsyFilter);
1156  chooser.setAcceptAllFileFilterUsed(false);
1157  chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
1158  int returnVal = chooser.showOpenDialog(this);
1159  if (returnVal == JFileChooser.APPROVE_OPTION) {
1160  File selFile = chooser.getSelectedFile();
1161  if (selFile == null) {
1162  JOptionPane.showMessageDialog(this,
1163  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.failImportMsg"),
1164  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.importButtonAction.featureName"),
1165  JOptionPane.WARNING_MESSAGE);
1166  logger.warning("Selected file was null, when trying to import interesting files set definitions");
1167  return;
1168  }
1169  Collection<FilesSet> importedSets;
1170  try {
1171  importedSets = InterestingItemsFilesSetSettings.readDefinitionsXML(selFile).values(); //read the xml from that path
1172  if (importedSets.isEmpty()) {
1173  throw new FilesSetsManager.FilesSetsManagerException("No Files Sets were read from the xml.");
1174  }
1176  JOptionPane.showMessageDialog(this,
1177  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.failImportMsg"),
1178  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.importButtonAction.featureName"),
1179  JOptionPane.WARNING_MESSAGE);
1180  logger.log(Level.WARNING, "No Interesting files set definitions were read from the selected file, exception", ex);
1181  return;
1182  }
1183  for (FilesSet set : importedSets) {
1184  int choice = JOptionPane.OK_OPTION;
1185  if (filesSets.containsKey(set.getName())) {
1186  Object[] options = {NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.yesOwMsg"),
1187  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.noSkipMsg"),
1188  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.cancelImportMsg")};
1189  choice = JOptionPane.showOptionDialog(this,
1190  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.overwriteSetPrompt", set.getName()),
1191  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.importOwConflict"),
1192  JOptionPane.YES_NO_CANCEL_OPTION,
1193  JOptionPane.QUESTION_MESSAGE,
1194  null,
1195  options,
1196  options[0]);
1197  }
1198  if (choice == JOptionPane.OK_OPTION) {
1199  selectedSet = set;
1200  this.filesSets.put(set.getName(), set);
1201  } else if (choice == JOptionPane.CANCEL_OPTION) {
1202  break;
1203  }
1204  }
1205  // Redo the list model for the files set list component
1206  FilesSetDefsPanel.this.setsListModel.clear();
1207  this.filesSets.values().forEach((set) -> {
1208  this.setsListModel.addElement(set);
1209  });
1210  // Select the new/edited files set definition in the set definitions
1211  // list. This will cause the selection listeners to repopulate the
1212  // subordinate components.
1213  this.setsList.setSelectedValue(selectedSet, true);
1214  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1215  }
1216 
1217  }//GEN-LAST:event_importSetButtonActionPerformed
1218 
1219  @NbBundle.Messages({"FilesSetDefsPanel.interesting.exportButtonAction.featureName=Interesting Files Set Export",
1220  "# {0} - file name",
1221  "FilesSetDefsPanel.exportButtonActionPerformed.fileExistPrompt=File {0} exists, overwrite?",
1222  "FilesSetDefsPanel.interesting.ExportedMsg=Interesting files set exported",
1223  "FilesSetDefsPanel.interesting.failExportMsg=Export of interesting files set failed"})
1224  private void exportSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportSetButtonActionPerformed
1225  //display warning that existing filessets with duplicate names will be overwritten
1226  //create file chooser to get xml filefinal String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
1227  JFileChooser chooser = new JFileChooser();
1228  final String EXTENSION = "xml"; //NON-NLS
1229  FileNameExtensionFilter autopsyFilter = new FileNameExtensionFilter(
1230  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.fileExtensionFilterLbl"), EXTENSION);
1231  chooser.addChoosableFileFilter(autopsyFilter);
1232  chooser.setSelectedFile(new File(this.setsList.getSelectedValue().getName()));
1233  chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
1234  int returnVal = chooser.showSaveDialog(this);
1235  if (returnVal == JFileChooser.APPROVE_OPTION) {
1236  final String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
1237  "FilesSetDefsPanel.interesting.exportButtonAction.featureName");
1238  File selFile = chooser.getSelectedFile();
1239  if (selFile == null) {
1240  JOptionPane.showMessageDialog(this,
1241  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.failExportMsg"),
1242  FEATURE_NAME,
1243  JOptionPane.WARNING_MESSAGE);
1244  logger.warning("Selected file was null, when trying to export interesting files set definitions");
1245  return;
1246  }
1247  //force append extension if not given
1248  String fileAbs = selFile.getAbsolutePath();
1249  if (!fileAbs.endsWith("." + EXTENSION)) {
1250  fileAbs = fileAbs + "." + EXTENSION;
1251  selFile = new File(fileAbs);
1252  }
1253  if (selFile.exists()) {
1254  //if the file already exists ask the user how to proceed
1255  final String FILE_EXISTS_MESSAGE = NbBundle.getMessage(this.getClass(),
1256  "FilesSetDefsPanel.exportButtonActionPerformed.fileExistPrompt", selFile.getName());
1257  boolean shouldWrite = JOptionPane.showConfirmDialog(this, FILE_EXISTS_MESSAGE, FEATURE_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION;
1258  if (!shouldWrite) {
1259  return;
1260  }
1261  }
1262  List<FilesSet> exportSets;
1263  exportSets = new ArrayList<>();
1264  //currently only exports selectedValue
1265  exportSets.add(this.setsList.getSelectedValue());
1266  boolean written = InterestingItemsFilesSetSettings.exportXmlDefinitionsFile(selFile, exportSets);
1267  if (written) {
1268  JOptionPane.showMessageDialog(
1269  WindowManager.getDefault().getMainWindow(),
1270  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.ExportedMsg"),
1271  FEATURE_NAME,
1272  JOptionPane.INFORMATION_MESSAGE);
1273  } else {
1274  JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
1275  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.failExportMsg"),
1276  FEATURE_NAME,
1277  JOptionPane.WARNING_MESSAGE);
1278  logger.warning("Export of interesting files set failed unable to write definitions xml file");
1279  }
1280  }
1281  }//GEN-LAST:event_exportSetButtonActionPerformed
1282 
1283  private void fileNameRegexCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileNameRegexCheckboxActionPerformed
1284  // TODO add your handling code here:
1285  }//GEN-LAST:event_fileNameRegexCheckboxActionPerformed
1286 
1287  // Variables declaration - do not modify//GEN-BEGIN:variables
1288  private javax.swing.JRadioButton allRadioButton;
1289  private javax.swing.JButton copySetButton;
1290  private javax.swing.JLabel daysIncludedLabel;
1291  private javax.swing.JTextField daysIncludedTextField;
1292  private javax.swing.JButton deleteRuleButton;
1293  private javax.swing.JButton deleteSetButton;
1294  private javax.swing.JRadioButton dirsRadioButton;
1295  private javax.swing.JButton editRuleButton;
1296  private javax.swing.JButton editSetButton;
1297  private javax.swing.JComboBox<String> equalitySignComboBox;
1298  private javax.swing.JButton exportSetButton;
1299  private javax.swing.ButtonGroup fileNameButtonGroup;
1300  private javax.swing.JRadioButton fileNameExtensionRadioButton;
1301  private javax.swing.JRadioButton fileNameRadioButton;
1302  private javax.swing.JCheckBox fileNameRegexCheckbox;
1303  private javax.swing.JTextField fileNameTextField;
1304  private javax.swing.JSpinner fileSizeSpinner;
1305  private javax.swing.JComboBox<String> fileSizeUnitComboBox;
1306  private javax.swing.JRadioButton filesRadioButton;
1307  private javax.swing.JCheckBox ignoreKnownFilesCheckbox;
1308  private javax.swing.JButton importSetButton;
1309  private javax.swing.JLabel ingestWarningLabel;
1310  private javax.swing.JCheckBox ingoreUnallocCheckbox;
1311  private javax.swing.JLabel jLabel1;
1312  private javax.swing.JLabel jLabel2;
1313  private javax.swing.JLabel jLabel3;
1314  private javax.swing.JLabel jLabel4;
1315  private javax.swing.JLabel jLabel5;
1316  private javax.swing.JLabel jLabel6;
1317  private javax.swing.JLabel jLabel7;
1318  private javax.swing.JLabel jLabel8;
1319  private javax.swing.JPanel jPanel1;
1320  private javax.swing.JScrollPane jScrollPane1;
1321  private javax.swing.JScrollPane jScrollPane2;
1322  private javax.swing.JTextArea jTextArea1;
1323  private javax.swing.JComboBox<String> mimeTypeComboBox;
1324  private javax.swing.JLabel modifiedDateLabel;
1325  private javax.swing.JButton newRuleButton;
1326  private javax.swing.JButton newSetButton;
1327  private javax.swing.JCheckBox rulePathConditionRegexCheckBox;
1328  private javax.swing.JTextField rulePathConditionTextField;
1329  private javax.swing.JList<FilesSet.Rule> rulesList;
1330  private javax.swing.JLabel rulesListLabel;
1331  private javax.swing.JScrollPane rulesListScrollPane;
1332  private javax.swing.JSeparator separator;
1333  private javax.swing.JScrollPane setDescScrollPanel;
1334  private javax.swing.JTextArea setDescriptionTextArea;
1335  private javax.swing.JList<FilesSet> setsList;
1336  private javax.swing.JLabel setsListLabel;
1337  private javax.swing.JScrollPane setsListScrollPane;
1338  private javax.swing.ButtonGroup typeButtonGroup;
1339  // End of variables declaration//GEN-END:variables
1340 
1341 }
static synchronized List< IngestProfile > getIngestProfiles()
void doFileSetsDialog(FilesSet selectedSet, boolean shouldCreateNew)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124
static synchronized SortedSet< String > getDetectedTypes()

Copyright © 2012-2016 Basis Technology. Generated on: Mon May 7 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.