2153: Restart message is needed while Auto Ingest options changes and switch between standalone and Join AutoIngest cluster

This commit is contained in:
U-BASIS\zhaohui 2016-12-21 10:04:42 -05:00
parent a5902d50f5
commit 88af9d19fb

View File

@ -204,6 +204,18 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel {
* Save mode to persistent storage.
*/
void store() {
boolean needsRestart = false;
AutoIngestUserPreferences.SelectedMode storedMode = AutoIngestUserPreferences.getMode();
if (AutoIngestUserPreferences.getJoinAutoModeCluster() != cbJoinAutoIngestCluster.isSelected()) {
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.MustRestart"),
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.restartRequiredLabel.text"),
JOptionPane.WARNING_MESSAGE);
});
}
AutoIngestUserPreferences.setJoinAutoModeCluster(cbJoinAutoIngestCluster.isSelected());
if (!cbJoinAutoIngestCluster.isSelected()) {
AutoIngestUserPreferences.setMode(AutoIngestUserPreferences.SelectedMode.STANDALONE);
@ -211,22 +223,16 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel {
}
if (jRadioButtonAutomated.isSelected()) {
boolean needsSaving = false;
if (storedMode != AutoIngestUserPreferences.SelectedMode.AUTOMATED) {
needsRestart = true;
}
String thePath = AutoIngestUserPreferences.getAutoModeImageFolder();
if (thePath != null && 0 != inputPathTextField.getText().compareTo(thePath)) {
needsSaving = true;
needsRestart = true;
}
thePath = AutoIngestUserPreferences.getAutoModeResultsFolder();
if (thePath != null && 0 != outputPathTextField.getText().compareTo(thePath)) {
needsSaving = true;
}
if (needsSaving) {
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.MustRestart"),
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.restartRequiredLabel.text"),
JOptionPane.WARNING_MESSAGE);
});
needsRestart = true;
}
AutoIngestUserPreferences.setMode(AutoIngestUserPreferences.SelectedMode.AUTOMATED);
@ -241,20 +247,27 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel {
AutoIngestUserPreferences.setSharedConfigMaster(masterNodeCheckBox.isSelected());
}
} else if (jRadioButtonReview.isSelected()) {
if (storedMode != AutoIngestUserPreferences.SelectedMode.REVIEW) {
needsRestart = true;
}
String thePath = AutoIngestUserPreferences.getAutoModeResultsFolder();
if (thePath != null && 0 != outputPathTextField.getText().compareTo(thePath)) {
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.MustRestart"),
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.restartRequiredLabel.text"),
JOptionPane.WARNING_MESSAGE);
});
needsRestart = true;
}
AutoIngestUserPreferences.setMode(AutoIngestUserPreferences.SelectedMode.REVIEW);
String resultsFolderPath = getNormalizedFolderPath(outputPathTextField.getText().trim());
AutoIngestUserPreferences.setAutoModeResultsFolder(resultsFolderPath);
AutoIngestUserPreferences.setAutoModeResultsFolder(resultsFolderPath);
}
if (needsRestart) {
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.MustRestart"),
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.restartRequiredLabel.text"),
JOptionPane.WARNING_MESSAGE);
});
}
}
void validateSettings() {