Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
FilesSetRulePanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014-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.Color;
22 import java.awt.event.ActionEvent;
23 import java.util.Arrays;
24 import java.util.List;
25 import java.util.SortedSet;
26 import java.util.logging.Level;
27 import java.util.regex.Pattern;
28 import java.util.regex.PatternSyntaxException;
29 import javax.swing.JButton;
30 import javax.swing.JComponent;
31 import javax.swing.JOptionPane;
32 import org.openide.DialogDisplayer;
33 import org.openide.NotifyDescriptor;
34 import org.openide.util.NbBundle;
35 import org.openide.util.NbBundle.Messages;
40 
44 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
45 final class FilesSetRulePanel extends javax.swing.JPanel {
46 
47  @Messages({
48  "FilesSetRulePanel.bytes=Bytes",
49  "FilesSetRulePanel.kiloBytes=Kilobytes",
50  "FilesSetRulePanel.megaBytes=Megabytes",
51  "FilesSetRulePanel.gigaBytes=Gigabytes",
52  "FilesSetRulePanel.nameTextField.fullNameExample=Example: \"file.exe\"",
53  "FilesSetRulePanel.nameTextField.extensionExample=Examples: \"jpg\" or \"jpg,jpeg,gif\"",
54  "FilesSetRulePanel.NoConditionError=Must have at least one condition to make a rule.",
55  "FilesSetRulePanel.NoMimeTypeError=Please select a valid MIME type.",
56  "FilesSetRulePanel.NoNameError=Name cannot be empty",
57  "FilesSetRulePanel.NoPathError=Path cannot be empty",
58  "FilesSetRulePanel.DaysIncludedEmptyError=Number of days included cannot be empty.",
59  "FilesSetRulePanel.DaysIncludedInvalidError=Number of days included must be a positive integer.",
60  "FilesSetRulePanel.ZeroFileSizeError=File size condition value must not be 0 (Unless = is selected).",
61  "# {0} - regex",
62  "FilesSetRulePanel.CommaInRegexWarning=Warning: Comma(s) in the file extension field will be interpreted as part of a regex and will not split the entry into multiple extensions (Entered: \"{0}\")",
63  })
64 
65  private static final long serialVersionUID = 1L;
66  private static final Logger logger = Logger.getLogger(FilesSetRulePanel.class.getName());
67  private static final String SLEUTHKIT_PATH_SEPARATOR = "/"; // NON-NLS
68  private static final List<String> ILLEGAL_FILE_NAME_CHARS = FilesSetsManager.getIllegalFileNameChars();
69  private static final List<String> ILLEGAL_FILE_PATH_CHARS = FilesSetsManager.getIllegalFilePathChars();
70  private JButton okButton;
71  private JButton cancelButton;
72  private TextPrompt nameTextFieldPrompt;
73 
77  FilesSetRulePanel(JButton okButton, JButton cancelButton, PANEL_TYPE panelType) {
78  initComponents();
79  if (panelType == FilesSetDefsPanel.PANEL_TYPE.FILE_INGEST_FILTERS) { //Hide the mimetype settings when this is displaying a FileSet rule instead of a interesting item rule
80  mimeTypeComboBox.setVisible(false);
81  mimeCheck.setVisible(false);
82  jLabel1.setVisible(false);
83  filesRadioButton.setVisible(false);
84  dirsRadioButton.setVisible(false);
85  allRadioButton.setVisible(false);
86  org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ingest.jLabel5.text")); // NOI18N
87 
88  } else {
89  populateMimeTypesComboBox();
90  }
91  this.dateCheckActionPerformed(null);
92  populateComponentsWithDefaultValues();
93  this.setButtons(okButton, cancelButton);
94 
95  updateNameTextFieldPrompt();
96  }
97 
103  FilesSetRulePanel(FilesSet.Rule rule, JButton okButton, JButton cancelButton, PANEL_TYPE panelType) {
104  initComponents();
105  if (panelType == FilesSetDefsPanel.PANEL_TYPE.FILE_INGEST_FILTERS) { //Hide the mimetype settings when this is displaying a FileSet rule instead of a interesting item rule
106  mimeTypeComboBox.setVisible(false);
107  mimeCheck.setVisible(false);
108  jLabel1.setVisible(false);
109  filesRadioButton.setVisible(false);
110  dirsRadioButton.setVisible(false);
111  allRadioButton.setVisible(false);
112  } else {
113  populateMimeTypesComboBox();
114  populateMimeConditionComponents(rule);
115  }
116  populateMimeTypesComboBox();
117  populateRuleNameComponent(rule);
118  populateTypeConditionComponents(rule);
119  populateNameConditionComponents(rule);
120  populatePathConditionComponents(rule);
121  populateDateConditionComponents(rule);
122  populateSizeConditionComponents(rule);
123  populateInclusiveExclusive(rule);
124  this.setButtons(okButton, cancelButton);
125 
126  updateNameTextFieldPrompt();
127  setComponentsForSearchType();
128  }
129 
134  private void updateNameTextFieldPrompt() {
138  String text;
139  if (fullNameRadioButton.isSelected()) {
140  text = Bundle.FilesSetRulePanel_nameTextField_fullNameExample();
141  } else {
142  text = Bundle.FilesSetRulePanel_nameTextField_extensionExample();
143  }
144  nameTextFieldPrompt = new TextPrompt(text, nameTextField);
145 
149  nameTextFieldPrompt.setForeground(Color.LIGHT_GRAY);
150  nameTextFieldPrompt.changeAlpha(0.9f); // Mostly opaque
151 
152  validate();
153  repaint();
154  }
155 
159  private void populateComponentsWithDefaultValues() {
160  this.filesRadioButton.setSelected(true);
161  this.fullNameRadioButton.setSelected(true);
162  this.equalitySymbolComboBox.setSelectedItem(FilesSet.Rule.FileSizeCondition.COMPARATOR.GREATER_THAN_EQUAL.getSymbol());
163  this.fileSizeComboBox.setSelectedItem(FilesSet.Rule.FileSizeCondition.SIZE_UNIT.KILOBYTE.getName());
164  this.mimeTypeComboBox.setSelectedIndex(0);
165  }
166 
167  private void populateMimeTypesComboBox() {
168  try {
169  SortedSet<String> detectableMimeTypes = FileTypeDetector.getDetectedTypes();
170  detectableMimeTypes.forEach((type) -> {
171  mimeTypeComboBox.addItem(type);
172  });
173  } catch (FileTypeDetector.FileTypeDetectorInitException ex) {
174  logger.log(Level.SEVERE, "Unable to get detectable file types", ex);
175  }
176  this.setOkButton();
177  }
178 
184  private void populateRuleNameComponent(FilesSet.Rule rule) {
185  this.ruleNameTextField.setText(rule.getName());
186  }
187 
188  private void populateMimeConditionComponents(FilesSet.Rule rule) {
189  FilesSet.Rule.MimeTypeCondition mimeTypeCondition = rule.getMimeTypeCondition();
190  if (mimeTypeCondition != null) {
191  this.mimeCheck.setSelected(true);
192  this.mimeCheckActionPerformed(null);
193  this.mimeTypeComboBox.setSelectedItem(mimeTypeCondition.getMimeType());
194  }
195  }
196 
197  private void populateSizeConditionComponents(FilesSet.Rule rule) {
198  FilesSet.Rule.FileSizeCondition fileSizeCondition = rule.getFileSizeCondition();
199  if (fileSizeCondition != null) {
200  this.fileSizeCheck.setSelected(true);
201  this.fileSizeCheckActionPerformed(null);
202  this.fileSizeSpinner.setValue(fileSizeCondition.getSizeValue());
203  this.fileSizeComboBox.setSelectedItem(fileSizeCondition.getUnit().getName());
204  this.equalitySymbolComboBox.setSelectedItem(fileSizeCondition.getComparator().getSymbol());
205  }
206  }
207 
212  private void setOkButton() {
213  if (this.okButton != null) {
214  this.okButton.setEnabled(this.fileSizeCheck.isSelected() || this.mimeCheck.isSelected()
215  || this.nameCheck.isSelected() || this.pathCheck.isSelected() || this.dateCheck.isSelected());
216  }
217  }
218 
226  private JOptionPane getOptionPane(JComponent parent) {
227  JOptionPane pane;
228  if (!(parent instanceof JOptionPane)) {
229  pane = getOptionPane((JComponent) parent.getParent());
230  } else {
231  pane = (JOptionPane) parent;
232  }
233  return pane;
234  }
235 
242  private void setButtons(JButton ok, JButton cancel) {
243  this.okButton = ok;
244  this.cancelButton = cancel;
245  okButton.addActionListener((ActionEvent e) -> {
246  JOptionPane pane = getOptionPane(okButton);
247  pane.setValue(okButton);
248  });
249  cancelButton.addActionListener((ActionEvent e) -> {
250  JOptionPane pane = getOptionPane(cancelButton);
251  pane.setValue(cancelButton);
252  });
253  this.setOkButton();
254  }
255 
262  private void populateTypeConditionComponents(FilesSet.Rule rule) {
263  FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition();
264  switch (typeCondition.getMetaType()) {
265  case FILES:
266  this.filesRadioButton.setSelected(true);
267  break;
268  case DIRECTORIES:
269  this.dirsRadioButton.setSelected(true);
270  break;
271  case ALL:
272  this.allRadioButton.setSelected(true);
273  break;
274  }
275  }
276 
277  private void populateInclusiveExclusive(FilesSet.Rule rule) {
278  this.inclusiveRuleTypeRadio.setSelected(!rule.isExclusive());
279  this.exclusiveRuleTypeRadio.setSelected(rule.isExclusive());
280  }
281 
287  private void populateNameConditionComponents(FilesSet.Rule rule) {
288  FilesSet.Rule.FileNameCondition nameCondition = rule.getFileNameCondition();
289  if (nameCondition != null) {
290  this.nameCheck.setSelected(true);
291  this.nameCheckActionPerformed(null);
292  this.nameTextField.setText(nameCondition.getTextToMatch());
293  this.nameRegexCheckbox.setSelected(nameCondition.isRegex());
294  if (nameCondition instanceof FilesSet.Rule.FullNameCondition) {
295  this.fullNameRadioButton.setSelected(true);
296  } else {
297  this.extensionRadioButton.setSelected(true);
298  }
299  }
300  }
301 
308  private void populatePathConditionComponents(FilesSet.Rule rule) {
309  FilesSet.Rule.ParentPathCondition pathCondition = rule.getPathCondition();
310  if (pathCondition != null) {
311  this.pathCheck.setSelected(true);
312  this.pathCheckActionPerformed(null);
313  this.pathTextField.setText(pathCondition.getTextToMatch());
314  this.pathRegexCheckBox.setSelected(pathCondition.isRegex());
315  }
316  }
317 
324  private void populateDateConditionComponents(FilesSet.Rule rule) {
325  FilesSet.Rule.DateCondition dateCondition = rule.getDateCondition();
326  if (dateCondition != null) {
327  this.dateCheck.setSelected(true);
328  this.dateCheckActionPerformed(null);
329  this.daysIncludedTextField.setText(Integer.toString(dateCondition.getDaysIncluded()));
330  }
331  }
332 
340  boolean isValidRuleDefinition() {
341 
342  if (!(this.mimeCheck.isSelected() || this.fileSizeCheck.isSelected() || this.pathCheck.isSelected() || this.nameCheck.isSelected() || this.dateCheck.isSelected())) {
343  NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
344  Bundle.FilesSetRulePanel_NoConditionError(),
345  NotifyDescriptor.WARNING_MESSAGE);
346  DialogDisplayer.getDefault().notify(notifyDesc);
347  return false;
348  }
349 
350  if (this.nameCheck.isSelected()) {
351  // The name condition must either be a regular expression that compiles or
352  // a string without illegal file name chars.
353  if (this.nameTextField.getText().isEmpty()) {
354  NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
355  Bundle.FilesSetRulePanel_NoNameError(),
356  NotifyDescriptor.WARNING_MESSAGE);
357  DialogDisplayer.getDefault().notify(notifyDesc);
358  return false;
359  }
360  if (this.nameRegexCheckbox.isSelected()) {
361 
362  // If extension is also selected and the regex contains a comma, display a warning
363  // since it is unclear whether the comma is part of a regex or is separating extensions.
364  if (this.extensionRadioButton.isSelected() && this.nameTextField.getText().contains(",")) {
365  NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
366  Bundle.FilesSetRulePanel_CommaInRegexWarning(this.nameTextField.getText()),
367  NotifyDescriptor.WARNING_MESSAGE);
368  DialogDisplayer.getDefault().notify(notifyDesc);
369  }
370 
371  try {
372  Pattern.compile(this.nameTextField.getText());
373  } catch (PatternSyntaxException ex) {
374  NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
375  NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.invalidNameRegex", ex.getLocalizedMessage()),
376  NotifyDescriptor.WARNING_MESSAGE);
377  DialogDisplayer.getDefault().notify(notifyDesc);
378  return false;
379  }
380  } else if (this.nameTextField.getText().isEmpty() || !FilesSetRulePanel.containsOnlyLegalChars(this.nameTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_NAME_CHARS)) {
381  NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
382  NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.invalidCharInName"),
383  NotifyDescriptor.WARNING_MESSAGE);
384  DialogDisplayer.getDefault().notify(notifyDesc);
385  return false;
386  }
387  }
388 
389  // The path condition, if specified, must either be a regular expression
390  // that compiles or a string without illegal file path chars.
391  if (this.pathCheck.isSelected()) {
392  if (this.pathTextField.getText().isEmpty()) {
393  NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
394  Bundle.FilesSetRulePanel_NoPathError(),
395  NotifyDescriptor.WARNING_MESSAGE);
396  DialogDisplayer.getDefault().notify(notifyDesc);
397  return false;
398  }
399  if (this.pathRegexCheckBox.isSelected()) {
400  try {
401  Pattern.compile(this.pathTextField.getText());
402  } catch (PatternSyntaxException ex) {
403  NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
404  NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.invalidPathRegex", ex.getLocalizedMessage()),
405  NotifyDescriptor.WARNING_MESSAGE);
406  DialogDisplayer.getDefault().notify(notifyDesc);
407  return false;
408  }
409  } else if (this.pathTextField.getText().isEmpty() || !FilesSetRulePanel.containsOnlyLegalChars(this.pathTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_PATH_CHARS)) {
410  NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
411  NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.invalidCharInPath"),
412  NotifyDescriptor.WARNING_MESSAGE);
413  DialogDisplayer.getDefault().notify(notifyDesc);
414  return false;
415  }
416  }
417  if (this.mimeCheck.isSelected()) {
418  if (this.mimeTypeComboBox.getSelectedIndex() == 0) {
419  NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
420  Bundle.FilesSetRulePanel_NoMimeTypeError(),
421  NotifyDescriptor.WARNING_MESSAGE);
422  DialogDisplayer.getDefault().notify(notifyDesc);
423  return false;
424  }
425  }
426  if (this.fileSizeCheck.isSelected()) {
427  if ((Integer) this.fileSizeSpinner.getValue() == 0 && !((String) this.equalitySymbolComboBox.getSelectedItem()).equals("=")) {
428  NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
429  Bundle.FilesSetRulePanel_ZeroFileSizeError(),
430  NotifyDescriptor.WARNING_MESSAGE);
431  DialogDisplayer.getDefault().notify(notifyDesc);
432  return false;
433  }
434  }
435 
436  if (this.dateCheck.isSelected()) {
437  if (this.daysIncludedTextField.getText().isEmpty()) {
438  NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
439  Bundle.FilesSetRulePanel_DaysIncludedEmptyError(),
440  NotifyDescriptor.WARNING_MESSAGE);
441  DialogDisplayer.getDefault().notify(notifyDesc);
442  return false;
443  }
444  try {
445  int value = Integer.parseInt(daysIncludedTextField.getText());
446  if (value < 0) {
447  throw new NumberFormatException("Negative numbers are not allowed for the within N days condition");
448  }
449  } catch (NumberFormatException e) {
450  //field did not contain an integer
451  NotifyDescriptor notifyDesc = new NotifyDescriptor.Message(
452  Bundle.FilesSetRulePanel_DaysIncludedInvalidError(),
453  NotifyDescriptor.WARNING_MESSAGE);
454  DialogDisplayer.getDefault().notify(notifyDesc);
455  return false;
456  }
457  }
458  return true;
459  }
460 
466  String getRuleName() {
467  return this.ruleNameTextField.getText();
468  }
469 
474  boolean isExclusive() {
475  return this.exclusiveRuleTypeRadio.isSelected();
476  }
477 
487  FilesSet.Rule.FileNameCondition getFileNameCondition() throws IllegalStateException {
488  FilesSet.Rule.FileNameCondition condition = null;
489  if (!this.nameTextField.getText().isEmpty()) {
490  if (this.nameRegexCheckbox.isSelected()) {
491  try {
492  Pattern pattern = Pattern.compile(this.nameTextField.getText(), Pattern.CASE_INSENSITIVE);
493  if (this.fullNameRadioButton.isSelected()) {
494  condition = new FilesSet.Rule.FullNameCondition(pattern);
495  } else {
496  condition = new FilesSet.Rule.ExtensionCondition(pattern);
497  }
498  } catch (PatternSyntaxException ex) {
499  logger.log(Level.SEVERE, "Attempt to get regex name condition that does not compile", ex); // NON-NLS
500  throw new IllegalStateException("The files set rule panel name condition is not in a valid state"); // NON-NLS
501  }
502  } else if (FilesSetRulePanel.containsOnlyLegalChars(this.nameTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_NAME_CHARS)) {
503  if (this.fullNameRadioButton.isSelected()) {
504  condition = new FilesSet.Rule.FullNameCondition(this.nameTextField.getText());
505  } else {
506  List<String> extensions = Arrays.asList(this.nameTextField.getText().split(","));
507  for (int i=0; i < extensions.size(); i++) {
508  // Remove leading and trailing whitespace.
509  extensions.set(i, extensions.get(i).trim());
510  }
511  condition = new FilesSet.Rule.ExtensionCondition(extensions);
512  }
513  } else {
514  logger.log(Level.SEVERE, "Attempt to get name condition with illegal chars"); // NON-NLS
515  throw new IllegalStateException("The files set rule panel name condition is not in a valid state"); // NON-NLS
516  }
517  }
518  return condition;
519  }
520 
526  FilesSet.Rule.MimeTypeCondition getMimeTypeCondition() {
527  FilesSet.Rule.MimeTypeCondition condition = null;
528  if (!this.mimeTypeComboBox.getSelectedItem().equals("")) {
529  condition = new FilesSet.Rule.MimeTypeCondition((String) this.mimeTypeComboBox.getSelectedItem());
530  }
531  return condition;
532  }
533 
539  FilesSet.Rule.FileSizeCondition getFileSizeCondition() {
540  FilesSet.Rule.FileSizeCondition condition = null;
541  if (this.fileSizeCheck.isSelected()) {
542  if ((Integer) this.fileSizeSpinner.getValue() != 0 || ((String) this.equalitySymbolComboBox.getSelectedItem()).equals("=")) {
543  FilesSet.Rule.FileSizeCondition.COMPARATOR comparator = FilesSet.Rule.FileSizeCondition.COMPARATOR.fromSymbol((String) this.equalitySymbolComboBox.getSelectedItem());
544  FilesSet.Rule.FileSizeCondition.SIZE_UNIT unit = FilesSet.Rule.FileSizeCondition.SIZE_UNIT.fromName((String) this.fileSizeComboBox.getSelectedItem());
545  int fileSizeValue = (Integer) this.fileSizeSpinner.getValue();
546  condition = new FilesSet.Rule.FileSizeCondition(comparator, unit, fileSizeValue);
547  }
548  }
549  return condition;
550  }
551 
558  FilesSet.Rule.MetaTypeCondition getMetaTypeCondition() {
559  if (this.filesRadioButton.isSelected()) {
560  return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES);
561  } else if (this.dirsRadioButton.isSelected()) {
562  return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES);
563  } else {
564  return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.ALL);
565  }
566  }
567 
577  FilesSet.Rule.ParentPathCondition getPathCondition() throws IllegalStateException {
578  FilesSet.Rule.ParentPathCondition condition = null;
579  if (!this.pathTextField.getText().isEmpty()) {
580  if (this.pathRegexCheckBox.isSelected()) {
581  try {
582  condition = new FilesSet.Rule.ParentPathCondition(Pattern.compile(this.pathTextField.getText(), Pattern.CASE_INSENSITIVE));
583  } catch (PatternSyntaxException ex) {
584  logger.log(Level.SEVERE, "Attempt to get malformed path condition", ex); // NON-NLS
585  throw new IllegalStateException("The files set rule panel path condition is not in a valid state"); // NON-NLS
586  }
587  } else {
588  String path = this.pathTextField.getText();
589  if (FilesSetRulePanel.containsOnlyLegalChars(path, FilesSetRulePanel.ILLEGAL_FILE_PATH_CHARS)) {
590  // Add a leading path separator if omitted.
591  if (!path.startsWith(FilesSetRulePanel.SLEUTHKIT_PATH_SEPARATOR)) {
592  path = FilesSetRulePanel.SLEUTHKIT_PATH_SEPARATOR + path;
593  }
594  // Add a trailing path separator if omitted.
595  if (!path.endsWith(FilesSetRulePanel.SLEUTHKIT_PATH_SEPARATOR)) {
596  path += FilesSetRulePanel.SLEUTHKIT_PATH_SEPARATOR;
597  }
598  condition = new FilesSet.Rule.ParentPathCondition(path);
599  } else {
600  logger.log(Level.SEVERE, "Attempt to get path condition with illegal chars"); // NON-NLS
601  throw new IllegalStateException("The files set rule panel path condition is not in a valid state"); // NON-NLS
602  }
603  }
604  }
605  return condition;
606  }
607 
617  FilesSet.Rule.DateCondition getDateCondition() {
618  FilesSet.Rule.DateCondition dateCondition = null;
619  if (!daysIncludedTextField.getText().isEmpty()) {
620  dateCondition = new FilesSet.Rule.DateCondition(Integer.parseInt(daysIncludedTextField.getText()));
621  }
622  return dateCondition;
623  }
624 
634  private static boolean containsOnlyLegalChars(String toBeChecked, List<String> illegalChars) {
635  for (String illegalChar : illegalChars) {
636  if (toBeChecked.contains(illegalChar)) {
637  return false;
638  }
639  }
640  return true;
641  }
642 
647  private void setComponentsForSearchType() {
648  if (!this.filesRadioButton.isSelected()) {
649  this.fullNameRadioButton.setSelected(true);
650  this.extensionRadioButton.setEnabled(false);
651  this.mimeTypeComboBox.setEnabled(false);
652  this.mimeTypeComboBox.setSelectedIndex(0);
653  this.equalitySymbolComboBox.setEnabled(false);
654  this.fileSizeComboBox.setEnabled(false);
655  this.fileSizeSpinner.setEnabled(false);
656  this.fileSizeSpinner.setValue(0);
657  this.fileSizeCheck.setEnabled(false);
658  this.fileSizeCheck.setSelected(false);
659  this.mimeCheck.setEnabled(false);
660  this.mimeCheck.setSelected(false);
661  } else {
662  if (this.nameCheck.isSelected()) {
663  this.extensionRadioButton.setEnabled(true);
664  }
665  this.fileSizeCheck.setEnabled(true);
666  this.mimeCheck.setEnabled(true);
667  }
668  }
669 
675  @SuppressWarnings("unchecked")
676  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
677  private void initComponents() {
678 
679  nameButtonGroup = new javax.swing.ButtonGroup();
680  typeButtonGroup = new javax.swing.ButtonGroup();
681  ruleTypeButtonGroup = new javax.swing.ButtonGroup();
682  ruleNameLabel = new javax.swing.JLabel();
683  ruleNameTextField = new javax.swing.JTextField();
684  jLabel1 = new javax.swing.JLabel();
685  nameTextField = new javax.swing.JTextField();
686  fullNameRadioButton = new javax.swing.JRadioButton();
687  extensionRadioButton = new javax.swing.JRadioButton();
688  nameRegexCheckbox = new javax.swing.JCheckBox();
689  pathTextField = new javax.swing.JTextField();
690  pathRegexCheckBox = new javax.swing.JCheckBox();
691  pathSeparatorInfoLabel = new javax.swing.JLabel();
692  jLabel5 = new javax.swing.JLabel();
693  mimeTypeComboBox = new javax.swing.JComboBox<String>();
694  equalitySymbolComboBox = new javax.swing.JComboBox<String>();
695  fileSizeComboBox = new javax.swing.JComboBox<String>();
696  fileSizeSpinner = new javax.swing.JSpinner();
697  nameCheck = new javax.swing.JCheckBox();
698  pathCheck = new javax.swing.JCheckBox();
699  mimeCheck = new javax.swing.JCheckBox();
700  fileSizeCheck = new javax.swing.JCheckBox();
701  filesRadioButton = new javax.swing.JRadioButton();
702  dirsRadioButton = new javax.swing.JRadioButton();
703  allRadioButton = new javax.swing.JRadioButton();
704  daysIncludedTextField = new javax.swing.JTextField();
705  daysIncludedLabel = new javax.swing.JLabel();
706  dateCheck = new javax.swing.JCheckBox();
707  javax.swing.JLabel ruleTypeLabel = new javax.swing.JLabel();
708  inclusiveRuleTypeRadio = new javax.swing.JRadioButton();
709  exclusiveRuleTypeRadio = new javax.swing.JRadioButton();
710  jSeparator1 = new javax.swing.JSeparator();
711 
712  org.openide.awt.Mnemonics.setLocalizedText(ruleNameLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleNameLabel.text")); // NOI18N
713 
714  ruleNameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleNameTextField.text")); // NOI18N
715 
716  org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel1.text")); // NOI18N
717 
718  nameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.nameTextField.text")); // NOI18N
719  nameTextField.setEnabled(false);
720 
721  nameButtonGroup.add(fullNameRadioButton);
722  org.openide.awt.Mnemonics.setLocalizedText(fullNameRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.fullNameRadioButton.text")); // NOI18N
723  fullNameRadioButton.setEnabled(false);
724  fullNameRadioButton.addActionListener(new java.awt.event.ActionListener() {
725  public void actionPerformed(java.awt.event.ActionEvent evt) {
726  fullNameRadioButtonActionPerformed(evt);
727  }
728  });
729 
730  nameButtonGroup.add(extensionRadioButton);
731  org.openide.awt.Mnemonics.setLocalizedText(extensionRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.extensionRadioButton.text")); // NOI18N
732  extensionRadioButton.setEnabled(false);
733  extensionRadioButton.addActionListener(new java.awt.event.ActionListener() {
734  public void actionPerformed(java.awt.event.ActionEvent evt) {
735  extensionRadioButtonActionPerformed(evt);
736  }
737  });
738 
739  org.openide.awt.Mnemonics.setLocalizedText(nameRegexCheckbox, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.nameRegexCheckbox.text")); // NOI18N
740  nameRegexCheckbox.setEnabled(false);
741 
742  pathTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.pathTextField.text")); // NOI18N
743  pathTextField.setEnabled(false);
744 
745  org.openide.awt.Mnemonics.setLocalizedText(pathRegexCheckBox, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.pathRegexCheckBox.text")); // NOI18N
746  pathRegexCheckBox.setEnabled(false);
747 
748  pathSeparatorInfoLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/info-icon-16.png"))); // NOI18N
749  org.openide.awt.Mnemonics.setLocalizedText(pathSeparatorInfoLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.pathSeparatorInfoLabel.text")); // NOI18N
750  pathSeparatorInfoLabel.setEnabled(false);
751 
752  org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.interesting.jLabel5.text")); // NOI18N
753 
754  mimeTypeComboBox.setEditable(true);
755  mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] {""}));
756  mimeTypeComboBox.setEnabled(false);
757 
758  equalitySymbolComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { ">", "<" }));
759  equalitySymbolComboBox.setEnabled(false);
760 
761  fileSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { Bundle.FilesSetRulePanel_bytes(), Bundle.FilesSetRulePanel_kiloBytes(), Bundle.FilesSetRulePanel_megaBytes(), Bundle.FilesSetRulePanel_gigaBytes() }));
762  fileSizeComboBox.setEnabled(false);
763 
764  fileSizeSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
765  fileSizeSpinner.setEnabled(false);
766 
767  org.openide.awt.Mnemonics.setLocalizedText(nameCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.nameCheck.text")); // NOI18N
768  nameCheck.addActionListener(new java.awt.event.ActionListener() {
769  public void actionPerformed(java.awt.event.ActionEvent evt) {
770  nameCheckActionPerformed(evt);
771  }
772  });
773 
774  org.openide.awt.Mnemonics.setLocalizedText(pathCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.pathCheck.text")); // NOI18N
775  pathCheck.addActionListener(new java.awt.event.ActionListener() {
776  public void actionPerformed(java.awt.event.ActionEvent evt) {
777  pathCheckActionPerformed(evt);
778  }
779  });
780 
781  org.openide.awt.Mnemonics.setLocalizedText(mimeCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.mimeCheck.text")); // NOI18N
782  mimeCheck.addActionListener(new java.awt.event.ActionListener() {
783  public void actionPerformed(java.awt.event.ActionEvent evt) {
784  mimeCheckActionPerformed(evt);
785  }
786  });
787 
788  org.openide.awt.Mnemonics.setLocalizedText(fileSizeCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.fileSizeCheck.text")); // NOI18N
789  fileSizeCheck.addActionListener(new java.awt.event.ActionListener() {
790  public void actionPerformed(java.awt.event.ActionEvent evt) {
791  fileSizeCheckActionPerformed(evt);
792  }
793  });
794 
795  typeButtonGroup.add(filesRadioButton);
796  org.openide.awt.Mnemonics.setLocalizedText(filesRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesRadioButton.text")); // NOI18N
797  filesRadioButton.addActionListener(new java.awt.event.ActionListener() {
798  public void actionPerformed(java.awt.event.ActionEvent evt) {
799  filesRadioButtonActionPerformed(evt);
800  }
801  });
802 
803  typeButtonGroup.add(dirsRadioButton);
804  org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.dirsRadioButton.text")); // NOI18N
805  dirsRadioButton.addActionListener(new java.awt.event.ActionListener() {
806  public void actionPerformed(java.awt.event.ActionEvent evt) {
807  dirsRadioButtonActionPerformed(evt);
808  }
809  });
810 
811  typeButtonGroup.add(allRadioButton);
812  org.openide.awt.Mnemonics.setLocalizedText(allRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.allRadioButton.text")); // NOI18N
813  allRadioButton.addActionListener(new java.awt.event.ActionListener() {
814  public void actionPerformed(java.awt.event.ActionEvent evt) {
815  allRadioButtonActionPerformed(evt);
816  }
817  });
818 
819  daysIncludedTextField.setEnabled(false);
820  daysIncludedTextField.setMinimumSize(new java.awt.Dimension(60, 20));
821  daysIncludedTextField.setPreferredSize(new java.awt.Dimension(60, 20));
822 
823  org.openide.awt.Mnemonics.setLocalizedText(daysIncludedLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.daysIncludedLabel.text")); // NOI18N
824 
825  org.openide.awt.Mnemonics.setLocalizedText(dateCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.dateCheck.text")); // NOI18N
826  dateCheck.addActionListener(new java.awt.event.ActionListener() {
827  public void actionPerformed(java.awt.event.ActionEvent evt) {
828  dateCheckActionPerformed(evt);
829  }
830  });
831 
832  org.openide.awt.Mnemonics.setLocalizedText(ruleTypeLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleTypeLabel.text")); // NOI18N
833 
834  ruleTypeButtonGroup.add(inclusiveRuleTypeRadio);
835  inclusiveRuleTypeRadio.setSelected(true);
836  org.openide.awt.Mnemonics.setLocalizedText(inclusiveRuleTypeRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.inclusiveRuleTypeRadio.text")); // NOI18N
837 
838  ruleTypeButtonGroup.add(exclusiveRuleTypeRadio);
839  org.openide.awt.Mnemonics.setLocalizedText(exclusiveRuleTypeRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.exclusiveRuleTypeRadio.text")); // NOI18N
840 
841  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
842  this.setLayout(layout);
843  layout.setHorizontalGroup(
844  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
845  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
846  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
847  .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
848  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
849  .addGroup(layout.createSequentialGroup()
850  .addGap(8, 8, 8)
851  .addComponent(jLabel5))
852  .addGroup(layout.createSequentialGroup()
853  .addContainerGap()
854  .addComponent(ruleTypeLabel))
855  .addGroup(layout.createSequentialGroup()
856  .addGap(119, 119, 119)
857  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
858  .addComponent(exclusiveRuleTypeRadio)
859  .addComponent(inclusiveRuleTypeRadio))))
860  .addGap(0, 0, Short.MAX_VALUE))
861  .addGroup(layout.createSequentialGroup()
862  .addContainerGap()
863  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
864  .addComponent(jSeparator1)
865  .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
866  .addGap(2, 2, 2)
867  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
868  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
869  .addComponent(ruleNameLabel)
870  .addGap(5, 5, 5)
871  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
872  .addComponent(mimeTypeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
873  .addComponent(pathTextField)
874  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
875  .addComponent(equalitySymbolComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
876  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
877  .addComponent(fileSizeSpinner)
878  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
879  .addComponent(fileSizeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
880  .addGroup(layout.createSequentialGroup()
881  .addComponent(pathRegexCheckBox)
882  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
883  .addComponent(pathSeparatorInfoLabel))
884  .addGroup(layout.createSequentialGroup()
885  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
886  .addComponent(ruleNameTextField)
887  .addGroup(layout.createSequentialGroup()
888  .addComponent(daysIncludedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
889  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
890  .addComponent(daysIncludedLabel)
891  .addGap(0, 0, Short.MAX_VALUE)))
892  .addGap(1, 1, 1))
893  .addGroup(layout.createSequentialGroup()
894  .addComponent(fullNameRadioButton)
895  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
896  .addComponent(extensionRadioButton)
897  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
898  .addComponent(nameRegexCheckbox))))
899  .addGroup(layout.createSequentialGroup()
900  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
901  .addComponent(nameCheck, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
902  .addComponent(jLabel1))
903  .addGap(16, 16, 16)
904  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
905  .addComponent(nameTextField)
906  .addGroup(layout.createSequentialGroup()
907  .addComponent(filesRadioButton)
908  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
909  .addComponent(dirsRadioButton)
910  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
911  .addComponent(allRadioButton))))))
912  .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
913  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
914  .addComponent(pathCheck)
915  .addComponent(mimeCheck)
916  .addComponent(fileSizeCheck)
917  .addComponent(dateCheck))
918  .addGap(0, 0, Short.MAX_VALUE)))))
919  .addContainerGap())
920  );
921  layout.setVerticalGroup(
922  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
923  .addGroup(layout.createSequentialGroup()
924  .addComponent(jLabel5)
925  .addGap(8, 8, 8)
926  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
927  .addComponent(ruleTypeLabel)
928  .addComponent(inclusiveRuleTypeRadio))
929  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
930  .addComponent(exclusiveRuleTypeRadio)
931  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
932  .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 9, javax.swing.GroupLayout.PREFERRED_SIZE)
933  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
934  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
935  .addGroup(layout.createSequentialGroup()
936  .addComponent(jLabel1)
937  .addGap(10, 10, 10)
938  .addComponent(nameCheck))
939  .addGroup(layout.createSequentialGroup()
940  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
941  .addComponent(filesRadioButton)
942  .addComponent(dirsRadioButton)
943  .addComponent(allRadioButton))
944  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
945  .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
946  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
947  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
948  .addComponent(fullNameRadioButton)
949  .addComponent(extensionRadioButton)
950  .addComponent(nameRegexCheckbox))
951  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
952  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
953  .addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
954  .addComponent(pathCheck))
955  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
956  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
957  .addComponent(pathRegexCheckBox)
958  .addComponent(pathSeparatorInfoLabel))
959  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
960  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
961  .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
962  .addComponent(mimeCheck))
963  .addGap(11, 11, 11)
964  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
965  .addComponent(equalitySymbolComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
966  .addComponent(fileSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
967  .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
968  .addComponent(fileSizeCheck))
969  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
970  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
971  .addComponent(daysIncludedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
972  .addComponent(daysIncludedLabel)
973  .addComponent(dateCheck))
974  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
975  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
976  .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
977  .addComponent(ruleNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
978  .addGap(12, 12, 12))
979  );
980  }// </editor-fold>//GEN-END:initComponents
981 
982  private void nameCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nameCheckActionPerformed
983  if (!this.nameCheck.isSelected()) {
984  this.nameTextField.setEnabled(false);
985  this.nameTextField.setText("");
986  this.fullNameRadioButton.setEnabled(false);
987  this.extensionRadioButton.setEnabled(false);
988  this.nameRegexCheckbox.setEnabled(false);
989  } else {
990  this.nameTextField.setEnabled(true);
991  this.fullNameRadioButton.setEnabled(true);
992  if (this.filesRadioButton.isSelected()) {
993  this.extensionRadioButton.setEnabled(true);
994  }
995  this.nameRegexCheckbox.setEnabled(true);
996  }
997  this.setOkButton();
998  }//GEN-LAST:event_nameCheckActionPerformed
999 
1000  private void pathCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathCheckActionPerformed
1001  if (!this.pathCheck.isSelected()) {
1002  this.pathTextField.setEnabled(false);
1003  this.pathTextField.setText("");
1004  this.pathRegexCheckBox.setEnabled(false);
1005  this.pathSeparatorInfoLabel.setEnabled(false);
1006  } else {
1007  this.pathTextField.setEnabled(true);
1008  this.pathRegexCheckBox.setEnabled(true);
1009  this.pathSeparatorInfoLabel.setEnabled(true);
1010  }
1011  this.setOkButton();
1012  }//GEN-LAST:event_pathCheckActionPerformed
1013 
1014  private void filesRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesRadioButtonActionPerformed
1015 
1016  this.setComponentsForSearchType();
1017  }//GEN-LAST:event_filesRadioButtonActionPerformed
1018 
1019  private void dirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioButtonActionPerformed
1020  this.setComponentsForSearchType();
1021  }//GEN-LAST:event_dirsRadioButtonActionPerformed
1022 
1023  private void allRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allRadioButtonActionPerformed
1024  this.setComponentsForSearchType();
1025  }//GEN-LAST:event_allRadioButtonActionPerformed
1026 
1027  private void dateCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dateCheckActionPerformed
1028  if (!this.dateCheck.isSelected()) {
1029  this.daysIncludedTextField.setEnabled(false);
1030  this.daysIncludedLabel.setEnabled(false);
1031  this.daysIncludedTextField.setText("");
1032  } else {
1033  this.daysIncludedTextField.setEnabled(true);
1034  this.daysIncludedLabel.setEnabled(true);
1035  }
1036  this.setOkButton();
1037  }//GEN-LAST:event_dateCheckActionPerformed
1038 
1039  private void fileSizeCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSizeCheckActionPerformed
1040  if (!this.fileSizeCheck.isSelected()) {
1041  this.fileSizeComboBox.setEnabled(false);
1042  this.fileSizeSpinner.setEnabled(false);
1043  this.fileSizeSpinner.setValue(0);
1044  this.equalitySymbolComboBox.setEnabled(false);
1045  } else {
1046  this.fileSizeComboBox.setEnabled(true);
1047  this.fileSizeSpinner.setEnabled(true);
1048  this.equalitySymbolComboBox.setEnabled(true);
1049  }
1050  this.setOkButton();
1051  }//GEN-LAST:event_fileSizeCheckActionPerformed
1052 
1053  private void mimeCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mimeCheckActionPerformed
1054  if (!this.mimeCheck.isSelected()) {
1055  this.mimeTypeComboBox.setEnabled(false);
1056  this.mimeTypeComboBox.setSelectedIndex(0);
1057  } else {
1058  this.mimeTypeComboBox.setEnabled(true);
1059  }
1060  this.setOkButton();
1061  }//GEN-LAST:event_mimeCheckActionPerformed
1062 
1063  private void extensionRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_extensionRadioButtonActionPerformed
1064  updateNameTextFieldPrompt();
1065  }//GEN-LAST:event_extensionRadioButtonActionPerformed
1066 
1067  private void fullNameRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fullNameRadioButtonActionPerformed
1068  updateNameTextFieldPrompt();
1069  }//GEN-LAST:event_fullNameRadioButtonActionPerformed
1070 
1071  // Variables declaration - do not modify//GEN-BEGIN:variables
1072  private javax.swing.JRadioButton allRadioButton;
1073  private javax.swing.JCheckBox dateCheck;
1074  private javax.swing.JLabel daysIncludedLabel;
1075  private javax.swing.JTextField daysIncludedTextField;
1076  private javax.swing.JRadioButton dirsRadioButton;
1077  private javax.swing.JComboBox<String> equalitySymbolComboBox;
1078  private javax.swing.JRadioButton exclusiveRuleTypeRadio;
1079  private javax.swing.JRadioButton extensionRadioButton;
1080  private javax.swing.JCheckBox fileSizeCheck;
1081  private javax.swing.JComboBox<String> fileSizeComboBox;
1082  private javax.swing.JSpinner fileSizeSpinner;
1083  private javax.swing.JRadioButton filesRadioButton;
1084  private javax.swing.JRadioButton fullNameRadioButton;
1085  private javax.swing.JRadioButton inclusiveRuleTypeRadio;
1086  private javax.swing.JLabel jLabel1;
1087  private javax.swing.JLabel jLabel5;
1088  private javax.swing.JSeparator jSeparator1;
1089  private javax.swing.JCheckBox mimeCheck;
1090  private javax.swing.JComboBox<String> mimeTypeComboBox;
1091  private javax.swing.ButtonGroup nameButtonGroup;
1092  private javax.swing.JCheckBox nameCheck;
1093  private javax.swing.JCheckBox nameRegexCheckbox;
1094  private javax.swing.JTextField nameTextField;
1095  private javax.swing.JCheckBox pathCheck;
1096  private javax.swing.JCheckBox pathRegexCheckBox;
1097  private javax.swing.JLabel pathSeparatorInfoLabel;
1098  private javax.swing.JTextField pathTextField;
1099  private javax.swing.JLabel ruleNameLabel;
1100  private javax.swing.JTextField ruleNameTextField;
1101  private javax.swing.ButtonGroup ruleTypeButtonGroup;
1102  private javax.swing.ButtonGroup typeButtonGroup;
1103  // End of variables declaration//GEN-END:variables
1104 }

Copyright © 2012-2022 Basis Technology. Generated on: Mon Apr 17 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.