Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
AddImageWizardSelectDspPanel.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2011-2018 Basis Technology Corp.
5 * Contact: carrier <at> sleuthkit <dot> org
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19package org.sleuthkit.autopsy.casemodule;
20
21import java.awt.Component;
22import java.awt.Cursor;
23import java.beans.PropertyChangeEvent;
24import java.beans.PropertyChangeListener;
25import java.util.logging.Level;
26import javax.swing.event.ChangeListener;
27import org.openide.WizardDescriptor;
28import org.openide.util.HelpCtx;
29import org.openide.util.NbBundle;
30import org.openide.windows.WindowManager;
31import org.sleuthkit.autopsy.coreutils.Logger;
32import org.sleuthkit.autopsy.coreutils.ModuleSettings;
33import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.ShortcutWizardDescriptorPanel;
34
39@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
40final class AddImageWizardSelectDspPanel extends ShortcutWizardDescriptorPanel implements PropertyChangeListener {
41
42 @NbBundle.Messages("SelectDataSourceProcessorPanel.name.text=Select Data Source Type")
43 private AddImageWizardSelectDspVisual component;
44 private static final String LAST_DSP_PROPERTIES_FILE = "LastDspUsed"; //NON-NLS
45 private static final String LAST_DSP_USED_KEY = "Last_Dsp_Used"; //NON-NLS
46 private static final Logger logger = Logger.getLogger(AddImageWizardSelectDspVisual.class.getName());
47
48 @Override
49 public Component getComponent() {
50 if (component == null) {
51 String lastDspUsed;
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);
55 } else {
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"); //NON-NLS
58 }
59 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
60 component = new AddImageWizardSelectDspVisual(lastDspUsed);
61 component.setName(Bundle.SelectDataSourceProcessorPanel_name_text());
62 }
63 component.addPropertyChangeListener(this);
64 return component;
65 }
66
67 @Override
68 public HelpCtx getHelp() {
69 return HelpCtx.DEFAULT_HELP;
70 }
71
72 @Override
73 public void readSettings(WizardDescriptor data) {
74 }
75
76 @Override
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); //NON-NLS magic string necesary to AddImageWizardChooseDataSourcePanel
81 }
82
83 @Override
84 public boolean isValid() {
85 return true;
86 }
87
88 @Override
89 public void addChangeListener(ChangeListener cl) {
90 }
91
92 @Override
93 public void removeChangeListener(ChangeListener cl) {
94 }
95
96 @Override
97 public void propertyChange(PropertyChangeEvent evt) {
98 }
99}
synchronized static Logger getLogger(String name)
Definition Logger.java:124
static synchronized void setConfigSetting(String moduleName, String settingName, String settingVal)
static synchronized String getConfigSetting(String moduleName, String settingName)

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.