[ 
https://jira.nuxeo.com/browse/NXP-7367?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anahide Tchertchian resolved NXP-7367.
--------------------------------------

       Resolution: Fixed
    Upgrade notes: New interface methods: PageProvider#isLastPageAvailable, and 
PageProvider#setCurrentPageOffset have been added and added to the default 
abstract implementation.  (was: PageProvider{getNumberOfPages now should return 
-1 when number of pages is unknown (instead of 0)
New interface methods: PageProvider#isLastPageAvailable, and 
PageProvider#setCurrentPageOffset have been added and added to the default 
abstract implementation.)

Done, note that PageProvider#isLastPageAvailable can now be used to test the 
display of the "last page" button (always return false when results count is 
unknown), but the template pageNavigationControls.xhtml was not changed to use 
it for compatibility reasons (still usable on old page providers relying on 
query models).

Note also that methods  AbstractPageProvider#getCurrentHigherNonEmptyPageIndex 
and setCurrentHigherNonEmptyPageIndex have to be called when building the 
current page content to handle pagination, see for instance the mock 
implementation in tests (MockPageProvider):

{code}
if (currentItems != null && currentItems.size() > 0) {
    int higherNonEmptyPage = getCurrentHigherNonEmptyPageIndex();
    int currentFilledPage = Long.valueOf(getCurrentPageIndex()).intValue();
    if (currentFilledPage > higherNonEmptyPage) {
        setCurrentHigherNonEmptyPageIndex(currentFilledPage);
    }
}
{code}

method AbstractPageProvider#getMaxNumberOfEmptyPages can also be overriden to 
allow more than one empty page before deciding to say that there is no next 
page available.


> Make default page providers handle next page when results count is unknown
> --------------------------------------------------------------------------
>
>                 Key: NXP-7367
>                 URL: https://jira.nuxeo.com/browse/NXP-7367
>             Project: Nuxeo Enterprise Platform
>          Issue Type: Improvement
>          Components: Search / Query
>    Affects Versions: 5.4.2
>            Reporter: Anahide Tchertchian
>            Assignee: Anahide Tchertchian
>             Fix For: 5.4.3
>
>
> Sometimes, page providers cannot provide the total number of results for a 
> given query (or won't, for performance reasons).
> Default page providers should handle this case gracefully, providing a "next 
> page" link even if results count is unknown, and stopping after a number of 
> "tries" without getting any result.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
ECM-tickets mailing list
ECM-tickets@lists.nuxeo.com
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets

Reply via email to