TableRenderingContext tContext,
UIComponent component
) throws IOException
{
tContext.getRenderStage().setStage(RenderStage.COLUMN_FOOTER_STAGE);
final ColumnData colData = tContext.getColumnData();
UIComponent footer = getFacet(component, CoreTable.FOOTER_FACET);
boolean hasColumnFooters = colData.getPhysicalIndexOfFirstFooter() >= 0;
// If there's a table footer, or column footers, we've got work to do
if ((footer != null) || hasColumnFooters)
{
ResponseWriter writer = context.getResponseWriter();
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
boolean useScroll = (getHeight(component, getFacesBean(component)) != null) && isIE(rc);
if (useScroll)
{
writer.writeAttribute("style", "position:relative;"+
"bottom:expression("+
"this.offsetParent.scrollHeight-this.offsetParent.scrollTop-"+
"this.offsetParent.clientHeight+1);" +
"left:-1px", null);
}
// total rows may need an ID. see bug 3211593:
/* Need new scheme for generateUniqueId()?
String rowID = XhtmlLafUtils.generateUniqueID(tContext);
writer.writeAttribute(XhtmlLafConstants.ID_ATTRIBUTE, rowID, null);
tContext.getRowData().setCurrentRowHeaderID(rowID);
*/
final int firstFooterPhysicalIndex = colData.getPhysicalIndexOfFirstFooter();
// By default, we try to render the table footer in the same row
// as the column footers; this is to save on screen real-estate,
// and do something with that space in the table if the first N
// columns have no footer content.
// When the first column does have a footer, we'll need to push
// the table footer down to an extra row
// If there isn't a column footer in the first row, render a TH
// with a sufficient colspan - and put the table footer in there
// if it exists.
// (Note this does need to be != 0, not > 0. Negative numbers
// mean there's no column footers, in which case we'll handle
// outputting the table footer right here)
if (firstFooterPhysicalIndex != 0)
{
writer.startElement(XhtmlConstants.TABLE_HEADER_ELEMENT, null);
final int colSpan = (firstFooterPhysicalIndex > 0)? firstFooterPhysicalIndex: tContext.getActualColumnCount();
writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE, IntegerUtils.getString(colSpan), null);
renderStyleClass(context, rc, SkinSelectors.AF_TABLE_COLUMN_FOOTER_STYLE);
if (footer != null)
encodeChild(context, footer);
writer.endElement(XhtmlConstants.TABLE_HEADER_ELEMENT);
}
if (firstFooterPhysicalIndex >= 0)
{
colData.setColumnIndex(tContext.getSpecialColumnCount(),
0/*logicalColumnIndex*/);
for(UIComponent child : (List<UIComponent>)component.getChildren())
{
if (child.isRendered())