You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2010/02/05 04:54:36 UTC

svn commit: r906801 - in /wicket/trunk/wicket/src/main/java/org/apache/wicket/markup: html/navigation/paging/PagingNavigationLink.java repeater/AbstractPageableView.java

Author: ivaynberg
Date: Fri Feb  5 03:54:35 2010
New Revision: 906801

URL: http://svn.apache.org/viewvc?rev=906801&view=rev
Log:
WICKET-2532 sacrifice some nice-to have error handling in the name of performance - remove extra call to dataprovider.size()

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationLink.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractPageableView.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationLink.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationLink.java?rev=906801&r1=906800&r2=906801&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationLink.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationLink.java Fri Feb  5 03:54:35 2010
@@ -46,8 +46,8 @@
 	 * @param pageable
 	 *            The pageable component for this page link
 	 * @param pageNumber
-	 *            The page number in the PageableListView that this link links to. Negative
-	 *            pageNumbers are relative to the end of the list.
+	 *            The page number in the PageableListView that this link links
+	 *            to. Negative pageNumbers are relative to the end of the list.
 	 */
 	public PagingNavigationLink(final String id, final IPageable pageable, final int pageNumber)
 	{
@@ -73,39 +73,12 @@
 	 */
 	public final int getPageNumber()
 	{
-		return cullPageNumber(pageNumber);
+		return pageNumber;
 	}
 
 	/**
-	 * Allows the link to cull the page number to the valid range before it is retrieved from the
-	 * link
-	 * 
-	 * @param pageNumber
-	 * @return culled page number
-	 */
-	protected int cullPageNumber(int pageNumber)
-	{
-		int idx = pageNumber;
-		if (idx < 0)
-		{
-			idx = pageable.getPageCount() + idx;
-		}
-
-		if (idx > (pageable.getPageCount() - 1))
-		{
-			idx = pageable.getPageCount() - 1;
-		}
-
-		if (idx < 0)
-		{
-			idx = 0;
-		}
-
-		return idx;
-	}
-
-	/**
-	 * @return True if this page is the first page of the containing PageableListView
+	 * @return True if this page is the first page of the containing
+	 *         PageableListView
 	 */
 	public final boolean isFirst()
 	{
@@ -113,7 +86,8 @@
 	}
 
 	/**
-	 * @return True if this page is the last page of the containing PageableListView
+	 * @return True if this page is the last page of the containing
+	 *         PageableListView
 	 */
 	public final boolean isLast()
 	{
@@ -121,7 +95,8 @@
 	}
 
 	/**
-	 * Returns true if this PageableListView navigation link links to the given page.
+	 * Returns true if this PageableListView navigation link links to the given
+	 * page.
 	 * 
 	 * @param page
 	 *            The page

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractPageableView.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractPageableView.java?rev=906801&r1=906800&r2=906801&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractPageableView.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractPageableView.java Fri Feb  5 03:54:35 2010
@@ -263,15 +263,6 @@
 	 */
 	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());
-		}
-
 		if (currentPage != page)
 		{
 			if (isVersioned())