this.ajaxFormUpdateController = ajaxFormUpdateController;
}
public void renderMarkup(MarkupWriter writer, final JSONObject reply, PartialMarkupRenderer renderer)
{
RenderCommand forZone = new RenderCommand()
{
public void render(MarkupWriter writer, RenderQueue queue)
{
// Create an element to contain the content for the zone. We give it a mnemonic
// element name and attribute just to help with debugging (the element itself is discarded).
final Element zoneContainer = writer.element("zone-update", "zoneId", zoneId);
ajaxFormUpdateController.setupBeforePartialZoneRender(writer);
queue.push(new RenderCommand()
{
public void render(MarkupWriter writer, RenderQueue queue)
{
writer.end(); // the zoneContainer element
// Need to do this Ajax Form-related cleanup here, before we extract the zone content.
ajaxFormUpdateController.cleanupAfterPartialZoneRender();
String zoneUpdateContent = zoneContainer.getChildMarkup();
zoneContainer.remove();
reply.getJSONObject("zones").put(zoneId, zoneUpdateContent);
}
});
// Make sure the zone's actual rendering command is processed first, then the inline
// RenderCommand just above.
queue.push(zoneRenderCommand);
}
};
RenderCommand existing = queue.getRootRenderCommand();
queue.initializeForPartialPageRender(new CombinedRenderCommand(existing, forZone));
renderer.renderMarkup(writer, reply);
}