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

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.