net.javaprog.ui.wizard
Class DefaultWizardModel

java.lang.Object
  extended by net.javaprog.ui.wizard.DefaultWizardModel
All Implemented Interfaces:
WizardModel

public class DefaultWizardModel
extends Object
implements WizardModel

Default implementation for WizardModel.

Author:
Michael Rudolf

Nested Class Summary
static class DefaultWizardModel.DummyStep
          Step implementation used in dynamic wizard models.
 
Field Summary
protected  int index
          The index of the currently displayed step.
protected  EventListenerList listenerList
          Manages the listeners registered with this model.
protected  List steps
          Contains references to the actual 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()
          Notifies the listeners that a certain step has been shown.
protected  void fireWizardCanceled()
          Notifies the listeners that the wizard has been canceled.
protected  void fireWizardFinished()
          Notifies the listeners that the wizard has been finished.
protected  void fireWizardModelChanged()
          Notifies the wizard that the wizard model has been changed.
 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

steps

protected List steps
Contains references to the actual steps.

See Also:
steps(), contains(Step), getSteps(), getStepCount()

index

protected int index
The index of the currently displayed step.

See Also:
getCurrentIndex()

listenerList

protected final EventListenerList listenerList
Manages the listeners registered with this model.

See Also:
addWizardModelListener(WizardModelListener), removeWizardModelListener(WizardModelListener)
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

removeWizardModelListener

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

Specified by:
removeWizardModelListener 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

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

getCurrentStep

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

Specified by:
getCurrentStep in interface WizardModel

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

getSteps

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

Specified by:
getSteps 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

steps

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


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

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

fireStepShown

protected void fireStepShown()
Notifies the listeners that a certain step has been shown.


fireWizardCanceled

protected void fireWizardCanceled()
Notifies the listeners that the wizard has been canceled.


fireWizardFinished

protected void fireWizardFinished()
Notifies the listeners that the wizard has been finished.


fireWizardModelChanged

protected void fireWizardModelChanged()
Notifies the wizard that the wizard model has been changed.