Author: maksimkaszynski
Date: 2007-09-03 09:15:35 -0400 (Mon, 03 Sep 2007)
New Revision: 2708
Added:
trunk/framework/impl/src/main/java/org/richfaces/component/util/ColumnUtil.java
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/MultiColumnSortListener.java
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/SingleColumnSortListener.java
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
Log:
moved to a different package
Copied: trunk/framework/impl/src/main/java/org/richfaces/component/util/ColumnUtil.java
(from rev 2699, trunk/ui/dataTable/src/main/java/org/richfaces/util/ColumnUtil.java)
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/component/util/ColumnUtil.java
(rev 0)
+++
trunk/framework/impl/src/main/java/org/richfaces/component/util/ColumnUtil.java 2007-09-03
13:15:35 UTC (rev 2708)
@@ -0,0 +1,65 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.util;
+
+import javax.faces.component.UIComponent;
+import javax.faces.el.ValueBinding;
+
+import org.richfaces.component.Column;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class ColumnUtil {
+
+ /**
+ * Extract sort expression from the column
+ *
+ * @param column
+ * @return logical representation of sort field assigned to column component given
+ * In case of EL-expression, an expression string is returned instead of value - so that
EL-expression can be evaluated later;
+ * If there's literal value of dedicated attribute is specified, return it;
+ * If attribute is not set, fall aback to component id
+ */
+
+ public static String getColumnSorting(Column column) {
+
+ UIComponent component = (UIComponent) column;
+
+ ValueBinding binding = component.getValueBinding("sortExpression");
+
+ if (binding != null) {
+ return binding.getExpressionString();
+ }
+
+ String sorting = column.getSortExpression();
+
+ if (sorting != null) {
+ return sorting;
+ }
+
+
+ return component.getId();
+ }
+
+}
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml 2007-09-03
13:10:57 UTC (rev 2707)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml 2007-09-03
13:15:35 UTC (rev 2708)
@@ -7,39 +7,27 @@
<h:form>
+ <rich:messages/>
<rich:spacer height="30" />
- <rich:scrollableDataTable rowKeyVar="rkv" frozenColCount="1"
height="400px"
- width="700px" id="carList" rows="40"
columnClasses="col"
- value="#{dataTableScrollerBean.allCars}" var="category"
sortMode="single">
+
+ <rich:scrollableDataTable id="id_Table" height="500px"
width="500px"
+ rows="5" value="#{dataTableScrollerBean.allCars}"
var="row">
- <rich:column id="make">
- <f:facet name="header"><h:outputText
styleClass="headerText" value="Make" /></f:facet>
- <h:outputText value="#{category.make}" />
- </rich:column>
- <rich:column id="model">
- <f:facet name="header"><h:outputText
styleClass="headerText" value="Model" /></f:facet>
- <h:outputText value="#{category.model}" />
- </rich:column>
- <rich:column id="price">
- <f:facet name="header"><h:outputText
styleClass="headerText" value="Price" /></f:facet>
- <h:outputText value="#{category.price}" />
- </rich:column>
- <rich:column id="mileage">
- <f:facet name="header"><h:outputText
styleClass="headerText" value="Mileage" /></f:facet>
- <h:outputText value="#{category.mileage}" />
- </rich:column>
- <rich:column width="200px" id="vin">
- <f:facet name="header"><h:outputText
styleClass="headerText" value="VIN" /></f:facet>
- <h:outputText value="#{category.vin}" />
- </rich:column>
- <rich:column id="stock">
- <f:facet name="header"><h:outputText
styleClass="headerText" value="Stock" /></f:facet>
- <h:outputText value="#{category.stock}" />
- </rich:column>
+ <rich:column id="id_Id">
+ <f:facet name="header">
+ <h:outputText value="ID" />
+ </f:facet>
+ <h:outputText value="#{row.make}" />
+ </rich:column>
+ <rich:column id="id_name">
+ <f:facet name="header">
+ <h:outputText value="Name" />
+ </f:facet>
+ <h:outputText value="#{row.model}" />
+ </rich:column>
+ </rich:scrollableDataTable>
+ </h:form>
- </rich:scrollableDataTable>
- </h:form>
-
</ui:composition>
\ No newline at end of file
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/MultiColumnSortListener.java
===================================================================
---
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/MultiColumnSortListener.java 2007-09-03
13:10:57 UTC (rev 2707)
+++
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/MultiColumnSortListener.java 2007-09-03
13:15:35 UTC (rev 2708)
@@ -12,9 +12,9 @@
import org.richfaces.component.Column;
import org.richfaces.component.UIScrollableDataTable;
+import org.richfaces.component.util.ColumnUtil;
import org.richfaces.model.SortField;
import org.richfaces.model.SortOrder;
-import org.richfaces.util.ColumnUtil;
/**
* Implementation of sortListener for multi-column sorting
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/SingleColumnSortListener.java
===================================================================
---
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/SingleColumnSortListener.java 2007-09-03
13:10:57 UTC (rev 2707)
+++
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/event/sort/SingleColumnSortListener.java 2007-09-03
13:15:35 UTC (rev 2708)
@@ -7,9 +7,9 @@
import org.richfaces.component.Column;
import org.richfaces.component.UIScrollableDataTable;
+import org.richfaces.component.util.ColumnUtil;
import org.richfaces.model.SortField;
import org.richfaces.model.SortOrder;
-import org.richfaces.util.ColumnUtil;
/**
* @author Maksim Kaszynski
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
===================================================================
---
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2007-09-03
13:10:57 UTC (rev 2707)
+++
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2007-09-03
13:15:35 UTC (rev 2708)
@@ -22,13 +22,13 @@
import org.apache.commons.logging.LogFactory;
import org.richfaces.component.Column;
import org.richfaces.component.UIScrollableDataTable;
+import org.richfaces.component.util.ColumnUtil;
import org.richfaces.event.scroll.ScrollEvent;
import org.richfaces.event.sort.SortEvent;
import org.richfaces.model.SortField;
import org.richfaces.model.SortOrder;
import org.richfaces.renderkit.CompositeRenderer;
import org.richfaces.renderkit.RendererContributor;
-import org.richfaces.util.ColumnUtil;
import org.richfaces.utils.TemplateLoader;