20 package org.sleuthkit.autopsy.casemodule;
22 import java.util.HashSet;
23 import java.util.Iterator;
25 import javax.swing.SwingUtilities;
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.Exceptions;
31 import org.openide.util.HelpCtx;
32 import org.openide.util.NbBundle;
41 class NewCaseWizardPanel2
implements WizardDescriptor.ValidatingPanel<WizardDescriptor> {
47 private NewCaseVisualPanel2 component;
48 private Boolean isFinish =
true;
49 private String caseName;
50 private String caseDir;
51 private String createdDirectory;
62 public NewCaseVisualPanel2 getComponent() {
63 if (component == null) {
64 component =
new NewCaseVisualPanel2();
76 public HelpCtx getHelp() {
78 return HelpCtx.DEFAULT_HELP;
90 public boolean isValid() {
99 private final Set<ChangeListener> listeners =
new HashSet<ChangeListener>(1);
107 public final void addChangeListener(ChangeListener l) {
108 synchronized (listeners) {
119 public final void removeChangeListener(ChangeListener l) {
120 synchronized (listeners) {
129 protected final void fireChangeEvent() {
130 Iterator<ChangeListener> it;
131 synchronized (listeners) {
132 it =
new HashSet<ChangeListener>(listeners).iterator();
134 ChangeEvent ev =
new ChangeEvent(
this);
135 while (it.hasNext()) {
136 it.next().stateChanged(ev);
153 public void readSettings(WizardDescriptor settings) {
154 caseName = (String) settings.getProperty(
"caseName");
155 caseDir = (String) settings.getProperty(
"caseParentDir");
156 createdDirectory = (String) settings.getProperty(
"createdDirectory");
169 public void storeSettings(WizardDescriptor settings) {
173 public void validate() throws WizardValidationException {
175 NewCaseVisualPanel2 currentComponent = getComponent();
176 final String caseNumber = currentComponent.getCaseNumber();
177 final String examiner = currentComponent.getExaminer();
179 SwingUtilities.invokeLater(
new Runnable(){
184 Case.create(createdDirectory, caseName, caseNumber, examiner);
185 }
catch (Exception ex) {
186 Exceptions.printStackTrace(ex);
193 }
catch(Exception ex) {
194 throw new WizardValidationException(this.getComponent(),
195 NbBundle.getMessage(
this.getClass(),
196 "NewCaseWizardPanel2.validate.errCreateCase.msg"),