if (!isWidgetSupported(protocol)) {
return;
}
// Render TBODY element closure.
TableBodyAttributes tableBodyAttributes = (TableBodyAttributes) attributes;
protocol.writeCloseTableBody(tableBodyAttributes.getXHTML2Attributes());
// Prepare buffer for JavaScript
StringBuffer script = new StringBuffer();
String tableBodyId = attributes.getId();
HashMap options = new HashMap();
// Prepare options to render.
StyleValue rowsPerPage = attributes.getStyles().getPropertyValues()
.getSpecifiedValue(StylePropertyDetails.MCS_TABLE_ROWS_PER_PAGE);
if (rowsPerPage instanceof StyleInteger) {
options.put("rowsPerPage", Integer.toString(((StyleInteger) rowsPerPage).getInteger()));
}
LoadAttributes loadAttributes = tableBodyAttributes.getLoadAttributes();
if (loadAttributes != null) {
// require AJAX script module
require(WidgetScriptModules.BASE_AJAX, protocol, attributes);
HashMap loadOptions = new HashMap();
loadOptions.put("src", createJavaScriptString(loadAttributes.getSrc()));
String when = loadAttributes.getWhen();
loadOptions.put("when", createJavaScriptString(when != null ? when : "onload"));
StringBuffer loadScript = new StringBuffer();
loadScript.append("new Widget.TableBodyLoad(")
.append(createJavaScriptObject(loadOptions))
.append(")");
options.put("load", loadScript.toString());
}
// Initialize cache.
if (tableBodyAttributes.getCachedPagesCount() != 0) {
options.put("cachedPagesCount", Integer.toString(tableBodyAttributes.getCachedPagesCount()));
}
// Render JavaScript to buffer
if (tableBodyId != null) {
script.append(createJavaScriptWidgetRegistrationOpening(tableBodyId, true));
}
script.append("new Widget.TableBody(")
.append(createJavaScriptString(tableBodyAttributes.getXHTML2Attributes().getId()))
.append(", ")
.append(createJavaScriptObject(options))
.append(")");
if (tableBodyId != null) {