19 package org.sleuthkit.autopsy.casemodule;
21 import java.awt.Color;
22 import java.awt.EventQueue;
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.util.HelpCtx;
30 import org.openide.util.Lookup;
31 import org.openide.util.NbBundle;
42 class AddImageWizardAddingProgressPanel
implements WizardDescriptor.FinishablePanel<WizardDescriptor> {
48 private boolean imgAdded =
false;
53 private AddImageWizardAddingProgressVisual component;
54 private final Set<ChangeListener> listeners =
new HashSet<>(1);
56 private DSPProgressMonitorImpl dspProgressMonitorImpl =
new DSPProgressMonitorImpl();
58 public DSPProgressMonitorImpl getDSPProgressMonitorImpl() {
59 return dspProgressMonitorImpl;
67 EventQueue.invokeLater(
new Runnable() {
70 getComponent().getProgressBar().setIndeterminate(indeterminate);
78 EventQueue.invokeLater(
new Runnable() {
81 getComponent().getProgressBar().setValue(progress);
89 EventQueue.invokeLater(
new Runnable() {
92 getComponent().setProgressMsgText(text);
110 public AddImageWizardAddingProgressVisual getComponent() {
111 if (component == null) {
112 component =
new AddImageWizardAddingProgressVisual();
124 public HelpCtx getHelp() {
126 return HelpCtx.DEFAULT_HELP;
136 public boolean isValid() {
139 Lookup.getDefault().lookup(AddImageAction.class).requestFocusButton(
140 NbBundle.getMessage(
this.getClass(),
"AddImageWizardAddingProgressPanel.isValid.focusNext"));
149 void setStateStarted() {
150 component.getProgressBar().setIndeterminate(
true);
151 component.setProgressBarTextAndColor(
152 NbBundle.getMessage(
this.getClass(),
"AddImageWizardAddingProgressPanel.stateStarted.progressBarText"), 0, Color.black);
158 void setStateFinished() {
160 getComponent().setStateFinished();
170 public final void addChangeListener(ChangeListener l) {
171 synchronized (listeners) {
182 public final void removeChangeListener(ChangeListener l) {
183 synchronized (listeners) {
192 protected final void fireChangeEvent() {
193 Iterator<ChangeListener> it;
194 synchronized (listeners) {
195 it =
new HashSet<ChangeListener>(listeners).iterator();
197 ChangeEvent ev =
new ChangeEvent(
this);
198 while (it.hasNext()) {
199 it.next().stateChanged(ev);
210 public void readSettings(WizardDescriptor settings) {
211 settings.setOptions(
new Object[]{WizardDescriptor.PREVIOUS_OPTION, WizardDescriptor.NEXT_OPTION, WizardDescriptor.FINISH_OPTION, WizardDescriptor.CANCEL_OPTION});
213 getComponent().setStateFinished();
224 public void storeSettings(WizardDescriptor settings) {
238 void addErrors(String errorString,
boolean critical) {
239 getComponent().showErrors(errorString, critical);
243 public boolean isFinishPanel() {
void setIndeterminate(final boolean indeterminate)
void setProgressText(final String text)
void setProgress(final int progress)