19 package org.sleuthkit.autopsy.report;
 
   21 import java.awt.Component;
 
   22 import java.util.Arrays;
 
   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.NbPreferences;
 
   30 final class ReportWizardIterator 
implements WizardDescriptor.Iterator<WizardDescriptor> {
 
   34     private ReportWizardPanel1 firstPanel;
 
   35     private ReportWizardPanel2 tableConfigPanel;
 
   36     private ReportWizardFileOptionsPanel fileConfigPanel;
 
   38     private List<WizardDescriptor.Panel<WizardDescriptor>> panels;
 
   42     private WizardDescriptor.Panel<WizardDescriptor>[] allConfigPanels;
 
   43     private String[] allConfigIndex;
 
   46     private WizardDescriptor.Panel<WizardDescriptor>[] tableConfigPanels;
 
   47     private String[] tableConfigIndex;
 
   50     private WizardDescriptor.Panel<WizardDescriptor>[] fileConfigPanels;
 
   51     private String[] fileConfigIndex;
 
   53     @SuppressWarnings({
"rawtypes", 
"unchecked"})
 
   54     ReportWizardIterator() {
 
   55         firstPanel = 
new ReportWizardPanel1();
 
   56         tableConfigPanel = 
new ReportWizardPanel2();
 
   57         fileConfigPanel = 
new ReportWizardFileOptionsPanel();
 
   59         allConfigPanels = 
new WizardDescriptor.Panel[]{firstPanel, tableConfigPanel, fileConfigPanel};
 
   60         tableConfigPanels = 
new WizardDescriptor.Panel[]{firstPanel, tableConfigPanel};
 
   61         fileConfigPanels = 
new WizardDescriptor.Panel[]{firstPanel, fileConfigPanel};
 
   64     private List<WizardDescriptor.Panel<WizardDescriptor>> getPanels() {
 
   66             panels = Arrays.asList(allConfigPanels);
 
   67             String[] steps = 
new String[panels.size()];
 
   68             for (
int i = 0; i < panels.size(); i++) {
 
   69                 Component c = panels.get(i).getComponent();
 
   71                 steps[i] = c.getName();
 
   72                 if (c instanceof JComponent) { 
 
   73                     JComponent jc = (JComponent) c;
 
   74                     jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
 
   75                     jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
 
   76                     jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, 
true);
 
   77                     jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, 
false);
 
   78                     jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, 
true);
 
   82             allConfigIndex = steps;
 
   83             tableConfigIndex = 
new String[]{steps[0], steps[1]};
 
   84             fileConfigIndex = 
new String[]{steps[0], steps[2]};
 
   96     private void enableConfigPanels(
boolean generalModule, 
boolean tableModule) {
 
   99         } 
else if (tableModule) {
 
  102             panels = Arrays.asList(tableConfigPanels);
 
  106             panels = Arrays.asList(fileConfigPanels);
 
  111     public WizardDescriptor.Panel<WizardDescriptor> current() {
 
  112         return getPanels().get(index);
 
  116     public String name() {
 
  121     public boolean hasNext() {
 
  122         return index < getPanels().size() - 1;
 
  126     public boolean hasPrevious() {
 
  131     public void nextPanel() {
 
  133             throw new NoSuchElementException();
 
  138             boolean generalModule, tableModule;
 
  140             generalModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean(
"generalModule", 
true); 
 
  141             tableModule = NbPreferences.forModule(ReportWizardPanel1.class).getBoolean(
"tableModule", 
true); 
 
  142             enableConfigPanels(generalModule, tableModule);
 
  149     public void previousPanel() {
 
  150         if (!hasPrevious()) {
 
  151             throw new NoSuchElementException();
 
  157     public void addChangeListener(ChangeListener l) {
 
  161     public void removeChangeListener(ChangeListener l) {