Package org.opencms.jsp.search.config
Class CmsSearchConfigurationPagination
- java.lang.Object
-
- org.opencms.jsp.search.config.CmsSearchConfigurationPagination
-
- All Implemented Interfaces:
I_CmsSearchConfigurationPagination
public class CmsSearchConfigurationPagination extends java.lang.Object implements I_CmsSearchConfigurationPagination
Search configuration for pagination.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PAGE_NAV_LENGTH
The default "Google"-like page navigation length.static java.lang.String
DEFAULT_PAGE_PARAM
The default request parameter to read the current page from.static java.util.List<java.lang.Integer>
DEFAULT_PAGE_SIZE
The default page size.
-
Constructor Summary
Constructors Constructor Description CmsSearchConfigurationPagination(java.lang.String pageParam, java.lang.Integer pageSize, java.lang.Integer pageNavLength)
Constructor setting all configuration options for the pagination.CmsSearchConfigurationPagination(java.lang.String pageParam, java.util.List<java.lang.Integer> pageSizes, java.lang.Integer pageNavLength)
Constructor setting all configuration options for the pagination.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static I_CmsSearchConfigurationPagination
create(java.lang.String pageParam, java.util.List<java.lang.Integer> pageSizes, java.lang.Integer pageNavLength)
Creates a new pagination configuration if at least one of the provided parameters is not null.int
getNumPages(long numFound)
Calculates the number of pages for the provided number of results.int
getPageNavLength()
Returns the length of a "Google"-like navigation.java.lang.String
getPageParam()
Returns the request parameter that should be used to send the current page.int
getPageSize()
Deprecated.java.util.List<java.lang.Integer>
getPageSizes()
Returns the page sizes as configured for the first pages of the search.int
getSizeOfPage(int pageNum)
Returns the page size for the provided page.int
getStartOfPage(int pageNum)
Returns the index of the first item to show on the given page.
-
-
-
Field Detail
-
DEFAULT_PAGE_SIZE
public static final java.util.List<java.lang.Integer> DEFAULT_PAGE_SIZE
The default page size.
-
DEFAULT_PAGE_NAV_LENGTH
public static final int DEFAULT_PAGE_NAV_LENGTH
The default "Google"-like page navigation length.- See Also:
- Constant Field Values
-
DEFAULT_PAGE_PARAM
public static final java.lang.String DEFAULT_PAGE_PARAM
The default request parameter to read the current page from.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsSearchConfigurationPagination
public CmsSearchConfigurationPagination(java.lang.String pageParam, java.lang.Integer pageSize, java.lang.Integer pageNavLength)
Constructor setting all configuration options for the pagination.- Parameters:
pageParam
- The request parameter used to send the current page number.pageSize
- The page size.pageNavLength
- The length of the "Google"-like page navigation. Should be an odd number.
-
CmsSearchConfigurationPagination
public CmsSearchConfigurationPagination(java.lang.String pageParam, java.util.List<java.lang.Integer> pageSizes, java.lang.Integer pageNavLength)
Constructor setting all configuration options for the pagination.- Parameters:
pageParam
- The request parameter used to send the current page number.pageSizes
- The page sizes for the first pages. The last provided size is the size of all following pages.pageNavLength
- The length of the "Google"-like page navigation. Should be an odd number.
-
-
Method Detail
-
create
public static I_CmsSearchConfigurationPagination create(java.lang.String pageParam, java.util.List<java.lang.Integer> pageSizes, java.lang.Integer pageNavLength)
Creates a new pagination configuration if at least one of the provided parameters is not null. Otherwise returns null.- Parameters:
pageParam
- The request parameter used to send the current page number.pageSizes
- The page sizes for the first pages. The last provided size is the size of all following pages.pageNavLength
- The length of the "Google"-like page navigation. Should be an odd number.- Returns:
- the pagination configuration, or
null
if none of the provided parameters is not null.
-
getNumPages
public int getNumPages(long numFound)
Description copied from interface:I_CmsSearchConfigurationPagination
Calculates the number of pages for the provided number of results.- Specified by:
getNumPages
in interfaceI_CmsSearchConfigurationPagination
- Parameters:
numFound
- the number of results- Returns:
- the number of result pages for the provided number of results.
- See Also:
I_CmsSearchConfigurationPagination.getNumPages(long)
-
getPageNavLength
public int getPageNavLength()
Description copied from interface:I_CmsSearchConfigurationPagination
Returns the length of a "Google"-like navigation. Should typically be an odd number.- Specified by:
getPageNavLength
in interfaceI_CmsSearchConfigurationPagination
- Returns:
- The length of a "Google"-like navigation.
- See Also:
I_CmsSearchConfigurationPagination.getPageNavLength()
-
getPageParam
public java.lang.String getPageParam()
Description copied from interface:I_CmsSearchConfigurationPagination
Returns the request parameter that should be used to send the current page.- Specified by:
getPageParam
in interfaceI_CmsSearchConfigurationPagination
- Returns:
- The request parameter that should be used to send the current page.
- See Also:
I_CmsSearchConfigurationPagination.getPageParam()
-
getPageSize
@Deprecated public int getPageSize()
Deprecated.Description copied from interface:I_CmsSearchConfigurationPagination
Returns the page size of pages that have not explicitely a size set. That means, if you specify the sizes [5,8], meaning the first page should have 5 entries, all others 8, the size 8 is returned by the method. To get the size of a specific page useI_CmsSearchConfigurationPagination.getSizeOfPage(int)
.- Specified by:
getPageSize
in interfaceI_CmsSearchConfigurationPagination
- Returns:
- The page size of pages that have not explicitely a size set.
- See Also:
I_CmsSearchConfigurationPagination.getPageSize()
-
getPageSizes
public java.util.List<java.lang.Integer> getPageSizes()
Description copied from interface:I_CmsSearchConfigurationPagination
Returns the page sizes as configured for the first pages of the search. The last provided size is the size of all following pages.- Specified by:
getPageSizes
in interfaceI_CmsSearchConfigurationPagination
- Returns:
- the configured page sizes for the first pages.
- See Also:
I_CmsSearchConfigurationPagination.getPageSizes()
-
getSizeOfPage
public int getSizeOfPage(int pageNum)
Description copied from interface:I_CmsSearchConfigurationPagination
Returns the page size for the provided page.- Specified by:
getSizeOfPage
in interfaceI_CmsSearchConfigurationPagination
- Parameters:
pageNum
- the number of the page (starting with 1) for which the size should be returned.- Returns:
- The page size for the provided page.
- See Also:
I_CmsSearchConfigurationPagination.getSizeOfPage(int)
-
getStartOfPage
public int getStartOfPage(int pageNum)
Description copied from interface:I_CmsSearchConfigurationPagination
Returns the index of the first item to show on the given page.- Specified by:
getStartOfPage
in interfaceI_CmsSearchConfigurationPagination
- Parameters:
pageNum
- the number of the page, for which the index of the first item to show on is requested.- Returns:
- the index of the first item to show on the provided page.
- See Also:
I_CmsSearchConfigurationPagination.getStartOfPage(int)
-
-