You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2009/04/27 10:11:40 UTC

svn commit: r768890 - in /incubator/click/branches/click-2.0.x: documentation/docs/roadmap-changes.html extras/src/org/apache/click/extras/control/FormTable.java

Author: sabob
Date: Mon Apr 27 08:11:40 2009
New Revision: 768890

URL: http://svn.apache.org/viewvc?rev=768890&view=rev
Log:
backport of FormTable sort fields. CLK-527

Modified:
    incubator/click/branches/click-2.0.x/documentation/docs/roadmap-changes.html
    incubator/click/branches/click-2.0.x/extras/src/org/apache/click/extras/control/FormTable.java

Modified: incubator/click/branches/click-2.0.x/documentation/docs/roadmap-changes.html
URL: http://svn.apache.org/viewvc/incubator/click/branches/click-2.0.x/documentation/docs/roadmap-changes.html?rev=768890&r1=768889&r2=768890&view=diff
==============================================================================
--- incubator/click/branches/click-2.0.x/documentation/docs/roadmap-changes.html (original)
+++ incubator/click/branches/click-2.0.x/documentation/docs/roadmap-changes.html Mon Apr 27 08:11:40 2009
@@ -83,6 +83,13 @@
     </div>
     <ul style="padding: 0em; margin-left:0em;margin-bottom: 2em">
       <li class="change">
+          Added FormTable sort methods <a href="extras-api/org/apache/click/extras/control/FormTable.html#setSortedColumn(java.lang.String)">setSortedColumn</a>,
+          <a href="extras-api/org/apache/click/extras/control/FormTable.html#setSortedAscending(boolean)">setSortedAscending</a>,
+          <a href="extras-api/org/apache/click/extras/control/FormTable.html#setPageNumber(int)">setPageNumber</a>
+          for programmatic sorting. This issue was raised and fixed by Ben Warner
+          [<a target='_blank' href="https://issues.apache.org/jira/browse/CLK-527">527</a>].
+      </li>
+      <li class="change">
           Improved performance in situations where many controls are added to
           a page by decreasing the buffer size used for including HTML imports.
       </li>

Modified: incubator/click/branches/click-2.0.x/extras/src/org/apache/click/extras/control/FormTable.java
URL: http://svn.apache.org/viewvc/incubator/click/branches/click-2.0.x/extras/src/org/apache/click/extras/control/FormTable.java?rev=768890&r1=768889&r2=768890&view=diff
==============================================================================
--- incubator/click/branches/click-2.0.x/extras/src/org/apache/click/extras/control/FormTable.java (original)
+++ incubator/click/branches/click-2.0.x/extras/src/org/apache/click/extras/control/FormTable.java Mon Apr 27 08:11:40 2009
@@ -375,6 +375,47 @@
         renderSubmittedValues = render;
     }
 
+    /**
+     * @see org.apache.click.control.Table#setSortedColumn(java.lang.String)
+     *
+     * @param value the the name of the sorted column
+     */
+    public void setSortedColumn(String columnName) {
+        Field field = (Field) getForm().getFields().get(COLUMN);
+        if(field != null){
+            field.setValue(columnName);
+        }
+        setSorted(false);
+        super.setSortedColumn(columnName);
+    }
+
+    /**
+     * @see org.apache.click.control.Table#setSortedAscending(boolean)
+     *
+     * @param value the ascending sort order status
+     */
+    public void setSortedAscending(boolean ascending) {
+        Field field = (Field) getForm().getFields().get(ASCENDING);
+        if(field != null){
+            field.setValue(Boolean.toString(ascending));
+        }
+        setSorted(false);
+        super.setSortedAscending(ascending);
+    }
+
+    /**
+     * @see org.apache.click.control.Table#setPageNumber(int)
+     *
+     * @param pageNumber set the currently displayed page number
+     */
+    public void setPageNumber(int pageNumber) {
+        Field field = (Field) getForm().getFields().get(PAGE);
+        if(field != null){
+            field.setValue(Integer.toString(pageNumber));
+        }
+        super.setPageNumber(pageNumber);
+    }
+
     // --------------------------------------------------------- Public Methods
 
     /**