tContext.setExplicitHeaderIDMode(true);
ResponseWriter writer = context.getResponseWriter();
UIComponent table = tContext.getTable();
// DataObject savedData = tContext.getCurrentDataObject();
RenderStage renderStage = tContext.getRenderStage();
Object assertKey = null;
assert ((assertKey = ((UIXCollection)table).getRowKey()) != null)||true;
//
// 2. Render the top / column header
//
// =-= ACW: if a table is very wide, then we render in a special mode
// where the control bars and the table content are in different HTML
// tables. see bug 2530006:
boolean wideMode = "100%".equals(tContext.getTableWidth());
if (wideMode)
{
// if we are in wideMode, we must close the outer table:
writer.endElement(XhtmlConstants.TABLE_ELEMENT);
}
else
{
// the content table is a row in the overall table
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
}
String height = getHeight(getFacesBean(component));
final boolean useScrollIE;
final String scrollID;
if ((height != null) && isIE(arc))
{
useScrollIE = true;
String tableId = tContext.getTableId();
scrollID = tableId+"_scroll";
writer.startElement("script", null);
renderScriptDeferAttribute(context, arc);
renderScriptTypeAttribute(context, arc);
_writeIEscrollScript(context, arc, tableId, scrollID);
writer.endElement("script");
writer.startElement("div", null);
// IE in standards compliant mode needs the "width:100%" for the vertical
// scroll bars to appear:
writer.writeAttribute("style", "overflow:auto;overflow-x:hidden;width:100%;height:"+height, null);
// bug 4585888:
writer.writeAttribute("onscroll", "return _uixIEmaskFrame.tickle('"+scrollID+"');", null);
writer.startElement("div", null);
// make room for the vertical scroll bar: //bug 4364828:
writer.writeAttribute("style", "padding-right:16px", null);
}
else
{
useScrollIE = false;
scrollID = null;
}
writer.startElement(XhtmlConstants.TABLE_ELEMENT, null);
renderStyleClass(context, arc, SkinSelectors.AF_TABLE_CONTENT_STYLE);
if ((height != null)&& isGecko(arc))
{
writer.writeAttribute("style", "border-width:0px", null);
}
FacesBean bean = getFacesBean(table);
String summary = getSummary(bean);
Object cellPadding = getTablePadding(table);
OutputUtils.renderLayoutTableAttributes(
context, arc, cellPadding,
"0", // cell spacing
"0", //border
"100%", //table width
summary);
_renderTableHeader(context, arc, tContext, table);
// render the column header
if (tContext.hasColumnHeaders())
{
renderStage.setStage(RenderStage.COLUMN_HEADER_STAGE);
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
if (useScrollIE)
{
// we create a bogus <tr> as a placeholder to occupy space
// while we use absolute positioning to hold the real <tr> in
// place. this is to solve bug 4624925:
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
writer.writeAttribute("style", // for ECM. optimized for simple look-n-feel.
"position:relative;top:-2px;left:0px;z-index:2", null);
//bug4364828, bug 4585888
writer.writeAttribute("id", scrollID, null);
}
renderColumnHeader(context, arc, tContext, component);
writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
}
assert _assertCurrencyKeyPreserved(assertKey, table);
//
// 3. Render all the rows
//
renderStage.setStage(RenderStage.DATA_STAGE);
renderTableRows(context, arc, tContext, component, bean);
assert _assertCurrencyKeyPreserved(assertKey, table);
// the content table is a row in the overall table
writer.endElement(XhtmlConstants.TABLE_ELEMENT);