//
// 1. Gather all the data we need to render
//
final RowData rowData = tContext.getRowData();
final UIComponent detail = tContext.getDetail();
final RenderStage renderStage = tContext.getRenderStage();
TableUtils.RowLoop loop = new TableUtils.RowLoop() {
@Override
protected void processRowImpl(FacesContext fc, CollectionComponent tableBase)
throws IOException
{
ResponseWriter writer = fc.getResponseWriter();
// compute all the rowSpans for the current row:
rowData.setCurrentRowSpan(-1);
//reset
renderStage.setStage(RenderStage.START_ROW_STAGE);
renderSingleRow(fc, arc, tContext, (UIComponent) tableBase);
renderStage.setStage(RenderStage.DATA_STAGE);
// render each of the individual rows in the rowSpan:
for (int i = 0, sz = rowData.getCurrentRowSpan(); i < sz; i++)
{
// start the row
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
renderSingleRow(fc, arc, tContext, (UIComponent) tableBase);
rowData.incCurrentSubRow();
// end the row
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
}
// if necessary, render a detail row
if ((detail != null)&&
((UIXTable)tableBase).getDisclosedRowKeys().isContained())
{
// indicate that we are now rendering inside of a details section
renderStage.setStage(RenderStage.DETAIL_ROW_STAGE);
ColumnData colData = tContext.getColumnData();
// while rendering the named children in the detail row,
// do not use the special response writer that
// defaults data cells with no data to <br>.
// This fixes bug 2367693.
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
writer.writeAttribute("headers",
colData.getHeaderID(tContext.getDetailColumnIndex()),
null);
writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE,
IntegerUtils.getString(tContext.getActualColumnCount()), null);
String styleClass = SkinSelectors.AF_TABLE_DETAIL_STYLE;
String borderStyleClass = CellUtils.getBorderClass(
true, true, true, true);
renderStyleClasses(fc, arc,
new String[]{styleClass, borderStyleClass});
encodeChild(fc, detail);
writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
// restore the data stage
renderStage.setStage(RenderStage.DATA_STAGE);
}
// end detail
}
};