Autopsy  4.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
InterestingItemDefsPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2016 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.awt.Font;
23 import java.util.ArrayList;
24 import java.util.HashMap;
25 import java.util.HashSet;
26 import java.util.List;
27 import java.util.Map;
28 import java.util.Set;
29 import java.util.SortedSet;
30 import java.util.TreeMap;
31 import java.util.logging.Level;
32 import javax.swing.DefaultListModel;
33 import javax.swing.JButton;
34 import javax.swing.JOptionPane;
35 import javax.swing.event.ListSelectionEvent;
36 import javax.swing.event.ListSelectionListener;
37 import org.apache.tika.mime.MediaType;
38 import org.openide.util.NbBundle;
43 import org.apache.tika.mime.MediaType;
44 import org.apache.tika.mime.MimeTypes;
45 import org.openide.util.Exceptions;
47 
51 final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel {
52 
53  @NbBundle.Messages({
54  "InterestingItemDefsPanel.bytes=Bytes",
55  "InterestingItemDefsPanel.kiloBytes=Kilobytes",
56  "InterestingItemDefsPanel.megaBytes=Megabytes",
57  "InterestingItemDefsPanel.gigaBytes=Gigabytes",
58  "InterestingItemsDefsPanel.loadError=Error loading interesting files sets from file.",
59  "InterestingItemsDefsPanel.saveError=Error saving interesting files sets to file."
60  })
61 
62  private static final SortedSet<MediaType> mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes();
63  private final DefaultListModel<FilesSet> setsListModel = new DefaultListModel<>();
64  private final DefaultListModel<FilesSet.Rule> rulesListModel = new DefaultListModel<>();
65  private final Logger logger = Logger.getLogger(InterestingItemDefsPanel.class.getName());
66  private JButton okButton = new JButton("OK");
67  private JButton cancelButton = new JButton("Cancel");
68 
69  // The following is a map of interesting files set names to interesting
70  // files set definitions. It is a snapshot of the files set definitions
71  // obtained from the interesting item definitions manager at the time the
72  // the panel is loaded. When the panel saves or stores its settings, these
73  // definitions, possibly changed, are submitted back to the interesting item
74  // definitions manager. Note that it is a tree map to aid in displaying
75  // files sets in sorted order by name.
76  private TreeMap<String, FilesSet> filesSets;
77 
81  InterestingItemDefsPanel() {
82  this.initComponents();
83  this.customInit();
84  this.setsList.setModel(setsListModel);
85  this.setsList.addListSelectionListener(new InterestingItemDefsPanel.SetsListSelectionListener());
86  this.rulesList.setModel(rulesListModel);
87  this.rulesList.addListSelectionListener(new InterestingItemDefsPanel.RulesListSelectionListener());
88  }
89 
90  @NbBundle.Messages({"InterestingItemDefsPanel.Title=Global Interesting Items Settings"})
91  private void customInit() {
92  setName(Bundle.InterestingItemDefsPanel_Title());
93 
94  Set<String> fileTypesCollated = new HashSet<>();
95  for (MediaType mediaType : mediaTypes) {
96  fileTypesCollated.add(mediaType.toString());
97  }
98 
99  FileTypeDetector fileTypeDetector;
100  try {
101  fileTypeDetector = new FileTypeDetector();
102  List<String> userDefinedFileTypes = fileTypeDetector.getUserDefinedTypes();
103  fileTypesCollated.addAll(userDefinedFileTypes);
104 
105  } catch (FileTypeDetector.FileTypeDetectorInitException ex) {
106  logger.log(Level.SEVERE, "Unable to get user defined file types", ex);
107  }
108 
109  List<String> toSort = new ArrayList<>(fileTypesCollated);
110  toSort.sort((String string1, String string2) -> {
111  int result = String.CASE_INSENSITIVE_ORDER.compare(string1, string2);
112  if (result == 0) {
113  result = string1.compareTo(string2);
114  }
115  return result;
116  });
117 
118  for (String file : toSort) {
119  mimeTypeComboBox.addItem(file);
120  }
121  this.fileSizeUnitComboBox.setSelectedIndex(1);
122  this.equalitySignComboBox.setSelectedIndex(2);
123  }
124 
128  @Override
129  public void saveSettings() {
130  try {
131  InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets);
132  } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
133  MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_saveError());
134  }
135  }
136 
140  @Override
141  public void store() {
142  this.saveSettings();
143  }
144 
148  @Override
149  public void load() {
150  this.resetComponents();
151 
152  try {
153  // Get a working copy of the interesting files set definitions and sort
154  // by set name.
155  this.filesSets = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets());
156  } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) {
157  MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_loadError());
158  this.filesSets = new TreeMap<>();
159  }
160 
161  // Populate the list model for the interesting files sets list
162  // component.
163  for (FilesSet set : this.filesSets.values()) {
164  this.setsListModel.addElement(set);
165  }
166 
167  if (!this.filesSets.isEmpty()) {
168  // Select the first files set by default. The list selections
169  // listeners will then populate the other components.
170  EventQueue.invokeLater(() -> {
171  InterestingItemDefsPanel.this.setsList.setSelectedIndex(0);
172  });
173  }
174  }
175 
179  private void resetComponents() {
180  this.resetRuleComponents();
181  this.setsListModel.clear();
182  this.setDescriptionTextArea.setText("");
183  this.ignoreKnownFilesCheckbox.setSelected(true);
184  this.newSetButton.setEnabled(true);
185  this.editSetButton.setEnabled(false);
186  this.deleteSetButton.setEnabled(false);
187  }
188 
193  private void resetRuleComponents() {
194  this.fileNameTextField.setText("");
195  this.fileNameRadioButton.setSelected(true);
196  this.fileNameRegexCheckbox.setSelected(false);
197  this.filesRadioButton.setSelected(true);
198  this.rulePathConditionTextField.setText("");
199  this.rulePathConditionRegexCheckBox.setSelected(false);
200  this.newRuleButton.setEnabled(!this.setsListModel.isEmpty());
201  this.editRuleButton.setEnabled(false);
202  this.deleteRuleButton.setEnabled(false);
203  }
204 
208  private final class SetsListSelectionListener implements ListSelectionListener {
209 
210  @Override
211  public void valueChanged(ListSelectionEvent e) {
212  if (e.getValueIsAdjusting()) {
213  return;
214  }
215 
216  InterestingItemDefsPanel.this.rulesListModel.clear();
217  InterestingItemDefsPanel.this.resetRuleComponents();
218 
219  // Get the selected interesting files set and populate the set
220  // components.
221  FilesSet selectedSet = InterestingItemDefsPanel.this.setsList.getSelectedValue();
222  if (selectedSet != null) {
223  // Populate the components that display the properties of the
224  // selected files set.
225  InterestingItemDefsPanel.this.setDescriptionTextArea.setText(selectedSet.getDescription());
226  InterestingItemDefsPanel.this.ignoreKnownFilesCheckbox.setSelected(selectedSet.ignoresKnownFiles());
227 
228  // Enable the new, edit and delete set buttons.
229  InterestingItemDefsPanel.this.newSetButton.setEnabled(true);
230  InterestingItemDefsPanel.this.editSetButton.setEnabled(true);
231  InterestingItemDefsPanel.this.deleteSetButton.setEnabled(true);
232 
233  // Populate the rule definitions list, sorted by name.
234  TreeMap<String, FilesSet.Rule> rules = new TreeMap<>(selectedSet.getRules());
235  for (FilesSet.Rule rule : rules.values()) {
236  InterestingItemDefsPanel.this.rulesListModel.addElement(rule);
237  }
238 
239  // Select the first rule by default.
240  if (!InterestingItemDefsPanel.this.rulesListModel.isEmpty()) {
241  InterestingItemDefsPanel.this.rulesList.setSelectedIndex(0);
242  }
243  }
244  }
245 
246  }
247 
252  private final class RulesListSelectionListener implements ListSelectionListener {
253 
254  @Override
255  public void valueChanged(ListSelectionEvent e) {
256  if (e.getValueIsAdjusting()) {
257  return;
258  }
259 
260  // Get the selected rule and populate the rule components.
261  FilesSet.Rule rule = InterestingItemDefsPanel.this.rulesList.getSelectedValue();
262  if (rule != null) {
263  // Get the conditions that make up the rule.
264  FilesSet.Rule.FileNameCondition nameCondition = rule.getFileNameCondition();
265  FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition();
266  FilesSet.Rule.ParentPathCondition pathCondition = rule.getPathCondition();
267  FilesSet.Rule.MimeTypeCondition mimeTypeCondition = rule.getMimeTypeCondition();
268  FilesSet.Rule.FileSizeCondition fileSizeCondition = rule.getFileSizeCondition();
269 
270  // Populate the components that display the properties of the
271  // selected rule.
272  if (nameCondition != null) {
273  InterestingItemDefsPanel.this.fileNameTextField.setText(nameCondition.getTextToMatch());
274  InterestingItemDefsPanel.this.fileNameRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.FullNameCondition);
275  InterestingItemDefsPanel.this.fileNameExtensionRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.ExtensionCondition);
276  InterestingItemDefsPanel.this.fileNameRegexCheckbox.setSelected(nameCondition.isRegex());
277  } else {
278  InterestingItemDefsPanel.this.fileNameTextField.setText("");
279  InterestingItemDefsPanel.this.fileNameRadioButton.setSelected(true);
280  InterestingItemDefsPanel.this.fileNameExtensionRadioButton.setSelected(false);
281  InterestingItemDefsPanel.this.fileNameRegexCheckbox.setSelected(false);
282  }
283  switch (typeCondition.getMetaType()) {
284  case FILES:
285  InterestingItemDefsPanel.this.filesRadioButton.setSelected(true);
286  break;
287  case DIRECTORIES:
288  InterestingItemDefsPanel.this.dirsRadioButton.setSelected(true);
289  break;
290  case FILES_AND_DIRECTORIES:
291  InterestingItemDefsPanel.this.bothRadioButton.setSelected(true);
292  break;
293  }
294  if (pathCondition != null) {
295  InterestingItemDefsPanel.this.rulePathConditionTextField.setText(pathCondition.getTextToMatch());
296  InterestingItemDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(pathCondition.isRegex());
297  } else {
298  InterestingItemDefsPanel.this.rulePathConditionTextField.setText("");
299  InterestingItemDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(false);
300  }
301  if (mimeTypeCondition != null) {
302  InterestingItemDefsPanel.this.mimeTypeComboBox.setSelectedItem(mimeTypeCondition.getMimeType());
303  } else {
304  InterestingItemDefsPanel.this.mimeTypeComboBox.setSelectedIndex(0);
305  }
306  if (fileSizeCondition != null) {
307  InterestingItemDefsPanel.this.fileSizeUnitComboBox.setSelectedItem(fileSizeCondition.getUnit().getName());
308  InterestingItemDefsPanel.this.equalitySignComboBox.setSelectedItem(fileSizeCondition.getComparator().getSymbol());
309  InterestingItemDefsPanel.this.jSpinner1.setValue(fileSizeCondition.getSizeValue());
310  } else {
311  InterestingItemDefsPanel.this.fileSizeUnitComboBox.setSelectedIndex(1);
312  InterestingItemDefsPanel.this.equalitySignComboBox.setSelectedIndex(2);
313  InterestingItemDefsPanel.this.jSpinner1.setValue(0);
314  }
315 
316  // Enable the new, edit and delete rule buttons.
317  InterestingItemDefsPanel.this.newRuleButton.setEnabled(true);
318  InterestingItemDefsPanel.this.editRuleButton.setEnabled(true);
319  InterestingItemDefsPanel.this.deleteRuleButton.setEnabled(true);
320  } else {
321  InterestingItemDefsPanel.this.resetRuleComponents();
322  }
323  }
324 
325  }
326 
335  private void doFileSetsDialog(FilesSet selectedSet) {
336  // Create a files set defintion panle.
337  FilesSetPanel panel;
338  if (selectedSet != null) {
339  // Editing an existing set definition.
340  panel = new FilesSetPanel(selectedSet);
341  } else {
342  // Creating a new set definition.
343  panel = new FilesSetPanel();
344  }
345 
346  // Do a dialog box with the files set panel until the user either enters
347  // a valid definition or cancels. Note that the panel gives the user
348  // feedback when isValidDefinition() is called.
349  int option = JOptionPane.OK_OPTION;
350  do {
351  option = JOptionPane.showConfirmDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
352  } while (option == JOptionPane.OK_OPTION && !panel.isValidDefinition());
353 
354  // While adding new ruleset(selectedSet == null), if rule set with same name already exists, do not add to the filesSets hashMap.
355  // In case of editing an existing ruleset(selectedSet != null), following check is not performed.
356  if (this.filesSets.containsKey(panel.getFilesSetName()) && selectedSet == null) {
357  MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(),
358  "InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text",
359  panel.getFilesSetName()));
360  return;
361  }
362 
363  if (option == JOptionPane.OK_OPTION) {
364  Map<String, FilesSet.Rule> rules = new HashMap<>();
365  if (selectedSet != null) {
366  // Interesting file sets are immutable for thread safety,
367  // so editing a files set definition is a replacement operation.
368  // Preserve the existing rules from the set being edited.
369  rules.putAll(selectedSet.getRules());
370  }
371  this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), rules);
372  }
373  }
374 
382  private void doFilesSetRuleDialog(FilesSet.Rule selectedRule) {
383  // Create a files set rule panel.
384  FilesSetRulePanel panel;
385  if (selectedRule != null) {
386  // Editing an existing rule definition.
387  panel = new FilesSetRulePanel(selectedRule, okButton, cancelButton);
388  } else {
389  // Creating a new rule definition.
390  panel = new FilesSetRulePanel(okButton, cancelButton);
391  }
392  // Do a dialog box with the files set panel until the user either enters
393  // a valid definition or cancels. Note that the panel gives the user
394  // feedback when isValidDefinition() is called.
395  int option = JOptionPane.OK_OPTION;
396  do {
397  option = JOptionPane.showOptionDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{okButton, cancelButton}, okButton);
398  } while (option == JOptionPane.OK_OPTION && !panel.isValidRuleDefinition());
399 
400  if (option == JOptionPane.OK_OPTION) {
401  // Interesting file sets are immutable for thread safety,
402  // so editing a files set rule definition is a replacement
403  // operation. Preserve the existing rules from the set being edited.
404  FilesSet selectedSet = this.setsList.getSelectedValue();
405  Map<String, FilesSet.Rule> rules = new HashMap<>(selectedSet.getRules());
406 
407  // Remove the "old" rule definition and add the new/edited
408  // definition.
409  if (selectedRule != null) {
410  rules.remove(selectedRule.getUuid());
411  }
412  FilesSet.Rule newRule = new FilesSet.Rule(panel.getRuleName(), panel.getFileNameCondition(), panel.getMetaTypeCondition(), panel.getPathCondition(), panel.getMimeTypeCondition(), panel.getFileSizeCondition());
413  rules.put(newRule.getUuid(), newRule);
414 
415  // Add the new/edited files set definition, replacing any previous
416  // definition with the same name and refreshing the display.
417  this.replaceFilesSet(selectedSet, selectedSet.getName(), selectedSet.getDescription(), selectedSet.ignoresKnownFiles(), rules);
418 
419  // Select the new/edited rule. Queue it up so it happens after the
420  // selection listeners react to the selection of the "new" files
421  // set.
422  EventQueue.invokeLater(() -> {
423  this.rulesList.setSelectedValue(newRule, true);
424  });
425  }
426  }
427 
441  void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, Map<String, FilesSet.Rule> rules) {
442  if (oldSet != null) {
443  // Remove the set to be replaced from the working copy if the files
444  // set definitions.
445  this.filesSets.remove(oldSet.getName());
446  }
447 
448  // Make the new/edited set definition and add it to the working copy of
449  // the files set definitions.
450  FilesSet newSet = new FilesSet(name, description, ignoresKnownFiles, rules);
451  this.filesSets.put(newSet.getName(), newSet);
452 
453  // Redo the list model for the files set list component, which will make
454  // everything stays sorted as in the working copy tree set.
455  InterestingItemDefsPanel.this.setsListModel.clear();
456  for (FilesSet set : this.filesSets.values()) {
457  this.setsListModel.addElement(set);
458  }
459 
460  // Select the new/edited files set definition in the set definitions
461  // list. This will cause the selection listeners to repopulate the
462  // subordinate components.
463  this.setsList.setSelectedValue(newSet, true);
464  }
465 
471  @SuppressWarnings("unchecked")
472  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
473  private void initComponents() {
474 
475  fileNameButtonGroup = new javax.swing.ButtonGroup();
476  typeButtonGroup = new javax.swing.ButtonGroup();
477  jScrollPane1 = new javax.swing.JScrollPane();
478  jPanel1 = new javax.swing.JPanel();
479  jLabel6 = new javax.swing.JLabel();
480  newRuleButton = new javax.swing.JButton();
481  filesRadioButton = new javax.swing.JRadioButton();
482  editRuleButton = new javax.swing.JButton();
483  rulesListLabel = new javax.swing.JLabel();
484  rulesListScrollPane = new javax.swing.JScrollPane();
485  rulesList = new javax.swing.JList<FilesSet.Rule>();
486  setDescScrollPanel = new javax.swing.JScrollPane();
487  setDescriptionTextArea = new javax.swing.JTextArea();
488  editSetButton = new javax.swing.JButton();
489  setsListScrollPane = new javax.swing.JScrollPane();
490  setsList = new javax.swing.JList<FilesSet>();
491  fileNameExtensionRadioButton = new javax.swing.JRadioButton();
492  jLabel3 = new javax.swing.JLabel();
493  fileNameTextField = new javax.swing.JTextField();
494  jLabel5 = new javax.swing.JLabel();
495  fileNameRadioButton = new javax.swing.JRadioButton();
496  rulePathConditionTextField = new javax.swing.JTextField();
497  ignoreKnownFilesCheckbox = new javax.swing.JCheckBox();
498  fileNameRegexCheckbox = new javax.swing.JCheckBox();
499  separator = new javax.swing.JSeparator();
500  setsListLabel = new javax.swing.JLabel();
501  bothRadioButton = new javax.swing.JRadioButton();
502  deleteSetButton = new javax.swing.JButton();
503  deleteRuleButton = new javax.swing.JButton();
504  newSetButton = new javax.swing.JButton();
505  jLabel2 = new javax.swing.JLabel();
506  dirsRadioButton = new javax.swing.JRadioButton();
507  jLabel1 = new javax.swing.JLabel();
508  jLabel4 = new javax.swing.JLabel();
509  rulePathConditionRegexCheckBox = new javax.swing.JCheckBox();
510  jScrollPane2 = new javax.swing.JScrollPane();
511  jTextArea1 = new javax.swing.JTextArea();
512  jLabel7 = new javax.swing.JLabel();
513  mimeTypeComboBox = new javax.swing.JComboBox<String>();
514  jLabel8 = new javax.swing.JLabel();
515  equalitySignComboBox = new javax.swing.JComboBox<String>();
516  jSpinner1 = new javax.swing.JSpinner();
517  fileSizeUnitComboBox = new javax.swing.JComboBox<String>();
518 
519  setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD, 11));
520 
521  jScrollPane1.setFont(jScrollPane1.getFont().deriveFont(jScrollPane1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
522 
523  jPanel1.setFont(jPanel1.getFont().deriveFont(jPanel1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
524 
525  jLabel6.setFont(jLabel6.getFont().deriveFont(jLabel6.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
526  org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel6.text")); // NOI18N
527 
528  newRuleButton.setFont(newRuleButton.getFont().deriveFont(newRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
529  newRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N
530  org.openide.awt.Mnemonics.setLocalizedText(newRuleButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.newRuleButton.text")); // NOI18N
531  newRuleButton.addActionListener(new java.awt.event.ActionListener() {
532  public void actionPerformed(java.awt.event.ActionEvent evt) {
533  newRuleButtonActionPerformed(evt);
534  }
535  });
536 
537  typeButtonGroup.add(filesRadioButton);
538  filesRadioButton.setFont(filesRadioButton.getFont().deriveFont(filesRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
539  filesRadioButton.setSelected(true);
540  org.openide.awt.Mnemonics.setLocalizedText(filesRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.filesRadioButton.text")); // NOI18N
541  filesRadioButton.setEnabled(false);
542 
543  editRuleButton.setFont(editRuleButton.getFont().deriveFont(editRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
544  editRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N
545  org.openide.awt.Mnemonics.setLocalizedText(editRuleButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.editRuleButton.text")); // NOI18N
546  editRuleButton.setEnabled(false);
547  editRuleButton.addActionListener(new java.awt.event.ActionListener() {
548  public void actionPerformed(java.awt.event.ActionEvent evt) {
549  editRuleButtonActionPerformed(evt);
550  }
551  });
552 
553  rulesListLabel.setFont(rulesListLabel.getFont().deriveFont(rulesListLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
554  org.openide.awt.Mnemonics.setLocalizedText(rulesListLabel, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.rulesListLabel.text")); // NOI18N
555 
556  rulesListScrollPane.setFont(rulesListScrollPane.getFont().deriveFont(rulesListScrollPane.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
557 
558  rulesList.setFont(rulesList.getFont().deriveFont(rulesList.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
559  rulesList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
560  rulesListScrollPane.setViewportView(rulesList);
561 
562  setDescScrollPanel.setFont(setDescScrollPanel.getFont().deriveFont(setDescScrollPanel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
563 
564  setDescriptionTextArea.setEditable(false);
565  setDescriptionTextArea.setBackground(new java.awt.Color(240, 240, 240));
566  setDescriptionTextArea.setColumns(20);
567  setDescriptionTextArea.setFont(setDescriptionTextArea.getFont().deriveFont(setDescriptionTextArea.getFont().getStyle() & ~java.awt.Font.BOLD, 13));
568  setDescriptionTextArea.setLineWrap(true);
569  setDescriptionTextArea.setRows(2);
570  setDescScrollPanel.setViewportView(setDescriptionTextArea);
571 
572  editSetButton.setFont(editSetButton.getFont().deriveFont(editSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
573  editSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N
574  org.openide.awt.Mnemonics.setLocalizedText(editSetButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.editSetButton.text")); // NOI18N
575  editSetButton.setEnabled(false);
576  editSetButton.addActionListener(new java.awt.event.ActionListener() {
577  public void actionPerformed(java.awt.event.ActionEvent evt) {
578  editSetButtonActionPerformed(evt);
579  }
580  });
581 
582  setsListScrollPane.setFont(setsListScrollPane.getFont().deriveFont(setsListScrollPane.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
583 
584  setsList.setFont(setsList.getFont().deriveFont(setsList.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
585  setsList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
586  setsListScrollPane.setViewportView(setsList);
587 
588  fileNameButtonGroup.add(fileNameExtensionRadioButton);
589  fileNameExtensionRadioButton.setFont(fileNameExtensionRadioButton.getFont().deriveFont(fileNameExtensionRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
590  org.openide.awt.Mnemonics.setLocalizedText(fileNameExtensionRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.fileNameExtensionRadioButton.text")); // NOI18N
591  fileNameExtensionRadioButton.setEnabled(false);
592 
593  jLabel3.setFont(jLabel3.getFont().deriveFont(jLabel3.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
594  org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel3.text")); // NOI18N
595 
596  fileNameTextField.setEditable(false);
597  fileNameTextField.setFont(fileNameTextField.getFont().deriveFont(fileNameTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
598  fileNameTextField.setText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.fileNameTextField.text")); // NOI18N
599  fileNameTextField.addActionListener(new java.awt.event.ActionListener() {
600  public void actionPerformed(java.awt.event.ActionEvent evt) {
601  fileNameTextFieldActionPerformed(evt);
602  }
603  });
604 
605  jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
606  org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel5.text")); // NOI18N
607 
608  fileNameButtonGroup.add(fileNameRadioButton);
609  fileNameRadioButton.setFont(fileNameRadioButton.getFont().deriveFont(fileNameRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
610  org.openide.awt.Mnemonics.setLocalizedText(fileNameRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.fileNameRadioButton.text")); // NOI18N
611  fileNameRadioButton.setEnabled(false);
612 
613  rulePathConditionTextField.setEditable(false);
614  rulePathConditionTextField.setFont(rulePathConditionTextField.getFont().deriveFont(rulePathConditionTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
615  rulePathConditionTextField.setText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.rulePathConditionTextField.text")); // NOI18N
616 
617  ignoreKnownFilesCheckbox.setFont(ignoreKnownFilesCheckbox.getFont().deriveFont(ignoreKnownFilesCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
618  org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.ignoreKnownFilesCheckbox.text")); // NOI18N
619  ignoreKnownFilesCheckbox.setEnabled(false);
620  ignoreKnownFilesCheckbox.addActionListener(new java.awt.event.ActionListener() {
621  public void actionPerformed(java.awt.event.ActionEvent evt) {
622  ignoreKnownFilesCheckboxActionPerformed(evt);
623  }
624  });
625 
626  fileNameRegexCheckbox.setFont(fileNameRegexCheckbox.getFont().deriveFont(fileNameRegexCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
627  org.openide.awt.Mnemonics.setLocalizedText(fileNameRegexCheckbox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.fileNameRegexCheckbox.text")); // NOI18N
628  fileNameRegexCheckbox.setEnabled(false);
629 
630  separator.setOrientation(javax.swing.SwingConstants.VERTICAL);
631 
632  setsListLabel.setFont(setsListLabel.getFont().deriveFont(setsListLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
633  org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.setsListLabel.text")); // NOI18N
634 
635  typeButtonGroup.add(bothRadioButton);
636  bothRadioButton.setFont(bothRadioButton.getFont().deriveFont(bothRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
637  org.openide.awt.Mnemonics.setLocalizedText(bothRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.bothRadioButton.text")); // NOI18N
638  bothRadioButton.setEnabled(false);
639 
640  deleteSetButton.setFont(deleteSetButton.getFont().deriveFont(deleteSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
641  deleteSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N
642  org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.deleteSetButton.text")); // NOI18N
643  deleteSetButton.setEnabled(false);
644  deleteSetButton.addActionListener(new java.awt.event.ActionListener() {
645  public void actionPerformed(java.awt.event.ActionEvent evt) {
646  deleteSetButtonActionPerformed(evt);
647  }
648  });
649 
650  deleteRuleButton.setFont(deleteRuleButton.getFont().deriveFont(deleteRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
651  deleteRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N
652  org.openide.awt.Mnemonics.setLocalizedText(deleteRuleButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.deleteRuleButton.text")); // NOI18N
653  deleteRuleButton.setEnabled(false);
654  deleteRuleButton.addActionListener(new java.awt.event.ActionListener() {
655  public void actionPerformed(java.awt.event.ActionEvent evt) {
656  deleteRuleButtonActionPerformed(evt);
657  }
658  });
659 
660  newSetButton.setFont(newSetButton.getFont().deriveFont(newSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
661  newSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N
662  org.openide.awt.Mnemonics.setLocalizedText(newSetButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.newSetButton.text")); // NOI18N
663  newSetButton.addActionListener(new java.awt.event.ActionListener() {
664  public void actionPerformed(java.awt.event.ActionEvent evt) {
665  newSetButtonActionPerformed(evt);
666  }
667  });
668 
669  jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
670  org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel2.text")); // NOI18N
671 
672  typeButtonGroup.add(dirsRadioButton);
673  dirsRadioButton.setFont(dirsRadioButton.getFont().deriveFont(dirsRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
674  org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.dirsRadioButton.text")); // NOI18N
675  dirsRadioButton.setEnabled(false);
676  dirsRadioButton.addActionListener(new java.awt.event.ActionListener() {
677  public void actionPerformed(java.awt.event.ActionEvent evt) {
678  dirsRadioButtonActionPerformed(evt);
679  }
680  });
681 
682  jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
683  org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel1.text")); // NOI18N
684 
685  jLabel4.setFont(jLabel4.getFont().deriveFont(jLabel4.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
686  org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel4.text")); // NOI18N
687 
688  rulePathConditionRegexCheckBox.setFont(rulePathConditionRegexCheckBox.getFont().deriveFont(rulePathConditionRegexCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
689  org.openide.awt.Mnemonics.setLocalizedText(rulePathConditionRegexCheckBox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text")); // NOI18N
690  rulePathConditionRegexCheckBox.setEnabled(false);
691 
692  jScrollPane2.setFont(jScrollPane2.getFont().deriveFont(jScrollPane2.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
693 
694  jTextArea1.setEditable(false);
695  jTextArea1.setBackground(new java.awt.Color(240, 240, 240));
696  jTextArea1.setColumns(20);
697  jTextArea1.setFont(jTextArea1.getFont().deriveFont(jTextArea1.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
698  jTextArea1.setLineWrap(true);
699  jTextArea1.setRows(3);
700  jTextArea1.setText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jTextArea1.text")); // NOI18N
701  jTextArea1.setWrapStyleWord(true);
702  jScrollPane2.setViewportView(jTextArea1);
703 
704  org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel7.text")); // NOI18N
705 
706  mimeTypeComboBox.setEditable(true);
707  mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] {""}));
708  mimeTypeComboBox.setEnabled(false);
709 
710  org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel8.text")); // NOI18N
711 
712  equalitySignComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "=", ">", "≥", "<", "≤" }));
713  equalitySignComboBox.setEnabled(false);
714 
715  jSpinner1.setEnabled(false);
716 
717  fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { Bundle.InterestingItemDefsPanel_bytes(), Bundle.InterestingItemDefsPanel_kiloBytes(), Bundle.InterestingItemDefsPanel_megaBytes(), Bundle.InterestingItemDefsPanel_gigaBytes() }));
718  fileSizeUnitComboBox.setEnabled(false);
719 
720  javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
721  jPanel1.setLayout(jPanel1Layout);
722  jPanel1Layout.setHorizontalGroup(
723  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
724  .addGroup(jPanel1Layout.createSequentialGroup()
725  .addContainerGap()
726  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
727  .addComponent(setsListLabel)
728  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
729  .addComponent(setsListScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
730  .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING))
731  .addGroup(jPanel1Layout.createSequentialGroup()
732  .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
733  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
734  .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
735  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
736  .addComponent(deleteSetButton)))
737  .addGap(18, 18, 18)
738  .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE)
739  .addGap(12, 12, 12)
740  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
741  .addGroup(jPanel1Layout.createSequentialGroup()
742  .addComponent(jLabel1)
743  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
744  .addGroup(jPanel1Layout.createSequentialGroup()
745  .addComponent(jLabel2)
746  .addGap(27, 27, 27)
747  .addComponent(filesRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
748  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
749  .addComponent(dirsRadioButton)
750  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
751  .addComponent(bothRadioButton)
752  .addGap(27, 27, 27))))
753  .addGroup(jPanel1Layout.createSequentialGroup()
754  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
755  .addGroup(jPanel1Layout.createSequentialGroup()
756  .addGap(380, 380, 380)
757  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
758  .addGroup(jPanel1Layout.createSequentialGroup()
759  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
760  .addComponent(jLabel3)
761  .addComponent(jLabel7)
762  .addComponent(jLabel8))
763  .addGap(6, 6, 6))
764  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
765  .addComponent(jLabel4)
766  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
767  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
768  .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.Alignment.LEADING)
769  .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
770  .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
771  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
772  .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
773  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
774  .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))
775  .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, 245, Short.MAX_VALUE)
776  .addComponent(fileNameTextField)))
777  .addGroup(jPanel1Layout.createSequentialGroup()
778  .addGap(360, 360, 360)
779  .addComponent(rulesListLabel))
780  .addGroup(jPanel1Layout.createSequentialGroup()
781  .addGap(360, 360, 360)
782  .addComponent(jLabel5))
783  .addGroup(jPanel1Layout.createSequentialGroup()
784  .addGap(360, 360, 360)
785  .addComponent(ignoreKnownFilesCheckbox))
786  .addGroup(jPanel1Layout.createSequentialGroup()
787  .addGap(360, 360, 360)
788  .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE))
789  .addGroup(jPanel1Layout.createSequentialGroup()
790  .addGap(360, 360, 360)
791  .addComponent(jLabel6))
792  .addGroup(jPanel1Layout.createSequentialGroup()
793  .addGap(360, 360, 360)
794  .addComponent(rulesListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE))
795  .addGroup(jPanel1Layout.createSequentialGroup()
796  .addGap(360, 360, 360)
797  .addComponent(newRuleButton)
798  .addGap(18, 18, 18)
799  .addComponent(editRuleButton)
800  .addGap(18, 18, 18)
801  .addComponent(deleteRuleButton))
802  .addGroup(jPanel1Layout.createSequentialGroup()
803  .addGap(456, 456, 456)
804  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
805  .addGroup(jPanel1Layout.createSequentialGroup()
806  .addComponent(fileNameRadioButton)
807  .addGap(4, 4, 4)
808  .addComponent(fileNameExtensionRadioButton)
809  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
810  .addComponent(fileNameRegexCheckbox))
811  .addComponent(rulePathConditionRegexCheckBox))))
812  .addGap(20, 20, 20))
813  );
814  jPanel1Layout.setVerticalGroup(
815  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
816  .addGroup(jPanel1Layout.createSequentialGroup()
817  .addContainerGap()
818  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
819  .addComponent(separator)
820  .addGroup(jPanel1Layout.createSequentialGroup()
821  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
822  .addGroup(jPanel1Layout.createSequentialGroup()
823  .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
824  .addGap(18, 18, 18)
825  .addComponent(setsListLabel)
826  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
827  .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
828  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
829  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
830  .addComponent(newSetButton)
831  .addComponent(editSetButton)
832  .addComponent(deleteSetButton)))
833  .addGroup(jPanel1Layout.createSequentialGroup()
834  .addComponent(jLabel6)
835  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
836  .addComponent(jLabel5)
837  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
838  .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
839  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
840  .addComponent(ignoreKnownFilesCheckbox)
841  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
842  .addComponent(rulesListLabel)
843  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
844  .addComponent(rulesListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
845  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
846  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
847  .addComponent(newRuleButton)
848  .addComponent(editRuleButton)
849  .addComponent(deleteRuleButton))
850  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
851  .addComponent(jLabel1)
852  .addGap(2, 2, 2)
853  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
854  .addComponent(jLabel2)
855  .addComponent(filesRadioButton)
856  .addComponent(dirsRadioButton)
857  .addComponent(bothRadioButton))
858  .addGap(16, 16, 16)
859  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
860  .addComponent(jLabel3)
861  .addComponent(fileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
862  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
863  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
864  .addComponent(fileNameRadioButton)
865  .addComponent(fileNameExtensionRadioButton)
866  .addComponent(fileNameRegexCheckbox))))
867  .addGap(14, 14, 14)
868  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
869  .addComponent(jLabel4)
870  .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
871  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
872  .addComponent(rulePathConditionRegexCheckBox)
873  .addGap(10, 10, 10)
874  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
875  .addComponent(jLabel7)
876  .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
877  .addGap(16, 16, 16)
878  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
879  .addComponent(jLabel8)
880  .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
881  .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
882  .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
883  .addContainerGap())
884  );
885 
886  jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {deleteRuleButton, deleteSetButton, editRuleButton, editSetButton, newRuleButton, newSetButton});
887 
888  jScrollPane1.setViewportView(jPanel1);
889 
890  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
891  this.setLayout(layout);
892  layout.setHorizontalGroup(
893  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
894  .addGroup(layout.createSequentialGroup()
895  .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 728, javax.swing.GroupLayout.PREFERRED_SIZE)
896  .addGap(0, 34, Short.MAX_VALUE))
897  );
898  layout.setVerticalGroup(
899  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
900  .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 503, Short.MAX_VALUE)
901  );
902  }// </editor-fold>//GEN-END:initComponents
903 
904  private void dirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioButtonActionPerformed
905  // TODO add your handling code here:
906  }//GEN-LAST:event_dirsRadioButtonActionPerformed
907 
908  private void newSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newSetButtonActionPerformed
909  this.doFileSetsDialog(null);
910  }//GEN-LAST:event_newSetButtonActionPerformed
911 
912  private void deleteRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteRuleButtonActionPerformed
913  // Interesting file sets are immutable for thread safety,
914  // so editing a files set rule definition is a replacement
915  // operation. Preserve the existing rules from the set being
916  // edited, except for the deleted rule.
917  FilesSet oldSet = this.setsList.getSelectedValue();
918  Map<String, FilesSet.Rule> rules = new HashMap<>(oldSet.getRules());
919  FilesSet.Rule selectedRule = this.rulesList.getSelectedValue();
920  rules.remove(selectedRule.getUuid());
921  this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), rules);
922  }//GEN-LAST:event_deleteRuleButtonActionPerformed
923 
924  private void deleteSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteSetButtonActionPerformed
925  FilesSet selectedSet = this.setsList.getSelectedValue();
926  this.filesSets.remove(selectedSet.getName());
927  this.setsListModel.removeElement(selectedSet);
928 
929  // Select the first of the remaining set definitions. This will cause
930  // the selection listeners to repopulate the subordinate components.
931  if (!this.filesSets.isEmpty()) {
932  this.setsList.setSelectedIndex(0);
933  } else {
934  this.resetComponents();
935  }
936  }//GEN-LAST:event_deleteSetButtonActionPerformed
937 
938  private void ignoreKnownFilesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ignoreKnownFilesCheckboxActionPerformed
939  // TODO add your handling code here:
940  }//GEN-LAST:event_ignoreKnownFilesCheckboxActionPerformed
941 
942  private void editSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editSetButtonActionPerformed
943  this.doFileSetsDialog(this.setsList.getSelectedValue());
944  }//GEN-LAST:event_editSetButtonActionPerformed
945 
946  private void editRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editRuleButtonActionPerformed
947  this.doFilesSetRuleDialog(this.rulesList.getSelectedValue());
948  }//GEN-LAST:event_editRuleButtonActionPerformed
949 
950  private void newRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newRuleButtonActionPerformed
951  this.doFilesSetRuleDialog(null);
952  }//GEN-LAST:event_newRuleButtonActionPerformed
953 
954  private void fileNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileNameTextFieldActionPerformed
955  // TODO add your handling code here:
956  }//GEN-LAST:event_fileNameTextFieldActionPerformed
957 
958  // Variables declaration - do not modify//GEN-BEGIN:variables
959  private javax.swing.JRadioButton bothRadioButton;
960  private javax.swing.JButton deleteRuleButton;
961  private javax.swing.JButton deleteSetButton;
962  private javax.swing.JRadioButton dirsRadioButton;
963  private javax.swing.JButton editRuleButton;
964  private javax.swing.JButton editSetButton;
965  private javax.swing.JComboBox<String> equalitySignComboBox;
966  private javax.swing.ButtonGroup fileNameButtonGroup;
967  private javax.swing.JRadioButton fileNameExtensionRadioButton;
968  private javax.swing.JRadioButton fileNameRadioButton;
969  private javax.swing.JCheckBox fileNameRegexCheckbox;
970  private javax.swing.JTextField fileNameTextField;
971  private javax.swing.JComboBox<String> fileSizeUnitComboBox;
972  private javax.swing.JRadioButton filesRadioButton;
973  private javax.swing.JCheckBox ignoreKnownFilesCheckbox;
974  private javax.swing.JLabel jLabel1;
975  private javax.swing.JLabel jLabel2;
976  private javax.swing.JLabel jLabel3;
977  private javax.swing.JLabel jLabel4;
978  private javax.swing.JLabel jLabel5;
979  private javax.swing.JLabel jLabel6;
980  private javax.swing.JLabel jLabel7;
981  private javax.swing.JLabel jLabel8;
982  private javax.swing.JPanel jPanel1;
983  private javax.swing.JScrollPane jScrollPane1;
984  private javax.swing.JScrollPane jScrollPane2;
985  private javax.swing.JSpinner jSpinner1;
986  private javax.swing.JTextArea jTextArea1;
987  private javax.swing.JComboBox<String> mimeTypeComboBox;
988  private javax.swing.JButton newRuleButton;
989  private javax.swing.JButton newSetButton;
990  private javax.swing.JCheckBox rulePathConditionRegexCheckBox;
991  private javax.swing.JTextField rulePathConditionTextField;
992  private javax.swing.JList<FilesSet.Rule> rulesList;
993  private javax.swing.JLabel rulesListLabel;
994  private javax.swing.JScrollPane rulesListScrollPane;
995  private javax.swing.JSeparator separator;
996  private javax.swing.JScrollPane setDescScrollPanel;
997  private javax.swing.JTextArea setDescriptionTextArea;
998  private javax.swing.JList<FilesSet> setsList;
999  private javax.swing.JLabel setsListLabel;
1000  private javax.swing.JScrollPane setsListScrollPane;
1001  private javax.swing.ButtonGroup typeButtonGroup;
1002  // End of variables declaration//GEN-END:variables
1003 
1004 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:166

Copyright © 2012-2015 Basis Technology. Generated on: Wed Apr 6 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.