// Render closure of the string widget. It'll now contain content of table rows.
String stringId = renderCloseString(protocol);
StringBuffer script = new StringBuffer();
ResponseTableBodyAttributes tableAttributes = (ResponseTableBodyAttributes) attributes;
if (tableAttributes.getId() != null) {
script.append(createJavaScriptWidgetRegistrationOpening(tableAttributes.getId(), true));
}
int rowsCount = tableAttributes.getTotalRowsCount();
script.append("new Widget.TableBodyResponse(")
.append(rowsCount == -1 ? "null" : Integer.toString(rowsCount))
.append(", ")
.append(createJavaScriptWidgetReference(stringId, true))
.append(")");
if (tableAttributes.getId() != null) {
script.append(createJavaScriptWidgetRegistrationClosure());
}
writeJavaScript(script.toString());
}