private void endBuReplace(String id) throws SAXException {
this.cocoonConsumer.endElement(BrowserUpdateTransformer.BU_NSURI, "replace", "bu:replace");
}
protected boolean pushWidget(String path, boolean unused) throws SAXException {
Widget parent = peekWidget();
if (path == null || path.length() == 0) {
throw new FormsRuntimeException("Missing 'id' attribute on template instruction");
}
Widget widget = parent.lookupWidget(path);
if (widget == null) {
throw new FormsRuntimeException(parent + " has no child named '" + path + "'", parent.getLocation());
}
String id = widget.getFullName();
// Is there an updated widget at a higher level in the template?
boolean inUpdatedTemplate = ((Boolean)widgetStack.peek(1)).booleanValue();
boolean display;
if (ajaxRequest) {
// An Ajax request. We will send partial updates
if (inUpdatedTemplate) {
// A parent widget has been updated: redisplay this one also
display = true;
} else if (this.updatedWidgets.contains(id)) {
// Widget has been updated. We are now in an updated template section,
// and widgets have to be surrounded with <bu:replace>
inUpdatedTemplate = true;
display = true;
} else if (this.childUpdatedWidgets.contains(id)) {
// A child need to be updated
display = true;
} else {
// Doesn't need to be displayed
display = false;
}
} else {
// Not an ajax request
if (ajaxTemplate) {
// Surround all widgets with <bu:replace>, which the bu tranformer will use to check structure
// consistency and add an id attribute to its child elements.
inUpdatedTemplate = true;
}
// Display the widget
display = true;
}
if (display) {
// Widget needs to be displayed, but does it actually allows it?
if (widget.getState().isDisplayingValues()) {
if (inUpdatedTemplate) {
// Updated part of an Ajax template: surround with <bu:replace>
startBuReplace(id);
}
} else {