19 package org.sleuthkit.autopsy.casemodule;
21 import java.util.HashSet;
22 import java.util.Iterator;
24 import javax.swing.event.ChangeEvent;
25 import javax.swing.event.ChangeListener;
26 import org.openide.WizardDescriptor;
27 import org.openide.WizardValidationException;
28 import org.openide.util.HelpCtx;
29 import org.openide.windows.WindowManager;
30 import java.awt.Cursor;
31 import java.util.logging.Level;
39 class NewCaseWizardPanel2
implements WizardDescriptor.ValidatingPanel<WizardDescriptor> {
41 private static final Logger logger = Logger.getLogger(NewCaseWizardPanel2.class.getName());
42 private static final String PROP_EXAMINER_NAME =
"LBL_EXAMINER_NAME";
43 private static final String PROP_EXAMINER_PHONE =
"LBL_EXAMINER_PHONE";
44 private static final String PROP_EXAMINER_EMAIL =
"LBL_EXAMINER_EMAIL";
45 private static final String PROP_ORGANIZATION_NAME =
"LBL_ORGANIZATION_NAME";
46 private NewCaseVisualPanel2 component;
47 private final Set<ChangeListener> listeners =
new HashSet<>(1);
55 public NewCaseVisualPanel2 getComponent() {
56 if (component == null) {
57 component =
new NewCaseVisualPanel2();
59 component.refreshCaseDetailsFields();
72 public HelpCtx getHelp() {
76 return HelpCtx.DEFAULT_HELP;
87 public boolean isValid() {
97 public final void addChangeListener(ChangeListener listener) {
98 synchronized (listeners) {
99 listeners.add(listener);
109 public final void removeChangeListener(ChangeListener listener) {
110 synchronized (listeners) {
111 listeners.remove(listener);
118 protected final void fireChangeEvent() {
119 Iterator<ChangeListener> it;
120 synchronized (listeners) {
121 it =
new HashSet<>(listeners).iterator();
123 ChangeEvent ev =
new ChangeEvent(
this);
124 while (it.hasNext()) {
125 it.next().stateChanged(ev);
138 public void readSettings(WizardDescriptor settings) {
139 NewCaseVisualPanel2 panel = getComponent();
141 String lastExaminerName = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_EXAMINER_NAME);
142 String lastExaminerPhone = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_EXAMINER_PHONE);
143 String lastExaminerEmail = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_EXAMINER_EMAIL);
144 String lastOrganizationName = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_ORGANIZATION_NAME);
145 panel.setExaminerName(lastExaminerName);
146 panel.setExaminerPhone(lastExaminerPhone);
147 panel.setExaminerEmail(lastExaminerEmail);
148 panel.setOrganization(EamDb.isEnabled() ? lastOrganizationName :
"");
149 panel.setCaseNumber(
"");
150 panel.setCaseNotes(
"");
151 }
catch (Exception e) {
152 logger.log(Level.WARNING,
"Could not read wizard settings in NewCaseWizardPanel2, ", e);
166 public void storeSettings(WizardDescriptor settings) {
167 settings.putProperty(
"caseNumber", component.getCaseNumber());
168 settings.putProperty(
"caseExaminerName", component.getExaminerName());
169 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_EXAMINER_NAME, component.getExaminerName());
170 settings.putProperty(
"caseExaminerPhone", component.getExaminerPhone());
171 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_EXAMINER_PHONE, component.getExaminerPhone());
172 settings.putProperty(
"caseExaminerEmail", component.getExaminerEmail());
173 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_EXAMINER_EMAIL, component.getExaminerEmail());
174 settings.putProperty(
"caseNotes", component.getCaseNotes());
175 settings.putProperty(
"caseOrganization", component.getOrganization());
176 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_ORGANIZATION_NAME, component.getOrganization());
180 public void validate() throws WizardValidationException {
181 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));