|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.webui.jsf.model.WizardModelBase
public class WizardModelBase
WizardModelBase
is the default
WizardModel
instance used by the
Wizard
.
This class's behavior supports wizard functionality as defined
by "Web Application Guidelines - Version 3.0". The support for a
step list as defined by the guidelines is encapsulated in
WizardStepListBase
.
This class maintains state, controls navigation, and expects the
existence of finish
and results
wizard steps.
In addition this class can control whether or not steps should participate
in JSF lifecycle phases, see
decode
,
validate
, and
update
.
WizardModelBase
expects a hierachy of
WizardStep
, WizardBranch
,
WizardBranchSteps
, and
WizardSubstepBranch
components. This hierarchy can be specified as children of the
Wizard
component or as a list returned by
Wizard.getSteps()
. If
getSteps
does not
return null, the steps represented by that value takes precedence over the
existence of Wizard
child components.
The Wizard
component calls the initialize
method twice during the request lifecycle. Once during
the RESTORE_VIEW phase, and once during the RENDER_RESPONSE phase.
This is necessary
so the model can re-evaluate the steps if changes have occured during
request processing or in the INVOKE_APPLICATION phase, which occur before
the RENDER_RESPONSE phase. On the first display of a wizard, the
initialize
method is only called once
during the RENDER_RESPONSE phase.
Note that a call to initialize during RESTORE_VIEW phase is only relevant
when the application is configured in client side state saving mode.
When the wizard receives events due to a user clicking one of the navigation
components, it calls handleEvent
with the corresponding event and data.
The wizard will call the complete
method to indicate
to the model that it considers the wizard session to be over and will no
longer reference it during this wizard session,
and that it is free to deallocate any resources.
Constructor Summary | |
---|---|
WizardModelBase()
Construct a WizardModelBase instance. |
Method Summary | |
---|---|
boolean |
canGotoStep(WizardStep step)
Return true if the user can navigate to step |
void |
complete()
Called to inform the model that this instance will no longer be referenced. |
boolean |
decode(int event,
boolean prematureRender)
Returns false if prematureRender is true, else true if the step should participate in the APPLY_REQUEST_VALUES phase. |
WizardStep |
getCurrentStep()
Return the current WizardStep instance. |
WizardStep |
getFirstStep()
Return the first WizardStep instance. |
WizardStep |
getLastStep()
Return the last WizardStep instance. |
WizardStep |
getNextStep(WizardStep step)
Return the WizardStep instance following
step . |
java.lang.String |
getPlaceholderText(WizardStep step)
Return a description of this WizardBranch step. |
WizardStep |
getPreviousStep(WizardStep step)
Return the WizardStep instance preceding
step
If there is no previous step return null. |
java.util.Iterator |
getWizardStepIterator()
Based on the current state of the Wizard, return an Iterator of the current sequence of WizardStep instances. |
WizardStepList |
getWizardStepList()
Return a WizardStepList of
WizardStepListItem instances. |
boolean |
handleEvent(WizardEvent event)
Handle the following WizardEvent events
and adjust the state accordingly. |
boolean |
hasCancel(WizardStep step)
Return true if the cancel button should be rendered for this step, else false. |
boolean |
hasClose(WizardStep step)
Return true if the close button should be rendered for this step, else false. |
boolean |
hasFinish(WizardStep step)
Return true if the finish button should be rendered for this step, else false. |
boolean |
hasNext(WizardStep step)
Return true if the next button should be rendered for this step, else false. |
boolean |
hasPrevious(WizardStep step)
Return true if the previous button should be rendered for this step, else false. |
boolean |
hasStepHelp()
Return true if any of the steps have step help. |
void |
initialize(Wizard wizard)
Initialize the current set of WizardSteps. |
boolean |
isBranch(WizardStep step)
Return true if step |
boolean |
isCancelDisabled(WizardStep step)
Return true if the cancel button should be disabled for this step, else false. |
boolean |
isCloseDisabled(WizardStep step)
Return true if the close button should be disabled for this step, else false. |
boolean |
isComplete()
Return true if the wizard has completed and there are no more steps for the user to complete, else false. |
boolean |
isCurrentStep(WizardStep step)
Return true if step is the current step, else false. |
boolean |
isFinishDisabled(WizardStep step)
Return true if the finish button should be disabled for this step, else false. |
boolean |
isFinishStep(WizardStep step)
Return true if step is the step the should
contain a Finish button. |
boolean |
isNextDisabled(WizardStep step)
Return true if the next button should be disabled for this step, else false. |
boolean |
isPreviousDisabled(WizardStep step)
Return true if the previous button should be disabled for this step, else false. |
boolean |
isResultsStep(WizardStep step)
Return true if step |
boolean |
isSubstep(WizardStep step)
Return true if step |
boolean |
isTransient()
StateHolder method indicating the this class is
persistent. |
void |
restoreState(javax.faces.context.FacesContext context,
java.lang.Object state)
StateHolder method called to restore the model's
current state based on the values in state . |
java.lang.Object |
saveState(javax.faces.context.FacesContext context)
StateHolder method called to save the state the model's
state. |
void |
setTransient(boolean transientFlag)
StateHolder method to set the persistent state of this
class. |
boolean |
update(int event,
boolean prematureRender)
Return true if the current step should participate in the UPDATE_MODEL_VALUES phase. |
boolean |
validate(int event,
boolean prematureRender)
Return true if the current step should participate in the PROCESS_VALIDATIONS phase. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WizardModelBase()
WizardModelBase
instance.
The initialize
method must be called with the
wizard
instance when the step children are
available. The Wizard
instance will call this method
at the appropriate time.
Method Detail |
---|
public void initialize(Wizard wizard)
Wizard
twice. Once
during RETORE_VIEW phase, and once during RENDER_RESPONSE phase.
This sequence affords the model the opportunity to modify its
state due to changes that may have occured during request processing.
Note that a call during RESTORE_VIEW phase is only relevant
when the application is configured in client side state saving mode.
initialize
in interface WizardModel
wizard
- The Wizard component.public java.util.Iterator getWizardStepIterator()
WizardStep
instances.
getWizardStepIterator
in interface WizardModel
public WizardStepList getWizardStepList()
WizardStepList
of
WizardStepListItem
instances.
getWizardStepList
in interface WizardModel
public WizardStep getFirstStep()
WizardStep
instance.
getFirstStep
in interface WizardModel
public WizardStep getLastStep()
WizardStep
instance.
The step that is returned is dependent on the state of the
wizard. It may only be the last step at this point in time.
At a later point in time, it may be a different step, due to
the existence of branch steps.
public WizardStep getNextStep(WizardStep step)
WizardStep
instance following
step
.
If there are no more steps return null.
getNextStep
in interface WizardModel
step
- The step preceding the returned step.public WizardStep getPreviousStep(WizardStep step)
WizardStep
instance preceding
step
If there is no previous step return null.
getPreviousStep
in interface WizardModel
step
- The step following the returned step.public WizardStep getCurrentStep()
WizardStep
instance.
getCurrentStep
in interface WizardModel
public boolean isCurrentStep(WizardStep step)
step
is the current step, else false.
isCurrentStep
in interface WizardModel
step
- The step to test.public boolean isFinishStep(WizardStep step)
step
is the step the should
contain a Finish button. This is the step that performs the
wizard task with the data collected from previous steps.
isFinishStep
in interface WizardModel
step
- The step to identify.public boolean isResultsStep(WizardStep step)
step is the results step, else false.
The Results step follows the Finish step and displays
only a "Close" button. It displays results of the task
performed in the Finish step.
- Specified by:
isResultsStep
in interface WizardModel
- Parameters:
step
- The step to identify.
public boolean isBranch(WizardStep step)
step is a branching step, else false.
A branching step acts as a step "placeholder" and informs
the user that the steps following this step are determined by
the data entered in this or previous steps. Text should be
provided from the getPlaceHolderText
method for this step, describing the branch.
- Specified by:
isBranch
in interface WizardModel
- Parameters:
step
- The step to identify.
public java.lang.String getPlaceholderText(WizardStep step)
WizardBranch
step.
getPlaceholderText
in interface WizardModel
step
- A branching step. It must be a
WizardBranch
instance.public boolean isSubstep(WizardStep step)
step is a substep step, else false.
A substep is a step or one of a series of substeps,
that occurs in every instance of this wizard.
Unlike the branch step, substep sequences are always the same
but may or may not be performed based on previous steps.
- Specified by:
isSubstep
in interface WizardModel
- Parameters:
step
- The step to check.
public boolean canGotoStep(WizardStep step)
step out
of sequence, else false.
Typically this method is called to determine if a previous
step should be rendered such that the user can select it
and navigate back to that step. Its possible that some
wizards may also allow forward navigation.
Note this method only supports navigating to steps occuring
before the current step.
- Specified by:
canGotoStep
in interface WizardModel
- Parameters:
step
- The step to check.
public boolean isPreviousDisabled(WizardStep step)
isPreviousDisabled
in interface WizardModel
step
- The step to check.public boolean isNextDisabled(WizardStep step)
isNextDisabled
in interface WizardModel
step
- The step to check.public boolean isFinishDisabled(WizardStep step)
isFinishDisabled
in interface WizardModel
step
- The step to check.public boolean isCancelDisabled(WizardStep step)
isCancelDisabled
in interface WizardModel
step
- The step to check.public boolean isCloseDisabled(WizardStep step)
isCloseDisabled
in interface WizardModel
step
- The step to check.public boolean hasPrevious(WizardStep step)
hasPrevious
in interface WizardModel
step
- The step to check.public boolean hasNext(WizardStep step)
hasNext
in interface WizardModel
step
- The step to check.public boolean hasCancel(WizardStep step)
hasCancel
in interface WizardModel
step
- The step to check.public boolean hasClose(WizardStep step)
hasClose
in interface WizardModel
step
- The step to check.public boolean hasFinish(WizardStep step)
hasFinish
in interface WizardModel
step
- The step to check.public boolean hasStepHelp()
hasStepHelp
in interface WizardModel
public boolean isComplete()
isComplete
in interface WizardModel
public void complete()
complete
in interface WizardModel
public boolean decode(int event, boolean prematureRender)
decode
in interface WizardModel
event
- The event that precipitated this call.prematureRender
- true if rendering is occuring before
RENDER_RESPONSE phase was normally expected.public boolean validate(int event, boolean prematureRender)
validate
in interface WizardModel
event
- The event that precipitated this call.prematureRender
- Is true if rendering is occuring before
RENDER_RESPONSE phase was normally expected.public boolean update(int event, boolean prematureRender)
update
in interface WizardModel
event
- The event that precipitated this call.prematureRender
- true if rendering is occuring before
RENDER_RESPONSE phase was normally expected.public boolean handleEvent(WizardEvent event)
WizardEvent
events
and adjust the state accordingly.
handleEvent
in interface WizardModel
public java.lang.Object saveState(javax.faces.context.FacesContext context)
StateHolder
method called to save the state the model's
state.
The saved state consists of the values of state,
currentStep
, and hasStepHelp
of the internal
WizardState
instance.
- Specified by:
saveState
in interface javax.faces.component.StateHolder
public void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
StateHolder
method called to restore the model's
current state based on the values in state
.
The restored state consists of values for state,
currentStep
, and hasStepHelp
of the internal
WizardState
instance.
- Specified by:
restoreState
in interface javax.faces.component.StateHolder
public void setTransient(boolean transientFlag)
StateHolder
method to set the persistent state of this
class. This call does not modify this class.
setTransient
in interface javax.faces.component.StateHolder
public boolean isTransient()
StateHolder
method indicating the this class is
persistent. This method returns false
isTransient
in interface javax.faces.component.StateHolder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |