this.queue = queue;
}
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 menumonic
// element name and attribute just to help with debugging (the element itself is discarded).
final Element zoneContainer = writer.element("zone-update", "zoneId", zoneId);
queue.push(new RenderCommand()
{
public void render(MarkupWriter writer, RenderQueue queue)
{
writer.end(); // the zoneContainer element
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);
}