net.jspcontrols.dialogs.actions.wizard
Class WizardAction

java.lang.Object
  extended byorg.apache.struts.action.Action
      extended byorg.apache.struts.actions.DispatchAction
          extended bynet.jspcontrols.dialogs.actions.SelectAction
              extended bynet.jspcontrols.dialogs.actions.DialogAction
                  extended bynet.jspcontrols.dialogs.actions.wizard.WizardAction
All Implemented Interfaces:
IDialogAction, ISelectAction

public class WizardAction
extends DialogAction

Basic wizard action. Implements back, forward and cancel method handlers. Works in pair with action form, implementing IWizardManager interface.

Author:
Michael Jouravlev

Field Summary
 
Fields inherited from class net.jspcontrols.dialogs.actions.SelectAction
keyMethodMap
 
Fields inherited from class org.apache.struts.actions.DispatchAction
clazz, log, messages, methods, types
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
WizardAction()
           
 
Method Summary
 org.apache.struts.action.ActionForward getDialogView(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Returns an ActionForward instance describing the View for current dialog state, usually a forward to a JSP page.
protected  java.util.Map getKeyMethodMap()
          Maps submit button names to handler methods; also maps initialization keys to initialization methods.
static org.apache.struts.action.ActionErrors getStrutsErrors(java.util.Map uiErrors)
          Pulls errors found during wizard transition from wizard into Struts error object.
 org.apache.struts.action.ActionForward onBack(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles "Back" button on wizard panel.
 org.apache.struts.action.ActionForward onCancel(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles "Cancel" button on wizard panel.
 org.apache.struts.action.ActionForward onNext(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles "Back" button on wizard panel.
 
Methods inherited from class net.jspcontrols.dialogs.actions.DialogAction
clearMessages, execute, execute, getActionSuffix, getMethodName, isBogusGET, isInit, isInput, saveDialogErrors, setNoCache
 
Methods inherited from class net.jspcontrols.dialogs.actions.SelectAction
buildLookupMap, cancelled, execute, getCancelKey, getDefaultKey, getInitKey, getMethod, resolveEvents, unspecified
 
Methods inherited from class org.apache.struts.actions.DispatchAction
dispatchMethod, getMethod
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.jspcontrols.dialogs.actions.ISelectAction
cancelled, unspecified
 

Constructor Detail

WizardAction

public WizardAction()
Method Detail

getKeyMethodMap

protected java.util.Map getKeyMethodMap()
Maps submit button names to handler methods; also maps initialization keys to initialization methods. Events, external to CRUDAction, are considered initializing events, and therefore must start with initialization prefix. For example, if initialization prefix starts with "DIALOG-EVENT", then "DIALOG-EVENT-CREATE" is a good key for "Create new business object" event, while "DIALOG-EVENT-CREATE" is not.

If you do not want to use all CRUD handlers, and want to protect yourself from calling unneeded handler, you can subclass this class, and override this method. Then you define only mappings that you need.

Overrides:
getKeyMethodMap in class DialogAction
Returns:
Map, containing association between event names (keys) and handler methods (values).
See Also:
SelectAction.getInitKey()

onCancel

public org.apache.struts.action.ActionForward onCancel(org.apache.struts.action.ActionMapping mapping,
                                                       org.apache.struts.action.ActionForm form,
                                                       javax.servlet.http.HttpServletRequest request,
                                                       javax.servlet.http.HttpServletResponse response)
                                                throws java.lang.Exception
Handles "Cancel" button on wizard panel. Commonly, ActionForward object returned by this handler redirects outside the wizard.

Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The HTTP request we are processing
response - The HTTP response we are creating
Returns:
ActionForward object, describing where to go next
Throws:
java.lang.Exception - if an exception occurs

onBack

public org.apache.struts.action.ActionForward onBack(org.apache.struts.action.ActionMapping mapping,
                                                     org.apache.struts.action.ActionForm form,
                                                     javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response)
                                              throws java.lang.Exception
Handles "Back" button on wizard panel. ActionForward object returned by this handler must redirect back to the wizard. This allows to display a View corresponding to current wizard state.

Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The HTTP request we are processing
response - The HTTP response we are creating
Returns:
ActionForward object, redirecting back to the wizard
Throws:
java.lang.Exception - if an exception occurs

onNext

public org.apache.struts.action.ActionForward onNext(org.apache.struts.action.ActionMapping mapping,
                                                     org.apache.struts.action.ActionForm form,
                                                     javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response)
                                              throws java.lang.Exception
Handles "Back" button on wizard panel. ActionForward object returned by this handler must redirect back to the wizard. This allows to display a View corresponding to current wizard state.

Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The HTTP request we are processing
response - The HTTP response we are creating
Returns:
ActionForward object, redirecting back to the wizard
Throws:
java.lang.Exception - if an exception occurs

getDialogView

public org.apache.struts.action.ActionForward getDialogView(org.apache.struts.action.ActionMapping mapping,
                                                            org.apache.struts.action.ActionForm form,
                                                            javax.servlet.http.HttpServletRequest request,
                                                            javax.servlet.http.HttpServletResponse response)
                                                     throws java.lang.Exception
Returns an ActionForward instance describing the View for current dialog state, usually a forward to a JSP page.

Specified by:
getDialogView in interface IDialogAction
Overrides:
getDialogView in class DialogAction
Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The HTTP request we are processing
response - The HTTP response we are creating
Returns:
ActionForward instance describing the View for dialog state
Throws:
java.lang.Exception - if an exception occurs

getStrutsErrors

public static org.apache.struts.action.ActionErrors getStrutsErrors(java.util.Map uiErrors)
Pulls errors found during wizard transition from wizard into Struts error object.

Parameters:
uiErrors - map of errors, where key is an error message, and value is error parameters as string array
Returns:
errors in Struts format