Autopsy  4.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-2017 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 final class AddImageWizardSelectDspPanel extends ShortcutWizardDescriptorPanel implements PropertyChangeListener {
40 
41  @NbBundle.Messages("SelectDataSourceProcessorPanel.name.text=Select Type of Data Source To Add")
42  private AddImageWizardSelectDspVisual component;
43  private static final String LAST_DSP_PROPERTIES_FILE = "LastDspUsed"; //NON-NLS
44  private static final String LAST_DSP_USED_KEY = "Last_Dsp_Used"; //NON-NLS
45  private static final Logger logger = Logger.getLogger(AddImageWizardSelectDspVisual.class.getName());
46 
47  @Override
48  public Component getComponent() {
49  if (component == null) {
50  String lastDspUsed;
51  if (!(ModuleSettings.getConfigSetting(LAST_DSP_PROPERTIES_FILE, LAST_DSP_USED_KEY) == null)
52  && !ModuleSettings.getConfigSetting(LAST_DSP_PROPERTIES_FILE, LAST_DSP_USED_KEY).isEmpty()) {
53  lastDspUsed = ModuleSettings.getConfigSetting(LAST_DSP_PROPERTIES_FILE, LAST_DSP_USED_KEY);
54  } else {
55  lastDspUsed = ImageDSProcessor.getType();
56  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
57  }
58  WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
59  component = new AddImageWizardSelectDspVisual(lastDspUsed);
60  component.setName(Bundle.SelectDataSourceProcessorPanel_name_text());
61  }
62  component.addPropertyChangeListener(this);
63  return component;
64  }
65 
66  @Override
67  public HelpCtx getHelp() {
68  return HelpCtx.DEFAULT_HELP;
69  }
70 
71  @Override
72  public void readSettings(WizardDescriptor data) {
73  }
74 
75  @Override
76  public void storeSettings(WizardDescriptor data) {
77  String lastDspUsed = component.getSelectedDsp();
78  ModuleSettings.setConfigSetting(LAST_DSP_PROPERTIES_FILE, LAST_DSP_USED_KEY, lastDspUsed);
79  data.putProperty("SelectedDsp", lastDspUsed); //NON-NLS magic string necesary to AddImageWizardChooseDataSourcePanel
80  }
81 
82  @Override
83  public boolean isValid() {
84  return true;
85  }
86 
87  @Override
88  public void addChangeListener(ChangeListener cl) {
89  }
90 
91  @Override
92  public void removeChangeListener(ChangeListener cl) {
93  }
94 
95  @Override
96  public void propertyChange(PropertyChangeEvent evt) {
97  }
98 }

Copyright © 2012-2016 Basis Technology. Generated on: Mon Apr 24 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.