// store TableRenderer's skin resource map, so that called to
// context.getTranslatedValue will get the correct key.
arc.setSkinResourceKeyMap(_resourceKeyMap);
TableRenderingContext tContext = createRenderingContext(context,
arc,
component);
try
{
tContext.install();
ResponseWriter rw = context.getResponseWriter();
rw.startElement("div", component);
renderId(context, component);
renderAllAttributes(context, arc, bean);
// If we need to render a "special" empty table, then bail.
if (renderTableWithoutColumns(context, arc, tContext, component))
return;
// start the outer table:
rw.startElement(XhtmlConstants.TABLE_ELEMENT, null);
renderTableAttributes(context, arc, component, bean, "0", "0");
RenderStage renderStage = tContext.getRenderStage();
assert (renderStage.getStage()==RenderStage.INITIAL_STAGE);
// give the table's columns a chance to initialize:
renderSingleRow(context, arc, tContext, component);
// 1. render the header bars (title, controlbar and subcontrolbar)
renderNavigationHeaderBars(context, arc, tContext, component, bean);
// 2. render the table content
renderTableContent(context, arc, tContext, component);
// 3. render the footer bars (controlbar) if applicable
if (_shouldRepeatControlBar(arc))
{
renderNavigationFooterBars(context, arc, tContext, component, bean);
}
// end the outertable:
rw.endElement(XhtmlConstants.TABLE_ELEMENT);
// gives some beans the chance to cleanup:
renderStage.setStage(RenderStage.END_STAGE);
renderSingleRow(context, arc, tContext, component);
String tid = tContext.getTableId();
FormData formData = arc.getFormData();
if (formData != null)
{
// Add sorting parameters.
// =-=AdamWiner FIXME: only really needed with sorting.
formData.addNeededValue(TrinidadRenderingConstants.STATE_PARAM);
formData.addNeededValue(TrinidadRenderingConstants.VALUE_PARAM);
//HKuhn - no need for scripts in printable mode
if (supportsScripting(arc))
{
rw.startElement(XhtmlConstants.SCRIPT_ELEMENT, null);
renderScriptDeferAttribute(context, arc);
// Bug #3426092:
// render the type="text/javascript" attribute in accessibility mode
renderScriptTypeAttribute(context, arc);
String formName = formData.getName();
rw.writeText(tContext.getJSVarName()+"="+
TreeUtils.createNewJSCollectionComponentState(formName, tid)+";", null);
rw.endElement(XhtmlConstants.SCRIPT_ELEMENT);
}
}
int first = tContext.getCollectionComponent().getFirst();
if (supportsScripting(arc))
{
XhtmlUtils.addLib(context, arc, "TableProxy()");
// Bug #2378405: Add a javascript variable giving the row number of
// the first row in the displayed rowset.
// Although it seems like we should check for existence here (to
// prevent duplication), we actually should not. If we have multiple
// tables on a page, they will all need independent value fields.
// We'd really like to use the flattened name here, but a colon doesn't
// work as part of a javascript variable name, so we have to build up a
// pseudo flattened name of the form _<tableName>_value.
// (=-=AEW Change code to write the value directly into the window,
// so a colon *would* work; however, if a field had an id of "value"
// in the table, we'd get a conflict; so don't change?)
// Also, since 1 is by far the most common value, don't bother
// writing it out: the Javascript will assume the value is 1 if
// it isn't.
int value = first + 1;
if (value != 1)
{
rw.startElement(XhtmlConstants.SCRIPT_NAME, null);
renderScriptDeferAttribute(context, arc);
// Bug #3426092:
// render the type="text/javascript" attribute in accessibility mode
renderScriptTypeAttribute(context, arc);
rw.writeText("window[\"_", null);
rw.writeText(tContext.getTableId(), null);
rw.writeText(_VALUE_FIELD_NAME, null);
rw.writeText("\"]=", null);
rw.writeText(IntegerUtils.getString(value), null);
rw.endElement(XhtmlConstants.SCRIPT_NAME);
}
}
OutputUtils.renderHiddenField(context,
tContext.getTableId() + ":rangeStart",
IntegerUtils.getString(first));
rw.endElement("div");
}
finally
{
// restore current skin resource map. Most likely there won't be one.
arc.setSkinResourceKeyMap(oldSkinResourceMap);
if (tContext != null)
tContext.release();
}
}