You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2011/04/10 21:43:00 UTC

svn commit: r1090876 - /myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java

Author: bommel
Date: Sun Apr 10 19:43:00 2011
New Revision: 1090876

URL: http://svn.apache.org/viewvc?rev=1090876&view=rev
Log:
(TOBAGO-986) Sheet can only sort UIOutput - Nothing happend with UILinkCommand and UIButtonCommand
thanks to Sven Bunge

Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java?rev=1090876&r1=1090875&r2=1090876&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java Sun Apr 10 19:43:00 2011
@@ -82,10 +82,12 @@ public class Sorter extends MethodBindin
 
           UIComponent child = getFirstSortableChild(column.getChildren());
           if (child != null) {
-            ValueBinding valueBinding = child.getValueBinding("value");
-            String var = data.getVar();
+            String attributeName = child instanceof UICommand ? "label":"value";
+            ValueBinding valueBinding = child.getValueBinding(attributeName);
+
 
             if (valueBinding != null) {
+              String var = data.getVar();
               if (isSimpleProperty(valueBinding.getExpressionString())) {
                 String expressionString = valueBinding.getExpressionString();
                 if (expressionString.startsWith("#{")
@@ -206,20 +208,23 @@ public class Sorter extends MethodBindin
 
     for (Iterator iter = children.iterator(); iter.hasNext();) {
       child = (UIComponent) iter.next();
-      if (child instanceof UICommand
-          || child instanceof javax.faces.component.UIPanel) {
-        child = getFirstSortableChild(child.getChildren());
-      }
       if (child instanceof UISelectMany
           || child instanceof UISelectOne
-          || child instanceof UISelectBoolean) {
-        continue;
-      } else if (child instanceof UIInput
-          && TobagoConstants.RENDERER_TYPE_HIDDEN.equals(child.getRendererType())) {
+          || child instanceof UISelectBoolean
+          || child instanceof UICommand
+          || (child instanceof UIInput && TobagoConstants.RENDERER_TYPE_HIDDEN.equals(child.getRendererType()))) {
         continue;
-      } else if (child instanceof UIOutput) {
+      }
+      if (child instanceof UIOutput) {
         break;
       }
+      if (child instanceof javax.faces.component.UICommand
+          || child instanceof javax.faces.component.UIPanel) {
+        child = getFirstSortableChild(child.getChildren());
+        if (child instanceof UIOutput) {
+          break;
+        }
+      }
     }
     return child;
   }