org.pietschy.wizard
Interface WizardModel

All Known Implementing Classes:
AbstractWizardModel

public interface WizardModel

This interface defines the Model for wizards. It provides various methods for determining the steps of the wizard along with the current traversal state of the wizard. The Wizard monitors the model using a PropertyChangeListener so all changes to the model properties must fire PropertyChangeEvents.

Most users should subclass either StaticModel or MultiPathModel. Implementors of more specialized models should consider extending AbstractWizardModel as it provides the basic methods and propery change management required by all models.


Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this model.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this model.
 WizardStep getActiveStep()
          Gets the current active step the wizard should display.
 boolean isLastAvailable()
          Checks if the last button should be enabled.
 boolean isLastStep(WizardStep step)
          Checks if the specified step is the last step in the wizard.
 boolean isLastVisible()
          Checks if the last button should be displayed.
 boolean isNextAvailable()
          Checks if the next button should be enabled.
 boolean isPreviousAvailable()
          Checks if the previous button should be enabled.
 void lastStep()
          Takes the model to the last step in the wizard and fires the appropriate property change events.
 void nextStep()
          Increments the model the the next step and fires the appropriate property change events.
 void previousStep()
          Takes the model back to the previsou step and fires the appropriate property change events.
 void refreshModelState()
          Called to request the model to update it current state.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from this model.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from this model.
 void reset()
          Takes the model back to the first step and fires the appropriate property change events.
 java.util.Iterator stepIterator()
          Returns an iterator over all the steps in the model.
 

Method Detail

isPreviousAvailable

public boolean isPreviousAvailable()
Checks if the previous button should be enabled.

Returns:
true if the previou button should be enabled, false otherwise.

isNextAvailable

public boolean isNextAvailable()
Checks if the next button should be enabled.

Returns:
true if the next button should be enabled, false otherwise.

isLastAvailable

public boolean isLastAvailable()
Checks if the last button should be enabled.

Returns:
true if the last button should be enabled, false otherwise.
See Also:
isLastVisible()

nextStep

public void nextStep()
Increments the model the the next step and fires the appropriate property change events. This method must only be called if isNextAvailable() returns true.


previousStep

public void previousStep()
Takes the model back to the previsou step and fires the appropriate property change events. This method must only be called if isPreviousAvailable() returns true.


lastStep

public void lastStep()
Takes the model to the last step in the wizard and fires the appropriate property change events. This method must only be called if isLastAvailable() returns true.


isLastVisible

public boolean isLastVisible()
Checks if the last button should be displayed. This method should only return true if the isLastAvailable() will return true at any point. Returning false will prevent the last button from appearing on the wizard at all.

Returns:
true if the last button should be displayed, false otherwise.

reset

public void reset()
Takes the model back to the first step and fires the appropriate property change events.


getActiveStep

public WizardStep getActiveStep()
Gets the current active step the wizard should display.

Returns:
the active step.

isLastStep

public boolean isLastStep(WizardStep step)
Checks if the specified step is the last step in the wizard.

Parameters:
step - the step to check
Returns:
true if its the final step in the wizard, false otherwise.

stepIterator

public java.util.Iterator stepIterator()
Returns an iterator over all the steps in the model. The iteration order is not guarenteed to the be the order of traversal.

Returns:
an iterator over all the steps of the model

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this model.

Parameters:
listener - the listener to add.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from this model.

Parameters:
listener - the listener to remove.

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this model.

Parameters:
propertyName - the property to listen to.
listener - the listener to add.

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from this model.

Parameters:
propertyName - the property to stop listening to.
listener - the listener to remove.

refreshModelState

public void refreshModelState()
Called to request the model to update it current state. This will be called when ever a step transition occurs but may also be called by the current WizardStep to force a refresh.



Copyright © 2004 Andrew Pietsch.