gt:          WizardPane pane = (WizardPane)nextStep;
context: /*************** <auto-copyright.pl BEGIN do not edit this line> **************
   *
   * VR Juggler is (C) Copyright 1998-2007 by Iowa State University
   *
   * Original Authors:
   *   Allen Bierbaum, Christopher Just,
   *   Patrick Hartling, Kevin Meinert,
   *   Carolina Cruz-Neira, Albert Baker
   *
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Library General Public
   * License as published by the Free Software Foundation; either
   * version 2 of the License, or (at your option) any later version.
   *
   * This library is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   * Library General Public License for more details.
   *
   * You should have received a copy of the GNU Library General Public
   * License along with this library; if not, write to the
   * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   * Boston, MA 02111-1307, USA.
   *
   *************** <auto-copyright.pl END do not edit this line> ***************/
  package org.vrjuggler.tweek.wizard;
  
  import java.io.Serializable;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.List;
  import java.util.NoSuchElementException;
  import java.util.Map;
  import java.awt.*;
  import javax.swing.*;
  import javax.swing.border.*;
  import java.awt.event.*;
  import info.clearthought.layout.*;
  
  /**
   * Bean implementation of the WizardView interface. This step will allow the
   * user to step their way through a Wizard.
   */
  public class WizardViewerBean
     extends JPanel
     implements Serializable, WizardView
  {
     /**
      * Creates a new WizardViewer bean with no initial wizard.
      */
     public WizardViewerBean()
     {
        this(new HashMap());
     }
  
     /**
      * Creates a new WizardViewer bean with no initial wizard.
      *
      * @param whiteBoard WhiteBoard to store data shared between WizardSteps.
      */
     public WizardViewerBean(Map whiteBoard)
     {
        mWhiteBoard = whiteBoard;
  
        listeners = new ArrayList();
  
        try
        {
           jbInit();
        }
        catch(Exception e)
        {
           e.printStackTrace();
        }
  
        setSidebarImage(null);
     }
  
     /**
      * Gets the wizard step that this view is currently at.
      *
      * @return  the current wizard step
      *
      * @throws  NoSuchElementException
      *             if there is no current step (i.e. the wizard is empty)
      */
     public WizardStep getCurrentWizardStep()
     {
        if (mCurrentStep == null)
        {
           throw new NoSuchElementException();
        }
        return mCurrentStep;
     }
  
     /**
      * Tells this view to move to the next step in the wizard.
      *
      * @return  true if the move was completed successfully, false otherwise
      *
      * @throws  NoSuchElementException
      *             if the current step is the last step
      */
     public boolean moveNext()
     {
        if (null != mCurrentStep && null != mCurrentStep.getStepLabel())
        {
           mCurrentStep.getStepLabel().setForeground(Color.GRAY);
        }
        // First try to get the next step since this might throw an exception
        WizardStep destStep = mWizardIterator.next();
        if (! visit(destStep))
        {
           // The next step didn't want to be exited. Roll back our changes
           // to the iterator.
           mWizardIterator.previous();
           return false;
        }
        if (null != mCurrentStep.getStepLabel())
        {
           mCurrentStep.getStepLabel().setForeground(Color.YELLOW);
        }
        backBtn.setEnabled(hasPrev());
        if (hasNext())
        {
           nextBtn.setEnabled(true);
           finishBtn.setEnabled(false);
        }
        else
        {
           nextBtn.setEnabled(false);
           finishBtn.setEnabled(true);
        }
        return true;
     }
  
     /**
      * Tells this view to move to the previous step in the wizard.
      *
      * @return  true if the move was completed successfully, false otherwise
      *
      * @throws  NoSuchElementException
      *             if the current step is the first step
      */
     public boolean movePrev()
     {
        if (null != mCurrentStep && null != mCurrentStep.getStepLabel())
        {
           mCurrentStep.getStepLabel().setForeground(Color.BLACK);
        }
        // First try to get the previous step since this might throw an exception
        WizardStep destStep = mWizardIterator.previous();
        if (! visit(destStep))
        {
           // The previous step didn't want to be exited. Roll back our changes
           // to the iterator.
           mWizardIterator.next();
           return false;
        }
        if (null != mCurrentStep.getStepLabel())
        {
           mCurrentStep.getStepLabel().setForeground(Color.YELLOW);
        }
        backBtn.setEnabled(hasPrev());
        finishBtn.setEnabled(false);
        nextBtn.setEnabled(hasNext());
        return true;
     }
  
     boolean first = true;
  
     /**
      * Exits the current step and enters the given step.
      *
      * @return  true if the visit was completed successfully, false if the
      *          current step didn't want to be exited
      */
     private boolean visit(WizardStep nextStep)
     {
        // Only exit the current step if we're actually in a step
        if (mCurrentStep != null)
        {
           // Exit the current step
           if (! mCurrentStep.onExiting())
           {
              // The step didn't want to be exited. Put the iterator back where
              // it was to rollback our changes.
              mWizardIterator.next();
              return false;
           }
           // TODO: don't assume the step is a pane
           WizardPane pane = (WizardPane)mCurrentStep;
           this.remove(pane.getGUI());
  
           // Revalidate the layout since this is not done automagically for us
           // for some reason. Otherwise, this component does not get repainted
           // with the new wizard pane component contained within.
           revalidate();
           repaint();
           mCurrentStep.onExited();
        }
  
        // Enter the next step
        mCurrentStep = nextStep;
  
        // Only enter the next step if there actually is one. We need this test
        // for the case where we're leaving the last step from the user clicking
        // the Finish button and visit(null) is called.
        if (mCurrentStep != null)
        {
           mCurrentStep.setMap(mWhiteBoard);
  
           mCurrentStep.onEntering();
           // TODO: don't assume the step is a pane
  