Autopsy  4.21.0
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  */
19 package org.sleuthkit.autopsy.casemodule;
20 
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;
34 
39 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
40 final 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 }

Copyright © 2012-2022 Basis Technology. Generated on: Tue Feb 6 2024
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.