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