org.apache.wicket.extensions.wizard
Class Wizard

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.html.panel.Panel
                  extended by org.apache.wicket.extensions.wizard.Wizard
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<Component>, IEventSink, IEventSource, IWizard, IWizardModelListener, IClusterable, IConverterLocator, IHeaderContributor, IRequestableComponent, IHierarchical<Component>
Direct Known Subclasses:
NewUserWizard, StaticWizard, StaticWizardWithPanels

public class Wizard
extends Panel
implements IWizardModelListener, IWizard

A wizard is a dialog component that takes users through a number of steps to complete a task. It has common functionality like a next, previous, finish and cancel button, and it uses a IWizardModel to navigate through the steps.

Before you can use the wizard component, it needs to be initialized with a model. You do this by calling init(IWizardModel) with the wizard model you intent to use.

This default implementation should be useful for basic cases, if the layout is exactly what you need. If you want to provide your own layout and/ or have more or less components (e.g. you want to additionally provide an overview component), you can override this class and add the components you want yourself using methods like newButtonBar(String) et-cetera.

Author:
Eelco Hillenius
See Also:
Serialized Form

Field Summary
static java.lang.String BUTTONS_ID
          Component id of the buttons panel as used by the default wizard panel.
static java.lang.String FEEDBACK_ID
          Component id of the feedback panel as used by the default wizard panel.
static java.lang.String FORM_ID
          Component id of the form as used by the default wizard panel.
static java.lang.String HEADER_ID
          Component id of the header panel as used by the default wizard panel.
static java.lang.String OVERVIEW_ID
          Component id of the overview panel as used by the default wizard panel.
static java.lang.String VIEW_ID
          Component id of the view panel (where the main wizard contents go) as used by the default wizard panel.
 
Fields inherited from class org.apache.wicket.markup.html.panel.Panel
PANEL
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
Wizard(java.lang.String id)
          Construct.
Wizard(java.lang.String id, boolean addDefaultCssStyle)
          Construct.
Wizard(java.lang.String id, IWizardModel wizardModel)
          Construct with a transition model.
Wizard(java.lang.String id, IWizardModel wizardModel, boolean addDefaultCssStyle)
          Construct with a transition model.
 
Method Summary
 void addDefaultCssStyle(IHeaderResponse response)
          Will let the wizard contribute a CSS include to the page's header.
 IWizardStep getActiveStep()
          Convenience method to get the active step from the model.
 Form<?> getForm()
          Gets the form in which the view is nested, and on which the wizard buttons work.
 IWizardModel getWizardModel()
          Gets the model this wizard is using.
protected  void init(IWizardModel wizardModel)
          Initialize this wizard with a transition model.
 boolean isVersioned()
          Turn versioning off for wizards.
protected  Component newButtonBar(java.lang.String id)
          Create a new button bar.
protected  Component newFeedbackPanel(java.lang.String id)
          Create a new feedback panel.
protected
<E> Form<E>
newForm(java.lang.String id)
          Create a new form.
protected  Component newOverviewBar(java.lang.String id)
          Create a new overview bar.
 void onActiveStepChanged(IWizardStep newStep)
          Called when the active step of this model changed.
protected  void onBeforeRender()
          Called just before a component is rendered.
 void onCancel()
          Called when the wizard is canceled.
 void onFinish()
          Called when the wizard is finished.
 void renderHead(IHeaderResponse response)
          Render to the web response whatever the component wants to contribute to the head section.
 
Methods inherited from class org.apache.wicket.markup.html.panel.Panel
newMarkupSourcingStrategy
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markRendering, modelChanged, modelChanging, onAfterRender, onComponentTag, onConfigure, onDetach, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BUTTONS_ID

public static final java.lang.String BUTTONS_ID
Component id of the buttons panel as used by the default wizard panel.

See Also:
Constant Field Values

FEEDBACK_ID

public static final java.lang.String FEEDBACK_ID
Component id of the feedback panel as used by the default wizard panel.

See Also:
Constant Field Values

HEADER_ID

public static final java.lang.String HEADER_ID
Component id of the header panel as used by the default wizard panel.

See Also:
Constant Field Values

OVERVIEW_ID

public static final java.lang.String OVERVIEW_ID
Component id of the overview panel as used by the default wizard panel.

See Also:
Constant Field Values

FORM_ID

public static final java.lang.String FORM_ID
Component id of the form as used by the default wizard panel.

See Also:
Constant Field Values

VIEW_ID

public static final java.lang.String VIEW_ID
Component id of the view panel (where the main wizard contents go) as used by the default wizard panel.

See Also:
Constant Field Values
Constructor Detail

Wizard

public Wizard(java.lang.String id)
Construct. Adds the default style.

If you override this class, it makes sense to call this constructor (super(id)), then - in your constructor - construct a transition model and then call init(IWizardModel) to initialize the wizard.

This constructor is not meant for normal clients of this class

Parameters:
id - The component model

Wizard

public Wizard(java.lang.String id,
              boolean addDefaultCssStyle)
Construct.

If you override this class, it makes sense to call this constructor (super(id)), then - in your constructor - construct a transition model and then call init(IWizardModel) to initialize the wizard.

This constructor is not meant for normal clients of this class

Parameters:
id - The component model
addDefaultCssStyle - Whether to add the default style

Wizard

public Wizard(java.lang.String id,
              IWizardModel wizardModel)
Construct with a transition model. Adds the default style.

For most clients, this is typically the right constructor to use.

Parameters:
id - The component id
wizardModel - The transitions model

Wizard

public Wizard(java.lang.String id,
              IWizardModel wizardModel,
              boolean addDefaultCssStyle)
Construct with a transition model.

For most clients, this is typically the right constructor to use.

Parameters:
id - The component id
wizardModel - The transitions model
addDefaultCssStyle - Whether to add the default style
Method Detail

addDefaultCssStyle

public void addDefaultCssStyle(IHeaderResponse response)
Will let the wizard contribute a CSS include to the page's header. It will add Wizard.css from this package. This method is typically called by the class that creates the wizard.

Parameters:
response -

renderHead

public void renderHead(IHeaderResponse response)
Description copied from class: Component
Render to the web response whatever the component wants to contribute to the head section.

Specified by:
renderHead in interface IHeaderContributor
Overrides:
renderHead in class Component
Parameters:
response - Response object

getActiveStep

public final IWizardStep getActiveStep()
Convenience method to get the active step from the model.

Returns:
The active step

getForm

public Form<?> getForm()
Gets the form in which the view is nested, and on which the wizard buttons work.

Returns:
The wizard form

getWizardModel

public final IWizardModel getWizardModel()
Description copied from interface: IWizard
Gets the model this wizard is using. This should never be null; a wizard is supposed to have a model.

Specified by:
getWizardModel in interface IWizard
Returns:
The wizard model.
See Also:
IWizard.getWizardModel()

isVersioned

public boolean isVersioned()
Turn versioning off for wizards. This works best when the wizard is not accessed from bookmarkable pages, so that the url doesn't change at all.

Overrides:
isVersioned in class Component
Returns:
False
See Also:
Component.isVersioned()

onActiveStepChanged

public void onActiveStepChanged(IWizardStep newStep)
Description copied from interface: IWizardModelListener
Called when the active step of this model changed.

Specified by:
onActiveStepChanged in interface IWizardModelListener
Parameters:
newStep - The new step
See Also:
IWizardModelListener.onActiveStepChanged(org.apache.wicket.extensions.wizard.IWizardStep)

onCancel

public void onCancel()
Called when the wizard is canceled.

Specified by:
onCancel in interface IWizardModelListener

onFinish

public void onFinish()
Called when the wizard is finished.

Specified by:
onFinish in interface IWizardModelListener

init

protected void init(IWizardModel wizardModel)
Initialize this wizard with a transition model.

If you constructed this wizard using a constructor without the transitions model argument, you must call this method prior to actually using it.

Parameters:
wizardModel -

newButtonBar

protected Component newButtonBar(java.lang.String id)
Create a new button bar. Clients can override this method to provide a custom button bar.

Parameters:
id - The id to be used to construct the component
Returns:
A new button bar

newFeedbackPanel

protected Component newFeedbackPanel(java.lang.String id)
Create a new feedback panel. Clients can override this method to provide a custom feedback panel.

Parameters:
id - The id to be used to construct the component
Returns:
A new feedback panel

newForm

protected <E> Form<E> newForm(java.lang.String id)
Create a new form. Clients can override this method to provide a custom Form.

Type Parameters:
E - The form's model object type
Parameters:
id - The id to be used to construct the component
Returns:
a new form

onBeforeRender

protected void onBeforeRender()
Description copied from class: Component
Called just before a component is rendered.

NOTE: If you override this, you *must* call super.onBeforeRender() within your implementation. Because this method is responsible for cascading Component.onBeforeRender() call to its children it is strongly recommended that super call is made at the end of the override.

Overrides:
onBeforeRender in class Component

newOverviewBar

protected Component newOverviewBar(java.lang.String id)
Create a new overview bar. Clients can override this method to provide a custom bar.

Parameters:
id - The id to be used to construct the component
Returns:
A new overview bar


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.