Author: nbelaevski
Date: 2011-01-18 20:02:11 -0500 (Tue, 18 Jan 2011)
New Revision: 21066
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
Log:
https://issues.jboss.org/browse/RF-10187
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2011-01-19
01:02:11 UTC (rev 21066)
@@ -50,7 +50,9 @@
protected static final String FIRST_ROW_CLASS_KEY = "firstRowClass";
- protected static final String CELL_CLASS_KEY = "cellClass";
+ protected static final String CELL_CLASS_KEY = "cellClass";
+
+ private static final String CELL_ELEMENT_KEY = "cellElement";
public void encodeColumn(FacesContext context, ResponseWriter writer, UIColumn
component, RowHolder rowHolder) throws IOException {
String parentId = rowHolder.getParentClientId();
@@ -89,8 +91,8 @@
}
public void encodeColumnStart(ResponseWriter writer, FacesContext context, String
parentId, UIComponent component) throws IOException {
- writer.startElement(HtmlConstants.TD_ELEM, component);
- getUtils().encodeId(context, component);
+ writer.startElement(getCellElement(context, parentId), component);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
component.getContainerClientId(context), HtmlConstants.ID_ATTRIBUTE);
String cellClass = getCellClass(context, parentId);
cellClass = concatClasses(cellClass,
component.getAttributes().get(COLUMN_CLASS));
encodeStyleClass(writer, context, component, HtmlConstants.STYLE_CLASS_ATTR,
cellClass);
@@ -111,7 +113,7 @@
}
public void encodeColumnEnd(ResponseWriter writer, FacesContext context, String
parentId) throws IOException {
- writer.endElement(HtmlConstants.TD_ELEM);
+ writer.endElement(getCellElement(context, parentId));
}
public void encodeFirstRowStart(ResponseWriter writer, FacesContext context, String
parentId, int currentRow, UIComponent component) throws IOException {
@@ -146,10 +148,20 @@
return get(context, id + CELL_CLASS_KEY);
}
- protected String getFacetElement(FacesContext context, String id, String facetName)
{
- return HtmlConstants.TD_ELEM;
+ protected String getCellElement(FacesContext context, String id) {
+ String elementName = get(context, id + CELL_ELEMENT_KEY);
+
+ if (elementName == null) {
+ elementName = HtmlConstants.TD_ELEM;
+ }
+
+ return elementName;
}
+ protected void setCellElement(FacesContext context, String id, String element) {
+ put(context, id + CELL_ELEMENT_KEY, element);
+ }
+
protected void saveRowStyles(FacesContext context, String id, String firstRowClass,
String rowClass, String cellClass) {
put(context, id + FIRST_ROW_CLASS_KEY, firstRowClass);
put(context, id + ROW_CLASS_KEY, rowClass);
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2011-01-19
01:02:11 UTC (rev 21066)
@@ -353,6 +353,11 @@
boolean encodeThead = containsThead();
if ((header != null && header.isRendered()) || isEncodeHeaders) {
+
+ String id = dataTable.getClientId(facesContext);
+
+ setCellElement(facesContext, id, HtmlConstants.TH_ELEM);
+
boolean partialUpdateEncoded = false;
String clientId = dataTable.getClientId(facesContext);
@@ -425,6 +430,8 @@
partialEnd(facesContext);
}
}
+
+ setCellElement(facesContext, id, null);
}
}
@@ -432,7 +439,7 @@
protected void encodeColumnFacet(FacesContext context, ResponseWriter writer,
UIDataTableBase dataTableBase, String facetName, int colCount, String cellClass) throws
IOException {
int tColCount = 0;
String id = dataTableBase.getClientId(context);
- String element = getFacetElement(context, id, facetName);
+ String element = getCellElement(context, id);
Iterator<UIComponent> headers = dataTableBase.columns();
@@ -480,7 +487,7 @@
UIComponent footer, String facetName, String rowClass, String cellClass, boolean
encodePartialUpdate) throws IOException {
boolean isColumnGroup = (footer instanceof Row);
- String element = getFacetElement(facesContext, id, facetName);
+ String element = getCellElement(facesContext, id);
boolean partialUpdateEncoded = false;
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2011-01-19
01:02:11 UTC (rev 21066)
@@ -394,11 +394,6 @@
return "rf-dt-b";
}
- @Override
- protected String getFacetElement(FacesContext context, String id, String facetName)
{
- return facetName.equals(UIDataTableBase.HEADER) ? HtmlConstants.TH_ELEM :
HtmlConstants.TD_ELEM;
- }
-
public EncodeStrategy getHiddenContainerStrategy(UIDataTableBase dataTableBase) {
return new DataTableHiddenEncodeStrategy();
}