20 package org.sleuthkit.autopsy.casemodule;
22 import java.awt.Component;
23 import java.util.ArrayList;
24 import java.util.List;
25 import java.util.NoSuchElementException;
26 import javax.swing.JComponent;
27 import javax.swing.event.ChangeListener;
28 import org.openide.WizardDescriptor;
29 import org.openide.util.NbBundle;
35 class AddImageWizardIterator
implements WizardDescriptor.Iterator<WizardDescriptor> {
37 private int index = 0;
38 private List<WizardDescriptor.Panel<WizardDescriptor>> panels;
39 private AddImageAction action;
41 AddImageWizardIterator(AddImageAction action) {
49 private List<WizardDescriptor.Panel<WizardDescriptor>> getPanels() {
51 panels =
new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>();
53 AddImageWizardAddingProgressPanel progressPanel =
new AddImageWizardAddingProgressPanel();
55 AddImageWizardChooseDataSourcePanel dsPanel =
new AddImageWizardChooseDataSourcePanel(progressPanel);
56 AddImageWizardIngestConfigPanel ingestConfigPanel =
new AddImageWizardIngestConfigPanel(dsPanel, action, progressPanel);
59 panels.add(ingestConfigPanel);
60 panels.add(progressPanel);
62 String[] steps =
new String[panels.size()];
63 for (
int i = 0; i < panels.size(); i++) {
64 Component c = panels.get(i).getComponent();
66 steps[i] = c.getName();
67 if (c instanceof JComponent) {
68 JComponent jc = (JComponent) c;
70 jc.putClientProperty(
"WizardPanel_contentSelectedIndex",
new Integer(i));
72 jc.putClientProperty(
"WizardPanel_contentData", steps);
74 jc.putClientProperty(
"WizardPanel_autoWizardStyle", Boolean.TRUE);
76 jc.putClientProperty(
"WizardPanel_contentDisplayed", Boolean.TRUE);
78 jc.putClientProperty(
"WizardPanel_contentNumbered", Boolean.TRUE);
91 public int getIndex() {
101 public WizardDescriptor.Panel<WizardDescriptor> current() {
102 if (panels != null) {
103 return panels.get(index);
105 return getPanels().get(index);
115 public String name() {
116 return NbBundle.getMessage(this.getClass(),
"AddImageWizardIterator.stepXofN", Integer.toString(index + 1),
126 public boolean hasNext() {
127 return index < getPanels().size() - 1;
137 public boolean hasPrevious() {
146 public void nextPanel() {
148 throw new NoSuchElementException();
158 public void previousPanel() {
159 if (!hasPrevious()) {
160 throw new NoSuchElementException();
169 public void addChangeListener(ChangeListener l) {
173 public void removeChangeListener(ChangeListener l) {