net.javaprog.ui.wizard
Class DefaultWizardModel

java.lang.Object
  |
  +--net.javaprog.ui.wizard.DefaultWizardModel
All Implemented Interfaces:
WizardModel

public class DefaultWizardModel
extends Object
implements WizardModel

Default implementation for WizardModel.


Nested Class Summary
static class DefaultWizardModel.DummyStep
          Step implementation used in dynamic wizard models.
 
Field Summary
protected  int index
           
protected  EventListenerList listenerList
           
protected  List steps
           
 
Constructor Summary
DefaultWizardModel(Step[] s)
          Creates a new wizard model from the given step array.
 
Method Summary
 void addWizardModelListener(WizardModelListener l)
          Adds a listener for the back, next and finish actions.
 void cancelWizard()
          Cancels the wizard.
 boolean contains(Step step)
          Returns whether the sequence contains the given step.
 void finishWizard()
          Finishes the wizard if possible.
protected  void fireStepShown()
           
protected  void fireWizardCanceled()
           
protected  void fireWizardFinished()
           
protected  void fireWizardModelChanged()
           
 int getCurrentIndex()
          Returns the index of the currently visible step in the sequence.
 Step getCurrentStep()
          Returns the currently visible step.
 int getStepCount()
          Returns the number of steps in this sequence.
 Step[] getSteps()
          Returns the sequence of steps as a plain array.
 void goBack()
          Requests that the previous step should be shown if possible.
 void goNext()
          Requests that the next step should be shown if possible.
 void removeWizardModelListener(WizardModelListener l)
          Removes a previously added listener.
 Iterator steps()
          Provides an iterator for the step sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

protected int index

listenerList

protected final EventListenerList listenerList

steps

protected List steps
Constructor Detail

DefaultWizardModel

public DefaultWizardModel(Step[] s)
Creates a new wizard model from the given step array.

Method Detail

addWizardModelListener

public void addWizardModelListener(WizardModelListener l)
Description copied from interface: WizardModel
Adds a listener for the back, next and finish actions.

Specified by:
addWizardModelListener in interface WizardModel

cancelWizard

public void cancelWizard()
Description copied from interface: WizardModel
Cancels the wizard. This method must notify the registered WizardListeners of the cancel event.

Specified by:
cancelWizard in interface WizardModel

contains

public boolean contains(Step step)
Description copied from interface: WizardModel
Returns whether the sequence contains the given step.

Specified by:
contains in interface WizardModel

finishWizard

public void finishWizard()
Description copied from interface: WizardModel
Finishes the wizard if possible. This method must notify the registered WizardListeners of the finish event.

Specified by:
finishWizard in interface WizardModel

fireStepShown

protected void fireStepShown()

fireWizardCanceled

protected void fireWizardCanceled()

fireWizardFinished

protected void fireWizardFinished()

fireWizardModelChanged

protected void fireWizardModelChanged()

getCurrentIndex

public int getCurrentIndex()
Description copied from interface: WizardModel
Returns the index of the currently visible step in the sequence.

Specified by:
getCurrentIndex in interface WizardModel

getCurrentStep

public Step getCurrentStep()
Description copied from interface: WizardModel
Returns the currently visible step.

Specified by:
getCurrentStep in interface WizardModel

getStepCount

public int getStepCount()
Description copied from interface: WizardModel
Returns the number of steps in this sequence.

Specified by:
getStepCount in interface WizardModel

getSteps

public Step[] getSteps()
Description copied from interface: WizardModel
Returns the sequence of steps as a plain array.

Specified by:
getSteps in interface WizardModel

goBack

public void goBack()
Description copied from interface: WizardModel
Requests that the previous step should be shown if possible. This method must notify the registered WizardListeners of the request.

Specified by:
goBack in interface WizardModel

goNext

public void goNext()
Description copied from interface: WizardModel
Requests that the next step should be shown if possible. This method must notify the registered WizardListeners of the request.

Specified by:
goNext in interface WizardModel

removeWizardModelListener

public void removeWizardModelListener(WizardModelListener l)
Description copied from interface: WizardModel
Removes a previously added listener.

Specified by:
removeWizardModelListener in interface WizardModel

steps

public Iterator steps()
Provides an iterator for the step sequence.