19 package org.sleuthkit.autopsy.casemodule;
21 import org.openide.util.NbBundle;
22 import java.awt.Component;
23 import java.util.List;
24 import javax.swing.JButton;
25 import javax.swing.JOptionPane;
26 import javax.swing.event.ChangeListener;
27 import org.openide.WizardDescriptor;
28 import org.openide.util.HelpCtx;
29 import org.openide.util.NbBundle.Messages;
30 import org.openide.windows.WindowManager;
44 @SuppressWarnings(
"PMD.SingularField")
45 class AddImageWizardIngestConfigPanel extends ShortcutWizardDescriptorPanel {
47 @Messages(
"AddImageWizardIngestConfigPanel.name.text=Configure Ingest")
48 private final IngestJobSettingsPanel ingestJobSettingsPanel;
53 private Component component = null;
54 private String lastProfileUsed = AddImageWizardIngestConfigPanel.class.getCanonicalName();
55 private final AddImageWizardAddingProgressPanel progressPanel;
57 AddImageWizardIngestConfigPanel(AddImageWizardAddingProgressPanel proPanel) {
58 this.progressPanel = proPanel;
59 IngestJobSettings ingestJobSettings =
new IngestJobSettings(AddImageWizardIngestConfigPanel.class.getCanonicalName());
60 showWarnings(ingestJobSettings);
63 this.ingestJobSettingsPanel =
new IngestJobSettingsPanel(ingestJobSettings);
76 public Component getComponent() {
77 if (component == null) {
78 component =
new AddImageWizardIngestConfigVisual(this.ingestJobSettingsPanel);
79 component.setName(Bundle.AddImageWizardIngestConfigPanel_name_text());
91 public HelpCtx getHelp() {
93 return HelpCtx.DEFAULT_HELP;
105 public boolean isValid() {
121 public final void addChangeListener(ChangeListener l) {
130 public final void removeChangeListener(ChangeListener l) {
146 public void readSettings(WizardDescriptor settings) {
147 JButton cancel =
new JButton(
148 NbBundle.getMessage(
this.getClass(),
"AddImageWizardIngestConfigPanel.CANCEL_BUTTON.text"));
149 cancel.setEnabled(
false);
150 settings.setOptions(
new Object[]{WizardDescriptor.PREVIOUS_OPTION, WizardDescriptor.NEXT_OPTION, WizardDescriptor.FINISH_OPTION, cancel});
163 public void storeSettings(WizardDescriptor settings) {
164 IngestJobSettings ingestJobSettings = ingestJobSettingsPanel.getSettings();
165 ingestJobSettings.save();
166 progressPanel.setIngestJobSettings(ingestJobSettings);
169 private static void showWarnings(IngestJobSettings ingestJobSettings) {
170 List<String> warnings = ingestJobSettings.getWarnings();
171 if (warnings.isEmpty() ==
false) {
172 StringBuilder warningMessage =
new StringBuilder();
173 for (String warning : warnings) {
174 warningMessage.append(warning).append(
"\n");
176 JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), warningMessage.toString());
186 public void processThisPanelBeforeSkipped() {
187 if (!(ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()) == null)
188 && !ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()).isEmpty()) {
189 lastProfileUsed = ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName());
194 IngestJobSettings ingestJobSettings =
new IngestJobSettings(IngestProfilePaths.getInstance().getIngestProfilePrefix() + lastProfileUsed);
195 progressPanel.setIngestJobSettings(ingestJobSettings);