net.javaprog.ui.wizard
Class AbstractStep

java.lang.Object
  extended by net.javaprog.ui.wizard.AbstractStep
All Implemented Interfaces:
Step

public abstract class AbstractStep
extends Object
implements Step

Provides a basic Step implementation. This class manages the PropertyChangeListeners and the caching of the step component.

Author:
Michael Rudolf

Field Summary
protected  boolean canCancel
           
protected  boolean canFinish
           
protected  boolean canGoBack
           
protected  boolean canGoNext
           
protected  JComponent component
          The component displayed in the wizard dialog.
protected  String description
          The description displayed by the step description renderer.
protected  EventListenerList listenerList
          Manages the listeners registered with this step.
protected  String name
          The name displayed in the step list.
 
Fields inherited from interface net.javaprog.ui.wizard.Step
BACK_PROPERTY, CANCEL_PROPERTY, FINISH_PROPERTY, NEXT_PROPERTY
 
Constructor Summary
AbstractStep(String name, String description)
          Creates a new Step with the given name and description.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Adds a listener for the back, next and finish properties.
 boolean canCancel()
          Returns whether the cancel action is enabled.
 boolean canFinish()
          Returns whether the finish action is enabled.
 boolean canGoBack()
          Returns whether the back action is enabled.
 boolean canGoNext()
          Returns whether the next action is enabled.
protected abstract  JComponent createComponent()
          Subclasses must overwrite this method and return the step's component.
protected  void firePropertyChange(String prop, Object oldValue, Object newValue)
          Notifies the listeners of a property change.
 JComponent getComponent()
          Returns the step's component.
 String getDescription()
          Returns a descriptive string for this step that might be displayed in the StepDescriptionRenderer.
 String getName()
          Returns the step's name that might be displayed in the StepDescriptionRenderer and in the StepListRenderer.
 void removePropertyChangeListener(PropertyChangeListener l)
          Removes a previously added listener.
protected  void setCanCancel(boolean b)
          Changes the canCancel property and notifies the listeners.
protected  void setCanFinish(boolean b)
          Changes the canFinish property and notifies the listeners.
protected  void setCanGoBack(boolean b)
          Changes the canGoBack property and notifies the listeners.
protected  void setCanGoNext(boolean b)
          Changes the canGoNext property and notifies the listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.javaprog.ui.wizard.Step
prepareRendering
 

Field Detail

canGoBack

protected boolean canGoBack

canGoNext

protected boolean canGoNext

canFinish

protected boolean canFinish

canCancel

protected boolean canCancel

name

protected String name
The name displayed in the step list.

See Also:
getName()

description

protected String description
The description displayed by the step description renderer.

See Also:
getDescription()

component

protected JComponent component
The component displayed in the wizard dialog.

See Also:
getComponent()

listenerList

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

See Also:
addPropertyChangeListener(PropertyChangeListener), removePropertyChangeListener(PropertyChangeListener)
Constructor Detail

AbstractStep

public AbstractStep(String name,
                    String description)
Creates a new Step with the given name and description.

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Description copied from interface: Step
Adds a listener for the back, next and finish properties.

Specified by:
addPropertyChangeListener in interface Step
See Also:
Step.removePropertyChangeListener(PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Description copied from interface: Step
Removes a previously added listener.

Specified by:
removePropertyChangeListener in interface Step
See Also:
Step.addPropertyChangeListener(PropertyChangeListener)

getDescription

public String getDescription()
Description copied from interface: Step
Returns a descriptive string for this step that might be displayed in the StepDescriptionRenderer.

Specified by:
getDescription in interface Step

getName

public String getName()
Description copied from interface: Step
Returns the step's name that might be displayed in the StepDescriptionRenderer and in the StepListRenderer.

Specified by:
getName in interface Step

getComponent

public JComponent getComponent()
Returns the step's component. This method caches the value retrieved from createComponent().

Specified by:
getComponent in interface Step
See Also:
createComponent()

createComponent

protected abstract JComponent createComponent()
Subclasses must overwrite this method and return the step's component. This method will only get called once and the result will be cached. Please ensure that all child containers are NOT opaque (i.e. all JPanel instances added to this component should not paint their background) otherwise the step rendering might get messed up.

See Also:
JComponent.setOpaque(boolean), getComponent()

canGoBack

public boolean canGoBack()
Description copied from interface: Step
Returns whether the back action is enabled.

Specified by:
canGoBack in interface Step

setCanGoBack

protected void setCanGoBack(boolean b)
Changes the canGoBack property and notifies the listeners.

Parameters:
b - whether the back button should be enabled or not
See Also:
canGoBack

canGoNext

public boolean canGoNext()
Description copied from interface: Step
Returns whether the next action is enabled.

Specified by:
canGoNext in interface Step

setCanGoNext

protected void setCanGoNext(boolean b)
Changes the canGoNext property and notifies the listeners.

Parameters:
b - whether the next button should be enabled or not
See Also:
canGoNext

canFinish

public boolean canFinish()
Description copied from interface: Step
Returns whether the finish action is enabled.

Specified by:
canFinish in interface Step

setCanFinish

protected void setCanFinish(boolean b)
Changes the canFinish property and notifies the listeners.

Parameters:
b - whether the finish button should be enabled or not
See Also:
canFinish

canCancel

public boolean canCancel()
Description copied from interface: Step
Returns whether the cancel action is enabled.

Specified by:
canCancel in interface Step

setCanCancel

protected void setCanCancel(boolean b)
Changes the canCancel property and notifies the listeners.

Parameters:
b - whether the wizard should be cancelable or not
Since:
0.1.4
See Also:
canCancel

firePropertyChange

protected void firePropertyChange(String prop,
                                  Object oldValue,
                                  Object newValue)
Notifies the listeners of a property change.