UI Updates

This commit is contained in:
Oliver Spohngellert 2016-02-19 16:50:40 -05:00
parent 863229043e
commit 2280e1005a
6 changed files with 201 additions and 168 deletions

View File

@ -26,11 +26,8 @@ FilesSetRulePanel.messages.invalidNameRegex=The name regular expression is not v
FilesSetRulePanel.messages.invalidCharInName=The name cannot contain \\, /, :, *, ?, \", <, or > unless it is a regular expression. FilesSetRulePanel.messages.invalidCharInName=The name cannot contain \\, /, :, *, ?, \", <, or > unless it is a regular expression.
FilesSetRulePanel.messages.invalidCharInPath=The path cannot contain \\, :, *, ?, \", <, or > unless it is a regular expression. FilesSetRulePanel.messages.invalidCharInPath=The path cannot contain \\, :, *, ?, \", <, or > unless it is a regular expression.
FilesSetRulePanel.messages.invalidPathRegex=The path regular expression is not valid:\n\n{0} FilesSetRulePanel.messages.invalidPathRegex=The path regular expression is not valid:\n\n{0}
FilesSetRulePanel.dirsRadioButton.text=Directories
FilesSetRulePanel.filesRadioButton.text=Files
InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text=Rule set with name {0} already exists. InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text=Rule set with name {0} already exists.
FilesSetRulePanel.pathSeparatorInfoLabel.text=Use / as path separator FilesSetRulePanel.pathSeparatorInfoLabel.text=Use / as path separator
FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories
FilesIdentifierIngestJobSettingsPanel.border.title=Select interesting files sets to enable during ingest: FilesIdentifierIngestJobSettingsPanel.border.title=Select interesting files sets to enable during ingest:
FilesSetRulePanel.jLabel1.text=Type: FilesSetRulePanel.jLabel1.text=Type:
FilesSetRulePanel.jLabel5.text=Enter information about files that you want to find. FilesSetRulePanel.jLabel5.text=Enter information about files that you want to find.
@ -64,4 +61,6 @@ InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=Regex
FilesSetRulePanel.nameCheck.text=Name Pattern: FilesSetRulePanel.nameCheck.text=Name Pattern:
FilesSetRulePanel.pathCheck.text=Path Pattern: FilesSetRulePanel.pathCheck.text=Path Pattern:
FilesSetRulePanel.mimeCheck.text=MIME Type: FilesSetRulePanel.mimeCheck.text=MIME Type:
FilesSetRulePanel.fileCheck.text=File Size: FilesSetRulePanel.filesCheck.text=Files
FilesSetRulePanel.directoriesCheck.text=Directories
FilesSetRulePanel.fileSizeCheck.text=File Size:

View File

@ -5,10 +5,7 @@ FilesSetPanel.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb
FilesSetPanel.messages.filesSetsMustBeNamed=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8\u306f\u540d\u524d\u304c\u5fc5\u8981\u3067\u3059\u3002 FilesSetPanel.messages.filesSetsMustBeNamed=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8\u306f\u540d\u524d\u304c\u5fc5\u8981\u3067\u3059\u3002
FilesSetPanel.nameLabel.text=\u30bb\u30c3\u30c8\u540d\uff1a FilesSetPanel.nameLabel.text=\u30bb\u30c3\u30c8\u540d\uff1a
FilesSetPanel.title=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8 FilesSetPanel.title=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8
FilesSetRulePanel.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea
FilesSetRulePanel.extensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f FilesSetRulePanel.extensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f
FilesSetRulePanel.filesAndDirsRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea
FilesSetRulePanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb
FilesSetRulePanel.fullNameRadioButton.text=\u30d5\u30eb\u30cd\u30fc\u30e0 FilesSetRulePanel.fullNameRadioButton.text=\u30d5\u30eb\u30cd\u30fc\u30e0
FilesSetRulePanel.jLabel1.text=\u30bf\u30a4\u30d7*\uff1a FilesSetRulePanel.jLabel1.text=\u30bf\u30a4\u30d7*\uff1a
FilesSetRulePanel.messages.emptyNameFilter=\u3053\u306e\u30eb\u30fc\u30eb\u306f\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3\u3092\u7279\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 FilesSetRulePanel.messages.emptyNameFilter=\u3053\u306e\u30eb\u30fc\u30eb\u306f\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3\u3092\u7279\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002

View File

@ -27,24 +27,24 @@
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/> <EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="filesRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="dirsRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="filesAndDirsRadioButton" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="ruleNameLabel" max="32767" attributes="0"/> <Component id="ruleNameLabel" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="ruleNameTextField" min="-2" pref="234" max="-2" attributes="0"/> <Component id="ruleNameTextField" min="-2" pref="234" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="64" max="-2" attributes="0"/>
<Component id="filesCheck" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="directoriesCheck" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group> </Group>
</Group> </Group>
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
@ -81,7 +81,7 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="mimeCheck" min="-2" max="-2" attributes="0"/> <Component id="mimeCheck" min="-2" max="-2" attributes="0"/>
<Component id="fileCheck" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="fileSizeCheck" alignment="0" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0"> <Group type="103" groupAlignment="1" attributes="0">
@ -107,9 +107,8 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="filesRadioButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="filesCheck" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="dirsRadioButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="directoriesCheck" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="filesAndDirsRadioButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
@ -142,7 +141,7 @@
<Component id="equalitySymbolComboBox" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="equalitySymbolComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fileSizeComboBox" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="fileSizeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fileSizeSpinner" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="fileSizeSpinner" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fileCheck" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="fileSizeCheck" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace min="-2" pref="15" max="-2" attributes="0"/> <EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
@ -179,45 +178,6 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JRadioButton" name="dirsRadioButton">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="typeButtonGroup"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties" key="FilesSetRulePanel.dirsRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="dirsRadioButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="filesRadioButton">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="typeButtonGroup"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties" key="FilesSetRulePanel.filesRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="filesRadioButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="filesAndDirsRadioButton">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="typeButtonGroup"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties" key="FilesSetRulePanel.filesAndDirsRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="filesAndDirsRadioButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="nameTextField"> <Component class="javax.swing.JTextField" name="nameTextField">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -298,9 +258,12 @@
</Property> </Property>
<Property name="enabled" type="boolean" value="false"/> <Property name="enabled" type="boolean" value="false"/>
</Properties> </Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mimeTypeComboBoxActionPerformed"/>
</Events>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;String&gt;()"/> <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox&lt;String&gt;()"/>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value=""/> <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues> </AuxValues>
</Component> </Component>
<Component class="javax.swing.JComboBox" name="equalitySymbolComboBox"> <Component class="javax.swing.JComboBox" name="equalitySymbolComboBox">
@ -366,14 +329,35 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mimeCheckActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mimeCheckActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JCheckBox" name="fileCheck"> <Component class="javax.swing.JCheckBox" name="fileSizeCheck">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties" key="FilesSetRulePanel.fileCheck.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties" key="FilesSetRulePanel.fileSizeCheck.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="fileCheckActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="fileSizeCheckActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="filesCheck">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties" key="FilesSetRulePanel.filesCheck.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="filesCheckActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="directoriesCheck">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties" key="FilesSetRulePanel.directoriesCheck.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="directoriesCheckActionPerformed"/>
</Events> </Events>
</Component> </Component>
</SubComponents> </SubComponents>

View File

@ -18,8 +18,9 @@
*/ */
package org.sleuthkit.autopsy.modules.interestingitems; package org.sleuthkit.autopsy.modules.interestingitems;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -27,7 +28,9 @@ import java.util.SortedSet;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException; import java.util.regex.PatternSyntaxException;
import javax.swing.AbstractButton; import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import org.apache.tika.mime.MediaType; import org.apache.tika.mime.MediaType;
import org.apache.tika.mime.MimeTypes; import org.apache.tika.mime.MimeTypes;
import org.openide.DialogDisplayer; import org.openide.DialogDisplayer;
@ -55,6 +58,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
private static final String SLEUTHKIT_PATH_SEPARATOR = "/"; // NON-NLS private static final String SLEUTHKIT_PATH_SEPARATOR = "/"; // NON-NLS
private static final List<String> ILLEGAL_FILE_NAME_CHARS = InterestingItemDefsManager.getIllegalFileNameChars(); private static final List<String> ILLEGAL_FILE_NAME_CHARS = InterestingItemDefsManager.getIllegalFileNameChars();
private static final List<String> ILLEGAL_FILE_PATH_CHARS = InterestingItemDefsManager.getIllegalFilePathChars(); private static final List<String> ILLEGAL_FILE_PATH_CHARS = InterestingItemDefsManager.getIllegalFilePathChars();
private JButton okButton;
private JButton cancelButton;
/** /**
* Constructs a files set rule panel in create rule mode. * Constructs a files set rule panel in create rule mode.
@ -83,7 +88,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
* Populates the UI components with default values. * Populates the UI components with default values.
*/ */
private void populateComponentsWithDefaultValues() { private void populateComponentsWithDefaultValues() {
this.filesRadioButton.setSelected(true); this.filesCheck.setSelected(true);
this.fullNameRadioButton.setSelected(true); this.fullNameRadioButton.setSelected(true);
this.equalitySymbolComboBox.setSelectedIndex(2); this.equalitySymbolComboBox.setSelectedIndex(2);
this.fileSizeComboBox.setSelectedIndex(1); this.fileSizeComboBox.setSelectedIndex(1);
@ -117,6 +122,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
for (String file : toSort) { for (String file : toSort) {
mimeTypeComboBox.addItem(file); mimeTypeComboBox.addItem(file);
} }
this.setOkButton();
} }
/** /**
@ -128,6 +134,55 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
this.ruleNameTextField.setText(rule.getName()); this.ruleNameTextField.setText(rule.getName());
} }
private void setOkButton() {
if (this.okButton != null) {
if (!(this.filesCheck.isSelected() || this.directoriesCheck.isSelected())
|| !(this.fileSizeCheck.isSelected() || this.mimeCheck.isSelected()
|| this.nameCheck.isSelected() || this.pathCheck.isSelected())) {
this.okButton.setEnabled(false);
}
else {
this.okButton.setEnabled(true);
}
}
}
private JOptionPane getOptionPane(JComponent parent) {
JOptionPane pane = null;
if (!(parent instanceof JOptionPane)) {
pane = getOptionPane((JComponent) parent.getParent());
} else {
pane = (JOptionPane) parent;
}
return pane;
}
/**
* Sets the buttons for ending the panel
*
* @param ok The ok button
* @param cancel The cancel button
*/
public void setButtons(JButton ok, JButton cancel) {
this.okButton = ok;
this.cancelButton = cancel;
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JOptionPane pane = getOptionPane(okButton);
pane.setValue(okButton);
}
});
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JOptionPane pane = getOptionPane(cancelButton);
pane.setValue(cancelButton);
}
});
this.setOkButton();
}
/** /**
* Populates the UI components that display the meta-type condition for a * Populates the UI components that display the meta-type condition for a
* rule. * rule.
@ -138,13 +193,14 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition(); FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition();
switch (typeCondition.getMetaType()) { switch (typeCondition.getMetaType()) {
case FILES: case FILES:
this.filesRadioButton.setSelected(true); this.filesCheck.setSelected(true);
break; break;
case DIRECTORIES: case DIRECTORIES:
this.dirsRadioButton.setSelected(true); this.directoriesCheck.setSelected(true);
break; break;
case FILES_AND_DIRECTORIES: case FILES_AND_DIRECTORIES:
this.filesAndDirsRadioButton.setSelected(true); this.filesCheck.setSelected(true);
this.directoriesCheck.setSelected(true);
break; break;
} }
} }
@ -335,9 +391,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
* @return A type condition. * @return A type condition.
*/ */
FilesSet.Rule.MetaTypeCondition getMetaTypeCondition() { FilesSet.Rule.MetaTypeCondition getMetaTypeCondition() {
if (this.filesRadioButton.isSelected()) { if (this.filesCheck.isSelected() && !this.directoriesCheck.isSelected()) {
return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES);
} else if (this.dirsRadioButton.isSelected()) { } else if (this.directoriesCheck.isSelected() && !this.filesCheck.isSelected()) {
return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES); return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES);
} else { } else {
return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES); return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES);
@ -407,7 +463,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
* state of the UI components in the type button group. * state of the UI components in the type button group.
*/ */
private void setComponentsForSearchType() { private void setComponentsForSearchType() {
if (!this.filesRadioButton.isSelected()) { if (this.directoriesCheck.isSelected()) {
this.fullNameRadioButton.setSelected(true); this.fullNameRadioButton.setSelected(true);
this.extensionRadioButton.setEnabled(false); this.extensionRadioButton.setEnabled(false);
this.mimeTypeComboBox.setEnabled(false); this.mimeTypeComboBox.setEnabled(false);
@ -416,14 +472,14 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
this.fileSizeComboBox.setEnabled(false); this.fileSizeComboBox.setEnabled(false);
this.fileSizeSpinner.setEnabled(false); this.fileSizeSpinner.setEnabled(false);
this.fileSizeSpinner.setValue(0); this.fileSizeSpinner.setValue(0);
this.fileCheck.setEnabled(false); this.fileSizeCheck.setEnabled(false);
this.fileCheck.setSelected(false); this.fileSizeCheck.setSelected(false);
this.mimeCheck.setEnabled(false); this.mimeCheck.setEnabled(false);
this.mimeCheck.setSelected(false); this.mimeCheck.setSelected(false);
} else { } else {
this.extensionRadioButton.setEnabled(true); this.extensionRadioButton.setEnabled(true);
this.fileCheck.setEnabled(true); this.fileSizeCheck.setEnabled(true);
this.mimeCheck.setEnabled(true); this.mimeCheck.setEnabled(true);
} }
} }
@ -442,9 +498,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
ruleNameLabel = new javax.swing.JLabel(); ruleNameLabel = new javax.swing.JLabel();
ruleNameTextField = new javax.swing.JTextField(); ruleNameTextField = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
dirsRadioButton = new javax.swing.JRadioButton();
filesRadioButton = new javax.swing.JRadioButton();
filesAndDirsRadioButton = new javax.swing.JRadioButton();
nameTextField = new javax.swing.JTextField(); nameTextField = new javax.swing.JTextField();
fullNameRadioButton = new javax.swing.JRadioButton(); fullNameRadioButton = new javax.swing.JRadioButton();
extensionRadioButton = new javax.swing.JRadioButton(); extensionRadioButton = new javax.swing.JRadioButton();
@ -460,7 +513,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
nameCheck = new javax.swing.JCheckBox(); nameCheck = new javax.swing.JCheckBox();
pathCheck = new javax.swing.JCheckBox(); pathCheck = new javax.swing.JCheckBox();
mimeCheck = new javax.swing.JCheckBox(); mimeCheck = new javax.swing.JCheckBox();
fileCheck = new javax.swing.JCheckBox(); fileSizeCheck = new javax.swing.JCheckBox();
filesCheck = new javax.swing.JCheckBox();
directoriesCheck = new javax.swing.JCheckBox();
org.openide.awt.Mnemonics.setLocalizedText(ruleNameLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleNameLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(ruleNameLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleNameLabel.text")); // NOI18N
@ -473,30 +528,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel1.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel1.text")); // NOI18N
typeButtonGroup.add(dirsRadioButton);
org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.dirsRadioButton.text")); // NOI18N
dirsRadioButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dirsRadioButtonActionPerformed(evt);
}
});
typeButtonGroup.add(filesRadioButton);
org.openide.awt.Mnemonics.setLocalizedText(filesRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesRadioButton.text")); // NOI18N
filesRadioButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
filesRadioButtonActionPerformed(evt);
}
});
typeButtonGroup.add(filesAndDirsRadioButton);
org.openide.awt.Mnemonics.setLocalizedText(filesAndDirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesAndDirsRadioButton.text")); // NOI18N
filesAndDirsRadioButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
filesAndDirsRadioButtonActionPerformed(evt);
}
});
nameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.nameTextField.text")); // NOI18N nameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.nameTextField.text")); // NOI18N
nameTextField.setEnabled(false); nameTextField.setEnabled(false);
@ -526,6 +557,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
mimeTypeComboBox.setEditable(true); mimeTypeComboBox.setEditable(true);
mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""}));
mimeTypeComboBox.setEnabled(false); mimeTypeComboBox.setEnabled(false);
mimeTypeComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mimeTypeComboBoxActionPerformed(evt);
}
});
equalitySymbolComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "", "<", "" })); equalitySymbolComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "", "<", "" }));
equalitySymbolComboBox.setEnabled(false); equalitySymbolComboBox.setEnabled(false);
@ -557,10 +593,25 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
} }
}); });
org.openide.awt.Mnemonics.setLocalizedText(fileCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.fileCheck.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(fileSizeCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.fileSizeCheck.text")); // NOI18N
fileCheck.addActionListener(new java.awt.event.ActionListener() { fileSizeCheck.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
fileCheckActionPerformed(evt); fileSizeCheckActionPerformed(evt);
}
});
filesCheck.setSelected(true);
org.openide.awt.Mnemonics.setLocalizedText(filesCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesCheck.text")); // NOI18N
filesCheck.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
filesCheckActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(directoriesCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.directoriesCheck.text")); // NOI18N
directoriesCheck.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
directoriesCheckActionPerformed(evt);
} }
}); });
@ -573,21 +624,20 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGap(8, 8, 8) .addGap(8, 8, 8)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(filesRadioButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(dirsRadioButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(filesAndDirsRadioButton))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel5)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(ruleNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(ruleNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(64, 64, 64)
.addComponent(filesCheck)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(directoriesCheck))
.addComponent(jLabel5))
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addComponent(nameCheck) .addComponent(nameCheck)
@ -616,7 +666,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mimeCheck) .addComponent(mimeCheck)
.addComponent(fileCheck)) .addComponent(fileSizeCheck))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
@ -635,9 +685,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1) .addComponent(jLabel1)
.addComponent(filesRadioButton) .addComponent(filesCheck)
.addComponent(dirsRadioButton) .addComponent(directoriesCheck))
.addComponent(filesAndDirsRadioButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
@ -664,7 +713,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
.addComponent(equalitySymbolComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(equalitySymbolComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(fileSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(fileCheck)) .addComponent(fileSizeCheck))
.addGap(15, 15, 15) .addGap(15, 15, 15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
@ -673,18 +722,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void filesAndDirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesAndDirsRadioButtonActionPerformed
setComponentsForSearchType();
}//GEN-LAST:event_filesAndDirsRadioButtonActionPerformed
private void dirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioButtonActionPerformed
setComponentsForSearchType();
}//GEN-LAST:event_dirsRadioButtonActionPerformed
private void filesRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesRadioButtonActionPerformed
setComponentsForSearchType();
}//GEN-LAST:event_filesRadioButtonActionPerformed
private void ruleNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ruleNameTextFieldActionPerformed private void ruleNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ruleNameTextFieldActionPerformed
// TODO add your handling code here: // TODO add your handling code here:
}//GEN-LAST:event_ruleNameTextFieldActionPerformed }//GEN-LAST:event_ruleNameTextFieldActionPerformed
@ -702,6 +739,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
this.extensionRadioButton.setEnabled(true); this.extensionRadioButton.setEnabled(true);
this.nameRegexCheckbox.setEnabled(true); this.nameRegexCheckbox.setEnabled(true);
} }
this.setOkButton();
}//GEN-LAST:event_nameCheckActionPerformed }//GEN-LAST:event_nameCheckActionPerformed
private void pathCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathCheckActionPerformed private void pathCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathCheckActionPerformed
@ -715,6 +753,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
this.pathRegexCheckBox.setEnabled(true); this.pathRegexCheckBox.setEnabled(true);
this.pathSeparatorInfoLabel.setEnabled(true); this.pathSeparatorInfoLabel.setEnabled(true);
} }
this.setOkButton();
}//GEN-LAST:event_pathCheckActionPerformed }//GEN-LAST:event_pathCheckActionPerformed
private void mimeCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mimeCheckActionPerformed private void mimeCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mimeCheckActionPerformed
@ -724,10 +763,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
} else { } else {
this.mimeTypeComboBox.setEnabled(true); this.mimeTypeComboBox.setEnabled(true);
} }
this.setOkButton();
}//GEN-LAST:event_mimeCheckActionPerformed }//GEN-LAST:event_mimeCheckActionPerformed
private void fileCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileCheckActionPerformed private void fileSizeCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSizeCheckActionPerformed
if (!this.fileCheck.isSelected()) { if (!this.fileSizeCheck.isSelected()) {
this.fileSizeComboBox.setEnabled(false); this.fileSizeComboBox.setEnabled(false);
this.fileSizeSpinner.setEnabled(false); this.fileSizeSpinner.setEnabled(false);
this.fileSizeSpinner.setValue(0); this.fileSizeSpinner.setValue(0);
@ -737,22 +777,36 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
this.fileSizeSpinner.setEnabled(true); this.fileSizeSpinner.setEnabled(true);
this.equalitySymbolComboBox.setEnabled(true); this.equalitySymbolComboBox.setEnabled(true);
} }
}//GEN-LAST:event_fileCheckActionPerformed this.setOkButton();
}//GEN-LAST:event_fileSizeCheckActionPerformed
private void filesCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesCheckActionPerformed
this.setComponentsForSearchType();
this.setOkButton();
}//GEN-LAST:event_filesCheckActionPerformed
private void directoriesCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_directoriesCheckActionPerformed
this.setComponentsForSearchType();
this.setOkButton();
}//GEN-LAST:event_directoriesCheckActionPerformed
private void mimeTypeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mimeTypeComboBoxActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_mimeTypeComboBoxActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JRadioButton dirsRadioButton; private javax.swing.JCheckBox directoriesCheck;
private javax.swing.JComboBox equalitySymbolComboBox; private javax.swing.JComboBox equalitySymbolComboBox;
private javax.swing.JRadioButton extensionRadioButton; private javax.swing.JRadioButton extensionRadioButton;
private javax.swing.JCheckBox fileCheck; private javax.swing.JCheckBox fileSizeCheck;
private javax.swing.JComboBox fileSizeComboBox; private javax.swing.JComboBox fileSizeComboBox;
private javax.swing.JSpinner fileSizeSpinner; private javax.swing.JSpinner fileSizeSpinner;
private javax.swing.JRadioButton filesAndDirsRadioButton; private javax.swing.JCheckBox filesCheck;
private javax.swing.JRadioButton filesRadioButton;
private javax.swing.JRadioButton fullNameRadioButton; private javax.swing.JRadioButton fullNameRadioButton;
private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel5;
private javax.swing.JCheckBox mimeCheck; private javax.swing.JCheckBox mimeCheck;
private javax.swing.JComboBox mimeTypeComboBox; private javax.swing.JComboBox<String> mimeTypeComboBox;
private javax.swing.ButtonGroup nameButtonGroup; private javax.swing.ButtonGroup nameButtonGroup;
private javax.swing.JCheckBox nameCheck; private javax.swing.JCheckBox nameCheck;
private javax.swing.JCheckBox nameRegexCheckbox; private javax.swing.JCheckBox nameRegexCheckbox;

View File

@ -293,7 +293,6 @@
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties" key="InterestingItemDefsPanel.newRuleButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties" key="InterestingItemDefsPanel.newRuleButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties> </Properties>
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="newRuleButtonActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="newRuleButtonActionPerformed"/>

View File

@ -30,6 +30,7 @@ import java.util.SortedSet;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.logging.Level; import java.util.logging.Level;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
@ -43,22 +44,24 @@ import org.apache.tika.mime.MediaType;
import org.apache.tika.mime.MimeTypes; import org.apache.tika.mime.MimeTypes;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
/** /**
* A panel that allows a user to make interesting item definitions. * A panel that allows a user to make interesting item definitions.
*/ */
final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel {
@NbBundle.Messages({ @NbBundle.Messages({
"InterestingItemDefsPanel.bytes=Bytes", "InterestingItemDefsPanel.bytes=Bytes",
"InterestingItemDefsPanel.kiloBytes=Kilobytes", "InterestingItemDefsPanel.kiloBytes=Kilobytes",
"InterestingItemDefsPanel.megaBytes=Megabytes", "InterestingItemDefsPanel.megaBytes=Megabytes",
"InterestingItemDefsPanel.gigaBytes=Gigabytes" "InterestingItemDefsPanel.gigaBytes=Gigabytes"
}) })
private static final SortedSet<MediaType> mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes(); private static final SortedSet<MediaType> mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes();
private final DefaultListModel<FilesSet> setsListModel = new DefaultListModel<>(); private final DefaultListModel<FilesSet> setsListModel = new DefaultListModel<>();
private final DefaultListModel<FilesSet.Rule> rulesListModel = new DefaultListModel<>(); private final DefaultListModel<FilesSet.Rule> rulesListModel = new DefaultListModel<>();
private final Logger logger = Logger.getLogger(InterestingItemDefsPanel.class.getName()); private final Logger logger = Logger.getLogger(InterestingItemDefsPanel.class.getName());
private JButton okButton = new JButton("OK");
private JButton cancelButton = new JButton("Cancel");
// The following is a map of interesting files set names to interesting // The following is a map of interesting files set names to interesting
// files set definitions. It is a snapshot of the files set definitions // files set definitions. It is a snapshot of the files set definitions
@ -80,7 +83,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
this.rulesList.setModel(rulesListModel); this.rulesList.setModel(rulesListModel);
this.rulesList.addListSelectionListener(new InterestingItemDefsPanel.RulesListSelectionListener()); this.rulesList.addListSelectionListener(new InterestingItemDefsPanel.RulesListSelectionListener());
} }
private void customInit() { private void customInit() {
Set<String> fileTypesCollated = new HashSet<>(); Set<String> fileTypesCollated = new HashSet<>();
for (MediaType mediaType : mediaTypes) { for (MediaType mediaType : mediaTypes) {
@ -290,8 +293,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
* respond to user interactions with the dialog. * respond to user interactions with the dialog.
* *
* @param selectedSet The currently selected files set, may be null to * @param selectedSet The currently selected files set, may be null to
* indicate a new interesting files set definition is to * indicate a new interesting files set definition is to be created.
* be created.
*/ */
private void doFileSetsDialog(FilesSet selectedSet) { private void doFileSetsDialog(FilesSet selectedSet) {
// Create a files set defintion panle. // Create a files set defintion panle.
@ -338,7 +340,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
* dialog box and respond to user interactions with the dialog. * dialog box and respond to user interactions with the dialog.
* *
* @param selectedRule The currently selected rule, may be null to indicate * @param selectedRule The currently selected rule, may be null to indicate
* a new rule definition is to be created. * a new rule definition is to be created.
*/ */
private void doFilesSetRuleDialog(FilesSet.Rule selectedRule) { private void doFilesSetRuleDialog(FilesSet.Rule selectedRule) {
// Create a files set rule panel. // Create a files set rule panel.
@ -350,13 +352,13 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
// Creating a new rule definition. // Creating a new rule definition.
panel = new FilesSetRulePanel(); panel = new FilesSetRulePanel();
} }
panel.setButtons(okButton, cancelButton);
// Do a dialog box with the files set panel until the user either enters // Do a dialog box with the files set panel until the user either enters
// a valid definition or cancels. Note that the panel gives the user // a valid definition or cancels. Note that the panel gives the user
// feedback when isValidDefinition() is called. // feedback when isValidDefinition() is called.
int option = JOptionPane.OK_OPTION; int option = JOptionPane.OK_OPTION;
do { do {
option = JOptionPane.showConfirmDialog(null, panel, NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); option = JOptionPane.showOptionDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{okButton, cancelButton}, okButton);
} while (option == JOptionPane.OK_OPTION && !panel.isValidRuleDefinition()); } while (option == JOptionPane.OK_OPTION && !panel.isValidRuleDefinition());
if (option == JOptionPane.OK_OPTION) { if (option == JOptionPane.OK_OPTION) {
@ -392,13 +394,12 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
* owned by this panel. If there is a definition with the same name, it will * owned by this panel. If there is a definition with the same name, it will
* be replaced, so this is an add/edit operation. * be replaced, so this is an add/edit operation.
* *
* @param oldSet A set to replace, null if the new set is not a * @param oldSet A set to replace, null if the new set is not a replacement.
* replacement. * @param name The name of the files set.
* @param name The name of the files set. * @param description The description of the files set.
* @param description The description of the files set.
* @param ignoresKnownFiles Whether or not the files set ignores known * @param ignoresKnownFiles Whether or not the files set ignores known
* files. * files.
* @param rules The set membership rules for the set. * @param rules The set membership rules for the set.
*/ */
void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, Map<String, FilesSet.Rule> rules) { void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, Map<String, FilesSet.Rule> rules) {
if (oldSet != null) { if (oldSet != null) {
@ -489,7 +490,6 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp
newRuleButton.setFont(newRuleButton.getFont().deriveFont(newRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); newRuleButton.setFont(newRuleButton.getFont().deriveFont(newRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
newRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N newRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(newRuleButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.newRuleButton.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(newRuleButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.newRuleButton.text")); // NOI18N
newRuleButton.setEnabled(false);
newRuleButton.addActionListener(new java.awt.event.ActionListener() { newRuleButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
newRuleButtonActionPerformed(evt); newRuleButtonActionPerformed(evt);