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;
43 @SuppressWarnings(
"PMD.SingularField")
44 class AddImageWizardIngestConfigPanel extends ShortcutWizardDescriptorPanel {
46 @Messages(
"AddImageWizardIngestConfigPanel.name.text=Configure Ingest")
47 private final IngestJobSettingsPanel ingestJobSettingsPanel;
52 private Component component = null;
53 private String lastProfileUsed = AddImageWizardIngestConfigPanel.class.getCanonicalName();
54 private final AddImageWizardAddingProgressPanel progressPanel;
56 AddImageWizardIngestConfigPanel(AddImageWizardAddingProgressPanel proPanel) {
57 this.progressPanel = proPanel;
58 IngestJobSettings ingestJobSettings =
new IngestJobSettings(AddImageWizardIngestConfigPanel.class.getCanonicalName());
59 showWarnings(ingestJobSettings);
62 this.ingestJobSettingsPanel =
new IngestJobSettingsPanel(ingestJobSettings);
75 public Component getComponent() {
76 if (component == null) {
77 component =
new AddImageWizardIngestConfigVisual(this.ingestJobSettingsPanel);
78 component.setName(Bundle.AddImageWizardIngestConfigPanel_name_text());
90 public HelpCtx getHelp() {
92 return HelpCtx.DEFAULT_HELP;
104 public boolean isValid() {
120 public final void addChangeListener(ChangeListener l) {
129 public final void removeChangeListener(ChangeListener l) {
145 public void readSettings(WizardDescriptor settings) {
146 JButton cancel =
new JButton(
147 NbBundle.getMessage(
this.getClass(),
"AddImageWizardIngestConfigPanel.CANCEL_BUTTON.text"));
148 cancel.setEnabled(
false);
149 settings.setOptions(
new Object[]{WizardDescriptor.PREVIOUS_OPTION, WizardDescriptor.NEXT_OPTION, WizardDescriptor.FINISH_OPTION, cancel});
162 public void storeSettings(WizardDescriptor settings) {
163 IngestJobSettings ingestJobSettings = ingestJobSettingsPanel.getSettings();
164 ingestJobSettings.save();
165 progressPanel.setIngestJobSettings(ingestJobSettings);
168 private static void showWarnings(IngestJobSettings ingestJobSettings) {
169 List<String> warnings = ingestJobSettings.getWarnings();
170 if (warnings.isEmpty() ==
false) {
171 StringBuilder warningMessage =
new StringBuilder();
172 for (String warning : warnings) {
173 warningMessage.append(warning).append(
"\n");
175 JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), warningMessage.toString());
185 public void processThisPanelBeforeSkipped() {
186 if (!(ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()) == null)
187 && !ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName()).isEmpty()) {
188 lastProfileUsed = ModuleSettings.getConfigSetting(IngestProfileSelectionWizardPanel.getLastProfilePropertiesFile(), AddImageWizardIterator.getPropLastprofileName());
192 IngestJobSettings ingestJobSettings =
new IngestJobSettings(lastProfileUsed);
193 progressPanel.setIngestJobSettings(ingestJobSettings);