19 package org.sleuthkit.autopsy.casemodule;
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.util.HashSet;
24 import java.util.Iterator;
26 import java.util.logging.Level;
27 import org.openide.util.NbBundle;
29 import javax.swing.event.ChangeEvent;
30 import javax.swing.event.ChangeListener;
31 import org.openide.WizardDescriptor;
32 import org.openide.util.HelpCtx;
33 import org.openide.util.Lookup;
34 import org.openide.windows.WindowManager;
35 import java.awt.Cursor;
42 @SuppressWarnings(
"PMD.SingularField")
43 class AddImageWizardDataSourceSettingsPanel extends ShortcutWizardDescriptorPanel implements PropertyChangeListener {
49 private AddImageWizardDataSourceSettingsVisual component;
50 private boolean isNextEnable =
false;
53 AddImageWizardDataSourceSettingsPanel() {
65 public AddImageWizardDataSourceSettingsVisual getComponent() {
66 if (component == null) {
67 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
68 component =
new AddImageWizardDataSourceSettingsVisual(
this);
69 component.setLocation(WindowManager.getDefault().getMainWindow().getLocation());
71 component.addPropertyChangeListener(
this);
82 public HelpCtx getHelp() {
84 return HelpCtx.DEFAULT_HELP;
96 public boolean isValid() {
103 void moveFocusToNext() {
106 Lookup.getDefault().lookup(AddImageAction.class).requestFocusButton(
107 NbBundle.getMessage(
this.getClass(),
"AddImageWizardChooseDataSourcePanel.moveFocusNext"));
116 public void enableNextButton(
boolean isEnabled) {
117 isNextEnable = isEnabled;
120 private final Set<ChangeListener> listeners =
new HashSet<>(1);
128 public final void addChangeListener(ChangeListener l) {
129 synchronized (listeners) {
140 public final void removeChangeListener(ChangeListener l) {
141 synchronized (listeners) {
150 protected final void fireChangeEvent() {
151 Iterator<ChangeListener> it;
152 synchronized (listeners) {
153 it =
new HashSet<>(listeners).iterator();
155 ChangeEvent ev =
new ChangeEvent(
this);
156 while (it.hasNext()) {
157 it.next().stateChanged(ev);
170 public void readSettings(WizardDescriptor settings) {
175 AddImageAction.CleanupTask cleanupTask = (AddImageAction.CleanupTask) settings.getProperty(AddImageAction.IMAGECLEANUPTASK_PROP);
176 if (cleanupTask != null) {
178 cleanupTask.cleanup();
179 }
catch (Exception ex) {
180 Logger logger = Logger.getLogger(AddImageWizardDataSourceSettingsPanel.class.getName());
181 logger.log(Level.WARNING,
"Error cleaning up image task", ex);
183 cleanupTask.disable();
186 }
catch (Exception e) {
188 component.setDspSelection((String) settings.getProperty(
"SelectedDsp"));
201 public void storeSettings(WizardDescriptor settings) {
211 public void propertyChange(PropertyChangeEvent evt) {