[richfaces-svn-commits] JBoss Rich Faces SVN: r15842 - in root/ui-sandbox/trunk/components/tables/ui/src/main: java/org/richfaces/component/html and 3 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu Nov 5 12:00:49 EST 2009


Author: abelevich
Date: 2009-11-05 12:00:48 -0500 (Thu, 05 Nov 2009)
New Revision: 15842

Added:
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlDataTable.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/datatable.js
Removed:
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISimpleDataTable.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlSimpleDataTable.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SimpleDataTableRenderer.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/simple-datatable.js
Modified:
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/DataIterator.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/FixedChildrenIterator.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlColumnGroup.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ElementEncodeListener.java
   root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/faces-config.xml
   root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/table.css
   root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/tables.taglib.xml
Log:
rename simpleDataTable -> dataTable

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/DataIterator.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/DataIterator.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/DataIterator.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -32,7 +32,7 @@
 	private Iterator<UIComponent> childrenIterator;
 	
 
-	public DataIterator(UIDataTable dataTable) {
+	public DataIterator(UIDataTableBase dataTable) {
 		this.childrenIterator = dataTable.getChildren().iterator();
 		this.facetsIterator = dataTable.getFacets().values().iterator();
 	}

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/FixedChildrenIterator.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/FixedChildrenIterator.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/FixedChildrenIterator.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -29,7 +29,7 @@
 	
 	private Iterator<UIComponent> currentColumnIterator;
 	
-	public FixedChildrenIterator(UIDataTable dataTable) {
+	public FixedChildrenIterator(UIDataTableBase dataTable) {
 		super(dataTable);
 	}
 	

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -28,7 +28,7 @@
  */
 public class SubtableFixedChildrenIterator extends FixedChildrenIterator {
 
-	public SubtableFixedChildrenIterator(UIDataTable dataTable) {
+	public SubtableFixedChildrenIterator(UIDataTableBase dataTable) {
 		super(dataTable);
 	}
 

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -1,41 +1,21 @@
 package org.richfaces.component;
 
-import java.util.Iterator;
+/**
+ * @author Anton Belevich
+ *
+ */
 
-import javax.faces.component.UIComponent;
-
-public abstract class UIDataTable extends UISequence implements Row {
-
-	public Iterator<UIComponent> columns() {
-		return 	new ColumnsIterator(this);
-	}
+public abstract class UIDataTable extends UIDataTableBase {
 	
-	@Override
-	protected Iterator<UIComponent> fixedChildren() {
-		return new FixedChildrenIterator(this);
+	public String getCellSkinClass() {
+		return "rich-table-cell";
 	}
 	
-	@Override
-	protected Iterator<UIComponent> dataChildren() {
-	
-		return new DataIterator(this);
+	public String getRowSkinClass() {
+		return "rich-table-row";
 	}
 	
-	public UIComponent getHeader() {
-        return getFacet("header");
-    }
-	
-	public UIComponent getFooter() {
-        return getFacet("footer");
-    }
-	
-	public UIComponent getCaption() {
-		return getFacet("caption");
+	public String getFirstRowSkinClass() {
+		return "rich-table-firstrow";
 	}
-	
-	@Override
-	public boolean getRendersChildren() {
-		return true;
-	}
-	
-}
+}	
\ No newline at end of file

Added: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java	                        (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -0,0 +1,41 @@
+package org.richfaces.component;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+
+public abstract class UIDataTableBase extends UISequence implements Row {
+
+	public Iterator<UIComponent> columns() {
+		return 	new ColumnsIterator(this);
+	}
+	
+	@Override
+	protected Iterator<UIComponent> fixedChildren() {
+		return new FixedChildrenIterator(this);
+	}
+	
+	@Override
+	protected Iterator<UIComponent> dataChildren() {
+	
+		return new DataIterator(this);
+	}
+	
+	public UIComponent getHeader() {
+        return getFacet("header");
+    }
+	
+	public UIComponent getFooter() {
+        return getFacet("footer");
+    }
+	
+	public UIComponent getCaption() {
+		return getFacet("caption");
+	}
+	
+	@Override
+	public boolean getRendersChildren() {
+		return true;
+	}
+	
+}

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -1,9 +1,8 @@
 package org.richfaces.component;
 
-
 /**
  * @author Anton Belevich
  *
  */
-public abstract class UIExtendedDataTable extends UISimpleDataTable {
+public abstract class UIExtendedDataTable extends UIDataTable {
 }

Deleted: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISimpleDataTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISimpleDataTable.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISimpleDataTable.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -1,25 +0,0 @@
-package org.richfaces.component;
-
-
-
-
-
-/**
- * @author Anton Belevich
- *
- */
-
-public abstract class UISimpleDataTable extends UIDataTable {
-	
-	public String getCellSkinClass() {
-		return "rich-table-cell";
-	}
-	
-	public String getRowSkinClass() {
-		return "rich-table-row";
-	}
-	
-	public String getFirstRowSkinClass() {
-		return "rich-table-firstrow";
-	}
-}	
\ No newline at end of file

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -33,7 +33,7 @@
  * JSF component class
  *
  */
-public abstract class UISubTable extends UIDataTable implements Row, Column {
+public abstract class UISubTable extends UIDataTableBase implements Row, Column {
 	
 	public static final String COMPONENT_TYPE = "org.richfaces.SubTable";
 	

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlColumnGroup.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlColumnGroup.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlColumnGroup.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -1,7 +1,6 @@
 package org.richfaces.component.html;
 
 import javax.el.MethodExpression;
-import javax.faces.context.FacesContext;
 
 import org.richfaces.component.UIColumnGroup;
 import org.richfaces.model.Ordering;

Added: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlDataTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlDataTable.java	                        (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlDataTable.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -0,0 +1,19 @@
+package org.richfaces.component.html;
+
+import org.richfaces.component.UIDataTable;
+
+public class HtmlDataTable extends UIDataTable {
+	
+    public static final String COMPONENT_TYPE = "org.richfaces.DataTable";
+    
+    public static final String COMPONENT_FAMILY = "org.richfaces.DataTable";
+
+    public HtmlDataTable() {
+		setRendererType("org.richfaces.DataTableRenderer");
+    }
+    
+    @Override
+    public String getFamily() {
+    	return COMPONENT_FAMILY;
+    }
+}

Deleted: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlSimpleDataTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlSimpleDataTable.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlSimpleDataTable.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -1,19 +0,0 @@
-package org.richfaces.component.html;
-
-import org.richfaces.component.UISimpleDataTable;
-
-public class HtmlSimpleDataTable extends UISimpleDataTable {
-	
-    public static final String COMPONENT_TYPE = "org.richfaces.SimpleDataTable";
-    
-    public static final String COMPONENT_FAMILY = "org.richfaces.SimpleDataTable";
-
-    public HtmlSimpleDataTable() {
-		setRendererType("org.richfaces.SimpleDataTableRenderer");
-    }
-    
-    @Override
-    public String getFamily() {
-    	return COMPONENT_FAMILY;
-    }
-}

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -29,7 +29,7 @@
 import org.ajax4jsf.model.DataVisitor;
 import org.ajax4jsf.renderkit.RendererBase;
 import org.richfaces.component.Row;
-import org.richfaces.component.UIDataTable;
+import org.richfaces.component.UIDataTableBase;
 
 /**
  * @author shura
@@ -67,7 +67,7 @@
 	}
 	
 	//TODO remove
-	public void encodeRows(FacesContext facesContext, UIDataTable table) throws IOException {
+	public void encodeRows(FacesContext facesContext, UIDataTableBase table) throws IOException {
 		RowHolder rowHolder =  new RowHolder(table); 
 		encodeRows(facesContext, table, rowHolder);
 	}

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -9,7 +9,7 @@
 
 import org.richfaces.component.Column;
 import org.richfaces.component.Row;
-import org.richfaces.component.UIDataTable;
+import org.richfaces.component.UIDataTableBase;
 
 
 @ResourceDependencies({
@@ -19,7 +19,7 @@
 })
 public abstract class AbstractTableRenderer extends AbstractRowsRenderer {
 
-	public boolean isColumnFacetPresent(UIDataTable table, String facetName) {
+	public boolean isColumnFacetPresent(UIDataTableBase table, String facetName) {
 		Iterator<UIComponent> columns = table.columns();
 		boolean result = false;
 		while(columns.hasNext() && !result) {
@@ -37,7 +37,7 @@
 	 * @return true if specified attribute should generate header on the table
 	 */
 	//TODO nick - rename this method
-	public boolean isHeaderFactoryColumnAttributePresent(UIDataTable table,String attributeName) {
+	public boolean isHeaderFactoryColumnAttributePresent(UIDataTableBase table,String attributeName) {
         Iterator<UIComponent> columns = table.columns();
         boolean result = false;
         while (columns.hasNext() && !result) {
@@ -47,14 +47,14 @@
         return result;
     }
 	
-	protected boolean isEncodeHeaders(UIDataTable table) {
+	protected boolean isEncodeHeaders(UIDataTableBase table) {
 		return	isColumnFacetPresent(table, "header") || 
 				isHeaderFactoryColumnAttributePresent(table, "sortBy") ||
 				isHeaderFactoryColumnAttributePresent(table, "comparator") ||
 				isHeaderFactoryColumnAttributePresent(table, "filterBy");
 	}
 	
-	protected int getColumnsCount(UIDataTable table) {
+	protected int getColumnsCount(UIDataTableBase table) {
 		// check for exact value in component
 		Integer span = (Integer) table.getAttributes().get("columns");
 		int count = (null != span && span.intValue() != Integer.MIN_VALUE) ? span.intValue() : calculateRowColumns(table.columns()); 

Added: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java	                        (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -0,0 +1,489 @@
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.component.Row;
+import org.richfaces.component.UIDataTableBase;
+import org.richfaces.component.UIDataTable;
+
+ at ResourceDependencies({
+    @ResourceDependency(name = "datatable.js"),
+    @ResourceDependency(name = "table.css")
+})
+public class DataTableRenderer extends AbstractTableRenderer implements ElementEncodeListener{
+	
+	
+	protected void encodeTableStructure(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
+		
+		 	Object key = dataTable.getRowKey();
+	        dataTable.captureOrigValue(context);
+	        dataTable.setRowKey(context, null);
+
+	        encodeCaption(writer, context, dataTable);
+
+	        //TODO nick - do we need this element if "columnsWidth" is absent?
+	        //TODO nick - use constants from HTML class for attribute/element names
+	        writer.startElement("colgroup", dataTable);
+	        int columns = getColumnsCount(dataTable);
+
+	        writer.writeAttribute(HTML.SPAN_ELEM, String.valueOf(columns), null);
+	        String columnsWidth = (String) dataTable.getAttributes().get("columnsWidth");
+
+	        if (null != columnsWidth) {
+	            String[] widths = columnsWidth.split(",");
+	            for (int i = 0; i < widths.length; i++) {
+	                writer.startElement("col", dataTable);
+	                writer.writeAttribute("width", widths[i], null);
+	                writer.endElement("col");
+	            }
+	        }
+	        writer.endElement("colgroup");
+
+	        encodeHeader(writer, context, dataTable, columns);
+	        encodeFooter(writer, context, dataTable, columns);
+
+	        dataTable.setRowKey(context, key);
+	        dataTable.restoreOrigValue(context);
+
+	}
+	
+	public void encodeRows(FacesContext context, UIDataTableBase dataTable) throws IOException {
+	
+		RowHolder holder = new RowHolder(dataTable);
+		holder.setCellClass(dataTable.getCellSkinClass());
+		holder.setRowClass(dataTable.getRowSkinClass());
+		holder.setFirstRowClass(dataTable.getFirstRowSkinClass());
+		holder.setHeaderRow(false);
+		
+		encodeRows(context, dataTable, holder);
+	}
+	
+	public void encodeRow(FacesContext context, RowHolder rowHolder) throws IOException {
+		
+		boolean rowStart = true;
+		int processCell = 0;
+		
+		Row row = rowHolder.getRow();
+		int processRow = rowHolder.getCurrentRow();
+		
+		ResponseWriter writer = context.getResponseWriter();
+		
+		Iterator<UIComponent> iterator = row.columns();
+		while(iterator.hasNext()) {
+			
+			UIComponent child = iterator.next();
+			if(child instanceof Row) {
+				
+				Row childRow = (Row)child;
+				RowHolder childRowHolder = new RowHolder(childRow);
+				childRowHolder.setCurrentRow(processRow);
+				childRowHolder.setCellElement(rowHolder.getCellElement());
+		
+				if(rowHolder.isHeaderRow()) {
+					childRowHolder.setRowClass(rowHolder.getRowClass());
+					childRowHolder.setFirstRowClass(rowHolder.getFirstRowClass());
+					childRowHolder.setCellClass(rowHolder.getCellClass());
+				} else {
+					childRowHolder.setRowClass(childRow.getRowSkinClass());
+					childRowHolder.setFirstRowClass(childRow.getFirstRowSkinClass());
+					childRowHolder.setCellClass(childRow.getCellSkinClass());
+				}
+				childRowHolder.setHeaderRow(rowHolder.isHeaderRow());
+				encodeRows(context, childRow, childRowHolder);
+							
+			} else if(child instanceof UIColumn) {
+				
+				if(child instanceof org.richfaces.component.UIColumn) {
+					org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn)child;
+					if(column.isBreakBefore() && processCell !=0) {
+						encodeRowEnd(writer, context, column);
+						rowHolder.nextRow();
+						rowStart = true;
+					}
+				}
+							
+				if(rowStart) {
+
+					if(processRow == 0) {
+						encodeFirstRowStart(writer, context, child, rowHolder);
+					} else {
+						encodeRowStart(writer, context, child, rowHolder);
+					}
+					
+					rowStart = false;
+				}
+				
+				encodeCellStart(writer, context, child, rowHolder);
+				encodeCellEnd(writer, context, child);
+								
+				if(!iterator.hasNext()) {
+					if(processRow == 0) {
+						encodeFirstRowEnd(writer, context, child);
+					} else {
+						encodeRowEnd(writer, context, child);
+					}
+				}
+				processCell++;
+			}
+	
+		}	
+	}
+	
+	@Override
+	protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+		if(!shouldProceed(component)) {
+			return;
+		}
+		UIDataTableBase dataTable = (UIDataTableBase)component;
+		encodeTableStart(writer,context, dataTable);
+		encodeTableStructure(writer, context, dataTable);
+	}
+	
+	@Override
+	protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+		
+		if(!shouldProceed(component)) {
+			return;
+		}
+		
+		UIDataTableBase dataTable = (UIDataTableBase)component;
+		encodeTableBodyStart(writer, context, dataTable);
+		encodeRows(context, dataTable);
+		encodeTableBodyEnd(writer, context, dataTable);
+		
+	}
+	
+	@Override
+	protected void doEncodeEnd(ResponseWriter writer, FacesContext context,	UIComponent component) throws IOException {
+		
+		if(!shouldProceed(component)) {
+			return;
+		}
+		
+		UIDataTableBase dataTable = (UIDataTableBase)component;
+		encodeTableEnd(writer, context, dataTable);
+	}
+	
+	protected boolean shouldProceed(UIComponent component) {
+		return (component instanceof UIDataTableBase);
+	}
+
+	@Override
+	protected Class<? extends UIComponent> getComponentClass() {
+		return UIDataTable.class;
+	}
+
+	public void encodeCellEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+		writer.endElement(HTML.TD_ELEM);
+	}
+
+	public void encodeCellStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder) throws IOException {
+		writer.startElement(HTML.TD_ELEM, component);
+		String cellClass = holder.getCellClass();
+		encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, cellClass);
+		
+		if(component instanceof org.richfaces.component.UIColumn) {
+			org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn)component;
+			
+			int rowspan = column.getRowspan(); 
+			if(rowspan != Integer.MIN_VALUE) {
+				writer.writeAttribute("rowspan", Integer.valueOf(rowspan), null);
+			}
+			
+			int colspan = column.getColspan();
+			if(colspan != Integer.MIN_VALUE) {
+				writer.writeAttribute("colspan", Integer.valueOf(colspan), null);
+			}
+		}
+		renderChildren(context, component);
+	}
+
+	public void encodeFirstRowEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+		writer.endElement(HTML.TR_ELEMENT);
+	}
+
+	public void encodeFirstRowStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder) throws IOException {
+		writer.startElement(HTML.TR_ELEMENT, component);
+		String styleClass = holder.getFirstRowClass() + " " + holder.getRowClass();
+		encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, styleClass);
+	}
+
+	public void encodeRowEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+		writer.endElement(HTML.TR_ELEMENT);
+	}
+
+	public void encodeRowStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder) throws IOException {
+		writer.startElement(HTML.TR_ELEMENT, component);
+		String styleClass = holder.getRowClass();
+		encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, styleClass);
+	}
+
+	public void encodeTableBodyEnd(ResponseWriter writer, FacesContext context, UIDataTableBase component) throws IOException {
+		writer.endElement(HTML.TABLE_ELEMENT);
+	}
+
+	public void encodeTableBodyStart(ResponseWriter writer, FacesContext context, UIDataTableBase component) throws IOException {
+		writer.startElement(HTML.BODY_ELEMENT, component);
+	}
+
+	public void encodeTableEnd(ResponseWriter writer, FacesContext context, UIDataTableBase component) throws IOException {
+		writer.endElement(HTML.BODY_ELEMENT);
+	}
+
+	public void encodeTableStart(ResponseWriter writer, FacesContext context, UIDataTableBase component) throws IOException {
+		writer.startElement(HTML.TABLE_ELEMENT, component);
+		String styleClass = getTableSkinClass();
+		encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, styleClass);
+	}
+
+	public void encodeCaption(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
+		 
+		UIComponent caption = dataTable.getCaption();
+	        
+		if (caption == null) {
+			return;
+		}
+	        
+		if(!caption.isRendered()) {
+			return;
+		}
+	                
+		writer.startElement(HTML.CAPTION_ELEMENT, dataTable);
+
+		String captionClass = (String) dataTable.getAttributes().get("captionClass");
+		String captionSkinClass = getCaptionSkinClass();
+		captionClass = captionClass != null ? captionClass + " " + captionClass : captionSkinClass;
+	        
+		writer.writeAttribute(HTML.CLASS_ATTRIBUTE, captionClass, "captionClass");
+
+		String captionStyle = (String) dataTable.getAttributes().get("captionStyle");
+	       
+		if (captionStyle != null && captionStyle.trim().length()!=0) {
+			writer.writeAttribute(HTML.STYLE_ATTRIBUTE, captionStyle, "captionStyle");
+		}
+
+		renderChild(context, caption);
+		
+		writer.endElement(HTML.CAPTION_ELEMENT);	
+	}
+
+	public void encodeFooter(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable, int columns) throws IOException {
+
+		Iterator<UIComponent> tableColumns = dataTable.columns();
+		
+		UIComponent footer = dataTable.getFooter();
+		
+		boolean columnFacetPresent = isColumnFacetPresent(dataTable, "footer");
+
+		if ((footer != null && footer.isRendered()) || columnFacetPresent) {
+			
+			writer.startElement(HTML.TFOOT_ELEMENT, dataTable);
+			String footerClass = (String) dataTable.getAttributes().get("footerClass");
+			
+			if (columnFacetPresent) {
+				writer.startElement(HTML.TR_ELEMENT, dataTable);
+				
+				encodeStyleClass(writer, context, dataTable, "footerClass", "rich-table-subfooter");
+		                //TODO nick - use "th" instead of "td"?
+		                //TODO nick - rename method "encodeHeaderFacets"
+				encodeHeaderFacets(context, writer, tableColumns, "rich-table-subfootercell", 
+									footerClass, "footer", HTML.TD_ELEM, columns);
+					writer.endElement(HTML.TR_ELEMENT);
+			}
+
+			
+			if (footer != null && footer.isRendered()) {
+                //TODO nick - use "th" instead of "td"?
+                //TODO nick - rename method "encodeTableHeaderFacet"
+				encodeTableHeaderFacet(context, columns, writer, footer, 
+				"rich-table-footer",
+				"rich-table-footer-continue",
+				"rich-table-footercell",
+				footerClass, HTML.TH_ELEM);
+			}
+					
+			writer.endElement(HTML.TFOOT_ELEMENT);
+		}
+	}	
+
+	public void encodeHeader(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable, int columns) throws IOException {
+	
+		UIComponent header = dataTable.getHeader();
+		boolean isEncodeHeaders = isEncodeHeaders(dataTable);
+
+		if ((header != null && header.isRendered()) || isEncodeHeaders) {
+			
+			writer.startElement(HTML.THEAD_ELEMENT, dataTable);
+			writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-table-thead", null);
+			
+			String headerClass = (String) dataTable.getAttributes().get("headerClass");
+			
+			if (header != null && header.isRendered()) {
+	                encodeTableHeaderFacet(context, columns, writer, header,
+	                        "rich-table-header",
+	                        //TODO nick - rename classes!!!
+	                        "rich-table-header-continue",
+	                        "rich-table-headercell",
+	                        headerClass, HTML.TH_ELEM);
+			}
+
+			if (isEncodeHeaders) {
+				writer.startElement(HTML.TR_ELEMENT, dataTable);
+				encodeStyleClass(writer, context, dataTable, "headerClass", "rich-table-subheader");
+				encodeHeaderFacets(context, writer, dataTable.columns(), "rich-table-subheadercell", headerClass, "header", HTML.TH_ELEM, columns);
+				writer.endElement(HTML.TR_ELEMENT);
+			}
+
+			writer.endElement(HTML.THEAD_ELEMENT);
+		}
+	}
+	
+    protected void encodeTableHeaderFacet(FacesContext context, int columns, ResponseWriter writer, UIComponent footer,
+            String skinFirstRowClass, String skinRowClass, String skinCellClass, String footerClass, String element)
+            throws IOException {
+    	
+    	if(footer instanceof Row) {
+    		Row row = (Row)footer;
+            	
+    		RowHolder holder = new RowHolder(row);
+    		holder.setCellElement(element);
+    		holder.setFirstRowClass(skinFirstRowClass);
+    		holder.setRowClass(skinRowClass);
+    		holder.setCellClass(skinCellClass);
+    		holder.resetCurrentRow();
+    		holder.setHeaderRow(true);
+            	
+    		encodeRows(context, row, holder);
+            
+    	} else {
+    		writer.startElement(HTML.TR_ELEMENT, footer);
+            	
+    		String rowClass = skinFirstRowClass;
+    		String cellClass = skinCellClass;
+    		if(footerClass != null && footerClass.trim().length()!=0) {
+    			rowClass = rowClass + " " + footerClass;
+    			cellClass = cellClass + " " + footerClass;
+    		} 
+            	
+    		encodeStyleClass(writer, context, footer, null, rowClass);
+            	
+    		writer.startElement(element, footer);
+            	
+    		encodeStyleClass(writer, context, footer, null, cellClass);
+            	
+    		if(columns > 0) {
+    			writer.writeAttribute("colspan", String.valueOf(columns), null);
+    		}
+    		writer.writeAttribute("scope", "colgroup", null);
+    		
+    		renderChild(context, footer);
+    			
+    		writer.endElement(element);
+    		writer.endElement(HTML.TR_ELEMENT);
+    	}
+    }
+
+    protected void encodeHeaderFacets(FacesContext context, ResponseWriter writer, Iterator<UIComponent> headers,
+            String skinCellClass, String headerClass, String facetName, String element, int colCount) throws IOException {
+            
+    	int tColCount = 0;
+
+    	while (headers.hasNext()) {
+    		UIComponent column = headers.next();
+    		if (!column.isRendered()) {
+    			continue;
+    		}
+
+    		Integer colspan = (Integer) column.getAttributes().get("colspan");
+    		if (colspan != null && colspan.intValue() > 0) {
+    			tColCount += colspan.intValue();
+    		} else {
+    			tColCount++;
+    		}
+
+    		if (tColCount > colCount) {
+    			break;
+    		}
+
+    		String classAttribute = facetName + "Class";
+            
+    		String columnHeaderClass = (String) column.getAttributes().get(classAttribute);
+                
+    		String styleClass = skinCellClass;
+    		if(headerClass != null && headerClass.trim().length() != 0) {
+    			styleClass  = styleClass + " " + headerClass;
+    		}
+                
+    		if(columnHeaderClass != null && columnHeaderClass.trim().length() != 0) {
+    			styleClass = styleClass + " " + columnHeaderClass;
+    		}
+                
+
+    		writer.startElement(element, column);
+                                
+    		encodeStyleClass(writer, context, column, null, styleClass);
+                
+    		writer.writeAttribute("scope", "col", null);
+    		getUtils().encodeAttribute(context, column, "colspan");
+
+    		UIComponent facet = column.getFacet(facetName);
+    		if (facet != null && facet.isRendered()) {
+    			renderChild(context, facet);
+    		}
+
+    		writer.endElement(element);
+    	}
+    }
+	
+
+	protected void  encodeStyleClass(ResponseWriter writer, FacesContext context, UIComponent component , String styleClassAttribute, String styleClass) throws IOException {
+		boolean isEmpty = isEmpty(component, styleClassAttribute); 
+		if( isEmpty && !(styleClass != null && styleClass.trim().length() != 0)) {
+			return;
+		}
+		
+		String componentStyleClass = isEmpty ? styleClass : styleClass + " " + component.getAttributes().get(styleClassAttribute); 
+		writer.writeAttribute(HTML.CLASS_ATTRIBUTE, componentStyleClass, null);
+	}
+		
+	protected boolean isEmpty(UIComponent component, String attribute) {
+		if(attribute == null) {
+			return true;
+		}
+		String value = (String) component.getAttributes().get(attribute);
+		return !(value != null && value.trim().length()!=0);
+	}
+	
+	protected void encodeStyle(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+		String style = (String)component.getAttributes().get(HTML.STYLE_ATTRIBUTE);
+		if(!isEmptyStyle(style)) {
+			writer.writeAttribute(HTML.STYLE_ATTRIBUTE, style, null);
+		}
+	}
+	
+	protected boolean isEmptyStyle(String style) {
+		return !((style != null) && (style.trim().length()!=0)); 
+	}
+	
+	protected String getTableSkinClass() {
+		return "rich-table"; 
+	}
+	
+	protected String getTableHeadSkinClass() {
+		return "rich-table-head";
+	}
+	
+	protected String getCaptionSkinClass() {
+		return "rich-table-caption";
+	}
+
+}

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ElementEncodeListener.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ElementEncodeListener.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ElementEncodeListener.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -6,7 +6,7 @@
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 
-import org.richfaces.component.UIDataTable;
+import org.richfaces.component.UIDataTableBase;
 
 public interface ElementEncodeListener {
 		
@@ -26,18 +26,18 @@
 	
 	public  void encodeFirstRowEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException;
 	
-	public void encodeTableStart(ResponseWriter writer, FacesContext context, UIDataTable dataTable) throws IOException;
+	public void encodeTableStart(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException;
 	
-	public void encodeTableEnd(ResponseWriter writer, FacesContext context, UIDataTable dataTable) throws IOException;
+	public void encodeTableEnd(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException;
 	
-	public void encodeTableBodyStart(ResponseWriter writer, FacesContext context, UIDataTable dataTable) throws IOException;
+	public void encodeTableBodyStart(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException;
 	
-	public void encodeTableBodyEnd(ResponseWriter writer, FacesContext context, UIDataTable dataTable) throws IOException;
+	public void encodeTableBodyEnd(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException;
 	
-	public void encodeCaption(ResponseWriter writer, FacesContext context, UIDataTable dataTable) throws IOException;
+	public void encodeCaption(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException;
 	
-	public void encodeHeader(ResponseWriter writer, FacesContext context, UIDataTable dataTable, int columns) throws IOException;
+	public void encodeHeader(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable, int columns) throws IOException;
 	
-	public void encodeFooter(ResponseWriter writer, FacesContext context, UIDataTable dataTable,  int columns) throws IOException;
+	public void encodeFooter(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable,  int columns) throws IOException;
 
 }

Deleted: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SimpleDataTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SimpleDataTableRenderer.java	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SimpleDataTableRenderer.java	2009-11-05 17:00:48 UTC (rev 15842)
@@ -1,487 +0,0 @@
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.util.Iterator;
-
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIColumn;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.Row;
-import org.richfaces.component.UIDataTable;
-import org.richfaces.component.UISimpleDataTable;
-
- at ResourceDependencies({
-    @ResourceDependency(name = "simple-datatable.js"),
-    @ResourceDependency(name = "simple-table.css")
-})
-public class SimpleDataTableRenderer extends AbstractTableRenderer implements ElementEncodeListener{
-	
-	
-	protected void encodeTableStructure(ResponseWriter writer, FacesContext context, UIDataTable dataTable) throws IOException {
-		
-		 	Object key = dataTable.getRowKey();
-	        dataTable.captureOrigValue(context);
-	        dataTable.setRowKey(context, null);
-
-	        encodeCaption(writer, context, dataTable);
-
-	        //TODO nick - do we need this element if "columnsWidth" is absent?
-	        //TODO nick - use constants from HTML class for attribute/element names
-	        writer.startElement("colgroup", dataTable);
-	        int columns = getColumnsCount(dataTable);
-
-	        writer.writeAttribute(HTML.SPAN_ELEM, String.valueOf(columns), null);
-	        String columnsWidth = (String) dataTable.getAttributes().get("columnsWidth");
-
-	        if (null != columnsWidth) {
-	            String[] widths = columnsWidth.split(",");
-	            for (int i = 0; i < widths.length; i++) {
-	                writer.startElement("col", dataTable);
-	                writer.writeAttribute("width", widths[i], null);
-	                writer.endElement("col");
-	            }
-	        }
-	        writer.endElement("colgroup");
-
-	        encodeHeader(writer, context, dataTable, columns);
-	        encodeFooter(writer, context, dataTable, columns);
-
-	        dataTable.setRowKey(context, key);
-	        dataTable.restoreOrigValue(context);
-
-	}
-	
-	public void encodeRows(FacesContext context, UIDataTable dataTable) throws IOException {
-	
-		RowHolder holder = new RowHolder(dataTable);
-		holder.setCellClass(dataTable.getCellSkinClass());
-		holder.setRowClass(dataTable.getRowSkinClass());
-		holder.setFirstRowClass(dataTable.getFirstRowSkinClass());
-		holder.setHeaderRow(false);
-		
-		encodeRows(context, dataTable, holder);
-	}
-	
-	public void encodeRow(FacesContext context, RowHolder rowHolder) throws IOException {
-		
-		boolean rowStart = true;
-		int processCell = 0;
-		
-		Row row = rowHolder.getRow();
-		int processRow = rowHolder.getCurrentRow();
-		
-		ResponseWriter writer = context.getResponseWriter();
-		
-		Iterator<UIComponent> iterator = row.columns();
-		while(iterator.hasNext()) {
-			
-			UIComponent child = iterator.next();
-			if(child instanceof Row) {
-				
-				Row childRow = (Row)child;
-				RowHolder childRowHolder = new RowHolder(childRow);
-				childRowHolder.setCurrentRow(processRow);
-				childRowHolder.setCellElement(rowHolder.getCellElement());
-		
-				if(rowHolder.isHeaderRow()) {
-					childRowHolder.setRowClass(rowHolder.getRowClass());
-					childRowHolder.setFirstRowClass(rowHolder.getFirstRowClass());
-					childRowHolder.setCellClass(rowHolder.getCellClass());
-				} else {
-					childRowHolder.setRowClass(childRow.getRowSkinClass());
-					childRowHolder.setFirstRowClass(childRow.getFirstRowSkinClass());
-					childRowHolder.setCellClass(childRow.getCellSkinClass());
-				}
-				childRowHolder.setHeaderRow(rowHolder.isHeaderRow());
-				encodeRows(context, childRow, childRowHolder);
-							
-			} else if(child instanceof UIColumn) {
-				
-				if(child instanceof org.richfaces.component.UIColumn) {
-					org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn)child;
-					if(column.isBreakBefore() && processCell !=0) {
-						encodeRowEnd(writer, context, column);
-						rowHolder.nextRow();
-						rowStart = true;
-					}
-				}
-							
-				if(rowStart) {
-
-					if(processRow == 0) {
-						encodeFirstRowStart(writer, context, child, rowHolder);
-					} else {
-						encodeRowStart(writer, context, child, rowHolder);
-					}
-					
-					rowStart = false;
-				}
-				
-				encodeCellStart(writer, context, child, rowHolder);
-				encodeCellEnd(writer, context, child);
-								
-				if(!iterator.hasNext()) {
-					if(processRow == 0) {
-						encodeFirstRowEnd(writer, context, child);
-					} else {
-						encodeRowEnd(writer, context, child);
-					}
-				}
-				processCell++;
-			}
-	
-		}	
-	}
-	
-	@Override
-	protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
-		if(!shouldProceed(component)) {
-			return;
-		}
-		UIDataTable dataTable = (UIDataTable)component;
-		encodeTableStart(writer,context, dataTable);
-		encodeTableStructure(writer, context, dataTable);
-	}
-	
-	@Override
-	protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
-		
-		if(!shouldProceed(component)) {
-			return;
-		}
-		
-		UIDataTable dataTable = (UIDataTable)component;
-		encodeTableBodyStart(writer, context, dataTable);
-		encodeRows(context, dataTable);
-		encodeTableBodyEnd(writer, context, dataTable);
-		
-	}
-	
-	@Override
-	protected void doEncodeEnd(ResponseWriter writer, FacesContext context,	UIComponent component) throws IOException {
-		
-		if(!shouldProceed(component)) {
-			return;
-		}
-		
-		UIDataTable dataTable = (UIDataTable)component;
-		encodeTableEnd(writer, context, dataTable);
-	}
-	
-	protected boolean shouldProceed(UIComponent component) {
-		return (component instanceof UIDataTable);
-	}
-
-	@Override
-	protected Class<? extends UIComponent> getComponentClass() {
-		return UISimpleDataTable.class;
-	}
-
-	public void encodeCellEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
-		writer.endElement(HTML.TD_ELEM);
-	}
-
-	public void encodeCellStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder) throws IOException {
-		writer.startElement(HTML.TD_ELEM, component);
-		String cellClass = holder.getCellClass();
-		encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, cellClass);
-		
-		if(component instanceof org.richfaces.component.UIColumn) {
-			org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn)component;
-			
-			int rowspan = column.getRowspan(); 
-			if(rowspan != Integer.MIN_VALUE) {
-				writer.writeAttribute("rowspan", Integer.valueOf(rowspan), null);
-			}
-			
-			int colspan = column.getColspan();
-			if(colspan != Integer.MIN_VALUE) {
-				writer.writeAttribute("colspan", Integer.valueOf(colspan), null);
-			}
-		}
-		renderChildren(context, component);
-	}
-
-	public void encodeFirstRowEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
-		writer.endElement(HTML.TR_ELEMENT);
-	}
-
-	public void encodeFirstRowStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder) throws IOException {
-		writer.startElement(HTML.TR_ELEMENT, component);
-		String styleClass = holder.getFirstRowClass() + " " + holder.getRowClass();
-		encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, styleClass);
-	}
-
-	public void encodeRowEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
-		writer.endElement(HTML.TR_ELEMENT);
-	}
-
-	public void encodeRowStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder) throws IOException {
-		writer.startElement(HTML.TR_ELEMENT, component);
-		String styleClass = holder.getRowClass();
-		encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, styleClass);
-	}
-
-	public void encodeTableBodyEnd(ResponseWriter writer, FacesContext context, UIDataTable component) throws IOException {
-		writer.endElement(HTML.TABLE_ELEMENT);
-	}
-
-	public void encodeTableBodyStart(ResponseWriter writer, FacesContext context, UIDataTable component) throws IOException {
-		writer.startElement(HTML.BODY_ELEMENT, component);
-	}
-
-	public void encodeTableEnd(ResponseWriter writer, FacesContext context, UIDataTable component) throws IOException {
-		writer.endElement(HTML.BODY_ELEMENT);
-	}
-
-	public void encodeTableStart(ResponseWriter writer, FacesContext context, UIDataTable component) throws IOException {
-		writer.startElement(HTML.TABLE_ELEMENT, component);
-		String styleClass = getTableSkinClass();
-		encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, styleClass);
-	}
-
-	public void encodeCaption(ResponseWriter writer, FacesContext context, UIDataTable dataTable) throws IOException {
-		 
-		UIComponent caption = dataTable.getCaption();
-	        
-		if (caption == null) {
-			return;
-		}
-	        
-		if(!caption.isRendered()) {
-			return;
-		}
-	                
-		writer.startElement(HTML.CAPTION_ELEMENT, dataTable);
-
-		String captionClass = (String) dataTable.getAttributes().get("captionClass");
-		String captionSkinClass = getCaptionSkinClass();
-		captionClass = captionClass != null ? captionClass + " " + captionClass : captionSkinClass;
-	        
-		writer.writeAttribute(HTML.CLASS_ATTRIBUTE, captionClass, "captionClass");
-
-		String captionStyle = (String) dataTable.getAttributes().get("captionStyle");
-	       
-		if (captionStyle != null && captionStyle.trim().length()!=0) {
-			writer.writeAttribute(HTML.STYLE_ATTRIBUTE, captionStyle, "captionStyle");
-		}
-
-		renderChild(context, caption);
-		
-		writer.endElement(HTML.CAPTION_ELEMENT);	
-	}
-
-	public void encodeFooter(ResponseWriter writer, FacesContext context, UIDataTable dataTable, int columns) throws IOException {
-
-		Iterator<UIComponent> tableColumns = dataTable.columns();
-		
-		UIComponent footer = dataTable.getFooter();
-		
-		boolean columnFacetPresent = isColumnFacetPresent(dataTable, "footer");
-
-		if ((footer != null && footer.isRendered()) || columnFacetPresent) {
-			
-			writer.startElement(HTML.TFOOT_ELEMENT, dataTable);
-			String footerClass = (String) dataTable.getAttributes().get("footerClass");
-			
-			if (columnFacetPresent) {
-				writer.startElement(HTML.TR_ELEMENT, dataTable);
-				
-				encodeStyleClass(writer, context, dataTable, "footerClass", "rich-table-subfooter");
-		                //TODO nick - use "th" instead of "td"?
-		                //TODO nick - rename method "encodeHeaderFacets"
-				encodeHeaderFacets(context, writer, tableColumns, "rich-table-subfootercell", 
-									footerClass, "footer", HTML.TD_ELEM, columns);
-					writer.endElement(HTML.TR_ELEMENT);
-			}
-
-			
-			if (footer != null && footer.isRendered()) {
-                //TODO nick - use "th" instead of "td"?
-                //TODO nick - rename method "encodeTableHeaderFacet"
-				encodeTableHeaderFacet(context, columns, writer, footer, 
-				"rich-table-footer",
-				"rich-table-footer-continue",
-				"rich-table-footercell",
-				footerClass, HTML.TH_ELEM);
-			}
-					
-			writer.endElement(HTML.TFOOT_ELEMENT);
-		}
-	}	
-
-	public void encodeHeader(ResponseWriter writer, FacesContext context, UIDataTable dataTable, int columns) throws IOException {
-	
-		UIComponent header = dataTable.getHeader();
-		boolean isEncodeHeaders = isEncodeHeaders(dataTable);
-
-		if ((header != null && header.isRendered()) || isEncodeHeaders) {
-			
-			writer.startElement(HTML.THEAD_ELEMENT, dataTable);
-			writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-table-thead", null);
-			
-			String headerClass = (String) dataTable.getAttributes().get("headerClass");
-			
-			if (header != null && header.isRendered()) {
-	                encodeTableHeaderFacet(context, columns, writer, header,
-	                        "rich-table-header",
-	                        //TODO nick - rename classes!!!
-	                        "rich-table-header-continue",
-	                        "rich-table-headercell",
-	                        headerClass, HTML.TH_ELEM);
-			}
-
-			if (isEncodeHeaders) {
-				writer.startElement(HTML.TR_ELEMENT, dataTable);
-				encodeStyleClass(writer, context, dataTable, "headerClass", "rich-table-subheader");
-				encodeHeaderFacets(context, writer, dataTable.columns(), "rich-table-subheadercell", headerClass, "header", HTML.TH_ELEM, columns);
-				writer.endElement(HTML.TR_ELEMENT);
-			}
-
-			writer.endElement(HTML.THEAD_ELEMENT);
-		}
-	}
-	
-    protected void encodeTableHeaderFacet(FacesContext context, int columns, ResponseWriter writer, UIComponent footer,
-            String skinFirstRowClass, String skinRowClass, String skinCellClass, String footerClass, String element)
-            throws IOException {
-    	
-    		 if(footer instanceof Row) {
-            	Row row = (Row)footer;
-            	
-            	RowHolder holder = new RowHolder(row);
-            	holder.setCellElement(element);
-            	holder.setFirstRowClass(skinFirstRowClass);
-            	holder.setRowClass(skinRowClass);
-            	holder.setCellClass(skinCellClass);
-            	holder.resetCurrentRow();
-            	holder.setHeaderRow(true);
-            	
-            	encodeRows(context, row, holder);
-            } else {
-            	writer.startElement(HTML.TR_ELEMENT, footer);
-            	
-            	String rowClass = skinFirstRowClass;
-            	String cellClass = skinCellClass;
-            	if(footerClass != null && footerClass.trim().length()!=0) {
-            		rowClass = rowClass + " " + footerClass;
-            		cellClass = cellClass + " " + footerClass;
-            	} 
-            	
-            	encodeStyleClass(writer, context, footer, null, rowClass);
-            	
-            	writer.startElement(element, footer);
-            	
-            	encodeStyleClass(writer, context, footer, null, cellClass);
-            	
-            	if(columns > 0) {
-    				writer.writeAttribute("colspan", String.valueOf(columns), null);
-    		    }
-    			writer.writeAttribute("scope", "colgroup", null);
-    		
-    			renderChild(context, footer);
-    			
-    			writer.endElement(element);
-    	        writer.endElement(HTML.TR_ELEMENT);
-            }
-        }
-
-        protected void encodeHeaderFacets(FacesContext context, ResponseWriter writer, Iterator<UIComponent> headers,
-            String skinCellClass, String headerClass, String facetName, String element, int colCount) throws IOException {
-            
-            int tColCount = 0;
-
-            while (headers.hasNext()) {
-                UIComponent column = headers.next();
-                if (!column.isRendered()) {
-                    continue;
-                }
-
-                Integer colspan = (Integer) column.getAttributes().get("colspan");
-                if (colspan != null && colspan.intValue() > 0) {
-                    tColCount += colspan.intValue();
-                } else {
-                    tColCount++;
-                }
-
-                if (tColCount > colCount) {
-                    break;
-                }
-
-                String classAttribute = facetName + "Class";
-                String columnHeaderClass = (String) column.getAttributes().get(classAttribute);
-                
-                String styleClass = skinCellClass;
-                if(headerClass != null && headerClass.trim().length() != 0) {
-                	styleClass  = styleClass + " " + headerClass;
-                }
-                
-                if(columnHeaderClass != null && columnHeaderClass.trim().length() != 0) {
-                	styleClass = styleClass + " " + columnHeaderClass;
-                }
-                
-
-                writer.startElement(element, column);
-                                
-                encodeStyleClass(writer, context, column, null, styleClass);
-                
-                writer.writeAttribute("scope", "col", null);
-                getUtils().encodeAttribute(context, column, "colspan");
-
-                UIComponent facet = column.getFacet(facetName);
-                if (facet != null && facet.isRendered()) {
-                    renderChild(context, facet);
-                }
-
-                writer.endElement(element);
-            }
-        }
-	
-
-	protected void  encodeStyleClass(ResponseWriter writer, FacesContext context, UIComponent component , String styleClassAttribute, String styleClass) throws IOException {
-		boolean isEmpty = isEmpty(component, styleClassAttribute); 
-		if( isEmpty && !(styleClass != null && styleClass.trim().length() != 0)) {
-			return;
-		}
-		
-		String componentStyleClass = isEmpty ? styleClass : styleClass + " " + component.getAttributes().get(styleClassAttribute); 
-		writer.writeAttribute(HTML.CLASS_ATTRIBUTE, componentStyleClass, null);
-	}
-		
-	protected boolean isEmpty(UIComponent component, String attribute) {
-		if(attribute == null) {
-			return true;
-		}
-		String value = (String) component.getAttributes().get(attribute);
-		return !(value != null && value.trim().length()!=0);
-	}
-	
-	protected void encodeStyle(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
-		String style = (String)component.getAttributes().get(HTML.STYLE_ATTRIBUTE);
-		if(!isEmptyStyle(style)) {
-			writer.writeAttribute(HTML.STYLE_ATTRIBUTE, style, null);
-		}
-	}
-	
-	protected boolean isEmptyStyle(String style) {
-		return !((style != null) && (style.trim().length()!=0)); 
-	}
-	
-	protected String getTableSkinClass() {
-		return "rich-table"; 
-	}
-	
-	protected String getTableHeadSkinClass() {
-		return "rich-table-head";
-	}
-	
-	protected String getCaptionSkinClass() {
-		return "rich-table-caption";
-	}
-
-}

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/faces-config.xml
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/faces-config.xml	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/faces-config.xml	2009-11-05 17:00:48 UTC (rev 15842)
@@ -4,8 +4,8 @@
 	version="2.0">
 
 	<component>
-		<component-type>org.richfaces.SimpleDataTable</component-type>
-		<component-class>org.richfaces.component.html.HtmlSimpleDataTable</component-class>
+		<component-type>org.richfaces.DataTable</component-type>
+		<component-class>org.richfaces.component.html.HtmlDataTable</component-class>
 	</component>
 
 	<component>
@@ -28,9 +28,9 @@
 	<render-kit>
 		<render-kit-id>HTML_BASIC</render-kit-id>
 		<renderer>
-			<component-family>org.richfaces.SimpleDataTable</component-family>
-			<renderer-type>org.richfaces.SimpleDataTableRenderer</renderer-type>
-			<renderer-class>org.richfaces.renderkit.SimpleDataTableRenderer</renderer-class>
+			<component-family>org.richfaces.DataTable</component-family>
+			<renderer-type>org.richfaces.DataTableRenderer</renderer-type>
+			<renderer-class>org.richfaces.renderkit.DataTableRenderer</renderer-class>
 		</renderer>
 		<renderer>
 			<component-family>org.richfaces.ExtendedDataTable</component-family>

Added: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/datatable.js
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/datatable.js	                        (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/datatable.js	2009-11-05 17:00:48 UTC (rev 15842)
@@ -0,0 +1 @@
+var i = 1;
\ No newline at end of file

Deleted: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/simple-datatable.js
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/simple-datatable.js	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/simple-datatable.js	2009-11-05 17:00:48 UTC (rev 15842)
@@ -1 +0,0 @@
-var i = 1;
\ No newline at end of file

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/table.css
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/table.css	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/table.css	2009-11-05 17:00:48 UTC (rev 15842)
@@ -1,3 +1,110 @@
+.rich-table{
+	background-color:#FFFFFF;
+	border-collapse:collapse;
+	border-left:1px solid #C0C0C0;
+	border-top:1px solid #C0C0C0;
+	empty-cells:show;
+}
+
+.rich-table-row{
+}
+
+.rich-table-firstrow{
+}
+
+.rich-table-cell{
+	border-bottom:1px solid #C0C0C0;
+	border-right:1px solid #C0C0C0;
+	color:#000000;
+	font-family:Arial,Verdana,sans-serif;
+	font-size:11px;
+	padding:4px;
+}
+
+
+.rich-subtable-row{
+}
+
+.rich-subtable-firstrow{
+}
+
+.rich-subtable-cell{
+	border-bottom:1px solid #C0C0C0;
+	border-right:1px solid #C0C0C0;
+	color:#000000;
+	background-color: #F0F0F0;
+	font-family:Arial,Verdana,sans-serif;
+	font-size:11px;
+	padding:4px;
+}
+
+.rich-table-header{
+}	
+
+.rich-table-header-continue{
+}
+
+.rich-table-headercell{
+	border-bottom:1px solid #C0C0C0;
+	border-right:1px solid #C0C0C0;
+	color:#000000;
+	font-family:Arial,Verdana,sans-serif;
+	font-size:11px;
+	font-weight:bold;
+	padding:4px;
+	text-align:center;
+}
+
+.rich-table-subheader{
+}	
+
+.rich-table-subheadercell{
+	border-bottom:1px solid #C0C0C0;
+	border-right:1px solid #C0C0C0;
+	color:#00000;
+	font-family:Arial,Verdana,sans-serif;
+	font-size:11px;
+	padding:4px;
+}
+
+.rich-table-subfootercell{
+	border-bottom:1px solid #C0C0C0;
+	border-right:1px solid #C0C0C0;
+	color:#00000;
+	font-family:Arial,Verdana,sans-serif;
+	font-size:11px;
+	padding:4px;
+}
+
+.rich-table-thead{
+	border-bottom:1px solid #C0C0C0;
+}
+
+.rich-table-footer{
+}
+
+.rich-table-footer-continue{
+}
+
+.rich-table-footercell{
+	border-bottom:1px solid #C0C0C0;
+	border-right:1px solid #C0C0C0;
+	color:#000000;
+	font-family:Arial,Verdana,sans-serif;
+	font-size:11px;
+	font-weight:bold;
+	padding:4px;
+	text-align:left;
+}
+
+.rich-subtable-footer{
+}
+
+.rich-subtable-footercell{
+	
+}	
+	
+
 <?xml version="1.0" encoding="UTF-8"?>
 <f:template xmlns:f='http:/jsf.exadel.com/template'
    xmlns:u='http:/jsf.exadel.com/template/util' 

Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/tables.taglib.xml
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/tables.taglib.xml	2009-11-05 14:27:15 UTC (rev 15841)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/tables.taglib.xml	2009-11-05 17:00:48 UTC (rev 15842)
@@ -4,10 +4,10 @@
 	<namespace>http://richfaces.org/rich</namespace>
 
 	<tag>
-		<tag-name>simpleDataTable</tag-name>
+		<tag-name>dataTable</tag-name>
 		<component>
-			<component-type>org.richfaces.SimpleDataTable</component-type>
-			<renderer-type>org.richfaces.SimpleDataTableRenderer</renderer-type>
+			<component-type>org.richfaces.DataTable</component-type>
+			<renderer-type>org.richfaces.DataTableRenderer</renderer-type>
 		</component>
 	</tag>
 	<tag>



More information about the richfaces-svn-commits mailing list