T
- any Serializable itempublic interface PageProvider<T> extends Serializable
Provides APIs to navigate between result pages
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_MAX_PAGE_SIZE
Default maximum page size value.
|
static String |
DEFAULT_MAX_PAGE_SIZE_RUNTIME_PROP |
static String |
HIGHLIGHT_CTX_DATA
Highlight context data property name.
|
static long |
PAGE_LIMIT_UNKNOWN
Page limit unknown.
|
static long |
UNKNOWN_SIZE
Constant to express that the total number of result elements is unknown (usually because the query has not been
done yet).
|
static long |
UNKNOWN_SIZE_AFTER_QUERY
Constant to express that the total number of result elements is unknown even after performing a query.
|
Modifier and Type | Method and Description |
---|---|
void |
addQuickFilter(QuickFilter quickFilter) |
void |
addSortInfo(String sortColumn,
boolean sortAscending)
Add the given sort info to the list of sorting infos.
|
void |
firstPage()
Go to the first page
|
List<AggregateDefinition> |
getAggregateDefinitions() |
Map<String,Aggregate<? extends Bucket>> |
getAggregates() |
List<QuickFilter> |
getAvailableQuickFilters() |
T |
getCurrentEntry()
Returns the current entry.
|
List<T> |
getCurrentPage()
Returns the current page of results.
|
long |
getCurrentPageIndex()
Returns the current page index as a zero-based integer.
|
long |
getCurrentPageOffset()
Returns the offset (starting from 0) of the first element in the current page or
UNKNOWN_SIZE . |
long |
getCurrentPageSize()
Returns the number of elements in current page.
|
String |
getCurrentPageStatus()
Returns a simple formatted string for current pagination status.
|
PageSelections<T> |
getCurrentSelectPage()
Returns the current page of results wrapped in a
PageSelection item. |
PageProviderDefinition |
getDefinition() |
Throwable |
getError() |
String |
getErrorMessage() |
List<String> |
getHighlights() |
long |
getMaxPageSize()
Returns the max number of results per page.
|
String |
getName()
Returns the provider identifier
|
long |
getNumberOfPages()
Returns the total number of pages or 0 if number of pages is unknown.
|
long |
getPageLimit()
Returns the page limit.
|
long |
getPageSize()
Returns the number of results per page.
|
List<Long> |
getPageSizeOptions()
Returns a list of available page size options to display in the page size selector.
|
Object[] |
getParameters() |
Map<String,Serializable> |
getProperties()
Gets properties set on the provider.
|
List<QuickFilter> |
getQuickFilters() |
long |
getResultsCount()
Returns the number of result elements if available or a negative value if it is unknown:
UNKNOWN_SIZE if it is unknown as query was not done, and since 5.5,
UNKNOWN_SIZE_AFTER_QUERY if it is still unknown after query was done. |
long |
getResultsCountLimit()
Limit of number of results beyond which the page provider may not be able to compute
#getResultsCount())
or navigate. |
DocumentModel |
getSearchDocumentModel() |
SortInfo |
getSortInfo()
Returns the first sorting info for this provider
|
int |
getSortInfoIndex(String sortColumn,
boolean sortAscending)
Returns a positive 0-based integer if given sort information is found on the set sort infos, indicating the sort
index, or -1 if this sort information is not found.
|
List<SortInfo> |
getSortInfos()
Returns the complete list of sorting info for this provider
|
boolean |
hasAggregateSupport() |
boolean |
hasChangedParameters(Object[] parameters)
Test if provider parameters have changed
|
boolean |
hasError() |
boolean |
isLastPageAvailable()
Returns a boolean expressing if the last page can be displayed.
|
boolean |
isNextEntryAvailable()
Returns true if there is a next entry.
|
boolean |
isNextPageAvailable()
Returns a boolean expressing if there are further pages.
|
boolean |
isPreviousEntryAvailable()
Returns true if there is a previous entry.
|
boolean |
isPreviousPageAvailable()
Returns a boolean expressing if there is a previous page.
|
boolean |
isSortable()
Returns if this provider is sortable
|
void |
lastPage()
Go to the last page.
|
void |
nextEntry()
Move the current entry to the next one, if applicable.
|
void |
nextPage()
Go to the next page
|
void |
previousEntry()
Move the current entry to the previous one, if applicable.
|
void |
previousPage()
Go to the previous page
|
void |
refresh()
Forces refresh of the current page.
|
void |
setCurrentEntry(T entry)
Sets the current entry.
|
void |
setCurrentEntryIndex(long index)
Sets the current entry index.
|
List<T> |
setCurrentPage(long page)
Sets the current page of results to the required one and return it.
|
void |
setCurrentPageIndex(long currentPageIndex)
Sets the current page of results to the required one.
|
void |
setCurrentPageOffset(long offset)
Sets the current page offset.
|
void |
setDefinition(PageProviderDefinition providerDefinition) |
void |
setHighlights(List<String> highlights) |
void |
setMaxPageSize(long pageSize)
Sets the max number of results per page.
|
void |
setName(String name)
Sets the provider identifier
|
void |
setPageProviderChangedListener(PageProviderChangedListener listener)
Sets the
PageProviderChangedListener for this PageProvider . |
void |
setPageSize(long pageSize)
Sets the number of results per page.
|
void |
setPageSizeOptions(List<Long> options)
Sets the page size options.
|
void |
setParameters(Object[] parameters) |
void |
setProperties(Map<String,Serializable> properties)
Sets properties set on the provider.
|
void |
setQuickFilters(List<QuickFilter> quickFilters) |
void |
setResultsCount(long resultsCount)
Sets the results count.
|
void |
setSearchDocumentModel(DocumentModel doc) |
void |
setSelectedEntries(List<T> entries)
Sets the list of selected entries to take into account in
getCurrentSelectPage() . |
void |
setSortable(boolean sortable) |
void |
setSortInfo(SortInfo sortInfo)
Sets the first and only sorting info for this provider.
|
void |
setSortInfo(String sortColumn,
boolean sortAscending,
boolean removeOtherSortInfos)
Sets the first and only sorting info for this provider if parameter removeOtherSortInfos is true.
|
void |
setSortInfos(List<SortInfo> sortInfo)
Sets the complete list of sorting info for this provider
|
static final String DEFAULT_MAX_PAGE_SIZE_RUNTIME_PROP
static final long UNKNOWN_SIZE
static final long UNKNOWN_SIZE_AFTER_QUERY
static final long DEFAULT_MAX_PAGE_SIZE
static final long PAGE_LIMIT_UNKNOWN
static final String HIGHLIGHT_CTX_DATA
Map<String,Serializable> getProperties()
Useful to retrieve a provider specific field attributes after instantiation. Other contextual parameters can be passed through API constructing the result provider.
void setProperties(Map<String,Serializable> properties)
Useful to initialize a provider specific field attributes after instantiation. Other contextual parameters can be passed through API constructing the result provider.
Object[] getParameters()
void setParameters(Object[] parameters)
long getPageSize()
getMaxPageSize()
is greater than
this value, it will be taken into account instead.void setPageSize(long pageSize)
getMaxPageSize()
is greater than this
value, it will be taken into account instead.long getMaxPageSize()
If page size is greater than this maximum value, it will be taken into account instead.
void setMaxPageSize(long pageSize)
If page size is greater than this maximum value, it will be taken into account instead.
List<Long> getPageSizeOptions()
Uses an hardcoded list of values, and adds up the page provider initial and current page sizes.
void setPageSizeOptions(List<Long> options)
long getResultsCount()
UNKNOWN_SIZE
if it is unknown as query was not done, and since 5.5,
UNKNOWN_SIZE_AFTER_QUERY
if it is still unknown after query was done.void setResultsCount(long resultsCount)
long getNumberOfPages()
long getPageLimit()
List<T> getCurrentPage()
This method is designed to be called from higher levels. It therefore ensures cheapness of repeated calls, rather than data consistency. There is a refresh() method for that.
PageSelections<T> getCurrentSelectPage()
PageSelection
item.
By default, no entry is selected, unless setSelectedEntries(List)
has been called before.
void setSelectedEntries(List<T> entries)
getCurrentSelectPage()
.void setCurrentPageOffset(long offset)
If the provider keeps information linked to the current page, they should be reset after calling this method.
void setCurrentPageIndex(long currentPageIndex)
currentPageIndex
- the page index, starting from 0List<T> setCurrentPage(long page)
page
- the page index, starting from 0void refresh()
boolean isNextPageAvailable()
boolean isLastPageAvailable()
boolean isPreviousPageAvailable()
long getCurrentPageSize()
long getCurrentPageOffset()
UNKNOWN_SIZE
.long getCurrentPageIndex()
String getCurrentPageStatus()
void firstPage()
void previousPage()
void nextPage()
void lastPage()
T getCurrentEntry()
void setCurrentEntry(T entry)
void setCurrentEntryIndex(long index)
boolean isNextEntryAvailable()
The next entry might be in next page, except if results count is unknown.
boolean isPreviousEntryAvailable()
The previous entry might be in previous page.
void previousEntry()
No exception: this method is intended to be plugged directly at the UI layer. In case there's no previous entry, nothing will happen.
void nextEntry()
If needed and possible, the provider will forward to next page. No special exceptions: this method is intended to be plugged directly at the UI layer. In case there's no next entry, nothing happens.
boolean isSortable()
void setSortable(boolean sortable)
List<SortInfo> getSortInfos()
SortInfo getSortInfo()
Also kept for compatibility with existing code.
void setSortInfos(List<SortInfo> sortInfo)
void setSortInfo(SortInfo sortInfo)
Also kept for compatibility with existing code.
void setSortInfo(String sortColumn, boolean sortAscending, boolean removeOtherSortInfos)
void addSortInfo(String sortColumn, boolean sortAscending)
int getSortInfoIndex(String sortColumn, boolean sortAscending)
DocumentModel getSearchDocumentModel()
void setSearchDocumentModel(DocumentModel doc)
boolean hasError()
String getErrorMessage()
void setDefinition(PageProviderDefinition providerDefinition)
PageProviderDefinition getDefinition()
void setPageProviderChangedListener(PageProviderChangedListener listener)
PageProviderChangedListener
for this PageProvider
.boolean hasChangedParameters(Object[] parameters)
List<AggregateDefinition> getAggregateDefinitions()
Map<String,Aggregate<? extends Bucket>> getAggregates()
boolean hasAggregateSupport()
List<QuickFilter> getQuickFilters()
void setQuickFilters(List<QuickFilter> quickFilters)
void addQuickFilter(QuickFilter quickFilter)
List<QuickFilter> getAvailableQuickFilters()
List<String> getHighlights()
void setHighlights(List<String> highlights)
long getResultsCountLimit()
#getResultsCount())
or navigate.
Requesting results beyond this limit may result in error. When #getResultsCount())
is negative, it means
there may be more results than this limit.
0 means there is no limit.
Copyright © 2018 Nuxeo. All rights reserved.