Interface PageProvider<T>

    • Method Detail

      • setName

        void setName​(String name)
        Sets the provider identifier
      • getProperties

        Map<String,​SerializablegetProperties()
        Gets properties set on the provider.

        Useful to retrieve a provider specific field attributes after instantiation. Other contextual parameters can be passed through API constructing the result provider.

      • setProperties

        void setProperties​(Map<String,​Serializable> properties)
        Sets properties set on the provider.

        Useful to initialize a provider specific field attributes after instantiation. Other contextual parameters can be passed through API constructing the result provider.

      • getPageSize

        long getPageSize()
        Returns the number of results per page. 0 means no pagination unless getMaxPageSize() is greater than this value, it will be taken into account instead.
      • setPageSize

        void setPageSize​(long pageSize)
        Sets the number of results per page. 0 means no pagination unless getMaxPageSize() is greater than this value, it will be taken into account instead.
      • getMaxPageSize

        long getMaxPageSize()
        Returns the max number of results per page. 0 means no pagination.

        If page size is greater than this maximum value, it will be taken into account instead.

        Since:
        5.4.2
      • setMaxPageSize

        void setMaxPageSize​(long pageSize)
        Sets the max number of results per page. 0 means no pagination.

        If page size is greater than this maximum value, it will be taken into account instead.

        Since:
        5.4.2
      • getPageSizeOptions

        List<LonggetPageSizeOptions()
        Returns a list of available page size options to display in the page size selector.

        Uses an hardcoded list of values, and adds up the page provider initial and current page sizes.

        Since:
        7.3
      • getResultsCount

        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.
      • setResultsCount

        void setResultsCount​(long resultsCount)
        Sets the results count.
        Since:
        5.5
      • getNumberOfPages

        long getNumberOfPages()
        Returns the total number of pages or 0 if number of pages is unknown.
      • getPageLimit

        long getPageLimit()
        Returns the page limit. The n first page we know they exist.
        Since:
        5.7.3
      • getCurrentPage

        List<TgetCurrentPage()
        Returns the current page of results.

        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.

        Returns:
        the current page
      • setCurrentPageOffset

        void setCurrentPageOffset​(long offset)
        Sets the current page offset.

        If the provider keeps information linked to the current page, they should be reset after calling this method.

        Since:
        5.5
      • setCurrentPageIndex

        void setCurrentPageIndex​(long currentPageIndex)
        Sets the current page of results to the required one.
        Parameters:
        currentPageIndex - the page index, starting from 0
        Since:
        5.7.3
      • setCurrentPage

        List<TsetCurrentPage​(long page)
        Sets the current page of results to the required one and return it.
        Parameters:
        page - the page index, starting from 0
      • refresh

        void refresh()
        Forces refresh of the current page.
      • isNextPageAvailable

        boolean isNextPageAvailable()
        Returns a boolean expressing if there are further pages.
      • isLastPageAvailable

        boolean isLastPageAvailable()
        Returns a boolean expressing if the last page can be displayed.
        Since:
        5.5
      • isPreviousPageAvailable

        boolean isPreviousPageAvailable()
        Returns a boolean expressing if there is a previous page.
      • getCurrentPageSize

        long getCurrentPageSize()
        Returns the number of elements in current page.
      • getCurrentPageOffset

        long getCurrentPageOffset()
        Returns the offset (starting from 0) of the first element in the current page or UNKNOWN_SIZE.
      • getCurrentPageIndex

        long getCurrentPageIndex()
        Returns the current page index as a zero-based integer.
      • firstPage

        void firstPage()
        Go to the first page
      • nextPage

        void nextPage()
        Go to the next page
      • lastPage

        void lastPage()
        Go to the last page. Does not do anything if there is only one page displayed, or if the number of results is unknown.
      • isNextEntryAvailable

        boolean isNextEntryAvailable()
        Returns true if there is a next entry.

        The next entry might be in next page, except if results count is unknown.

      • isPreviousEntryAvailable

        boolean isPreviousEntryAvailable()
        Returns true if there is a previous entry.

        The previous entry might be in previous page.

      • previousEntry

        void previousEntry()
        Move the current entry to the previous one, if applicable.

        No exception: this method is intended to be plugged directly at the UI layer. In case there's no previous entry, nothing will happen.

      • nextEntry

        void nextEntry()
        Move the current entry to the next one, if applicable.

        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.

      • isSortable

        boolean isSortable()
        Returns if this provider is sortable
      • getSortInfo

        SortInfo getSortInfo()
        Returns the first sorting info for this provider

        Also kept for compatibility with existing code.

      • setSortInfo

        void setSortInfo​(SortInfo sortInfo)
        Sets the first and only sorting info for this provider.

        Also kept for compatibility with existing code.

      • setSortInfo

        void setSortInfo​(String sortColumn,
                         boolean sortAscending,
                         boolean removeOtherSortInfos)
        Sets the first and only sorting info for this provider if parameter removeOtherSortInfos is true. Otherwise, adds or changes the sortAscending information according to given direction.
      • addSortInfo

        void addSortInfo​(String sortColumn,
                         boolean sortAscending)
        Add the given sort info to the list of sorting infos.
      • getSortInfoIndex

        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.
      • getResultsCountLimit

        long getResultsCountLimit()
        Limit of number of results beyond which the page provider may not be able to compute 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.

        Since:
        9.3