19 package org.sleuthkit.autopsy.casemodule;
21 import java.awt.Component;
22 import java.awt.Cursor;
23 import java.beans.PropertyChangeEvent;
24 import java.beans.PropertyChangeListener;
25 import java.util.logging.Level;
26 import javax.swing.event.ChangeListener;
27 import org.openide.WizardDescriptor;
28 import org.openide.util.HelpCtx;
29 import org.openide.util.NbBundle;
30 import org.openide.windows.WindowManager;
39 @SuppressWarnings(
"PMD.SingularField")
40 final class AddImageWizardSelectDspPanel extends ShortcutWizardDescriptorPanel implements PropertyChangeListener {
42 @NbBundle.Messages(
"SelectDataSourceProcessorPanel.name.text=Select Type of Data Source To Add")
43 private AddImageWizardSelectDspVisual component;
44 private static final String LAST_DSP_PROPERTIES_FILE =
"LastDspUsed";
45 private static final String LAST_DSP_USED_KEY =
"Last_Dsp_Used";
46 private static final Logger logger = Logger.getLogger(AddImageWizardSelectDspVisual.class.getName());
49 public Component getComponent() {
50 if (component == null) {
52 if (!(ModuleSettings.getConfigSetting(LAST_DSP_PROPERTIES_FILE, LAST_DSP_USED_KEY) == null)
53 && !ModuleSettings.getConfigSetting(LAST_DSP_PROPERTIES_FILE, LAST_DSP_USED_KEY).isEmpty()) {
54 lastDspUsed = ModuleSettings.getConfigSetting(LAST_DSP_PROPERTIES_FILE, LAST_DSP_USED_KEY);
56 lastDspUsed = ImageDSProcessor.getType();
57 logger.log(Level.WARNING,
"There was no properties file containing the last DataSourceProcessor used, Disk Image or VM will be selected as default selection");
59 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
60 component =
new AddImageWizardSelectDspVisual(lastDspUsed);
61 component.setName(Bundle.SelectDataSourceProcessorPanel_name_text());
63 component.addPropertyChangeListener(
this);
68 public HelpCtx getHelp() {
69 return HelpCtx.DEFAULT_HELP;
73 public void readSettings(WizardDescriptor data) {
77 public void storeSettings(WizardDescriptor data) {
78 String lastDspUsed = component.getSelectedDsp();
79 ModuleSettings.setConfigSetting(LAST_DSP_PROPERTIES_FILE, LAST_DSP_USED_KEY, lastDspUsed);
80 data.putProperty(
"SelectedDsp", lastDspUsed);
84 public boolean isValid() {
89 public void addChangeListener(ChangeListener cl) {
93 public void removeChangeListener(ChangeListener cl) {
97 public void propertyChange(PropertyChangeEvent evt) {