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();
70 public HelpCtx getHelp() {
74 return HelpCtx.DEFAULT_HELP;
85 public boolean isValid() {
95 public final void addChangeListener(ChangeListener listener) {
96 synchronized (listeners) {
97 listeners.add(listener);
107 public final void removeChangeListener(ChangeListener listener) {
108 synchronized (listeners) {
109 listeners.remove(listener);
116 protected final void fireChangeEvent() {
117 Iterator<ChangeListener> it;
118 synchronized (listeners) {
119 it =
new HashSet<>(listeners).iterator();
121 ChangeEvent ev =
new ChangeEvent(
this);
122 while (it.hasNext()) {
123 it.next().stateChanged(ev);
136 public void readSettings(WizardDescriptor settings) {
137 NewCaseVisualPanel2 panel = getComponent();
138 panel.refreshCaseDetailsFields();
140 String lastExaminerName = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_EXAMINER_NAME);
141 String lastExaminerPhone = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_EXAMINER_PHONE);
142 String lastExaminerEmail = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_EXAMINER_EMAIL);
143 String lastOrganizationName = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_ORGANIZATION_NAME);
144 panel.setExaminerName(lastExaminerName);
145 panel.setExaminerPhone(lastExaminerPhone);
146 panel.setExaminerEmail(lastExaminerEmail);
147 panel.setOrganization(CentralRepository.isEnabled() ? lastOrganizationName :
"");
148 panel.setCaseNumber(
"");
149 panel.setCaseNotes(
"");
150 }
catch (Exception e) {
151 logger.log(Level.WARNING,
"Could not read wizard settings in NewCaseWizardPanel2, ", e);
165 public void storeSettings(WizardDescriptor settings) {
166 settings.putProperty(
"caseNumber", component.getCaseNumber());
167 settings.putProperty(
"caseExaminerName", component.getExaminerName());
168 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_EXAMINER_NAME, component.getExaminerName());
169 settings.putProperty(
"caseExaminerPhone", component.getExaminerPhone());
170 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_EXAMINER_PHONE, component.getExaminerPhone());
171 settings.putProperty(
"caseExaminerEmail", component.getExaminerEmail());
172 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_EXAMINER_EMAIL, component.getExaminerEmail());
173 settings.putProperty(
"caseNotes", component.getCaseNotes());
174 settings.putProperty(
"caseOrganization", component.getOrganization());
175 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_ORGANIZATION_NAME, component.getOrganization());
179 public void validate() throws WizardValidationException {
180 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));