click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r978876 - in /click/trunk/click: extras/src/org/apache/click/extras/control/FormTable.java framework/src/org/apache/click/control/Table.java
Date Sat, 24 Jul 2010 13:49:28 GMT
Author: sabob
Date: Sat Jul 24 13:49:28 2010
New Revision: 978876

URL: http://svn.apache.org/viewvc?rev=978876&view=rev
Log:
without stateful pages we can revert CLK-685

Modified:
    click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java
    click/trunk/click/framework/src/org/apache/click/control/Table.java

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java?rev=978876&r1=978875&r2=978876&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java Sat Jul 24
13:49:28 2010
@@ -33,6 +33,7 @@ import org.apache.click.util.HtmlStringB
 import org.apache.click.control.ActionLink;
 import org.apache.click.dataprovider.PagingDataProvider;
 import org.apache.commons.lang.StringUtils;
+import org.springframework.util.NumberUtils;
 
 /**
  * Provides a FormTable data grid control.
@@ -473,26 +474,16 @@ public class FormTable extends Table {
      */
     @Override
     public boolean onProcess() {
-        ActionLink controlLink = getControlLink();
+        ActionLink localControlLink = getControlLink();
 
         boolean continueProcessing = super.onProcess();
 
-        if (controlLink.isClicked()) {
-            Context context = getContext();
-            getForm().getField(PAGE).setValue(context.getRequestParameter(PAGE));
-
-            getForm().getField(COLUMN).setValue(context.getRequestParameter(COLUMN));
-
-            String ascending = context.getRequestParameter(ASCENDING);
-            getForm().getField(ASCENDING).setValue(ascending);
-
-            // Table.onProcess() flips the sort order, so to ensure the ASCENDING
-            // Field value is in sync with the Table, we flip the field value as
-            // well.
-            String sort = context.getRequestParameter(SORT);
-            if ("true".equals(sort) || ascending == null) {
-                getForm().getField(ASCENDING).setValue("true".equals(ascending) ? "false"
: "true");
-            }
+        if (localControlLink.isClicked()) {
+            getForm().getField(PAGE).setValue(Integer.toString(getPageNumber()));
+
+            getForm().getField(COLUMN).setValue(getSortedColumn());
+
+            getForm().getField(ASCENDING).setValue(Boolean.toString(isSortedAscending()));
 
         } else {
 

Modified: click/trunk/click/framework/src/org/apache/click/control/Table.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/Table.java?rev=978876&r1=978875&r2=978876&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/Table.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/Table.java Sat Jul 24 13:49:28
2010
@@ -1395,31 +1395,37 @@ public class Table extends AbstractContr
      */
     @Override
     public boolean onProcess() {
-        ActionLink controlLink = getControlLink();
+        ActionLink localControlLink = getControlLink();
 
-        controlLink.onProcess();
+        // Ensure parameters are defined to cater for Ajax requests that uses
+        // strict parameter binding
+        localControlLink.defineParameter(PAGE);
+        localControlLink.defineParameter(COLUMN);
+        localControlLink.defineParameter(ASCENDING);
+        localControlLink.defineParameter(SORT);
 
-        if (controlLink.isClicked()) {
-            Context context = getContext();
-            String page = context.getRequestParameter(PAGE);
+        localControlLink.onProcess();
+
+        if (localControlLink.isClicked()) {
+            String page = localControlLink.getParameter(PAGE);
             if (NumberUtils.isNumber(page)) {
                 setPageNumber(Integer.parseInt(page));
             } else {
                 setPageNumber(0);
             }
 
-            String column = context.getRequestParameter(COLUMN);
+            String column = localControlLink.getParameter(COLUMN);
             if (column != null) {
                 setSortedColumn(column);
             }
 
-            String ascending = context.getRequestParameter(ASCENDING);
+            String ascending = localControlLink.getParameter(ASCENDING);
             if (ascending != null) {
                 setSortedAscending("true".equals(ascending));
             }
 
             // Flip sorting order
-            if ("true".equals(context.getRequestParameter(SORT))) {
+            if ("true".equals(localControlLink.getParameter(SORT))) {
                 setSortedAscending(!isSortedAscending());
             }
         }



Mime
View raw message