19 package org.sleuthkit.autopsy.casemodule;
21 import java.awt.Component;
22 import java.util.ArrayList;
23 import java.util.List;
24 import java.util.NoSuchElementException;
25 import javax.swing.JComponent;
26 import javax.swing.event.ChangeListener;
27 import org.openide.WizardDescriptor;
28 import org.openide.util.NbBundle;
34 class AddImageWizardIterator
implements WizardDescriptor.Iterator<WizardDescriptor> {
36 private int index = 0;
37 private List<WizardDescriptor.Panel<WizardDescriptor>> panels;
38 private AddImageAction action;
40 AddImageWizardIterator(AddImageAction action) {
48 private List<WizardDescriptor.Panel<WizardDescriptor>> getPanels() {
50 panels =
new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>();
52 AddImageWizardAddingProgressPanel progressPanel =
new AddImageWizardAddingProgressPanel();
54 AddImageWizardChooseDataSourcePanel dsPanel =
new AddImageWizardChooseDataSourcePanel(progressPanel);
55 AddImageWizardIngestConfigPanel ingestConfigPanel =
new AddImageWizardIngestConfigPanel(dsPanel, action, progressPanel);
58 panels.add(ingestConfigPanel);
59 panels.add(progressPanel);
61 String[] steps =
new String[panels.size()];
62 for (
int i = 0; i < panels.size(); i++) {
63 Component c = panels.get(i).getComponent();
65 steps[i] = c.getName();
66 if (c instanceof JComponent) {
67 JComponent jc = (JComponent) c;
69 jc.putClientProperty(
"WizardPanel_contentSelectedIndex",
new Integer(i));
71 jc.putClientProperty(
"WizardPanel_contentData", steps);
73 jc.putClientProperty(
"WizardPanel_autoWizardStyle", Boolean.TRUE);
75 jc.putClientProperty(
"WizardPanel_contentDisplayed", Boolean.TRUE);
77 jc.putClientProperty(
"WizardPanel_contentNumbered", Boolean.TRUE);
90 public int getIndex() {
100 public WizardDescriptor.Panel<WizardDescriptor> current() {
101 if (panels != null) {
102 return panels.get(index);
104 return getPanels().get(index);
114 public String name() {
115 return NbBundle.getMessage(this.getClass(),
"AddImageWizardIterator.stepXofN", Integer.toString(index + 1),
125 public boolean hasNext() {
126 return index < getPanels().size() - 1;
136 public boolean hasPrevious() {
145 public void nextPanel() {
147 throw new NoSuchElementException();
157 public void previousPanel() {
158 if (!hasPrevious()) {
159 throw new NoSuchElementException();
169 public void addChangeListener(ChangeListener l) {
173 public void removeChangeListener(ChangeListener l) {