Author: hlship
Date: Fri Feb  9 11:10:49 2007
New Revision: 505428

URL: http://svn.apache.org/viewvc?view=rev&rev=505428
Log:
Change the GridPager to "latch" the immediate page range around the upper and 
lower bounds of the available pages (this ensures that there are always at 
least 2 * range + 1 pages to select, even when on the first or last page of the 
set).

Modified:
    
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridPager.java
    
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java

Modified: 
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridPager.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridPager.java?view=diff&rev=505428&r1=505427&r2=505428
==============================================================================
--- 
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridPager.java
 (original)
+++ 
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridPager.java
 Fri Feb  9 11:10:49 2007
@@ -65,7 +65,24 @@
         for (int i = 1; i <= 2; i++)
             writePageLink(writer, i);
 
-        for (int i = _currentPage - _range; i <= _currentPage + _range; i++)
+        int low = _currentPage - _range;
+        int high = _currentPage + _range;
+        
+        if (low < 1)
+        {
+            low = 1;
+            high = 2 * _range + 1;
+        }
+        else
+        {
+            if (high > _maxPages)
+            {
+                high = _maxPages;
+                low = high - 2 * _range;
+            }
+        }
+        
+        for (int i = low; i <= high; i++)
             writePageLink(writer, i);
 
         for (int i = _maxPages - 1; i <= _maxPages; i++)

Modified: 
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?view=diff&rev=505428&r1=505427&r2=505428
==============================================================================
--- 
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
 (original)
+++ 
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
 Fri Feb  9 11:10:49 2007
@@ -816,6 +816,10 @@
                 "Soundtrack",
                 "30",
                 "****");
+
+        clickAndWait("link=69");
+
+        assertText("//tr[22]/td[1]", "radioioAmbient");
     }
 
     @Test


Reply via email to