From 0408036295d4fc540847ed0e819f55ebf23a2f70 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 31 Aug 2017 11:05:19 -0400 Subject: [PATCH 1/4] 2970 Central Repo options panel only allows applying of enabled CR when config is done --- .../optionspanel/GlobalSettingsPanel.form | 21 +++++++++++++++++-- .../optionspanel/GlobalSettingsPanel.java | 20 ++++++++++++++---- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form index 2e87f1d5a4..aeb4dfd880 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form @@ -83,7 +83,11 @@ - + + + + + @@ -108,7 +112,10 @@ - + + + + @@ -152,6 +159,16 @@ + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java index c0be22bf90..5d8e294173 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java @@ -56,7 +56,8 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i } @Messages({"GlobalSettingsPanel.title=Central Repository Settings", - "GlobalSettingsPanel.cbUseCentralRepo.text=Use a Central Repository"}) + "GlobalSettingsPanel.cbUseCentralRepo.text=Use a Central Repository", + "GlobalSettingsPanel.lbConfigCentralRepo.text=Central Repository must be configured before it can be used."}) private void customizeComponents() { setName(Bundle.GlobalSettingsPanel_title()); } @@ -83,6 +84,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i lbDbPlatformValue = new javax.swing.JLabel(); lbDbNameValue = new javax.swing.JLabel(); lbDbLocationValue = new javax.swing.JLabel(); + lbConfigCentralRepo = new javax.swing.JLabel(); pnDatabaseContentButtons = new javax.swing.JPanel(); bnImportDatabase = new javax.swing.JButton(); bnManageTags = new javax.swing.JButton(); @@ -107,6 +109,9 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i } }); + lbConfigCentralRepo.setForeground(new java.awt.Color(255, 0, 0)); + org.openide.awt.Mnemonics.setLocalizedText(lbConfigCentralRepo, org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.lbConfigCentralRepo.text")); // NOI18N + javax.swing.GroupLayout pnDatabaseConfigurationLayout = new javax.swing.GroupLayout(pnDatabaseConfiguration); pnDatabaseConfiguration.setLayout(pnDatabaseConfigurationLayout); pnDatabaseConfigurationLayout.setHorizontalGroup( @@ -125,7 +130,10 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i .addComponent(lbDbPlatformValue, javax.swing.GroupLayout.PREFERRED_SIZE, 711, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbDbNameValue, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 711, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(lbDbLocationValue, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 711, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addComponent(bnDbConfigure)) + .addGroup(pnDatabaseConfigurationLayout.createSequentialGroup() + .addComponent(bnDbConfigure) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lbConfigCentralRepo, javax.swing.GroupLayout.PREFERRED_SIZE, 361, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pnDatabaseConfigurationLayout.setVerticalGroup( @@ -144,7 +152,9 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i .addComponent(lbDbLocationLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbDbLocationValue, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE) - .addComponent(bnDbConfigure) + .addGroup(pnDatabaseConfigurationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(bnDbConfigure) + .addComponent(lbConfigCentralRepo)) .addContainerGap()) ); @@ -314,7 +324,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i * @return true if it's okay, false otherwise. */ public boolean valid() { - return true; + return !(cbUseCentralRepo.isSelected() && lbDbPlatformValue.getText().equals(DISABLED.toString())); } @Override @@ -401,6 +411,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i lbDbPlatformTypeLabel.setEnabled(enable && !ingestRunning); lbDbPlatformValue.setEnabled(enable && !ingestRunning); tbOops.setEnabled(enable && !ingestRunning); + lbConfigCentralRepo.setVisible(enable && EamDbPlatformEnum.getSelectedPlatform().equals(DISABLED)); } /** @@ -425,6 +436,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i private javax.swing.JButton bnManageTags; private javax.swing.JButton bnManageTypes; private javax.swing.JCheckBox cbUseCentralRepo; + private javax.swing.JLabel lbConfigCentralRepo; private javax.swing.JLabel lbDbLocationLabel; private javax.swing.JLabel lbDbLocationValue; private javax.swing.JLabel lbDbNameLabel; From a3d9d7bcc979413b6ae7fc58d9f2dc0602f31f2b Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 31 Aug 2017 13:59:09 -0400 Subject: [PATCH 2/4] 2970 removed redundant message about config --- .../optionspanel/GlobalSettingsPanel.form | 21 ++----------------- .../optionspanel/GlobalSettingsPanel.java | 15 ++----------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form index aeb4dfd880..2e87f1d5a4 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form @@ -83,11 +83,7 @@ - - - - - + @@ -112,10 +108,7 @@ - - - - + @@ -159,16 +152,6 @@ - - - - - - - - - - diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java index 5d8e294173..4f7b726e1d 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java @@ -84,7 +84,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i lbDbPlatformValue = new javax.swing.JLabel(); lbDbNameValue = new javax.swing.JLabel(); lbDbLocationValue = new javax.swing.JLabel(); - lbConfigCentralRepo = new javax.swing.JLabel(); pnDatabaseContentButtons = new javax.swing.JPanel(); bnImportDatabase = new javax.swing.JButton(); bnManageTags = new javax.swing.JButton(); @@ -109,9 +108,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i } }); - lbConfigCentralRepo.setForeground(new java.awt.Color(255, 0, 0)); - org.openide.awt.Mnemonics.setLocalizedText(lbConfigCentralRepo, org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.lbConfigCentralRepo.text")); // NOI18N - javax.swing.GroupLayout pnDatabaseConfigurationLayout = new javax.swing.GroupLayout(pnDatabaseConfiguration); pnDatabaseConfiguration.setLayout(pnDatabaseConfigurationLayout); pnDatabaseConfigurationLayout.setHorizontalGroup( @@ -130,10 +126,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i .addComponent(lbDbPlatformValue, javax.swing.GroupLayout.PREFERRED_SIZE, 711, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbDbNameValue, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 711, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(lbDbLocationValue, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 711, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGroup(pnDatabaseConfigurationLayout.createSequentialGroup() - .addComponent(bnDbConfigure) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lbConfigCentralRepo, javax.swing.GroupLayout.PREFERRED_SIZE, 361, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(bnDbConfigure)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pnDatabaseConfigurationLayout.setVerticalGroup( @@ -152,9 +145,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i .addComponent(lbDbLocationLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbDbLocationValue, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE) - .addGroup(pnDatabaseConfigurationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(bnDbConfigure) - .addComponent(lbConfigCentralRepo)) + .addComponent(bnDbConfigure) .addContainerGap()) ); @@ -411,7 +402,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i lbDbPlatformTypeLabel.setEnabled(enable && !ingestRunning); lbDbPlatformValue.setEnabled(enable && !ingestRunning); tbOops.setEnabled(enable && !ingestRunning); - lbConfigCentralRepo.setVisible(enable && EamDbPlatformEnum.getSelectedPlatform().equals(DISABLED)); } /** @@ -436,7 +426,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i private javax.swing.JButton bnManageTags; private javax.swing.JButton bnManageTypes; private javax.swing.JCheckBox cbUseCentralRepo; - private javax.swing.JLabel lbConfigCentralRepo; private javax.swing.JLabel lbDbLocationLabel; private javax.swing.JLabel lbDbLocationValue; private javax.swing.JLabel lbDbNameLabel; From ba3338eccc417f412c5fc76f73a1b5c1c9b2775c Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 31 Aug 2017 17:22:35 -0400 Subject: [PATCH 3/4] 2970 allow property change to be fired when cofig was modified --- .../optionspanel/EamDbSettingsDialog.java | 11 +++++++++++ .../optionspanel/GlobalSettingsPanel.java | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java index 6ef345ac4f..54660c8205 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java @@ -51,6 +51,7 @@ public class EamDbSettingsDialog extends JDialog { private final SqliteEamDbSettings dbSettingsSqlite; private DatabaseTestResult testingStatus; private EamDbPlatformEnum selectedPlatform; + private boolean configurationChanged = false; /** * Creates new form EamDbSettingsDialog @@ -390,6 +391,14 @@ public class EamDbSettingsDialog extends JDialog { testingStatus = DatabaseTestResult.TESTEDOK; valid(); } + /** + * Returns if changes to the central repository configuration were successfully applied + * + * @return true if the database configuration was successfully changed false if it was not + */ + boolean wasConfigurationChanged() { + return configurationChanged; + } @Messages({"EamDbSettingsDialog.okButton.errorTitle.text=Restart Required.", "EamDbSettingsDialog.okButton.errorMsg.text=Please restart Autopsy to begin using the new database platform.", @@ -459,6 +468,7 @@ public class EamDbSettingsDialog extends JDialog { // in case we are still using the same instance. try { EamDb.getInstance().updateSettings(); + configurationChanged = true; } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, Bundle.EamDbSettingsDialog_okButton_connectionErrorMsg_text(), ex); //NON-NLS setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); @@ -473,6 +483,7 @@ public class EamDbSettingsDialog extends JDialog { // in case we are still using the same instance. try { EamDb.getInstance().updateSettings(); + configurationChanged = true; } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, Bundle.EamDbSettingsDialog_okButton_connectionErrorMsg_text(), ex); //NON-NLS setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java index 4f7b726e1d..bf5e5cc000 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java @@ -261,6 +261,9 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i store(); EamDbSettingsDialog dialog = new EamDbSettingsDialog(); load(); // reload db settings content and update buttons + if (dialog.wasConfigurationChanged()) { + firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); + } }//GEN-LAST:event_bnDbConfigureActionPerformed private void cbUseCentralRepoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbUseCentralRepoActionPerformed @@ -315,7 +318,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i * @return true if it's okay, false otherwise. */ public boolean valid() { - return !(cbUseCentralRepo.isSelected() && lbDbPlatformValue.getText().equals(DISABLED.toString())); + return !cbUseCentralRepo.isSelected() || !lbDbPlatformValue.getText().equals(DISABLED.toString()); } @Override From 5c4964966a6c7383af8b99eee1196cd142a40409 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 31 Aug 2017 17:37:28 -0400 Subject: [PATCH 4/4] 2970 cleanup remove unused bundle message --- .../centralrepository/optionspanel/GlobalSettingsPanel.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java index bf5e5cc000..bf6e59d8fd 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java @@ -56,8 +56,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i } @Messages({"GlobalSettingsPanel.title=Central Repository Settings", - "GlobalSettingsPanel.cbUseCentralRepo.text=Use a Central Repository", - "GlobalSettingsPanel.lbConfigCentralRepo.text=Central Repository must be configured before it can be used."}) + "GlobalSettingsPanel.cbUseCentralRepo.text=Use a Central Repository"}) private void customizeComponents() { setName(Bundle.GlobalSettingsPanel_title()); }