org.broadleafcommerce.core.web
Class PaginationCommandObject

java.lang.Object
  extended by org.broadleafcommerce.core.web.AjaxFormCommandObject
      extended by org.broadleafcommerce.core.web.PaginationCommandObject

public class PaginationCommandObject
extends AjaxFormCommandObject


Constructor Summary
PaginationCommandObject()
           
 
Method Summary
 String getContainerId()
           
 String getDataSource()
           
 List<?> getDisplayList()
           
 int getEndIndex()
          One past the index of the last item that will be displayed on this page.
 int getListSize()
          Either the size of fullList or the value earlier passed to setListSize.
 String getNextLinkText()
           
 int getPageNumber()
           
 int getPageSize()
           
 String getPreviousLinkText()
           
 int getStartIndex()
          The index of the first item to be displayed based on pageSize and pageNumber.
 boolean isShowNext()
          Returns true if there are additional items to display.
 boolean isShowPrevious()
          Returns true unless pageNumber is 0
 void setContainerId(String containerId)
          The id of a div surrounding the paginated list tag.
 void setDataSource(String dataSource)
          The url to submit to for next and previous.
 void setDisplayList(List<?> displayList)
          One of the two methods for populating the data in the list.
 void setFullList(List<?> fullList)
          One of the two methods for populating the data in the list.
 void setListSize(int listSize)
           
 void setNextLinkText(String nextLinkText)
          The test to render for the next link, HTML formatted
 void setPageNumber(int pageNumber)
          The page number to display.
 void setPageSize(int pageSize)
          The number of items to display on a page.
 void setPreviousLinkText(String previousLinkText)
          The text to render for the previous link, HTML formatted
 
Methods inherited from class org.broadleafcommerce.core.web.AjaxFormCommandObject
isAjaxRequest, setAjaxRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PaginationCommandObject

public PaginationCommandObject()
Method Detail

getPreviousLinkText

public String getPreviousLinkText()

setPreviousLinkText

public void setPreviousLinkText(String previousLinkText)
The text to render for the previous link, HTML formatted

Parameters:
previousLinkText -

getNextLinkText

public String getNextLinkText()

setNextLinkText

public void setNextLinkText(String nextLinkText)
The test to render for the next link, HTML formatted

Parameters:
nextLinkText -

getContainerId

public String getContainerId()

setContainerId

public void setContainerId(String containerId)
The id of a div surrounding the paginated list tag. This is used when rendering the javascript to enable AJAX page loads

Parameters:
containerId -

getDataSource

public String getDataSource()

setDataSource

public void setDataSource(String dataSource)
The url to submit to for next and previous. Generally set to request.getRequestURI().toString()

Parameters:
dataSource -

setFullList

public void setFullList(List<?> fullList)
One of the two methods for populating the data in the list. Use this method when you have all the items that will be in this list. The PaginationCommandObject will automatically return the correct items in getDisplayList

Parameters:
fullList -

getDisplayList

public List<?> getDisplayList()

setDisplayList

public void setDisplayList(List<?> displayList)
One of the two methods for populating the data in the list. Use this method when getting all list items is expensive. The PaginationCommandObject will display exactly these items regardless of page size eg. if page size is 25 and a list of size 50 is passed in, 50 items will be displayed. When using this method it is important to set listSize, or the isShowNext() logic will always return false

Parameters:
displayList -

getPageNumber

public int getPageNumber()

setPageNumber

public void setPageNumber(int pageNumber)
The page number to display. Page 0 is the first page. Defaults to 0.

Parameters:
pageNumber -

getPageSize

public int getPageSize()

setPageSize

public void setPageSize(int pageSize)
The number of items to display on a page.

Parameters:
pageSize -

getStartIndex

public int getStartIndex()
The index of the first item to be displayed based on pageSize and pageNumber. If listSize has been set (either through setListSize or setFullList) and an otherwise invalid startIndex would be returned, the greater of 0 or (listSize - pageSize) is returned

Returns:

getEndIndex

public int getEndIndex()
One past the index of the last item that will be displayed on this page.

Returns:

getListSize

public int getListSize()
Either the size of fullList or the value earlier passed to setListSize. Defaults to -1.

Returns:

setListSize

public void setListSize(int listSize)

isShowPrevious

public boolean isShowPrevious()
Returns true unless pageNumber is 0

Returns:

isShowNext

public boolean isShowNext()
Returns true if there are additional items to display.

Returns:


Copyright © 2012. All Rights Reserved.