Autopsy  4.4
Graphical digital forensics platform for The Sleuth Kit and other tools.
NewCaseWizardPanel2.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2017 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.casemodule;
20 
21 import java.util.HashSet;
22 import java.util.Iterator;
23 import java.util.Set;
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 
35 class NewCaseWizardPanel2 implements WizardDescriptor.ValidatingPanel<WizardDescriptor> {
36 
37  private NewCaseVisualPanel2 component;
38  private final Set<ChangeListener> listeners = new HashSet<>(1);
39 
45  @Override
46  public NewCaseVisualPanel2 getComponent() {
47  if (component == null) {
48  component = new NewCaseVisualPanel2();
49  }
50  return component;
51  }
52 
59  @Override
60  public HelpCtx getHelp() {
61  /*
62  * Currently, no help is provided for this panel.
63  */
64  return HelpCtx.DEFAULT_HELP;
65  }
66 
74  @Override
75  public boolean isValid() {
76  return true;
77  }
78 
84  @Override
85  public final void addChangeListener(ChangeListener listener) {
86  synchronized (listeners) {
87  listeners.add(listener);
88  }
89  }
90 
96  @Override
97  public final void removeChangeListener(ChangeListener listener) {
98  synchronized (listeners) {
99  listeners.remove(listener);
100  }
101  }
102 
106  protected final void fireChangeEvent() {
107  Iterator<ChangeListener> it;
108  synchronized (listeners) {
109  it = new HashSet<>(listeners).iterator();
110  }
111  ChangeEvent ev = new ChangeEvent(this);
112  while (it.hasNext()) {
113  it.next().stateChanged(ev);
114  }
115  }
116 
125  @Override
126  public void readSettings(WizardDescriptor settings) {
127  }
128 
138  @Override
139  public void storeSettings(WizardDescriptor settings) {
140  NewCaseVisualPanel2 currentComponent = getComponent();
141  settings.putProperty("caseNumber", currentComponent.getCaseNumber()); //NON-NLS
142  settings.putProperty("caseExaminer", currentComponent.getExaminer()); //NON-NLS
143  }
144 
145  @Override
146  public void validate() throws WizardValidationException {
147  WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
148  }
149 }

Copyright © 2012-2016 Basis Technology. Generated on: Tue Jun 13 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.