Autopsy  4.9.1
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  setDescriptionTextArea.setOpaque(false);
659  setDescScrollPanel.setViewportView(setDescriptionTextArea);
660 
661  editSetButton.setFont(editSetButton.getFont().deriveFont(editSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
662  editSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N
663  org.openide.awt.Mnemonics.setLocalizedText(editSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.editSetButton.text")); // NOI18N
664  editSetButton.setEnabled(false);
665  editSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
666  editSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
667  editSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
668  editSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
669  editSetButton.addActionListener(new java.awt.event.ActionListener() {
670  public void actionPerformed(java.awt.event.ActionEvent evt) {
671  editSetButtonActionPerformed(evt);
672  }
673  });
674 
675  setsListScrollPane.setFont(setsListScrollPane.getFont().deriveFont(setsListScrollPane.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
676 
677  setsList.setFont(setsList.getFont().deriveFont(setsList.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
678  setsList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
679  setsListScrollPane.setViewportView(setsList);
680 
681  fileNameButtonGroup.add(fileNameExtensionRadioButton);
682  fileNameExtensionRadioButton.setFont(fileNameExtensionRadioButton.getFont().deriveFont(fileNameExtensionRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
683  org.openide.awt.Mnemonics.setLocalizedText(fileNameExtensionRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameExtensionRadioButton.text")); // NOI18N
684  fileNameExtensionRadioButton.setEnabled(false);
685 
686  jLabel3.setFont(jLabel3.getFont().deriveFont(jLabel3.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
687  org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel3.text")); // NOI18N
688 
689  fileNameTextField.setEditable(false);
690  fileNameTextField.setFont(fileNameTextField.getFont().deriveFont(fileNameTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
691  fileNameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameTextField.text")); // NOI18N
692 
693  jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
694  org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel5.text")); // NOI18N
695 
696  fileNameButtonGroup.add(fileNameRadioButton);
697  fileNameRadioButton.setFont(fileNameRadioButton.getFont().deriveFont(fileNameRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
698  org.openide.awt.Mnemonics.setLocalizedText(fileNameRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameRadioButton.text")); // NOI18N
699  fileNameRadioButton.setEnabled(false);
700 
701  rulePathConditionTextField.setEditable(false);
702  rulePathConditionTextField.setFont(rulePathConditionTextField.getFont().deriveFont(rulePathConditionTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
703  rulePathConditionTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.rulePathConditionTextField.text")); // NOI18N
704 
705  ignoreKnownFilesCheckbox.setFont(ignoreKnownFilesCheckbox.getFont().deriveFont(ignoreKnownFilesCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
706  org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ignoreKnownFilesCheckbox.text")); // NOI18N
707  ignoreKnownFilesCheckbox.setEnabled(false);
708 
709  fileNameRegexCheckbox.setFont(fileNameRegexCheckbox.getFont().deriveFont(fileNameRegexCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
710  org.openide.awt.Mnemonics.setLocalizedText(fileNameRegexCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameRegexCheckbox.text")); // NOI18N
711  fileNameRegexCheckbox.setEnabled(false);
712  fileNameRegexCheckbox.addActionListener(new java.awt.event.ActionListener() {
713  public void actionPerformed(java.awt.event.ActionEvent evt) {
714  fileNameRegexCheckboxActionPerformed(evt);
715  }
716  });
717 
718  separator.setOrientation(javax.swing.SwingConstants.VERTICAL);
719 
720  setsListLabel.setFont(setsListLabel.getFont().deriveFont(setsListLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
721  org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.setsListLabel.text")); // NOI18N
722 
723  typeButtonGroup.add(allRadioButton);
724  allRadioButton.setFont(allRadioButton.getFont().deriveFont(allRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
725  org.openide.awt.Mnemonics.setLocalizedText(allRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.allRadioButton.text")); // NOI18N
726  allRadioButton.setEnabled(false);
727 
728  deleteSetButton.setFont(deleteSetButton.getFont().deriveFont(deleteSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
729  deleteSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N
730  org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.deleteSetButton.text")); // NOI18N
731  deleteSetButton.setEnabled(false);
732  deleteSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
733  deleteSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
734  deleteSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
735  deleteSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
736  deleteSetButton.addActionListener(new java.awt.event.ActionListener() {
737  public void actionPerformed(java.awt.event.ActionEvent evt) {
738  deleteSetButtonActionPerformed(evt);
739  }
740  });
741 
742  deleteRuleButton.setFont(deleteRuleButton.getFont().deriveFont(deleteRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
743  deleteRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N
744  org.openide.awt.Mnemonics.setLocalizedText(deleteRuleButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.deleteRuleButton.text")); // NOI18N
745  deleteRuleButton.setEnabled(false);
746  deleteRuleButton.addActionListener(new java.awt.event.ActionListener() {
747  public void actionPerformed(java.awt.event.ActionEvent evt) {
748  deleteRuleButtonActionPerformed(evt);
749  }
750  });
751 
752  newSetButton.setFont(newSetButton.getFont().deriveFont(newSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
753  newSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N
754  org.openide.awt.Mnemonics.setLocalizedText(newSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.newSetButton.text")); // NOI18N
755  newSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
756  newSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
757  newSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
758  newSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
759  newSetButton.addActionListener(new java.awt.event.ActionListener() {
760  public void actionPerformed(java.awt.event.ActionEvent evt) {
761  newSetButtonActionPerformed(evt);
762  }
763  });
764 
765  jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
766  org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel2.text")); // NOI18N
767 
768  typeButtonGroup.add(dirsRadioButton);
769  dirsRadioButton.setFont(dirsRadioButton.getFont().deriveFont(dirsRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
770  org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.dirsRadioButton.text")); // NOI18N
771  dirsRadioButton.setEnabled(false);
772 
773  jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
774  org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel1.text")); // NOI18N
775 
776  jLabel4.setFont(jLabel4.getFont().deriveFont(jLabel4.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
777  org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel4.text")); // NOI18N
778 
779  rulePathConditionRegexCheckBox.setFont(rulePathConditionRegexCheckBox.getFont().deriveFont(rulePathConditionRegexCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
780  org.openide.awt.Mnemonics.setLocalizedText(rulePathConditionRegexCheckBox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.rulePathConditionRegexCheckBox.text")); // NOI18N
781  rulePathConditionRegexCheckBox.setEnabled(false);
782 
783  jScrollPane2.setFont(jScrollPane2.getFont().deriveFont(jScrollPane2.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
784 
785  jTextArea1.setEditable(false);
786  jTextArea1.setBackground(new java.awt.Color(240, 240, 240));
787  jTextArea1.setColumns(20);
788  jTextArea1.setFont(jTextArea1.getFont().deriveFont(jTextArea1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
789  jTextArea1.setLineWrap(true);
790  jTextArea1.setRows(3);
791  jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jTextArea1.text")); // NOI18N
792  jTextArea1.setWrapStyleWord(true);
793  jTextArea1.setOpaque(false);
794  jScrollPane2.setViewportView(jTextArea1);
795 
796  org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel7.text")); // NOI18N
797 
798  mimeTypeComboBox.setBackground(new java.awt.Color(240, 240, 240));
799  mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] {""}));
800  mimeTypeComboBox.setEnabled(false);
801  mimeTypeComboBox.setMinimumSize(new java.awt.Dimension(0, 20));
802  mimeTypeComboBox.setPreferredSize(new java.awt.Dimension(12, 20));
803 
804  org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel8.text")); // NOI18N
805 
806  equalitySignComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "=", ">", "≥", "<", "≤" }));
807  equalitySignComboBox.setEnabled(false);
808 
809  fileSizeSpinner.setEnabled(false);
810  fileSizeSpinner.setMinimumSize(new java.awt.Dimension(2, 20));
811 
812  fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { Bundle.FilesSetDefsPanel_bytes(), Bundle.FilesSetDefsPanel_kiloBytes(), Bundle.FilesSetDefsPanel_megaBytes(), Bundle.FilesSetDefsPanel_gigaBytes() }));
813  fileSizeUnitComboBox.setEnabled(false);
814 
815  org.openide.awt.Mnemonics.setLocalizedText(ingoreUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingoreUnallocCheckbox.text")); // NOI18N
816  ingoreUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingoreUnallocCheckbox.toolTipText")); // NOI18N
817  ingoreUnallocCheckbox.setEnabled(false);
818 
819  ingestWarningLabel.setFont(ingestWarningLabel.getFont().deriveFont(ingestWarningLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
820  ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N
821  org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingestWarningLabel.text")); // NOI18N
822 
823  copySetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/new16.png"))); // NOI18N
824  org.openide.awt.Mnemonics.setLocalizedText(copySetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.copySetButton.text")); // NOI18N
825  copySetButton.setEnabled(false);
826  copySetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
827  copySetButton.setMaximumSize(new java.awt.Dimension(111, 25));
828  copySetButton.setMinimumSize(new java.awt.Dimension(111, 25));
829  copySetButton.setPreferredSize(new java.awt.Dimension(111, 25));
830  copySetButton.addActionListener(new java.awt.event.ActionListener() {
831  public void actionPerformed(java.awt.event.ActionEvent evt) {
832  copySetButtonActionPerformed(evt);
833  }
834  });
835 
836  importSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/import16.png"))); // NOI18N
837  org.openide.awt.Mnemonics.setLocalizedText(importSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.importSetButton.text")); // NOI18N
838  importSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
839  importSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
840  importSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
841  importSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
842  importSetButton.addActionListener(new java.awt.event.ActionListener() {
843  public void actionPerformed(java.awt.event.ActionEvent evt) {
844  importSetButtonActionPerformed(evt);
845  }
846  });
847 
848  exportSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/export16.png"))); // NOI18N
849  org.openide.awt.Mnemonics.setLocalizedText(exportSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.exportSetButton.text")); // NOI18N
850  exportSetButton.setEnabled(false);
851  exportSetButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
852  exportSetButton.setMaximumSize(new java.awt.Dimension(111, 25));
853  exportSetButton.setMinimumSize(new java.awt.Dimension(111, 25));
854  exportSetButton.setPreferredSize(new java.awt.Dimension(111, 25));
855  exportSetButton.addActionListener(new java.awt.event.ActionListener() {
856  public void actionPerformed(java.awt.event.ActionEvent evt) {
857  exportSetButtonActionPerformed(evt);
858  }
859  });
860 
861  org.openide.awt.Mnemonics.setLocalizedText(modifiedDateLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.modifiedDateLabel.text")); // NOI18N
862 
863  daysIncludedTextField.setEditable(false);
864  daysIncludedTextField.setHorizontalAlignment(javax.swing.JTextField.TRAILING);
865  daysIncludedTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.daysIncludedTextField.text")); // NOI18N
866  daysIncludedTextField.setMinimumSize(new java.awt.Dimension(60, 20));
867  daysIncludedTextField.setPreferredSize(new java.awt.Dimension(60, 20));
868 
869  org.openide.awt.Mnemonics.setLocalizedText(daysIncludedLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.daysIncludedLabel.text")); // NOI18N
870  daysIncludedLabel.setEnabled(false);
871 
872  javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
873  jPanel1.setLayout(jPanel1Layout);
874  jPanel1Layout.setHorizontalGroup(
875  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
876  .addGroup(jPanel1Layout.createSequentialGroup()
877  .addContainerGap()
878  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
879  .addGroup(jPanel1Layout.createSequentialGroup()
880  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
881  .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
882  .addComponent(copySetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
883  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
884  .addComponent(importSetButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
885  .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
886  .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
887  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
888  .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
889  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
890  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
891  .addComponent(exportSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
892  .addComponent(deleteSetButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
893  .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE)
894  .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE)
895  .addComponent(setsListLabel))
896  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
897  .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
898  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
899  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
900  .addGroup(jPanel1Layout.createSequentialGroup()
901  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
902  .addComponent(rulesListScrollPane, javax.swing.GroupLayout.Alignment.TRAILING)
903  .addComponent(setDescScrollPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
904  .addGroup(jPanel1Layout.createSequentialGroup()
905  .addGap(16, 16, 16)
906  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
907  .addComponent(jLabel7)
908  .addComponent(jLabel8)
909  .addComponent(jLabel2)
910  .addComponent(jLabel4)
911  .addComponent(modifiedDateLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
912  .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
913  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
914  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
915  .addComponent(rulePathConditionTextField)
916  .addComponent(fileNameTextField, javax.swing.GroupLayout.Alignment.TRAILING)
917  .addComponent(mimeTypeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
918  .addGroup(jPanel1Layout.createSequentialGroup()
919  .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
920  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
921  .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
922  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
923  .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
924  .addGroup(jPanel1Layout.createSequentialGroup()
925  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
926  .addComponent(rulePathConditionRegexCheckBox)
927  .addGroup(jPanel1Layout.createSequentialGroup()
928  .addComponent(daysIncludedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
929  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
930  .addComponent(daysIncludedLabel))
931  .addGroup(jPanel1Layout.createSequentialGroup()
932  .addComponent(filesRadioButton)
933  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
934  .addComponent(dirsRadioButton)
935  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
936  .addComponent(allRadioButton))
937  .addGroup(jPanel1Layout.createSequentialGroup()
938  .addComponent(fileNameRadioButton)
939  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
940  .addComponent(fileNameExtensionRadioButton)
941  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
942  .addComponent(fileNameRegexCheckbox)))
943  .addGap(0, 0, Short.MAX_VALUE)))))
944  .addGap(8, 8, 8))
945  .addGroup(jPanel1Layout.createSequentialGroup()
946  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
947  .addComponent(rulesListLabel)
948  .addGroup(jPanel1Layout.createSequentialGroup()
949  .addComponent(ignoreKnownFilesCheckbox)
950  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
951  .addComponent(ingoreUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
952  .addGroup(jPanel1Layout.createSequentialGroup()
953  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
954  .addComponent(jLabel5)
955  .addComponent(jLabel6))
956  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
957  .addComponent(ingestWarningLabel))
958  .addComponent(jLabel1)
959  .addGroup(jPanel1Layout.createSequentialGroup()
960  .addComponent(newRuleButton)
961  .addGap(18, 18, 18)
962  .addComponent(editRuleButton)
963  .addGap(18, 18, 18)
964  .addComponent(deleteRuleButton)))
965  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
966  );
967 
968  jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {copySetButton, deleteSetButton, editSetButton, exportSetButton, importSetButton, newSetButton});
969 
970  jPanel1Layout.setVerticalGroup(
971  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
972  .addGroup(jPanel1Layout.createSequentialGroup()
973  .addContainerGap()
974  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
975  .addComponent(separator)
976  .addGroup(jPanel1Layout.createSequentialGroup()
977  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
978  .addGroup(jPanel1Layout.createSequentialGroup()
979  .addComponent(jLabel6)
980  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
981  .addComponent(jLabel5)
982  .addGap(1, 1, 1))
983  .addComponent(ingestWarningLabel, javax.swing.GroupLayout.Alignment.TRAILING))
984  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
985  .addComponent(setDescScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE)
986  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
987  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
988  .addComponent(ignoreKnownFilesCheckbox)
989  .addComponent(ingoreUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
990  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
991  .addComponent(rulesListLabel)
992  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
993  .addComponent(rulesListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
994  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
995  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
996  .addComponent(newRuleButton)
997  .addComponent(editRuleButton)
998  .addComponent(deleteRuleButton))
999  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1000  .addComponent(jLabel1)
1001  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1002  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1003  .addComponent(jLabel2)
1004  .addComponent(filesRadioButton)
1005  .addComponent(dirsRadioButton)
1006  .addComponent(allRadioButton))
1007  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1008  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1009  .addComponent(jLabel3)
1010  .addComponent(fileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
1011  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1012  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1013  .addComponent(fileNameRadioButton)
1014  .addComponent(fileNameExtensionRadioButton)
1015  .addComponent(fileNameRegexCheckbox))
1016  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1017  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1018  .addComponent(jLabel4)
1019  .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
1020  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1021  .addComponent(rulePathConditionRegexCheckBox)
1022  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1023  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1024  .addComponent(jLabel7)
1025  .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1026  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1027  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1028  .addComponent(jLabel8)
1029  .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1030  .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1031  .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1032  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1033  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1034  .addComponent(modifiedDateLabel)
1035  .addComponent(daysIncludedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1036  .addComponent(daysIncludedLabel))
1037  .addContainerGap())
1038  .addGroup(jPanel1Layout.createSequentialGroup()
1039  .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1040  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1041  .addComponent(setsListLabel)
1042  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1043  .addComponent(setsListScrollPane)
1044  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1045  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1046  .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1047  .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1048  .addComponent(deleteSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1049  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1050  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1051  .addComponent(copySetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1052  .addComponent(importSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1053  .addComponent(exportSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1054  .addGap(6, 6, 6))))
1055  );
1056 
1057  jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {copySetButton, deleteRuleButton, deleteSetButton, editRuleButton, editSetButton, exportSetButton, importSetButton, newRuleButton, newSetButton});
1058 
1059  jScrollPane1.setViewportView(jPanel1);
1060 
1061  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
1062  this.setLayout(layout);
1063  layout.setHorizontalGroup(
1064  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1065  .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE)
1066  );
1067  layout.setVerticalGroup(
1068  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1069  .addComponent(jScrollPane1)
1070  );
1071  }// </editor-fold>//GEN-END:initComponents
1072 
1073  private void newSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newSetButtonActionPerformed
1074  this.doFileSetsDialog(null, true);
1075  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1076  }//GEN-LAST:event_newSetButtonActionPerformed
1077 
1078  private void deleteRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteRuleButtonActionPerformed
1079  // Interesting file sets are immutable for thread safety,
1080  // so editing a files set rule definition is a replacement
1081  // operation. Preserve the existing rules from the set being
1082  // edited, except for the deleted rule.
1083  FilesSet oldSet = this.setsList.getSelectedValue();
1084  Map<String, FilesSet.Rule> rules = new HashMap<>(oldSet.getRules());
1085  FilesSet.Rule selectedRule = this.rulesList.getSelectedValue();
1086  rules.remove(selectedRule.getUuid());
1087  this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), oldSet.ingoresUnallocatedSpace(), rules);
1088  if (!this.rulesListModel.isEmpty()) {
1089  this.rulesList.setSelectedIndex(0);
1090  } else {
1091  this.resetRuleComponents();
1092  }
1093  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1094  }//GEN-LAST:event_deleteRuleButtonActionPerformed
1095 
1096  private void deleteSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteSetButtonActionPerformed
1097  FilesSet selectedSet = this.setsList.getSelectedValue();
1098  if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) {
1099  for (IngestProfile profile : IngestProfiles.getIngestProfiles()) {
1100  if (profile.getFileIngestFilter().equals(selectedSet.getName())) {
1101  MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(),
1102  "FilesSetDefsPanel.ingest.fileFilterInUseError",
1103  selectedSet.getName(), profile.toString()));
1104  return;
1105  }
1106  }
1107 
1108  }
1109  this.filesSets.remove(selectedSet.getName());
1110  this.setsListModel.removeElement(selectedSet);
1111  // Select the first of the remaining set definitions. This will cause
1112  // the selection listeners to repopulate the subordinate components.
1113  if (!this.filesSets.isEmpty()) {
1114  this.setsList.setSelectedIndex(0);
1115  } else {
1116  this.resetComponents();
1117  }
1118  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1119  }//GEN-LAST:event_deleteSetButtonActionPerformed
1120 
1121  private void editSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editSetButtonActionPerformed
1122  this.doFileSetsDialog(this.setsList.getSelectedValue(), false);
1123  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1124  }//GEN-LAST:event_editSetButtonActionPerformed
1125 
1126  private void editRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editRuleButtonActionPerformed
1127  this.doFilesSetRuleDialog(this.rulesList.getSelectedValue());
1128  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1129  }//GEN-LAST:event_editRuleButtonActionPerformed
1130 
1131  private void newRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newRuleButtonActionPerformed
1132  this.doFilesSetRuleDialog(null);
1133  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1134  }//GEN-LAST:event_newRuleButtonActionPerformed
1135 
1136  private void copySetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copySetButtonActionPerformed
1137  this.doFileSetsDialog(this.setsList.getSelectedValue(), true);
1138  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1139  }//GEN-LAST:event_copySetButtonActionPerformed
1140  @NbBundle.Messages({
1141  "FilesSetDefsPanel.yesOwMsg=Yes, overwrite",
1142  "FilesSetDefsPanel.noSkipMsg=No, skip",
1143  "FilesSetDefsPanel.cancelImportMsg=Cancel import",
1144  "# {0} - FilesSet name",
1145  "FilesSetDefsPanel.interesting.overwriteSetPrompt=Interesting files set <{0}> already exists locally, overwrite?",
1146  "FilesSetDefsPanel.interesting.importOwConflict=Import Interesting files set conflict",
1147  "FilesSetDefsPanel.interesting.failImportMsg=Interesting files set not imported",
1148  "FilesSetDefsPanel.interesting.fileExtensionFilterLbl=Autopsy Interesting File Set File (xml)",
1149  "FilesSetDefsPanel.interesting.importButtonAction.featureName=Interesting Files Set Import"
1150  })
1151  private void importSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importSetButtonActionPerformed
1152  //save currently selected value as default value to select
1153  FilesSet selectedSet = this.setsList.getSelectedValue();
1154  JFileChooser chooser = new JFileChooser();
1155  final String EXTENSION = "xml"; //NON-NLS
1156  FileNameExtensionFilter autopsyFilter = new FileNameExtensionFilter(
1157  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.fileExtensionFilterLbl"), EXTENSION);
1158  chooser.addChoosableFileFilter(autopsyFilter);
1159  chooser.setAcceptAllFileFilterUsed(false);
1160  chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
1161  int returnVal = chooser.showOpenDialog(this);
1162  if (returnVal == JFileChooser.APPROVE_OPTION) {
1163  File selFile = chooser.getSelectedFile();
1164  if (selFile == null) {
1165  JOptionPane.showMessageDialog(this,
1166  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.failImportMsg"),
1167  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.importButtonAction.featureName"),
1168  JOptionPane.WARNING_MESSAGE);
1169  logger.warning("Selected file was null, when trying to import interesting files set definitions");
1170  return;
1171  }
1172  Collection<FilesSet> importedSets;
1173  try {
1174  importedSets = InterestingItemsFilesSetSettings.readDefinitionsXML(selFile).values(); //read the xml from that path
1175  if (importedSets.isEmpty()) {
1176  throw new FilesSetsManager.FilesSetsManagerException("No Files Sets were read from the xml.");
1177  }
1179  JOptionPane.showMessageDialog(this,
1180  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.failImportMsg"),
1181  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.importButtonAction.featureName"),
1182  JOptionPane.WARNING_MESSAGE);
1183  logger.log(Level.WARNING, "No Interesting files set definitions were read from the selected file, exception", ex);
1184  return;
1185  }
1186  for (FilesSet set : importedSets) {
1187  int choice = JOptionPane.OK_OPTION;
1188  if (filesSets.containsKey(set.getName())) {
1189  Object[] options = {NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.yesOwMsg"),
1190  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.noSkipMsg"),
1191  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.cancelImportMsg")};
1192  choice = JOptionPane.showOptionDialog(this,
1193  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.overwriteSetPrompt", set.getName()),
1194  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.importOwConflict"),
1195  JOptionPane.YES_NO_CANCEL_OPTION,
1196  JOptionPane.QUESTION_MESSAGE,
1197  null,
1198  options,
1199  options[0]);
1200  }
1201  if (choice == JOptionPane.OK_OPTION) {
1202  selectedSet = set;
1203  this.filesSets.put(set.getName(), set);
1204  } else if (choice == JOptionPane.CANCEL_OPTION) {
1205  break;
1206  }
1207  }
1208  // Redo the list model for the files set list component
1209  FilesSetDefsPanel.this.setsListModel.clear();
1210  this.filesSets.values().forEach((set) -> {
1211  this.setsListModel.addElement(set);
1212  });
1213  // Select the new/edited files set definition in the set definitions
1214  // list. This will cause the selection listeners to repopulate the
1215  // subordinate components.
1216  this.setsList.setSelectedValue(selectedSet, true);
1217  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1218  }
1219 
1220  }//GEN-LAST:event_importSetButtonActionPerformed
1221 
1222  @NbBundle.Messages({"FilesSetDefsPanel.interesting.exportButtonAction.featureName=Interesting Files Set Export",
1223  "# {0} - file name",
1224  "FilesSetDefsPanel.exportButtonActionPerformed.fileExistPrompt=File {0} exists, overwrite?",
1225  "FilesSetDefsPanel.interesting.ExportedMsg=Interesting files set exported",
1226  "FilesSetDefsPanel.interesting.failExportMsg=Export of interesting files set failed"})
1227  private void exportSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportSetButtonActionPerformed
1228  //display warning that existing filessets with duplicate names will be overwritten
1229  //create file chooser to get xml filefinal String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
1230  JFileChooser chooser = new JFileChooser();
1231  final String EXTENSION = "xml"; //NON-NLS
1232  FileNameExtensionFilter autopsyFilter = new FileNameExtensionFilter(
1233  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.fileExtensionFilterLbl"), EXTENSION);
1234  chooser.addChoosableFileFilter(autopsyFilter);
1235  chooser.setSelectedFile(new File(this.setsList.getSelectedValue().getName()));
1236  chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
1237  int returnVal = chooser.showSaveDialog(this);
1238  if (returnVal == JFileChooser.APPROVE_OPTION) {
1239  final String FEATURE_NAME = NbBundle.getMessage(this.getClass(),
1240  "FilesSetDefsPanel.interesting.exportButtonAction.featureName");
1241  File selFile = chooser.getSelectedFile();
1242  if (selFile == null) {
1243  JOptionPane.showMessageDialog(this,
1244  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.failExportMsg"),
1245  FEATURE_NAME,
1246  JOptionPane.WARNING_MESSAGE);
1247  logger.warning("Selected file was null, when trying to export interesting files set definitions");
1248  return;
1249  }
1250  //force append extension if not given
1251  String fileAbs = selFile.getAbsolutePath();
1252  if (!fileAbs.endsWith("." + EXTENSION)) {
1253  fileAbs = fileAbs + "." + EXTENSION;
1254  selFile = new File(fileAbs);
1255  }
1256  if (selFile.exists()) {
1257  //if the file already exists ask the user how to proceed
1258  final String FILE_EXISTS_MESSAGE = NbBundle.getMessage(this.getClass(),
1259  "FilesSetDefsPanel.exportButtonActionPerformed.fileExistPrompt", selFile.getName());
1260  boolean shouldWrite = JOptionPane.showConfirmDialog(this, FILE_EXISTS_MESSAGE, FEATURE_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION;
1261  if (!shouldWrite) {
1262  return;
1263  }
1264  }
1265  List<FilesSet> exportSets;
1266  exportSets = new ArrayList<>();
1267  //currently only exports selectedValue
1268  exportSets.add(this.setsList.getSelectedValue());
1269  boolean written = InterestingItemsFilesSetSettings.exportXmlDefinitionsFile(selFile, exportSets);
1270  if (written) {
1271  JOptionPane.showMessageDialog(
1272  WindowManager.getDefault().getMainWindow(),
1273  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.ExportedMsg"),
1274  FEATURE_NAME,
1275  JOptionPane.INFORMATION_MESSAGE);
1276  } else {
1277  JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
1278  NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.interesting.failExportMsg"),
1279  FEATURE_NAME,
1280  JOptionPane.WARNING_MESSAGE);
1281  logger.warning("Export of interesting files set failed unable to write definitions xml file");
1282  }
1283  }
1284  }//GEN-LAST:event_exportSetButtonActionPerformed
1285 
1286  private void fileNameRegexCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileNameRegexCheckboxActionPerformed
1287  // TODO add your handling code here:
1288  }//GEN-LAST:event_fileNameRegexCheckboxActionPerformed
1289 
1290  // Variables declaration - do not modify//GEN-BEGIN:variables
1291  private javax.swing.JRadioButton allRadioButton;
1292  private javax.swing.JButton copySetButton;
1293  private javax.swing.JLabel daysIncludedLabel;
1294  private javax.swing.JTextField daysIncludedTextField;
1295  private javax.swing.JButton deleteRuleButton;
1296  private javax.swing.JButton deleteSetButton;
1297  private javax.swing.JRadioButton dirsRadioButton;
1298  private javax.swing.JButton editRuleButton;
1299  private javax.swing.JButton editSetButton;
1300  private javax.swing.JComboBox<String> equalitySignComboBox;
1301  private javax.swing.JButton exportSetButton;
1302  private javax.swing.ButtonGroup fileNameButtonGroup;
1303  private javax.swing.JRadioButton fileNameExtensionRadioButton;
1304  private javax.swing.JRadioButton fileNameRadioButton;
1305  private javax.swing.JCheckBox fileNameRegexCheckbox;
1306  private javax.swing.JTextField fileNameTextField;
1307  private javax.swing.JSpinner fileSizeSpinner;
1308  private javax.swing.JComboBox<String> fileSizeUnitComboBox;
1309  private javax.swing.JRadioButton filesRadioButton;
1310  private javax.swing.JCheckBox ignoreKnownFilesCheckbox;
1311  private javax.swing.JButton importSetButton;
1312  private javax.swing.JLabel ingestWarningLabel;
1313  private javax.swing.JCheckBox ingoreUnallocCheckbox;
1314  private javax.swing.JLabel jLabel1;
1315  private javax.swing.JLabel jLabel2;
1316  private javax.swing.JLabel jLabel3;
1317  private javax.swing.JLabel jLabel4;
1318  private javax.swing.JLabel jLabel5;
1319  private javax.swing.JLabel jLabel6;
1320  private javax.swing.JLabel jLabel7;
1321  private javax.swing.JLabel jLabel8;
1322  private javax.swing.JPanel jPanel1;
1323  private javax.swing.JScrollPane jScrollPane1;
1324  private javax.swing.JScrollPane jScrollPane2;
1325  private javax.swing.JTextArea jTextArea1;
1326  private javax.swing.JComboBox<String> mimeTypeComboBox;
1327  private javax.swing.JLabel modifiedDateLabel;
1328  private javax.swing.JButton newRuleButton;
1329  private javax.swing.JButton newSetButton;
1330  private javax.swing.JCheckBox rulePathConditionRegexCheckBox;
1331  private javax.swing.JTextField rulePathConditionTextField;
1332  private javax.swing.JList<FilesSet.Rule> rulesList;
1333  private javax.swing.JLabel rulesListLabel;
1334  private javax.swing.JScrollPane rulesListScrollPane;
1335  private javax.swing.JSeparator separator;
1336  private javax.swing.JScrollPane setDescScrollPanel;
1337  private javax.swing.JTextArea setDescriptionTextArea;
1338  private javax.swing.JList<FilesSet> setsList;
1339  private javax.swing.JLabel setsListLabel;
1340  private javax.swing.JScrollPane setsListScrollPane;
1341  private javax.swing.ButtonGroup typeButtonGroup;
1342  // End of variables declaration//GEN-END:variables
1343 
1344 }
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-2018 Basis Technology. Generated on: Tue Dec 18 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.