fr.paris.lutece.util.html
Class AbstractPaginator<E>

java.lang.Object
  extended by fr.paris.lutece.util.html.AbstractPaginator<E>
Type Parameters:
E - the type
All Implemented Interfaces:
IPaginator<E>
Direct Known Subclasses:
DelegatePaginator, Paginator

public abstract class AbstractPaginator<E>
extends Object
implements IPaginator<E>

Abstract Paginator


Field Summary
protected  List<E> _list
          the actual list
protected  int _nItemPerPage
          items per page
protected  int _nItemsCount
          element count
protected  int _nPageCurrent
          the current page
protected  String _strBaseUrl
          base url
protected  String _strItemsPerPageParameterName
          items per page parameter name
protected  String _strPageIndexParameterName
          page index parameter name
static String LABEL_FIRST
           
static String LABEL_LAST
           
static String LABEL_NEXT
           
static String LABEL_PREVIOUS
           
static String PARAMETER_ITEMS_PER_PAGE
          Default value for Items Per Page Parameter
static String PARAMETER_PAGE_INDEX
          Default value for Page Index Parameter
 
Constructor Summary
AbstractPaginator()
           
 
Method Summary
 String getFirstPageLink()
          Returns the previous page link
 int getItemsCount()
          Returns the number of items in the collection
 int getItemsPerPage()
          Gets the items count per page.
static int getItemsPerPage(javax.servlet.http.HttpServletRequest request, String strParameter, int nCurrent, int nDefault)
          Gets the number of items per page from a request parameter
 String getItemsPerPageParameterName()
          Get the parameter name of the items_per_page
 String getLabelFirst()
          Get First label
 String getLabelItemCount()
          Get Item Count label
 String getLabelItemCountPerPage()
          Get Item Count per page label
 String getLabelLast()
          Get First label
 String getLabelNext()
          Get Next label
 String getLabelPrevious()
          Get Previous label
 String getLastPageLink()
          Returns the previous page link
 String getNextPageLink()
          Returns the previous page link
 int getPageCurrent()
          Returns the current page index
static String getPageIndex(javax.servlet.http.HttpServletRequest request, String strParameter, String strCurrentPageIndex)
          Gets the new page index from a request parameter
 int getPagesCount()
          Gets the number of pages
 List<PaginatorPage> getPagesLinks()
          Returns Pages Links
 String getPreviousPageLink()
          Returns the previous page link
 int getRangeMax()
          Returns the index of the last item of the current page range
 int getRangeMin()
          Returns the index of the first item of the current page range
 void setItemsPerPageParameterName(String strItemsPerPageParameterName)
          Set the parameter name of the items_per_page
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.paris.lutece.util.html.IPaginator
getPageItems
 

Field Detail

PARAMETER_PAGE_INDEX

public static final String PARAMETER_PAGE_INDEX
Default value for Page Index Parameter

See Also:
Constant Field Values

PARAMETER_ITEMS_PER_PAGE

public static final String PARAMETER_ITEMS_PER_PAGE
Default value for Items Per Page Parameter

See Also:
Constant Field Values

LABEL_FIRST

public static final String LABEL_FIRST
See Also:
Constant Field Values

LABEL_PREVIOUS

public static final String LABEL_PREVIOUS
See Also:
Constant Field Values

LABEL_NEXT

public static final String LABEL_NEXT
See Also:
Constant Field Values

LABEL_LAST

public static final String LABEL_LAST
See Also:
Constant Field Values

_strPageIndexParameterName

protected String _strPageIndexParameterName
page index parameter name


_nItemPerPage

protected int _nItemPerPage
items per page


_strBaseUrl

protected String _strBaseUrl
base url


_list

protected List<E> _list
the actual list


_nPageCurrent

protected int _nPageCurrent
the current page


_strItemsPerPageParameterName

protected String _strItemsPerPageParameterName
items per page parameter name


_nItemsCount

protected int _nItemsCount
element count

Constructor Detail

AbstractPaginator

public AbstractPaginator()
Method Detail

getPageCurrent

public int getPageCurrent()
Returns the current page index

Specified by:
getPageCurrent in interface IPaginator<E>
Returns:
The current page index

getFirstPageLink

public String getFirstPageLink()
Returns the previous page link

Specified by:
getFirstPageLink in interface IPaginator<E>
Returns:
The previous page link

getPreviousPageLink

public String getPreviousPageLink()
Returns the previous page link

Specified by:
getPreviousPageLink in interface IPaginator<E>
Returns:
The previous page link

getLastPageLink

public String getLastPageLink()
Returns the previous page link

Specified by:
getLastPageLink in interface IPaginator<E>
Returns:
The previous page link

getItemsPerPage

public int getItemsPerPage()
Gets the items count per page.

Specified by:
getItemsPerPage in interface IPaginator<E>
Returns:
items count per page.

getNextPageLink

public String getNextPageLink()
Returns the previous page link

Specified by:
getNextPageLink in interface IPaginator<E>
Returns:
The previous page link

getPagesLinks

public List<PaginatorPage> getPagesLinks()
Returns Pages Links

Specified by:
getPagesLinks in interface IPaginator<E>
Returns:
Pages Links

getLabelFirst

public String getLabelFirst()
Get First label

Specified by:
getLabelFirst in interface IPaginator<E>
Returns:
The Label

getLabelPrevious

public String getLabelPrevious()
Get Previous label

Specified by:
getLabelPrevious in interface IPaginator<E>
Returns:
The Label

getLabelNext

public String getLabelNext()
Get Next label

Specified by:
getLabelNext in interface IPaginator<E>
Returns:
The Label

getLabelLast

public String getLabelLast()
Get First label

Specified by:
getLabelLast in interface IPaginator<E>
Returns:
The Label

getLabelItemCount

public String getLabelItemCount()
Get Item Count label

Specified by:
getLabelItemCount in interface IPaginator<E>
Returns:
The Label

getLabelItemCountPerPage

public String getLabelItemCountPerPage()
Get Item Count per page label

Specified by:
getLabelItemCountPerPage in interface IPaginator<E>
Returns:
The Label

getItemsPerPageParameterName

public String getItemsPerPageParameterName()
Get the parameter name of the items_per_page

Specified by:
getItemsPerPageParameterName in interface IPaginator<E>
Returns:
the parameter name

setItemsPerPageParameterName

public void setItemsPerPageParameterName(String strItemsPerPageParameterName)
Set the parameter name of the items_per_page

Specified by:
setItemsPerPageParameterName in interface IPaginator<E>
Parameters:
strItemsPerPageParameterName - the parameter name

getPagesCount

public int getPagesCount()
Gets the number of pages

Specified by:
getPagesCount in interface IPaginator<E>
Returns:
the number of pages

getRangeMin

public int getRangeMin()
Returns the index of the first item of the current page range

Specified by:
getRangeMin in interface IPaginator<E>
Returns:
The index of the first item of the current page range

getRangeMax

public int getRangeMax()
Returns the index of the last item of the current page range

Specified by:
getRangeMax in interface IPaginator<E>
Returns:
The index of the last item of the current page range

getItemsCount

public int getItemsCount()
Returns the number of items in the collection

Specified by:
getItemsCount in interface IPaginator<E>
Returns:
The number of items in the collection

getItemsPerPage

public static int getItemsPerPage(javax.servlet.http.HttpServletRequest request,
                                  String strParameter,
                                  int nCurrent,
                                  int nDefault)
Gets the number of items per page from a request parameter

Parameters:
request - The HTTP request
strParameter - The request parameter name
nCurrent - The current number of items
nDefault - The default number of items
Returns:
The new number of items

getPageIndex

public static String getPageIndex(javax.servlet.http.HttpServletRequest request,
                                  String strParameter,
                                  String strCurrentPageIndex)
Gets the new page index from a request parameter

Parameters:
request - The HTTP request
strParameter - The request parameter name
strCurrentPageIndex - The current page index
Returns:
The new page index


Copyright © 2014 Mairie de Paris. All Rights Reserved.