nl.gx.webmanager.springmvc.controller.component
Class PanelComponentController

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.context.support.WebApplicationObjectSupport
          extended by org.springframework.web.servlet.support.WebContentGenerator
              extended by org.springframework.web.servlet.mvc.AbstractController
                  extended by org.springframework.web.servlet.mvc.BaseCommandController
                      extended by org.springframework.web.servlet.mvc.AbstractFormController
                          extended by org.springframework.web.servlet.mvc.SimpleFormController
                              extended by nl.gx.webmanager.springmvc.controller.BaseWebmanagerController
                                  extended by nl.gx.webmanager.springmvc.controller.component.ComponentController
                                      extended by nl.gx.webmanager.springmvc.controller.component.PanelComponentController
All Implemented Interfaces:
DelegatedController, ComponentAware, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.mvc.Controller
Direct Known Subclasses:
AuthorizationMaintenancePanelController, TreeActionPanelController

public abstract class PanelComponentController
extends ComponentController

This class is the base class for panel component controllers. Component controllers are controllers that are registered by a component. These controllers are not running in the Spring application context but controller methods are delegated to it by a MainSpringController which does run inside the Spring application context. A panel only contains one controller controlling all tabs. Dependend on the current selected tab however different form backing objects may be returned by this controller. This controller contains base functionality to define (horizontal and vertical) panel tabs. Custom controllers for panel components should extend this class.

Since:
WebManager 9.0.8
Author:
ivol

Field Summary
static java.lang.String COMMAND_OBJECT_KEY
          key to set/get the command object on the session for implementaiton of the springmvc post and redirect patern.
static java.lang.String PANEL_ID_KEY
          key to get the request attribute for selection of the current pannel class.
static java.lang.String PANEL_TAB_ID_KEY
          request key for tabid of the active tab.
static java.lang.String WEB_ID_KEY
          key to get the current webid from the request
 
Fields inherited from class nl.gx.webmanager.springmvc.controller.BaseWebmanagerController
formBackingObject, PROTOCOL_PROCESSED_KEY
 
Fields inherited from class org.springframework.web.servlet.mvc.BaseCommandController
DEFAULT_COMMAND_NAME
 
Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator
METHOD_GET, METHOD_HEAD, METHOD_POST
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
PanelComponentController()
           
 
Method Summary
 PanelTab addTab(java.lang.String tabId, java.lang.String titleKey, java.lang.String viewFileName, DelegatedController controller, javax.servlet.http.HttpServletRequest request)
          Adds a main tab to the panel navigation.
 PanelTab addTab(java.lang.String tabId, java.lang.String titleKey, java.lang.String titleImage, java.lang.String viewFileName, DelegatedController controller, java.lang.String presentationName, javax.servlet.http.HttpServletRequest request)
          Adds a main tab to the panel navigation.
protected  void createEditViews()
          Callback to add edit views.
 java.lang.Object formBackingObject(javax.servlet.http.HttpServletRequest request)
          Retrieve a form backing object for the current form from the given request.
 WmEditView getEditView()
          get the default editview; the edit view with empty value
protected  DelegatedController getStatefulTabController(java.lang.Class clazz, javax.servlet.http.HttpServletRequest request)
          This method is a helper class for caching controller instances per user session.
protected abstract  void initializeTabSet(javax.servlet.http.HttpServletRequest request, PanelBase panel)
          Override this method to define the tabset
 void onBind(javax.servlet.http.HttpServletRequest request, java.lang.Object command, org.springframework.validation.BindException errors)
          Process the Siteworks protocol and process the WebManager Spring protocol.
 void onSubmit(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object command, org.springframework.validation.BindException errors, org.springframework.web.servlet.ModelAndView modelAndView)
          Methods that override this method MUST call super.onSubmit in order to function properly.
 java.util.Map<java.lang.String,java.lang.Object> referenceData(javax.servlet.http.HttpServletRequest request, java.lang.Object command, org.springframework.validation.Errors errors)
          Add panel object to the model rendered by the PanelController.
 PanelTab setSingleTab(java.lang.String viewFileName, DelegatedController controller, javax.servlet.http.HttpServletRequest request)
          Sets a single tab onto the panel.
 org.springframework.web.servlet.ModelAndView showForm(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.validation.BindException errors, java.util.Map controlModel)
          Returns the Model and view to be used when rendering the form backing object that is returned by this controller
 
Methods inherited from class nl.gx.webmanager.springmvc.controller.component.ComponentController
addEditView, addEditView, createResourceBaseNames, getBundleDefinitionId, getComponent, getParentController, onSubmit, onSubmit, onSubmit, referenceData, setBundleDefinitionId, setComponent, setDelegatedControllers, setParentController
 
Methods inherited from class nl.gx.webmanager.springmvc.controller.BaseWebmanagerController
addControllerDelegation, addDisallowedField, addEditView, addEditViews, addResourceBaseName, addValidator, getControllerDelegationMap, getEditContext, getEditLanguageLabel, getEditViewByValue, getEditViews, getPresentationContext, getResourceBaseNames, getServletContextHack, getVersion, getWebsite, getWebsiteByRequest, getWmSession, initBinder, initialize, isReloadWebManager, onBindAndValidate, popNestedPath, pushNestedPath, removeControllerDelegation, setReloadWebManager, showForm
 
Methods inherited from class org.springframework.web.servlet.mvc.SimpleFormController
doSubmitAction, getFormView, getSuccessView, isFormChangeRequest, isFormChangeRequest, onFormChange, onFormChange, processFormSubmission, setFormView, setSuccessView, suppressValidation
 
Methods inherited from class org.springframework.web.servlet.mvc.AbstractFormController
currentFormObject, getCommand, getErrorsForNewForm, getFormSessionAttributeName, getFormSessionAttributeName, handleInvalidSubmit, handleRequestInternal, isBindOnNewForm, isFormSubmission, isSessionForm, onBindOnNewForm, onBindOnNewForm, setBindOnNewForm, setSessionForm, showForm, showForm, showNewForm
 
Methods inherited from class org.springframework.web.servlet.mvc.BaseCommandController
bindAndValidate, checkCommand, createBinder, createCommand, getBindingErrorProcessor, getCommandClass, getCommandName, getMessageCodesResolver, getPropertyEditorRegistrars, getValidator, getValidators, getWebBindingInitializer, initApplicationContext, isValidateOnBinding, onBind, prepareBinder, setBindingErrorProcessor, setCommandClass, setCommandName, setMessageCodesResolver, setPropertyEditorRegistrar, setPropertyEditorRegistrars, setValidateOnBinding, setValidator, setValidators, setWebBindingInitializer, suppressBinding, suppressValidation, suppressValidation, useDirectFieldAccess
 
Methods inherited from class org.springframework.web.servlet.mvc.AbstractController
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession
 
Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader
 
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nl.gx.webmanager.springmvc.DelegatedController
addValidator, getControllerDelegationMap, getEditViewByValue, getResourceBaseNames, getValidators, initBinder, initialize, onBindAndValidate
 

Field Detail

PANEL_TAB_ID_KEY

public static final java.lang.String PANEL_TAB_ID_KEY
request key for tabid of the active tab.

See Also:
Constant Field Values

COMMAND_OBJECT_KEY

public static final java.lang.String COMMAND_OBJECT_KEY
key to set/get the command object on the session for implementaiton of the springmvc post and redirect patern.

See Also:
Constant Field Values

PANEL_ID_KEY

public static final java.lang.String PANEL_ID_KEY
key to get the request attribute for selection of the current pannel class.

See Also:
Constant Field Values

WEB_ID_KEY

public static final java.lang.String WEB_ID_KEY
key to get the current webid from the request

See Also:
Constant Field Values
Constructor Detail

PanelComponentController

public PanelComponentController()
Method Detail

formBackingObject

public java.lang.Object formBackingObject(javax.servlet.http.HttpServletRequest request)
                                   throws javax.servlet.ServletException
Description copied from class: ComponentController
Retrieve a form backing object for the current form from the given request. Override this method to return the form backing object

Specified by:
formBackingObject in interface DelegatedController
Overrides:
formBackingObject in class ComponentController
Parameters:
request - current HTTP request
Returns:
the FormBackingObject
Throws:
javax.servlet.ServletException - in case of errors

onBind

public void onBind(javax.servlet.http.HttpServletRequest request,
                   java.lang.Object command,
                   org.springframework.validation.BindException errors)
            throws java.lang.Exception
Process the Siteworks protocol and process the WebManager Spring protocol.

Specified by:
onBind in interface DelegatedController
Overrides:
onBind in class BaseWebmanagerController
Parameters:
request - current HTTP request
command - the command object to perform further binding on
errors - validation errors holder, allowing for additional custom registration of binding errors
Throws:
java.lang.Exception - in case of invalid state or arguments

onSubmit

public void onSubmit(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response,
                     java.lang.Object command,
                     org.springframework.validation.BindException errors,
                     org.springframework.web.servlet.ModelAndView modelAndView)
              throws java.lang.Exception
Methods that override this method MUST call super.onSubmit in order to function properly. Delegates the onSubmit to all registered sub components.

Specified by:
onSubmit in interface DelegatedController
Overrides:
onSubmit in class BaseWebmanagerController
Parameters:
request - current servlet request
response - current servlet response
command - form object with request parameters bound onto it
errors - Errors instance without errors (subclass can add errors if it wants to)
modelAndView - the model and view prepared by the main spring controller
Throws:
java.lang.Exception - in case of errors

showForm

public org.springframework.web.servlet.ModelAndView showForm(javax.servlet.http.HttpServletRequest request,
                                                             javax.servlet.http.HttpServletResponse response,
                                                             org.springframework.validation.BindException errors,
                                                             java.util.Map controlModel)
                                                      throws java.lang.Exception
Returns the Model and view to be used when rendering the form backing object that is returned by this controller

Specified by:
showForm in interface DelegatedController
Overrides:
showForm in class ComponentController
Parameters:
request - Current servlet request
response - Current servlet response
errors - Errors instance without errors (subclass can add errors if it wants to)
controlModel - The model passed by the platform controller
Returns:
The model and view to be used when rendering the form backing object
Throws:
java.lang.Exception - in case of errors

referenceData

public java.util.Map<java.lang.String,java.lang.Object> referenceData(javax.servlet.http.HttpServletRequest request,
                                                                      java.lang.Object command,
                                                                      org.springframework.validation.Errors errors)
                                                               throws java.lang.Exception
Add panel object to the model rendered by the PanelController.

Specified by:
referenceData in interface DelegatedController
Overrides:
referenceData in class BaseWebmanagerController
Parameters:
request - current HTTP request
command - the command object to perform further binding on
errors - validation errors holder, allowing for additional custom registration of binding errors
Returns:
Map with reference data
Throws:
java.lang.Exception - in case of invalid state or arguments
See Also:
ModelAndView

createEditViews

protected void createEditViews()
Description copied from class: BaseWebmanagerController
Callback to add edit views. Sub classes should implement this method, call the super and invoke addEditViews to add its own edit views to the controller.

Specified by:
createEditViews in class BaseWebmanagerController

getEditView

public WmEditView getEditView()
Description copied from class: BaseWebmanagerController
get the default editview; the edit view with empty value

Specified by:
getEditView in interface DelegatedController
Overrides:
getEditView in class BaseWebmanagerController
Returns:
the defalt editview

setSingleTab

public PanelTab setSingleTab(java.lang.String viewFileName,
                             DelegatedController controller,
                             javax.servlet.http.HttpServletRequest request)
Sets a single tab onto the panel. This will hide the tab control with which tabs are surrounded usually. Only use if you want to create a panel without tabs and just one view.

Parameters:
viewFileName -
controller -
request -
Returns:

addTab

public PanelTab addTab(java.lang.String tabId,
                       java.lang.String titleKey,
                       java.lang.String viewFileName,
                       DelegatedController controller,
                       javax.servlet.http.HttpServletRequest request)
Adds a main tab to the panel navigation.

Parameters:
tabId - unique tabId within this panel
titleKey - resourcebundle key for the tab title, not shown if empty
viewFileName - view file form this tab, may be null in the tab holds only subtabs
panelViewCommandClass - command class for this tab, may be null in the tab holds only subtabs if this is a maintab that holds only subtabs which operates as differant views on the same command, set this command here.
Returns:
PanelTab the added panelTab for adding Sub Tabs ( level 2) if required null in case of configuration exceptions

addTab

public PanelTab addTab(java.lang.String tabId,
                       java.lang.String titleKey,
                       java.lang.String titleImage,
                       java.lang.String viewFileName,
                       DelegatedController controller,
                       java.lang.String presentationName,
                       javax.servlet.http.HttpServletRequest request)
Adds a main tab to the panel navigation.

Parameters:
tabId - unique tabId within this panel
titleKey - resourcebundle key for the tab title, not shown if empty
titleImage - image shown as title, not shown if empty
viewFileName - view file form this tab, may be null in the tab holds only subtabs
panelViewCommandClass - command class for this tab, may be null in the tab holds only subtabs if this is a maintab that holds only subtabs which operates as differant views on the same command, set this command here.
presentationName - may be either PanelTabset.LEVEL1_HORIZONTAL, PanelTabset.LEVEL1_VERTICAL, PanelTabset.LEVEL2_HORIZONTAL, PanelTabset.LEVEL2_VERTICAL or null if the presentationName should not changed or the default should be set in case none is set.
Returns:
PanelTab the added panelTab for adding Sub Tabs ( level 2) if required null in case of configuration exceptions

initializeTabSet

protected abstract void initializeTabSet(javax.servlet.http.HttpServletRequest request,
                                         PanelBase panel)
Override this method to define the tabset


getStatefulTabController

protected DelegatedController getStatefulTabController(java.lang.Class clazz,
                                                       javax.servlet.http.HttpServletRequest request)
This method is a helper class for caching controller instances per user session. This ensures that the next time a user opens the panel, the form backing object provided by the controller will have the same state. Usually controllers have a lifespan of the request and are thus stateless. An instance returned by this method is stateful within the users session.

Parameters:
clazz - Class of the controller to retrieve an instance from
Returns:
Instance of the controller of the specified class


Copyright © 2007-2011 GX Software BV. All Rights Reserved.