org.pietschy.wizard
Class AbstractWizardModel

java.lang.Object
  extended byorg.pietschy.wizard.AbstractWizardModel
All Implemented Interfaces:
WizardModel
Direct Known Subclasses:
DynamicModel, MultiPathModel, StaticModel

public abstract class AbstractWizardModel
extends java.lang.Object
implements WizardModel

This class provides a base for implementors of WizardModel. It provides the basic PropertyChangeListener management and fires the appropriate events when the various properties are changed.

Subclasses will generally override refreshModelState() to update the state of the various model properties.


Constructor Summary
AbstractWizardModel()
           
 
Method Summary
protected  void addCompleteListener(WizardStep step)
          Adds a listener to the "complete" property of the WizardStep.
 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 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 refreshModelState()
          This is an empty method that is intended for subclasses to override to update their various properties based on the active step.
 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.
protected  void setActiveStep(WizardStep activeStep)
          Provided for subclasses to change the current step in response to a call to WizardModel.nextStep() or its related methods.
protected  void setCancelAvailable(boolean cancelAvailable)
          Configures if the cncel button should be enabled.
protected  void setLastAvailable(boolean lastAvailable)
          Configures if the last button should be enabled.
 void setLastVisible(boolean lastVisible)
          Configures if the last button should be displayed.
protected  void setNextAvailable(boolean nextAvailable)
          Configures if the next button should be enabled.
protected  void setPreviousAvailable(boolean previousAvailable)
          Configures if the previous button should be enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pietschy.wizard.WizardModel
isLastStep, lastStep, nextStep, previousStep, reset, stepIterator
 

Constructor Detail

AbstractWizardModel

public AbstractWizardModel()
Method Detail

getActiveStep

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

Specified by:
getActiveStep in interface WizardModel
Returns:
the active step.

setActiveStep

protected void setActiveStep(WizardStep activeStep)
Provided for subclasses to change the current step in response to a call to WizardModel.nextStep() or its related methods.

Parameters:
activeStep - the new step.

isPreviousAvailable

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

Specified by:
isPreviousAvailable in interface WizardModel
Returns:
true if the previou button should be enabled, false otherwise.

isNextAvailable

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

Specified by:
isNextAvailable in interface WizardModel
Returns:
true if the next button should be enabled, false otherwise.

isLastAvailable

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

Specified by:
isLastAvailable in interface WizardModel
Returns:
true if the last button should be enabled, false otherwise.
See Also:
isLastVisible()

setPreviousAvailable

protected void setPreviousAvailable(boolean previousAvailable)
Configures if the previous button should be enabled.

Parameters:
previousAvailable - true to enable the previous button, false otherwise.

setNextAvailable

protected void setNextAvailable(boolean nextAvailable)
Configures if the next button should be enabled.

Parameters:
nextAvailable - true to enable the next button, false otherwise.

setLastAvailable

protected void setLastAvailable(boolean lastAvailable)
Configures if the last button should be enabled.

Parameters:
lastAvailable - true to enable the last button, false otherwise.

setCancelAvailable

protected void setCancelAvailable(boolean cancelAvailable)
Configures if the cncel button should be enabled.

Parameters:
cancelAvailable - true to enable the cancel button, false otherwise.

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.

Specified by:
isLastVisible in interface WizardModel
Returns:
true if the previou last should be displayed, false otherwise.

setLastVisible

public void setLastVisible(boolean lastVisible)
Configures if the last button should be displayed.

Parameters:
lastVisible - true to display the last button, false otherwise.
See Also:
isLastVisible()

refreshModelState

public void refreshModelState()
This is an empty method that is intended for subclasses to override to update their various properties based on the active step.

Specified by:
refreshModelState in interface WizardModel

addPropertyChangeListener

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

Specified by:
addPropertyChangeListener in interface WizardModel
Parameters:
listener - the listener to add.

removePropertyChangeListener

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

Specified by:
removePropertyChangeListener in interface WizardModel
Parameters:
listener - the listener to remove.

addPropertyChangeListener

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

Specified by:
addPropertyChangeListener in interface WizardModel
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.

Specified by:
removePropertyChangeListener in interface WizardModel
Parameters:
propertyName - the property to stop listening to.
listener - the listener to remove.

addCompleteListener

protected void addCompleteListener(WizardStep step)
Adds a listener to the "complete" property of the WizardStep. Any changes to this property will in automatically invoke refreshModelState().

Parameters:
step - the WizardStep to monitor.


Copyright © 2004 Andrew Pietsch.