You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Cristiano Kliemann (JIRA)" <ji...@apache.org> on 2007/12/10 04:40:43 UTC

[jira] Created: (WICKET-1216) IDataProvider.size being called after DataView.setItemsPerPage

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


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" clause 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.


[jira] Issue Comment Edited: (WICKET-1216) IDataProvider.size being called after DataView.setItemsPerPage

Posted by "Cristiano Kliemann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550750 ] 

cristianok edited comment on WICKET-1216 at 12/11/07 3:52 PM:
----------------------------------------------------------------------

Sorry, I was looking at rc1 code. Next time I will check trunk first.

Actually, the short circuit was implemented on 04/Nov/2007, rev 591860 (pos-rc1).

      was (Author: cristianok):
    Sorry, I was looking at rc1 code. Next time I will check trunk first.

Actually, the short circuit was implemented on 04/Nov/2007, rev 591860 (pre-rc1).
  
> 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.


[jira] Commented: (WICKET-1216) IDataProvider.size being called after DataView.setItemsPerPage

Posted by "Cristiano Kliemann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550750 ] 

Cristiano Kliemann commented on WICKET-1216:
--------------------------------------------

Sorry, I was looking at rc1 code. Next time I will check trunk first.

Actually, the short circuit was implemented on 04/Nov/2007, rev 591860 (pre-rc1).

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


[jira] Issue Comment Edited: (WICKET-1216) IDataProvider.size being called after DataView.setItemsPerPage

Posted by "Cristiano Kliemann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550750 ] 

cristianok edited comment on WICKET-1216 at 12/11/07 3:53 PM:
----------------------------------------------------------------------

Sorry, I was looking at rc1 code. Next time I will check trunk first.

Actually, the short circuit was implemented on 04/Nov/2007, rev 591860 (after rc1).

      was (Author: cristianok):
    Sorry, I was looking at rc1 code. Next time I will check trunk first.

Actually, the short circuit was implemented on 04/Nov/2007, rev 591860 (pos-rc1).
  
> 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.


[jira] Resolved: (WICKET-1216) IDataProvider.size being called after DataView.setItemsPerPage

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ 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.


[jira] Assigned: (WICKET-1216) IDataProvider.size being called after DataView.setItemsPerPage

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-1216:
-------------------------------------

    Assignee: Igor Vaynberg

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


[jira] Updated: (WICKET-1216) IDataProvider.size being called after DataView.setItemsPerPage

Posted by "Cristiano Kliemann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cristiano Kliemann updated WICKET-1216:
---------------------------------------

       Priority: Minor  (was: Major)
    Description: 
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.

  was:
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" clause 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.


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