[ 
https://issues.apache.org/jira/browse/WICKET-1216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Igor Vaynberg resolved WICKET-1216.
-----------------------------------

    Resolution: Invalid

not sure what version of wicket's code you are looking at, but this is already 
implemented and i believe has been implemented for quiet some time.

here is what the code looks like currently in trunk:

        public final void setCurrentPage(int page)
        {
                // If page == 0, short-circuit the range check. This saves a 
call to
                // getPageCount(), but more importantly avoids it being called 
until
                // your AbstractPageableView is actually rendered.
                if (page != 0 && (page < 0 || (page >= getPageCount() && 
getPageCount() > 0)))
                {
                        throw new IndexOutOfBoundsException("argument [page]=" 
+ page + ", must be 0<=page<" +
                                getPageCount());
                }

so as you can see we already short circuit when page == 0

> IDataProvider.size being called after DataView.setItemsPerPage
> --------------------------------------------------------------
>
>                 Key: WICKET-1216
>                 URL: https://issues.apache.org/jira/browse/WICKET-1216
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-rc1
>            Reporter: Cristiano Kliemann
>            Assignee: Igor Vaynberg
>            Priority: Minor
>
> DataView.setItemsPerPage shouldn't call IDataProvider.size(). It happens 
> because it indirectly resets the current page back to zero, calling 
> AbstractPageableView.setCurrentPage, which checks the page count.
> Perhaps changing the "if" statement of AbstractPageableView.setCurrentPage 
> from:
> if (page < 0 || (page >= getPageCount() && getPageCount() > 0))
> to:
> if (page < 0 || (page > 0 && page >= getPageCount() && getPageCount() > 0))
> I think it shouldn't check the page count if the page being set is 0.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to