class: BasePaginatorListSessionBean

public abstract class: BasePaginatorListSessionBean
Author: Markus Haarlaender (initial creation)
Project: Phase: 1.0; Status: Proposed; Version: $Revision: 2262 $ $LastChangedDate: 2009-02-27 14:; Complexity: 1
Dates: Created: 16.07.2009 15:32:03; Modified: 16.07.2009 15:32:03;
Flags: Active: false; IsRoot: false; IsLeaf: false;
Extension Points:
UUID: {12776780-A8EE-494c-9BF9-5796EA351B49}
This abstract bean class is used to manage lists with one or two paginators. It can work together with different BaseListRetrieverRequestBeans that are responsible to retrieve the list elements. On a jsp page, at first the BaseListRetrieverRequestBean has to be initialized. It then automatically updates the list in this bean (by calling update) whenever necessary and reads required GET parameters (via readOutParamaters()). This bean has to be managed in the session scope of JSF. The list only refreshes if any GET parameters have changed or new parameters have been added. If you want to refresh the list anyway, please call the hasChanged method.
@param <ListElementType> The Type of the list elements managed by this bean
@param <FilterType> The type of filters managed by this bean that are usable for every ListRetriever, eg. sorting of PubItems.
 

Goto: Custom Properties, Fields, Methods

Extends: FacesBean

See also: FacesBean, PubItemListSessionBean

Appears in: common_presentation

Connections
 
Custom Properties
 
BasePaginatorListSessionBean Attributes
Attribute Details
private int
  currentPageNumber
Notes: The current paginator page number
private List
  currentPartList
Notes: The list containing the current elements of the displayed list
private int
  elementsPerPage
Notes: The current number of elements per page
private int
  elementsPerPageBottom
Notes: Bound to the selected value of the lower elementsPerPage selection menu
private List
  elementsPerPageSelectItems
Notes: A list that contains the menu entries of the elements per page menu.
private int
  elementsPerPageTop
Notes: Bound to the selected value of the upper elementsPerPage selection menu
private String
  goToPage
Notes: The current value of the 'go to' input fields
private String
  goToPageBottom
Notes: This attribute is bound to the 'go to' input field of the lower paginator
private String
  goToPageTop
Notes: This attribute is bound to the 'go to' input field of the upper paginator
private boolean
  hasChanged
Notes: Indicates if the list should be upadated even if no parameters have changed
private Map
  oldRedirectParameterMap
Notes: A Map that has stored the GET parameters from the last request
private String
  pageType
Notes: A String that describes the current type of the page. Drawn from the corresponding BaseListRetrieverRequestBean.
private BaseListRetrieverRequestBean
  paginatorListRetriever
Notes: The current BaseListRetrieverRequestBean
private List
  paginatorPageList
Notes: A list containing the PaginatorPage objects
private static String
  parameterElementsPerPage
Initial: "elementsPerPage"
Notes: The GET parameter name for the elements per page value
private static String
  parameterPageNumber
Initial: "pageNumber"
Notes: The GET parameter name for the current page number
private Map
  redirectParameterMap
Notes: A map that contains the currently used GET parameters by this bean and the corresponding BaseListRetrieverRequestBean.
private int
  totalNumberOfElements
Initial: 0
Notes: The total number of elements that are in the complete list (without any limit or offset filters). corresponding BaseListRetrieverRequestBean.
 
BasePaginatorListSessionBean Methods
Operation Details
public
BasePaginatorListSessionBean():
Sequential
Notes: Initializes a new BasePaginatorListSessionBean
protected abstract
beforeRedirect():void
Sequential
Notes: Method is called before a redirection. Subclasses can save states here.
public
changeElementsPerPageBottom():String
Sequential
Tags: throws=Exception
Notes: Used as action when the user changes the lower number of elements menu.
@return
public
changeElementsPerPageTop():String
Sequential
Tags: throws=Exception
Notes: Used as action when the user changes the upper number of elements menu.
@return
public abstract
getAdditionalFilters():FilterType
Sequential
Notes: When calling this method, implementing subclasses can return additional filters that are typical for the list elements and that should be always passed to the BaseListRetrieverRequestBean when retrieving a new list, e.g. for sorting
@return
public
getCurrentPageNumber():int
Sequential
Notes: Returns the current page number of the paginator
@return
public
getCurrentPartList():List
Sequential
Notes: Returns the current list with the specified elements
@return
public
getElementsPerPage():int
Sequential
Notes: Returns the currently selected number of elements per page
@return
public
getElementsPerPageBottom():int
Sequential
Tags: annotations=@Deprecated
Notes: WARNING: USE THIS METHOD ONLY FROM UPPER PAGINATOR SELECTION MENU IN JSPF. For getting the value manually, use getElementsPerPage().
@param elementsPerPageTop
public
getElementsPerPageSelectItems():List
Sequential
Notes: Returns the menu entries of the elements per page menu
@return
public
getElementsPerPageTop():int
Sequential
Tags: annotations=@Deprecated
Notes: WARNING: USE THIS METHOD ONLY FROM UPPER PAGINATOR SELECTION MENU IN JSPF. For getting the value manually, use getElementsPerPage().
@param elementsPerPageTop
public
getFirstPaginatorPageNumber():int
Sequential
Notes: Returns the number of the paginator page button that should be displayed as first button of the paginator in order to always display exactly seven paginator page buttons
@return
public
getGoToPage():String
Sequential
Notes: Returns the value of the go to input fields.
@return
public
getGoToPageBottom():String
Sequential
Tags: annotations=@Deprecated
Notes: WARNING: USE THIS METHOD ONLY FROM LOWER GO TO INPUT FIELD MENU IN JSPF. For getting the value manually, use getGoToPage().
@param elementsPerPageTop
public
getGoToPageTop():String
Sequential
Tags: annotations=@Deprecated
Notes: WARNING: USE THIS METHOD ONLY FROM UPPER GO TO INPUT FIELD MENU IN JSPF. For getting the value manually, use getGoToPage().
@param elementsPerPageTop
private
getHasChanged():boolean
Sequential
Notes: Returns the value of hasChanged and resets it to false.
@return
public
getLinkForFirstPage():String
Sequential
Notes: Returns the link for the "First Page"-Button of the Paginator
@return
public
getLinkForLastPage():String
Sequential
Notes: Returns the link for the "Last Page"-Button of the Paginator
@return
public
getLinkForNextPage():String
Sequential
Notes: Returns the link for the "Next"-Button of the Paginator
@return
public
getLinkForPreviousPage():String
Sequential
Notes: Returns the link for the "Previous"-Button of the Paginator
@return
protected
getModifiedLink(
   String key,
   String value):String
Sequential
Notes: Returns a link of which one GET parameter is modified
@return
public
getOffset():int
Sequential
Notes: Returns the current offset (starting with 0)
public
getPageType():String
Sequential
Notes: Returns the pageType, a String that describes the current page with which this list is used.
@return
protected
getPaginatorListRetriever():BaseListRetrieverRequestBean
Sequential
Notes: Returns the corresponding BaseListRetrieverRequestBean.
@return
public
getPaginatorPages():List
Sequential
Notes: Returns a list with the paginator pages. Used from jsf to iterate over the numbers
@return
public
getPaginatorPageSize():int
Sequential
Notes: Returns the number of all paginator pages, not only the visible ones
@return
public
getParameterElementsPerPage():String
Sequential
public
getParameterMap():Map
Sequential
Notes: Returns a map that contains all HTTP GET parameters as key-value pairs. If you want to redirect please add your parameters here first.
@return
public
getParameterPageNumber():String
Sequential
public
getPartListSize():int
Sequential
Notes: Returns the size of the current list
@return
public
getRedirectUrl():String
Sequential
Notes: Returns the url to redirect, including the page path (drawn from BaseListRetrieverRequestBean and all get parameters from the parameterMap.
@return
public
getTotalNumberOfElements():int
Sequential
Notes: Returns the total number of elements, without offset and limit filters. Drawn from BaseRetrieverRequestBean
private
getUrlParameterString():String
Sequential
Notes: Returns the GET parameters from the parameter map as string that can be appended to the URL
@return
public
goToPageBottom():String
Sequential
Notes: Used as action when the user sends an value from the lower go to input field
@return
public
goToPageTop():String
Sequential
Notes: Used as action when the user sends an value from the upper go to input field
@return
protected abstract
listUpdated():void
Sequential
Notes: Called whenever a new list is retrieved and set.
protected abstract
pageTypeChanged():void
Sequential
Notes: This method is called whenever a new pageType is used. You can reset session-specific variables here, e.g.
private
parametersChanged():boolean
Sequential
Notes: Compares the parameters from the current request with the ones from the last request. Returns true if parameters have changed or if there are more/less parameters since the last request. This is done in order to avoid the list update if only e.g. a new menu should be displayed.
@return
protected abstract
readOutParameters():void
Sequential
Notes: Implementing subclasses have to read out and set GET parameters within this method. If parameters are set, please do not forget to add them to the parameterMap of this class. Otherwise they won't be in the redirect URL.
public
redirect():void
Sequential
Notes: Redirects to the current list page using all parameters from the parameterMap and the path to the jsp page (drawn form BaseListretrieverRequestBean=
public
saveOldParameters():void
Sequential
Notes: Copies the current parameters in the parameter store
public
setCurrentPageNumber(
   int currentPageNumber):void
Sequential
Notes: Sets the current paginator page number
public
setElementsPerPage(
   int elementsPerPage):void
Sequential
Notes: Sets the current value for 'element per pages'
public
setElementsPerPageBottom(
   int elementsPerPageBottom):void
Sequential
Tags: annotations=@Deprecated
Notes: WARNING: USE THIS METHOD ONLY FROM LOWER PAGINATOR SELECTION MENU IN JSPF. For setting the value manually, use setElementsPerPage().
@param elementsPerPageTop
public
setElementsPerPageSelectItems(
   List elementsPerPageSelectItems):void
Sequential
Notes: Sets the menu entries of the elements per page menu
public
setElementsPerPageTop(
   int elementsPerPageTop):void
Sequential
Tags: annotations=@Deprecated
Notes: WARNING: USE THIS METHOD ONLY FROM UPPER PAGINATOR SELECTION MENU IN JSPF. For setting the value manually, use setElementsPerPage().
public
setGoToPage(
   String goToPage):void
Sequential
Notes: Sets the value of the go to input fields.
public
setGoToPageBottom(
   String goToPage):void
Sequential
Tags: annotations=@Deprecated
Notes: WARNING: USE THIS METHOD ONLY FROM LOWER GO TO INPUT FIELD MENU IN JSPF. For setting the value manually, use setGoToPage().
@param elementsPerPageTop
public
setGoToPageTop(
   String goToPage):void
Sequential
Tags: annotations=@Deprecated
Notes: WARNING: USE THIS METHOD ONLY FROM UPPER GO TO INPUT FIELD MENU IN JSPF. For setting the value manually, use setGoToPage().
@param elementsPerPageTop
public
setHasChanged():void
Sequential
Notes: Set this method from outside if the list has to be updated even if no GET parameters have changed;
public
setPageType(
   String pageType):void
Sequential
Notes: Sets the pageType and, whenever a new pageType is used, calls pageTypeChanged(), clears the parameter map and the input fields of go to boxes.
public
setPaginatorListRetriever(
   BaseListRetrieverRequestBean paginatorListRetriever):void
Sequential
Notes: Sets the current BaseListRetrieverRequestBean of this SessionBean
public
update():void
Sequential
Notes: This method is called by the corresponding BaseListRetrieverRequestBean whenever the list has to be updated. It reads out basic parameters and calls readOutParamters on implementing subclasses. It uses the BaseListRetrieverRequestBean in order to retrieve the new list and finally calls listUpdated on implementing subclasses.