[richfaces-svn-commits] JBoss Rich Faces SVN: r2379 - in trunk: samples/richfaces-demo/src/main/webapp/richfaces and 3 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Tue Aug 21 12:25:48 EDT 2007
Author: maksimkaszynski
Date: 2007-08-21 12:25:48 -0400 (Tue, 21 Aug 2007)
New Revision: 2379
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTableScroller/examples/scrollableDataTable.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/usage.xhtml
Modified:
trunk/framework/impl/src/main/java/org/richfaces/model/impl/PropertyResolverComparator.java
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/iconimages/ScrollableDataTableIconBasic.java
Log:
added scrollableTableDemo
Modified: trunk/framework/impl/src/main/java/org/richfaces/model/impl/PropertyResolverComparator.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/model/impl/PropertyResolverComparator.java 2007-08-21 13:39:36 UTC (rev 2378)
+++ trunk/framework/impl/src/main/java/org/richfaces/model/impl/PropertyResolverComparator.java 2007-08-21 16:25:48 UTC (rev 2379)
@@ -28,7 +28,9 @@
*
*/
public class PropertyResolverComparator implements Comparator {
-
+
+ private static SortField [] EMPTY = {};
+
private PropertyResolver resolver;
private SortOrder sortOrder;
@@ -40,48 +42,38 @@
this.sortOrder = sortOrder;
}
- public int compare(Object arg0, Object arg1) {
+ public int compare(Object o1, Object o2) {
int result = 0;
- /*Object prop1 = null;
- SortField [ sortOrder.getFields();
- while (result == 0 && )
+ SortField [] fields = sortOrder == null ? EMPTY : sortOrder.getFields();
- try {
- prop1 = resolver.getValue(arg0, sortOrder.getSortColumn());
- } catch (EvaluationException e) {
- //prop1 remains null
- }
-
- Object prop2 = null;
-
- try {
- prop2 = resolver.getValue(arg1, sortOrder.getSortColumn());
- } catch (EvaluationException e) {
- //prop1 remains null
- }
-
- if (prop1 == null) {
- if (prop2 == null) {
- result = 0;
- } else {
- result = -1;
- }
- } else {
- if (prop2 == null) {
- result = 1;
- } else {
- if (prop1 instanceof Comparable && prop2 instanceof Comparable) {
- result = ((Comparable) prop1).compareTo(prop2);
- } else {
- result = prop1.toString().compareTo(prop2.toString());
+ for(int i = 0; i < fields.length && result == 0; i++) {
+ SortField field = fields[i];
+ String name = field.getName();
+ Boolean asc = field.getAscending();
+
+ if (name != null && asc != null) {
+ Object property1 = null;
+ Object property2 = null;
+
+ property1 = resolver.getValue(o1, name);
+
+ property2 = resolver.getValue(o2, name);
+
+ if (property1 instanceof Comparable && property2 instanceof Comparable) {
+ result = ((Comparable) property1).compareTo(property2);
}
+ if (!asc.booleanValue()) {
+ result = -result;
+ }
+
+
}
+
}
- if (!sortOrder.isAscending()) {
- result = -result;
- }*/
+
+
return result;
}
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTableScroller/examples/scrollableDataTable.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTableScroller/examples/scrollableDataTable.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/dataTableScroller/examples/scrollableDataTable.xhtml 2007-08-21 16:25:48 UTC (rev 2379)
@@ -0,0 +1,58 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <style>
+ </style>
+
+ <h:form>
+ <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="multi">
+
+ <rich:column id="make" sortable="true">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Make" />
+ </f:facet>
+ <h:outputText value="#{category.make}" />
+ </rich:column>
+ <rich:column id="model" sortable="true">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Model" />
+ </f:facet>
+ <h:outputText value="#{category.model}" />
+ </rich:column>
+ <rich:column id="price" sortable="true">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Price" />
+ </f:facet>
+ <h:outputText value="#{category.price}" />
+ </rich:column>
+ <rich:column id="mileage" sortable="true">
+ <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" sortable="true">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="VIN" />
+ </f:facet>
+ <h:outputText value="#{category.vin}" />
+ </rich:column>
+ <rich:column id="stock" sortable="true">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Stock" />
+ </f:facet>
+ <h:outputText value="#{category.stock}" />
+ </rich:column>
+
+
+
+ </rich:scrollableDataTable>
+ </h:form>
+
+</ui:composition>
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/usage.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/usage.xhtml 2007-08-21 16:25:48 UTC (rev 2379)
@@ -0,0 +1,23 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+<ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+
+
+ <p>Scrollable Data Table</p>
+
+ <div class="sample-container">
+ <ui:include src="/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml"/>
+ <ui:param name="openlabel" value="View Page Source" />
+ </ui:include>
+ </div>
+ </ui:define>
+</ui:composition>
+</html>
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable.xhtml 2007-08-21 16:25:48 UTC (rev 2379)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:rich="http://richfaces.org/rich">
+<ui:composition template="/templates/main.xhtml">
+ <ui:define name="title">RichFaces - Open Source Rich JSF Components - Scrollable Data Table</ui:define>
+ <ui:define name="body">
+ <rich:tabPanel switchType="server" value="#{componentNavigator.activeTab}" styleClass="top_tab" contentClass="content_tab" headerClass="header_tabs_class" inactiveTabClass="inactive_tab" activeTabClass="active_tab">
+ <rich:tab label="Usage">
+ <ui:include src="/richfaces/scrollableDataTable/usage.xhtml"/>
+ </rich:tab>
+ </rich:tabPanel>
+ </ui:define>
+</ui:composition>
+</html>
Modified: trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/iconimages/ScrollableDataTableIconBasic.java
===================================================================
--- trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/iconimages/ScrollableDataTableIconBasic.java 2007-08-21 13:39:36 UTC (rev 2378)
+++ trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/iconimages/ScrollableDataTableIconBasic.java 2007-08-21 16:25:48 UTC (rev 2379)
@@ -16,20 +16,21 @@
public abstract class ScrollableDataTableIconBasic extends Java2Dresource {
- static final Dimension dimension = new Dimension(16, 16);
-
public ScrollableDataTableIconBasic() {
setRenderer(new GifRenderer());
setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
}
public Dimension getDimensions(FacesContext facesContext, Object data) {
- return dimension;
+ return calculateDimensions();
}
protected Dimension getDimensions(ResourceContext resourceContext) {
- return dimension;
+ return calculateDimensions();
}
+ public abstract Dimension calculateDimensions();
+
+
protected Object getDataToStore(FacesContext context, Object data) {
Skin skin = SkinFactory.getInstance().getSkin(context);
Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
More information about the richfaces-svn-commits
mailing list