Author: maksimkaszynski
Date: 2008-03-24 12:35:06 -0400 (Mon, 24 Mar 2008)
New Revision: 7124
Modified:
trunk/framework/impl/src/main/java/org/richfaces/component/util/ColumnUtil.java
Log:
http://jira.jboss.com/jira/browse/RF-2293
Modified: trunk/framework/impl/src/main/java/org/richfaces/component/util/ColumnUtil.java
===================================================================
---
trunk/framework/impl/src/main/java/org/richfaces/component/util/ColumnUtil.java 2008-03-24
16:35:01 UTC (rev 7123)
+++
trunk/framework/impl/src/main/java/org/richfaces/component/util/ColumnUtil.java 2008-03-24
16:35:06 UTC (rev 7124)
@@ -21,8 +21,8 @@
package org.richfaces.component.util;
+import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
-import javax.faces.el.ValueBinding;
import org.richfaces.component.Column;
@@ -42,24 +42,35 @@
* If attribute is not set, fall aback to component id
*/
- public static String getColumnSorting(Column column) {
+ public static String getColumnSorting(UIComponent column) {
UIComponent component = (UIComponent) column;
- ValueBinding binding = component.getValueBinding("sortExpression");
+ ValueExpression binding = component.getValueExpression("sortExpression");
if (binding != null) {
return binding.getExpressionString();
}
- String sorting = column.getSortExpression();
-
- if (sorting != null) {
- return sorting;
+ if (component instanceof Column) {
+ Column col = (Column) component;
+ String sorting = col.getSortExpression();
+
+ if (sorting != null) {
+ return sorting;
+ }
}
return component.getId();
}
+
+ public static boolean isSortable(UIComponent component) {
+ if (component instanceof Column) {
+ return ((Column) component).isSortable();
+ }
+ return
Boolean.valueOf(String.valueOf(component.getAttributes().get("sortable")));
+ }
+
}