Author: ilya_shaikovsky
Date: 2008-03-11 13:27:47 -0400 (Tue, 11 Mar 2008)
New Revision: 6716
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/Facet.java
trunk/samples/richfaces-demo/src/main/webapp/richfaces/columns/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/columns/examples/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/columns/examples/example.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/columns/usage.xhtml
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java
Log:
Columns example
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java 2008-03-11
17:24:13 UTC (rev 6715)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java 2008-03-11
17:27:47 UTC (rev 6716)
@@ -25,12 +25,17 @@
private UIScrollableDataTable table;
- private ArrayList<DemoInventoryItem> selectedCars = new
ArrayList<DemoInventoryItem>();
+ private ArrayList<DemoInventoryItem> selectedCars = new
ArrayList<DemoInventoryItem>();
+ private ArrayList<Facet> columns = new ArrayList<Facet>();
private static int DECIMALS = 1;
private static int ROUNDING_MODE = BigDecimal.ROUND_HALF_UP;
private static List <DemoInventoryItem> allCars = null;
+ public DataTableScrollerBean() {
+ initColumnsHeaders();
+ }
+
public List <DemoInventoryItem> getAllCars() {
synchronized (this) {
if (allCars == null) {
@@ -77,7 +82,6 @@
}
}
}
-
return allCars;
}
@@ -193,4 +197,47 @@
public void setTable(UIScrollableDataTable table) {
this.table = table;
}
+
+ public void initColumnsHeaders(){
+ columns.clear();
+ String header;
+ String footer="";
+ header = "Chevrolet Corvette";
+ Facet facet = new Facet(header ,footer);
+ columns.add(facet);
+ header = "Ford Explorer";
+ facet = new Facet(header ,footer);
+ columns.add(facet);
+ header = "Nissan Maxima";
+ facet = new Facet(header ,footer);
+ columns.add(facet);
+ header = "Toyota Camry";
+ facet = new Facet(header ,footer);
+ columns.add(facet);
+ header = "GMC Yukon";
+ facet = new Facet(header ,footer);
+ columns.add(facet);
+ header = "Infiniti G35";
+ facet = new Facet(header ,footer);
+ columns.add(facet);
+ }
+
+ public ArrayList<DemoInventoryItem[]> getModel() {
+
+ ArrayList model = new ArrayList();
+ model.add(createCar("Chevrolet","Corvette", 10).toArray());
+ model.add(createCar("Ford","Explorer", 10).toArray());
+ model.add(createCar("Nissan","Maxima", 10).toArray());
+ model.add(createCar("Toyota","Camry", 10).toArray());
+ model.add(createCar("GMC","Yukon", 10).toArray());
+ model.add(createCar("Infiniti","G35", 10).toArray());
+
+ return model;
+ //TODO Columns rendered wrong for such model
+ }
+
+ public ArrayList<Facet> getColumns() {
+ return columns;
+ }
+
}
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/Facet.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/Facet.java
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/Facet.java 2008-03-11
17:27:47 UTC (rev 6716)
@@ -0,0 +1,53 @@
+/*
+ * Facet.java Date created: 10.12.2007
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.datatablescroller;
+
+/**
+ * TODO Class description goes here.
+ * @author "Andrey Markavtsov"
+ *
+ */
+public class Facet {
+ private String header;
+ private String footer;
+
+ /**
+ * TODO Description goes here.
+ * @param header
+ * @param footer
+ */
+ public Facet(String header, String footer) {
+ super();
+ this.header = header;
+ this.footer = footer;
+ }
+ /**
+ * @return the header
+ */
+ public String getHeader() {
+ return header;
+ }
+ /**
+ * @param header the header to set
+ */
+ public void setHeader(String header) {
+ this.header = header;
+ }
+ /**
+ * @return the footer
+ */
+ public String getFooter() {
+ return footer;
+ }
+ /**
+ * @param footer the footer to set
+ */
+ public void setFooter(String footer) {
+ this.footer = footer;
+ }
+
+}
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/columns/examples/example.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/columns/examples/example.xhtml
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/columns/examples/example.xhtml 2008-03-11
17:27:47 UTC (rev 6716)
@@ -0,0 +1,19 @@
+<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">
+
+ <h:form>
+ <rich:dataTable value="#{dataTableScrollerBean.model}"
var="model">
+ <rich:columns value="#{dataTableScrollerBean.columns}"
var="columns" index="ind">
+ <f:facet name="header">
+ <h:outputText value="#{columns.header}"/>
+ </f:facet>
+ <h:outputText value="#{model[ind].model}"/>
+ </rich:columns>
+ </rich:dataTable>
+ </h:form>
+
+</ui:composition>
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/columns/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/columns/usage.xhtml
(rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/columns/usage.xhtml 2008-03-11
17:27:47 UTC (rev 6716)
@@ -0,0 +1,26 @@
+<!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>
+ SHORT DESCRIPTION
+ </p>
+ <div class="sample-container" >
+ <ui:include src="/richfaces/columns/examples/example.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath"
value="/richfaces/columns/examples/example.xhtml"/>
+ </ui:include>
+ </div>
+ <p>
+ DESCRIPTION
+ </p>
+ </ui:define>
+
+ </ui:composition>
+</html>