com.sri.emo.wizard
Class AbstractWizard

java.lang.Object
  extended by com.sri.emo.wizard.AbstractWizard
All Implemented Interfaces:
Wizard, Serializable
Direct Known Subclasses:
BranchingWizard, SequentialWizard

public abstract class AbstractWizard
extends Object
implements Wizard, Serializable

Base class for wizard implementations. Use one of the constructors for customization of behavior.

Author:
Michael Rimov
See Also:
Serialized Form

Constructor Summary
AbstractWizard(WizardMonitor wizMonitor)
          Constructor for brand new wizard.
 
Method Summary
 WizardPage begin()
          Retrieve the first wizard page and initialize any special data for the Wizard.
 void destroy()
          De-initialize all data for the wizard.
 boolean equals(Object parm1)
          Checks for equality field by field.
protected  Stack getBackTrace()
          Retrieve the backtrace stack
 WizardPage getCurrentPage()
          Retrieves a pointer to the current page in the wizard.
 Object getId()
          Retrieve the id of the Wizard.
protected abstract  WizardPage getInitialPage()
          Retrieve the initial page defined for the wizard in the sequence.
protected  WizardMonitor getMonitor()
          Retreieve the monitor associated with this wizard.
 String getSummary()
          Retrieve the text summary of the wizard.
 String getTitle()
          Retrieve the title of the wizard.
 int hashCode()
          Returns hashcode of the title.
abstract  WizardPage next(WizardPage src, Serializable newData)
          Execute the next page in the wizard.
 WizardPage previous()
          Backtracks the stack.
 Object processFinish(WizardPage src, Serializable data, Map additonalParams)
          Processes the final finish and returns some sort of data that can be whatever is desired.
protected  void setCurrentPage(WizardPage current)
          Set the current page for the wizard.
 void setId(Object id)
          Sets the wizard Id.
 void setSummary(String wizardSummary)
          Set the summary text of the wizard.
 void setTitle(String wizardTitle)
          Set the title of the wizard.
 String toString()
          Override of toString().
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sri.emo.wizard.Wizard
backupToPage, getAllData, getPageById, getStepHistory
 

Constructor Detail

AbstractWizard

public AbstractWizard(WizardMonitor wizMonitor)
Constructor for brand new wizard.

Parameters:
wizMonitor - the wizard monitor.
Method Detail

getMonitor

protected WizardMonitor getMonitor()
Retreieve the monitor associated with this wizard.

Returns:
WizardMonitor

getBackTrace

protected Stack getBackTrace()
Retrieve the backtrace stack

Returns:
java.util.Stack

begin

public WizardPage begin()
                 throws WizardException
Description copied from interface: Wizard
Retrieve the first wizard page and initialize any special data for the Wizard.

Specified by:
begin in interface Wizard
Returns:
WizardPage instance.
Throws:
WizardException - upon error.

getInitialPage

protected abstract WizardPage getInitialPage()
Retrieve the initial page defined for the wizard in the sequence.

Returns:
WizardPage instance.

next

public abstract WizardPage next(WizardPage src,
                                Serializable newData)
                         throws WizardException
Description copied from interface: Wizard
Execute the next page in the wizard.

Specified by:
next in interface Wizard
Parameters:
src - the source page of the next event.
newData - the data to post to the Wizard.
Returns:
WizardPage instance.
Throws:
WizardException - upon error.

getCurrentPage

public WizardPage getCurrentPage()
Description copied from interface: Wizard
Retrieves a pointer to the current page in the wizard.

Specified by:
getCurrentPage in interface Wizard
Returns:
Wizard Page instance

setCurrentPage

protected void setCurrentPage(WizardPage current)
Set the current page for the wizard.

Parameters:
current - the current page.

previous

public WizardPage previous()
                    throws WizardException
Backtracks the stack.

Retrieve the first wizard page and initialize any special data for the Wizard.

Specified by:
previous in interface Wizard
Returns:
WizardPage instance
Throws:
WizardException - upon error, including if we are already at the first state.

destroy

public void destroy()
             throws WizardException
Description copied from interface: Wizard
De-initialize all data for the wizard.

Specified by:
destroy in interface Wizard
Throws:
WizardException - upon destruction error.

processFinish

public Object processFinish(WizardPage src,
                            Serializable data,
                            Map additonalParams)
                     throws WizardException
Processes the final finish and returns some sort of data that can be whatever is desired. If using a web environment, the WizardController will put the object on the request context with the name "WizardResult"

Override in subclasses to return somethingfun useful. Call the superclass implementation to set the final version and trigger the monitor execution. This particular version returns getAllData(), but of course, in your derived class you can return anything you want.

Specified by:
processFinish in interface Wizard
Parameters:
src - WizardPage
data - Serializable
additonalParams - Map: whatever the desired wizard needs from the controller. Values and objects will vary and is defined by the Application Layer that calls this method.
Returns:
Serializable in this case a data Map.
Throws:
WizardException

getTitle

public String getTitle()
Description copied from interface: Wizard
Retrieve the title of the wizard.

Specified by:
getTitle in interface Wizard
Returns:
java.lang.String.

setTitle

public void setTitle(String wizardTitle)
Set the title of the wizard.

Parameters:
wizardTitle - the new wizard title.

getSummary

public String getSummary()
Description copied from interface: Wizard
Retrieve the text summary of the wizard. May return null since summary attribute is optional.

Specified by:
getSummary in interface Wizard
Returns:
String or null if none is defined.

setSummary

public void setSummary(String wizardSummary)
Set the summary text of the wizard.

Parameters:
wizardSummary - String, the new summary value.

toString

public String toString()
Override of toString().

Overrides:
toString in class Object
Returns:
Wizard Title

getId

public Object getId()
Retrieve the id of the Wizard. Implementations may return null if they do not differentiate wizards by any id.

Specified by:
getId in interface Wizard
Returns:
Object any particular object.

setId

public void setId(Object id)
Sets the wizard Id.

Parameters:
id - Object the object that represents the wizard id.

hashCode

public int hashCode()
Returns hashcode of the title.

Overrides:
hashCode in class Object
Returns:
integer

equals

public boolean equals(Object parm1)
Checks for equality field by field.

Overrides:
equals in class Object
Parameters:
parm1 - the other object
Returns:
true if the objects are equal


Copyright © 2004-2006 Codeguild, Inc.. All Rights Reserved.