19 package org.sleuthkit.autopsy.casemodule;
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
24 import java.util.HashSet;
25 import java.util.Iterator;
27 import java.util.logging.Level;
29 import org.openide.util.NbBundle;
31 import javax.swing.event.ChangeEvent;
32 import javax.swing.event.ChangeListener;
33 import org.openide.WizardDescriptor;
34 import org.openide.util.HelpCtx;
35 import org.openide.util.Lookup;
42 class AddImageWizardChooseDataSourcePanel
implements WizardDescriptor.Panel<WizardDescriptor>, PropertyChangeListener {
48 private AddImageWizardAddingProgressPanel progressPanel;
49 private AddImageWizardChooseDataSourceVisual component;
50 private boolean isNextEnable =
false;
51 private static final String PROP_LASTDATASOURCE_PATH =
"LBL_LastDataSource_PATH";
52 private static final String PROP_LASTDATASOURCE_TYPE =
"LBL_LastDataSource_TYPE";
54 private String NSRLPath, knownBadPath;
57 AddImageWizardChooseDataSourcePanel(AddImageWizardAddingProgressPanel proPanel) {
59 this.progressPanel = proPanel;
71 public AddImageWizardChooseDataSourceVisual getComponent() {
72 if (component == null) {
73 component =
new AddImageWizardChooseDataSourceVisual(
this);
75 component.addPropertyChangeListener(
this);
86 public HelpCtx getHelp() {
88 return HelpCtx.DEFAULT_HELP;
101 public boolean isValid() {
108 void moveFocusToNext() {
111 Lookup.getDefault().lookup(AddImageAction.class).requestFocusButton(
112 NbBundle.getMessage(
this.getClass(),
"AddImageWizardChooseDataSourcePanel.moveFocusNext"));
121 public void enableNextButton(
boolean isEnabled) {
122 isNextEnable = isEnabled;
125 private final Set<ChangeListener> listeners =
new HashSet<ChangeListener>(1);
133 public final void addChangeListener(ChangeListener l) {
134 synchronized (listeners) {
145 public final void removeChangeListener(ChangeListener l) {
146 synchronized (listeners) {
155 protected final void fireChangeEvent() {
156 Iterator<ChangeListener> it;
157 synchronized (listeners) {
158 it =
new HashSet<ChangeListener>(listeners).iterator();
160 ChangeEvent ev =
new ChangeEvent(
this);
161 while (it.hasNext()) {
162 it.next().stateChanged(ev);
179 public void readSettings(WizardDescriptor settings) {
188 this.NSRLPath = null;
189 this.knownBadPath = null;
195 AddImageAction.CleanupTask cleanupTask = (AddImageAction.CleanupTask) settings.getProperty(AddImageAction.IMAGECLEANUPTASK_PROP);
196 if (cleanupTask != null) {
198 cleanupTask.cleanup();
199 }
catch (Exception ex) {
200 Logger logger = Logger.getLogger(AddImageWizardChooseDataSourcePanel.class.getName());
201 logger.log(Level.WARNING,
"Error cleaning up image task", ex);
203 cleanupTask.disable();
206 }
catch (Exception e) {
221 public void storeSettings(WizardDescriptor settings) {
233 public void propertyChange(PropertyChangeEvent evt) {