You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/03/18 19:55:31 UTC

svn commit: r638505 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry/corelib/components/ test/app1/ test/java/org/apache/tapestry/integration/ test/java/org/apache/tapestry/integration/app1/pages/

Author: hlship
Date: Tue Mar 18 11:55:26 2008
New Revision: 638505

URL: http://svn.apache.org/viewvc?rev=638505&view=rev
Log:
TAPESTRY-2263: Add a reset() method to the Grid component to reset paging and sorting to initial defaults

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Grid.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/GridDemo.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/GridDemo.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Grid.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Grid.java?rev=638505&r1=638504&r2=638505&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Grid.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Grid.java Tue Mar 18 11:55:26 2008
@@ -453,4 +453,15 @@
     {
         _row = row;
     }
+
+
+    /**
+     * Resets the Grid to inital settings; this sets the current page to one, and {@linkplain
+     * org.apache.tapestry.grid.GridSortModel#clear() clears the sort model}.
+     */
+    public void reset()
+    {
+        _currentPage = 1;
+        _sortModel.clear();
+    }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/GridDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/GridDemo.tml?rev=638505&r1=638504&r2=638505&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/GridDemo.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/GridDemo.tml Tue Mar 18 11:55:26 2008
@@ -11,4 +11,8 @@
         </t:parameter>
     </table>
 
+    <p>
+        [<t:actionlink t:id="reset">reset the Grid</t:actionlink>]
+    </p>
+
 </html>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?rev=638505&r1=638504&r2=638505&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Tue Mar 18 11:55:26 2008
@@ -658,6 +658,12 @@
 
         assertAttribute("//img[@id='title:sort']/@src", "assets/tapestry/corelib/components/sort-desc.png");
         assertAttribute("//img[@id='title:sort']/@alt", "[Desc]");
+
+        clickAndWait("link=reset the Grid");
+
+        // Back to where we started.
+
+        assertTextSeries("//tr[1]/td[%d]", 1, "Bug Juice", "Late Lounge (2 of 2)", "45 Dip", "Electronica", "4", "-");
     }
 
     @Test
@@ -1864,7 +1870,9 @@
                 "Class org.apache.tapestry.integration.app1.pages.Datum contains field(s) (_value) that are not private. You should change these fields to private, and add accessor methods if needed.");
     }
 
-    /** TAPESTRY-2244 */
+    /**
+     * TAPESTRY-2244
+     */
     @Test
     public void cached()
     {
@@ -1872,15 +1880,18 @@
 
         assertText("//span[@id='value']", "000");
         assertText("//span[@id='value2size']", "111");
-        
+
         assertText("//span[@class='watch'][1]", "0");
         assertText("//span[@class='watch'][2]", "0");
         assertText("//span[@class='watch'][3]", "1");
     }
-    
-    /** TAPESTRY-2244 */
+
+    /**
+     * TAPESTRY-2244
+     */
     @Test
-    public void override_method_with_cached() {
+    public void override_method_with_cached()
+    {
         start("Cached Annotation2");
         assertText("//span[@id='value']", "111");
     }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/GridDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/GridDemo.java?rev=638505&r1=638504&r2=638505&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/GridDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/GridDemo.java Tue Mar 18 11:55:26 2008
@@ -52,4 +52,8 @@
         _grid.getSortModel().updateSort("rating");
     }
 
+    void onActionFromReset()
+    {
+        _grid.reset();
+    }
 }