19 package org.sleuthkit.autopsy.logicalimager.configuration;
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.util.HashSet;
24 import java.util.Iterator;
26 import javax.swing.event.ChangeEvent;
27 import javax.swing.event.ChangeListener;
28 import org.openide.WizardDescriptor;
29 import org.openide.WizardValidationException;
30 import org.openide.util.HelpCtx;
35 final class ConfigWizardPanel1
implements WizardDescriptor.ValidatingPanel<WizardDescriptor> {
41 private ConfigVisualPanel1 component;
42 private boolean valid =
false;
49 public ConfigVisualPanel1 getComponent() {
50 if (component == null) {
51 component =
new ConfigVisualPanel1();
52 component.addPropertyChangeListener(
new PropertyChangeListener() {
54 public void propertyChange(PropertyChangeEvent evt) {
55 if (evt.getPropertyName().equals(ConfigVisualPanel1.getUpdateEventName())) {
56 valid = component.isPanelValid();
67 public HelpCtx getHelp() {
69 return HelpCtx.DEFAULT_HELP;
75 public boolean isValid() {
83 private final Set<ChangeListener> listeners =
new HashSet<>(1);
91 public void addChangeListener(ChangeListener l) {
92 synchronized (listeners) {
103 public void removeChangeListener(ChangeListener l) {
104 synchronized (listeners) {
113 void fireChangeEvent() {
114 Iterator<ChangeListener> it;
115 synchronized (listeners) {
116 it =
new HashSet<>(listeners).iterator();
118 ChangeEvent ev =
new ChangeEvent(
this);
119 while (it.hasNext()) {
120 it.next().stateChanged(ev);
125 public void readSettings(WizardDescriptor wiz) {
127 component.setConfigFilename((String) wiz.getProperty(
"configFilename"));
131 public void storeSettings(WizardDescriptor wiz) {
133 wiz.putProperty(
"configFilename", component.getConfigPath());
134 wiz.putProperty(
"config", component.getConfig());
138 public void validate() throws WizardValidationException {
139 valid = component.isPanelValid();