2934 save the enabling of new checkbox to modulesettings

This commit is contained in:
William Schaefer 2017-08-11 14:37:07 -04:00
parent c6c5acba0f
commit 6586cc4af6
3 changed files with 25 additions and 21 deletions

View File

@ -76,4 +76,4 @@ ImportHashDatabaseDialog.lbFilePath.text=File Path:
ImportHashDatabaseDialog.tfFilePath.text= ImportHashDatabaseDialog.tfFilePath.text=
EamDbSettingsDialog.jLabel1.text=SQLite should only be used by one examiner at a time. EamDbSettingsDialog.jLabel1.text=SQLite should only be used by one examiner at a time.
EamDbSettingsDialog.jLabel2.text=Database type: EamDbSettingsDialog.jLabel2.text=Database type:
GlobalSettingsPanel.jCheckBox1.text=Use a Central Repository GlobalSettingsPanel.cbUseCentralRepo.text=Use a Central Repository

View File

@ -26,7 +26,7 @@
<Component id="tbOops" alignment="1" max="32767" attributes="0"/> <Component id="tbOops" alignment="1" max="32767" attributes="0"/>
<Component id="pnDatabaseConfiguration" max="32767" attributes="0"/> <Component id="pnDatabaseConfiguration" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="jCheckBox1" min="-2" pref="186" max="-2" attributes="0"/> <Component id="cbUseCentralRepo" min="-2" pref="186" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -37,7 +37,7 @@
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/> <Component id="cbUseCentralRepo" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="pnDatabaseConfiguration" min="-2" max="-2" attributes="0"/> <Component id="pnDatabaseConfiguration" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
@ -245,14 +245,14 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox1"> <Component class="javax.swing.JCheckBox" name="cbUseCentralRepo">
<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/centralrepository/optionspanel/Bundle.properties" key="GlobalSettingsPanel.jCheckBox1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="GlobalSettingsPanel.cbUseCentralRepo.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="jCheckBox1ActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbUseCentralRepoActionPerformed"/>
</Events> </Events>
</Component> </Component>
</SubComponents> </SubComponents>

View File

@ -32,6 +32,8 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbPlatformEnum;
import static org.sleuthkit.autopsy.centralrepository.datamodel.EamDbPlatformEnum.DISABLED; import static org.sleuthkit.autopsy.centralrepository.datamodel.EamDbPlatformEnum.DISABLED;
import org.sleuthkit.autopsy.centralrepository.datamodel.PostgresEamDbSettings; import org.sleuthkit.autopsy.centralrepository.datamodel.PostgresEamDbSettings;
import org.sleuthkit.autopsy.centralrepository.datamodel.SqliteEamDbSettings; import org.sleuthkit.autopsy.centralrepository.datamodel.SqliteEamDbSettings;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
/** /**
* Main settings panel for the Central Repository * Main settings panel for the Central Repository
@ -52,6 +54,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
initComponents(); initComponents();
customizeComponents(); customizeComponents();
addIngestJobEventsListener(); addIngestJobEventsListener();
cbUseCentralRepo.setSelected(Boolean.parseBoolean(ModuleSettings.getConfigSetting("CentralRepository", "db.useCentralRepo"))); // NON-NLS
} }
@Messages({"GlobalSettingsPanel.title=Central Repository Settings"}) @Messages({"GlobalSettingsPanel.title=Central Repository Settings"})
@ -86,7 +89,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
bnManageTags = new javax.swing.JButton(); bnManageTags = new javax.swing.JButton();
bnManageTypes = new javax.swing.JButton(); bnManageTypes = new javax.swing.JButton();
tbOops = new javax.swing.JTextField(); tbOops = new javax.swing.JTextField();
jCheckBox1 = new javax.swing.JCheckBox(); cbUseCentralRepo = new javax.swing.JCheckBox();
setName(""); // NOI18N setName(""); // NOI18N
@ -200,10 +203,10 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
tbOops.setText(org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.tbOops.text")); // NOI18N tbOops.setText(org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.tbOops.text")); // NOI18N
tbOops.setBorder(null); tbOops.setBorder(null);
org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1, org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.jCheckBox1.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(cbUseCentralRepo, org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.cbUseCentralRepo.text")); // NOI18N
jCheckBox1.addActionListener(new java.awt.event.ActionListener() { cbUseCentralRepo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox1ActionPerformed(evt); cbUseCentralRepoActionPerformed(evt);
} }
}); });
@ -218,14 +221,14 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
.addComponent(tbOops, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(tbOops, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(pnDatabaseConfiguration, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnDatabaseConfiguration, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(jCheckBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cbUseCentralRepo, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))) .addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap()) .addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jCheckBox1) .addComponent(cbUseCentralRepo)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(pnDatabaseConfiguration, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pnDatabaseConfiguration, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -256,11 +259,11 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
load(); // reload db settings content and update buttons load(); // reload db settings content and update buttons
}//GEN-LAST:event_bnDbConfigureActionPerformed }//GEN-LAST:event_bnDbConfigureActionPerformed
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed private void cbUseCentralRepoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbUseCentralRepoActionPerformed
//if saved setting is disabled checkbox should be disabled already //if saved setting is disabled checkbox should be disabled already
enableDatabaseConfigureButton(jCheckBox1.isSelected()); enableDatabaseConfigureButton(cbUseCentralRepo.isSelected());
enableButtonSubComponents(jCheckBox1.isSelected() && !EamDbPlatformEnum.getSelectedPlatform().equals(DISABLED)); enableButtonSubComponents(cbUseCentralRepo.isSelected() && !EamDbPlatformEnum.getSelectedPlatform().equals(DISABLED));
}//GEN-LAST:event_jCheckBox1ActionPerformed }//GEN-LAST:event_cbUseCentralRepoActionPerformed
@Override @Override
@Messages({"GlobalSettingsPanel.validationerrMsg.mustConfigure=Configure the database to enable this module."}) @Messages({"GlobalSettingsPanel.validationerrMsg.mustConfigure=Configure the database to enable this module."})
@ -269,7 +272,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
enableAllSubComponents(false); enableAllSubComponents(false);
EamDbPlatformEnum selectedPlatform = EamDbPlatformEnum.getSelectedPlatform(); EamDbPlatformEnum selectedPlatform = EamDbPlatformEnum.getSelectedPlatform();
switch (selectedPlatform) { switch (selectedPlatform) {
case POSTGRESQL: case POSTGRESQL:
PostgresEamDbSettings dbSettingsPg = new PostgresEamDbSettings(); PostgresEamDbSettings dbSettingsPg = new PostgresEamDbSettings();
@ -289,7 +291,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
lbDbPlatformValue.setText(EamDbPlatformEnum.DISABLED.toString()); lbDbPlatformValue.setText(EamDbPlatformEnum.DISABLED.toString());
lbDbNameValue.setText(""); lbDbNameValue.setText("");
lbDbLocationValue.setText(""); lbDbLocationValue.setText("");
enableDatabaseConfigureButton(jCheckBox1.isSelected()); enableDatabaseConfigureButton(cbUseCentralRepo.isSelected());
tbOops.setText(Bundle.GlobalSettingsPanel_validationerrMsg_mustConfigure()); tbOops.setText(Bundle.GlobalSettingsPanel_validationerrMsg_mustConfigure());
break; break;
} }
@ -299,6 +301,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
@Override @Override
public void store() { // Click OK or Apply on Options Panel public void store() { // Click OK or Apply on Options Panel
ModuleSettings.setConfigSetting("CentralRepository", "db.useCentralRepo", Boolean.toString(cbUseCentralRepo.isSelected()));
} }
/** /**
@ -312,6 +315,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
@Override @Override
public void saveSettings() { // Click OK on Global Settings Panel public void saveSettings() { // Click OK on Global Settings Panel
store();
} }
@Override @Override
@ -366,8 +370,8 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
* @return True * @return True
*/ */
private boolean enableAllSubComponents(Boolean enable) { private boolean enableAllSubComponents(Boolean enable) {
enableDatabaseConfigureButton(jCheckBox1.isSelected() && enable); enableDatabaseConfigureButton(cbUseCentralRepo.isSelected() && enable);
enableButtonSubComponents(jCheckBox1.isSelected() && enable); enableButtonSubComponents(cbUseCentralRepo.isSelected() && enable);
return true; return true;
} }
@ -411,7 +415,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
private javax.swing.JButton bnImportDatabase; private javax.swing.JButton bnImportDatabase;
private javax.swing.JButton bnManageTags; private javax.swing.JButton bnManageTags;
private javax.swing.JButton bnManageTypes; private javax.swing.JButton bnManageTypes;
private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox cbUseCentralRepo;
private javax.swing.JLabel lbDbLocationLabel; private javax.swing.JLabel lbDbLocationLabel;
private javax.swing.JLabel lbDbLocationValue; private javax.swing.JLabel lbDbLocationValue;
private javax.swing.JLabel lbDbNameLabel; private javax.swing.JLabel lbDbNameLabel;