org.broadleafcommerce.core.web
Class PaginationController

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 org.broadleafcommerce.core.web.AjaxFormController
                                  extended by org.broadleafcommerce.core.web.PaginationController
All Implemented Interfaces:
org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.mvc.Controller

public abstract class PaginationController
extends AjaxFormController

Pagination Controller's default implementation assumes that successView points to a JSP that contains a div whose sole contents are a that includes the same JSP as ajaxView. Inside ajaxView is the The most basic implementation only needs to implement populatePaginatedList, setting the list on the default PaginationCommandObject. For more advanced pagination scenarios, such as search strings, filters, or sorting, PaginationControllerObject should be subclassed and formBackingObject overriden. To populate additional elements of the model, override populateStandard and call super.populateStandard.

Author:
dmclain

Field Summary
 
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
PaginationController()
           
 
Method Summary
protected  Object formBackingObject(javax.servlet.http.HttpServletRequest request)
           
 String getPaginationObjectName()
           
protected  void populateAjax(Map<String,Object> model, Object object)
           
protected abstract  void populatePaginatedList(Map<String,Object> model, PaginationCommandObject object)
          populatePaginatedList is where the logic to retrieve the list items is implemented.
protected  void populateStandard(Map<String,Object> model, Object object)
           
 void setPaginationObjectName(String paginationObjectName)
          The name by which the PaginationCommandObject will be named for the jsp.
 
Methods inherited from class org.broadleafcommerce.core.web.AjaxFormController
getAjaxView, isFormSubmission, onSubmit, setAjaxView
 
Methods inherited from class org.springframework.web.servlet.mvc.SimpleFormController
doSubmitAction, getFormView, getSuccessView, isFormChangeRequest, isFormChangeRequest, onFormChange, onFormChange, onSubmit, onSubmit, processFormSubmission, referenceData, referenceData, setFormView, setSuccessView, showForm, showForm, suppressValidation
 
Methods inherited from class org.springframework.web.servlet.mvc.AbstractFormController
currentFormObject, getCommand, getErrorsForNewForm, getFormSessionAttributeName, getFormSessionAttributeName, handleInvalidSubmit, handleRequestInternal, isBindOnNewForm, 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, initBinder, isValidateOnBinding, onBind, onBind, onBindAndValidate, 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
 

Constructor Detail

PaginationController

public PaginationController()
Method Detail

getPaginationObjectName

public String getPaginationObjectName()

setPaginationObjectName

public void setPaginationObjectName(String paginationObjectName)
The name by which the PaginationCommandObject will be named for the jsp.

Parameters:
paginationObjectName -

populatePaginatedList

protected abstract void populatePaginatedList(Map<String,Object> model,
                                              PaginationCommandObject object)
populatePaginatedList is where the logic to retrieve the list items is implemented. There are two strategies, pulling all items or only pulling the displayed subset. The easiest to implement is to retrieve all items that are in the list and call PaginationCommandObject.setFullList, and the paginatedList will determine what items to display. For expensive retrievals of large lists, only pull the PaginationCommandObject.getPageSize() subset starting at PaginationCommandObject.getStartIndex(). If using setDisplayList, the next button will not display unless PaginationCommandObject.setListSize is called with a number greater then or equal to PaginationCommandObject.getEndIndex()

Parameters:
model -
object -

formBackingObject

protected Object formBackingObject(javax.servlet.http.HttpServletRequest request)
                            throws javax.servlet.ServletException
Overrides:
formBackingObject in class org.springframework.web.servlet.mvc.AbstractFormController
Throws:
javax.servlet.ServletException

populateAjax

protected void populateAjax(Map<String,Object> model,
                            Object object)
Specified by:
populateAjax in class AjaxFormController

populateStandard

protected void populateStandard(Map<String,Object> model,
                                Object object)
Specified by:
populateStandard in class AjaxFormController


Copyright © 2012. All Rights Reserved.