Add Create VHD checkbox to configuration panel

This commit is contained in:
Joe Ho 2019-08-13 14:04:54 -04:00
parent fe0e1b4cf1
commit bca13c0808
6 changed files with 59 additions and 5 deletions

View File

@ -122,3 +122,4 @@ EditNonFullPathsRulePanel.fileNamesInfoLabel.text=File names are case insensitiv
EditNonFullPathsRulePanel.extensionsInfoLabel.text=Extensions are case insensitive.
ConfigVisualPanel2.promptBeforeExit.text=Prompt before exiting imager
ConfigVisualPanel2.promptBeforeExit.actionCommand=
ConfigVisualPanel2.createVHDCheckBox.text=Create VHD

View File

@ -191,6 +191,8 @@ EditNonFullPathsRulePanel.fileNamesInfoLabel.text=File names are case insensitiv
EditNonFullPathsRulePanel.extensionsInfoLabel.text=Extensions are case insensitive.
ConfigVisualPanel2.promptBeforeExit.text=Prompt before exiting imager
ConfigVisualPanel2.promptBeforeExit.actionCommand=
ConfigVisualPanel2.createVHDCheckBox.toolTipText=
ConfigVisualPanel2.createVHDCheckBox.text=Create VHD
NewRuleSetPanel.attributeRule.description=Search for files based on one or more attributes or metadata fields.
NewRuleSetPanel.attributeRule.name=Attribute
NewRuleSetPanel.fullPathRule.description=Search for files based on full exact match path.

View File

@ -103,6 +103,7 @@
<Component id="flagEncryptionProgramsCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="finalizeImageWriter" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="promptBeforeExit" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="createVHDCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
@ -193,7 +194,8 @@
<Component id="finalizeImageWriter" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="promptBeforeExit" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="createVHDCheckBox" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
@ -582,5 +584,15 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="promptBeforeExitActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="createVHDCheckBox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/logicalimager/configuration/Bundle.properties" key="ConfigVisualPanel2.createVHDCheckBox.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="createVHDCheckBoxActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -111,6 +111,7 @@ final class ConfigVisualPanel2 extends JPanel {
maxSizeLabel = new javax.swing.JLabel();
maxSizeTextField = new javax.swing.JFormattedTextField();
promptBeforeExit = new javax.swing.JCheckBox();
createVHDCheckBox = new javax.swing.JCheckBox();
org.openide.awt.Mnemonics.setLocalizedText(modifiedDateLabel, org.openide.util.NbBundle.getMessage(ConfigVisualPanel2.class, "ConfigVisualPanel2.modifiedDateLabel.text")); // NOI18N
@ -264,6 +265,13 @@ final class ConfigVisualPanel2 extends JPanel {
}
});
org.openide.awt.Mnemonics.setLocalizedText(createVHDCheckBox, org.openide.util.NbBundle.getMessage(ConfigVisualPanel2.class, "ConfigVisualPanel2.createVHDCheckBox.text")); // NOI18N
createVHDCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
createVHDCheckBoxActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -338,7 +346,8 @@ final class ConfigVisualPanel2 extends JPanel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(flagEncryptionProgramsCheckBox)
.addComponent(finalizeImageWriter)
.addComponent(promptBeforeExit))
.addComponent(promptBeforeExit)
.addComponent(createVHDCheckBox))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(jSeparator1)))))
);
@ -412,7 +421,8 @@ final class ConfigVisualPanel2 extends JPanel {
.addComponent(finalizeImageWriter)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(promptBeforeExit)
.addGap(21, 21, 21))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(createVHDCheckBox))))
);
}// </editor-fold>//GEN-END:initComponents
@ -546,6 +556,10 @@ final class ConfigVisualPanel2 extends JPanel {
config.setPromptBeforeExit(promptBeforeExit.isSelected());
}//GEN-LAST:event_promptBeforeExitActionPerformed
private void createVHDCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createVHDCheckBoxActionPerformed
config.setCreateVHD(createVHDCheckBox.isSelected());
}//GEN-LAST:event_createVHDCheckBoxActionPerformed
/**
* Set the whether the a rule for detecting encryption programs will be
* added to the rules in this config
@ -588,6 +602,7 @@ final class ConfigVisualPanel2 extends JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField configFileTextField;
private javax.swing.JCheckBox createVHDCheckBox;
private javax.swing.JLabel daysIncludedLabel;
private javax.swing.JButton deleteRuleButton;
private javax.swing.JTextField descriptionEditTextField;
@ -638,13 +653,14 @@ final class ConfigVisualPanel2 extends JPanel {
* Update the panel to reflect the rules in the current config
*
* @param configFilePath path of the config file being modified
* @param config contents of the config file being modifed
* @param config contents of the config file being modified
* @param rowSelectionkey the name of the rule to select by default
*/
private void updatePanel(String configFilePath, LogicalImagerConfig config, String rowSelectionkey) {
configFileTextField.setText(configFilePath);
finalizeImageWriter.setSelected(config.isFinalizeImageWriter());
promptBeforeExit.setSelected(config.isPromptBeforeExit());
createVHDCheckBox.setSelected(config.isCreateVHD());
LogicalImagerRuleSet ruleSet = getRuleSetFromCurrentConfig();
flagEncryptionProgramsCheckBox.setSelected(ruleSet.find(EncryptionProgramsRule.getName()) != null);
RulesTableModel rulesTableModel = new RulesTableModel();

View File

@ -42,6 +42,10 @@ class LogicalImagerConfig {
@Expose(serialize = true)
private boolean promptBeforeExit;
@SerializedName("create-VHD")
@Expose(serialize = true)
private boolean createVHD;
@SerializedName("rule-sets")
@Expose(serialize = true)
private List<LogicalImagerRuleSet> ruleSets;
@ -50,6 +54,7 @@ class LogicalImagerConfig {
this.version = CURRENT_VERSION;
this.finalizeImageWriter = false;
this.promptBeforeExit = true;
this.createVHD = false;
this.ruleSets = new ArrayList<>();
}
@ -60,6 +65,7 @@ class LogicalImagerConfig {
this.version = CURRENT_VERSION;
this.finalizeImageWriter = finalizeImageWriter;
this.promptBeforeExit = true;
this.createVHD = false;
this.ruleSets = ruleSets;
}
@ -71,6 +77,7 @@ class LogicalImagerConfig {
this.version = version;
this.finalizeImageWriter = finalizeImageWriter;
this.promptBeforeExit = true;
this.createVHD = false;
this.ruleSets = ruleSets;
}
@ -78,11 +85,13 @@ class LogicalImagerConfig {
String version,
boolean finalizeImageWriter,
boolean promptBeforeExit,
boolean creatVHD,
List<LogicalImagerRuleSet> ruleSets
) {
this.version = version;
this.finalizeImageWriter = finalizeImageWriter;
this.promptBeforeExit = promptBeforeExit;
this.createVHD = creatVHD;
this.ruleSets = ruleSets;
}
@ -114,6 +123,14 @@ class LogicalImagerConfig {
this.promptBeforeExit = promptBeforeExit;
}
boolean isCreateVHD() {
return createVHD;
}
void setCreateVHD(boolean createVHD) {
this.createVHD = createVHD;
}
List<LogicalImagerRuleSet> getRuleSets() {
return ruleSets;
}

View File

@ -46,6 +46,7 @@ class LogicalImagerConfigDeserializer implements JsonDeserializer<LogicalImagerC
String version = LogicalImagerConfig.getCurrentVersion();
boolean finalizeImageWriter = false;
boolean promptBeforeExit = true;
boolean createVHD = false;
final JsonObject jsonObject = je.getAsJsonObject();
final JsonElement jsonVersion = jsonObject.get("version"); // NON-NLS
@ -63,6 +64,11 @@ class LogicalImagerConfigDeserializer implements JsonDeserializer<LogicalImagerC
promptBeforeExit = jsonPromptBeforeExit.getAsBoolean();
}
final JsonElement jsonCreateVHD = jsonObject.get("create-VHD"); // NON-NLS
if (jsonCreateVHD != null) {
createVHD = jsonCreateVHD.getAsBoolean();
}
JsonArray asJsonArray = jsonObject.get("rule-sets").getAsJsonArray(); // NON-NLS
if (asJsonArray == null) {
throw new JsonParseException(Bundle.LogicalImagerConfigDeserializer_missingRuleSetException());
@ -80,7 +86,7 @@ class LogicalImagerConfigDeserializer implements JsonDeserializer<LogicalImagerC
LogicalImagerRuleSet ruleSet = new LogicalImagerRuleSet(setName, rules);
ruleSets.add(ruleSet);
}
return new LogicalImagerConfig(version, finalizeImageWriter, promptBeforeExit, ruleSets);
return new LogicalImagerConfig(version, finalizeImageWriter, promptBeforeExit, createVHD, ruleSets);
}
private List<LogicalImagerRule> parseRules(JsonArray asJsonArray) {