19 package org.sleuthkit.autopsy.casemodule;
22 import java.awt.Color;
23 import java.awt.EventQueue;
24 import java.util.HashSet;
25 import java.util.Iterator;
27 import javax.swing.event.ChangeEvent;
28 import javax.swing.event.ChangeListener;
29 import org.openide.WizardDescriptor;
30 import org.openide.util.HelpCtx;
31 import org.openide.util.Lookup;
32 import org.openide.util.NbBundle;
43 class AddImageWizardAddingProgressPanel
implements WizardDescriptor.FinishablePanel<WizardDescriptor> {
49 private boolean imgAdded =
false;
54 private AddImageWizardAddingProgressVisual component;
55 private final Set<ChangeListener> listeners =
new HashSet<>(1);
57 private DSPProgressMonitorImpl dspProgressMonitorImpl =
new DSPProgressMonitorImpl();
59 public DSPProgressMonitorImpl getDSPProgressMonitorImpl() {
60 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);
111 public AddImageWizardAddingProgressVisual getComponent() {
112 if (component == null) {
113 component =
new AddImageWizardAddingProgressVisual();
125 public HelpCtx getHelp() {
127 return HelpCtx.DEFAULT_HELP;
137 public boolean isValid() {
140 Lookup.getDefault().lookup(AddImageAction.class).requestFocusButton(
141 NbBundle.getMessage(
this.getClass(),
"AddImageWizardAddingProgressPanel.isValid.focusNext"));
150 void setStateStarted() {
151 component.getProgressBar().setIndeterminate(
true);
152 component.setProgressBarTextAndColor(
153 NbBundle.getMessage(
this.getClass(),
"AddImageWizardAddingProgressPanel.stateStarted.progressBarText"), 0, Color.black);
159 void setStateFinished() {
161 getComponent().setStateFinished();
171 public final void addChangeListener(ChangeListener l) {
172 synchronized (listeners) {
183 public final void removeChangeListener(ChangeListener l) {
184 synchronized (listeners) {
193 protected final void fireChangeEvent() {
194 Iterator<ChangeListener> it;
195 synchronized (listeners) {
196 it =
new HashSet<ChangeListener>(listeners).iterator();
198 ChangeEvent ev =
new ChangeEvent(
this);
199 while (it.hasNext()) {
200 it.next().stateChanged(ev);
211 public void readSettings(WizardDescriptor settings) {
212 settings.setOptions(
new Object[]{WizardDescriptor.PREVIOUS_OPTION, WizardDescriptor.NEXT_OPTION, WizardDescriptor.FINISH_OPTION, WizardDescriptor.CANCEL_OPTION});
214 getComponent().setStateFinished();
225 public void storeSettings(WizardDescriptor settings) {
239 void addErrors(String errorString,
boolean critical) {
240 getComponent().showErrors(errorString, critical);
244 public boolean isFinishPanel() {
void setIndeterminate(final boolean indeterminate)
void setProgressText(final String text)
void setProgress(final int progress)