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 Object
implements I_CmsSearchConfigurationPagination
Search configuration for pagination.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default "Google"-like page navigation length.static final String
The default request parameter to read the current page from.The default page size. -
Constructor Summary
ConstructorDescriptionCmsSearchConfigurationPagination
(String pageParam, Integer pageSize, Integer pageNavLength) Constructor setting all configuration options for the pagination.CmsSearchConfigurationPagination
(String pageParam, List<Integer> pageSizes, Integer pageNavLength) Constructor setting all configuration options for the pagination. -
Method Summary
Modifier and TypeMethodDescriptionCreates 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
Returns the length of a "Google"-like navigation.Returns the request parameter that should be used to send the current page.int
Deprecated.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 Details
-
DEFAULT_PAGE_SIZE
The default page size. -
DEFAULT_PAGE_NAV_LENGTH
The default "Google"-like page navigation length.- See Also:
-
DEFAULT_PAGE_PARAM
The default request parameter to read the current page from.- See Also:
-
-
Constructor Details
-
CmsSearchConfigurationPagination
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(String pageParam, List<Integer> pageSizes, 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 Details
-
create
public static I_CmsSearchConfigurationPagination create(String pageParam, List<Integer> pageSizes, 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
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:
-
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:
-
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:
-
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:
-
getSizeOfPage
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:
-
getStartOfPage
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.getPageSize()