use of org.apache.tapestry5.corelib.components.Zone in project tapestry-5 by apache.
the class SingleZonePartialRendererFilter method renderMarkup.
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) {
// the zoneContainer element
writer.end();
// Need to do this Ajax Form-related cleanup here, before we extract the zone content.
ajaxFormUpdateController.cleanupAfterPartialZoneRender();
String zoneUpdateContent = zoneContainer.getChildMarkup();
zoneContainer.remove();
// This has changed a bit in 5.4;
// In 5.3, it was just "zones", and was key/value pairs for id and content.
// In 5.4, it is "content", and is an array of id/content arrays
reply.in(InternalConstants.PARTIAL_KEY).append("content", new JSONArray(zoneId, zoneUpdateContent));
}
});
// Make sure the zone's actual rendering command is processed first, then the inline
// RenderCommand just above.
queue.push(zoneRenderCommand);
}
};
queue.addPartialRenderer(forZone);
renderer.renderMarkup(writer, reply);
}
use of org.apache.tapestry5.corelib.components.Zone in project tapestry-5 by apache.
the class ProgressiveDisplay method beginRender.
Block beginRender(MarkupWriter writer) {
String clientId = jsSupport.allocateClientId(resources);
String elementName = resources.getElementName("div");
writer.element(elementName, "id", clientId, "data-container-type", "zone");
resources.renderInformalParameters(writer);
Link link = resources.createEventLink(EventConstants.ACTION, context);
jsSupport.require("t5/core/zone").invoke("deferredZoneUpdate").with(clientId, link.toURI());
// of the component.
return initial;
}
use of org.apache.tapestry5.corelib.components.Zone in project tapestry-5 by apache.
the class Zone method beginRender.
void beginRender(MarkupWriter writer) {
clientId = resources.isBound("id") ? idParameter : javascriptSupport.allocateClientId(resources);
Element e = writer.element(elementName, "id", clientId, "data-container-type", "zone");
if (simpleIds) {
e.attribute("data-simple-ids", "true");
}
resources.renderInformalParameters(writer);
insideForm = formSupport != null;
if (insideForm) {
JSONObject parameters = new JSONObject(RequestConstants.FORM_CLIENTID_PARAMETER, formSupport.getClientId(), RequestConstants.FORM_COMPONENTID_PARAMETER, formSupport.getFormComponentId());
e.attribute("data-zone-parameters", parameters.toString(compactJSON));
hiddenFieldPositioner = new HiddenFieldPositioner(writer, rules);
actionSink = new ComponentActionSink(logger, clientDataEncoder);
environment.push(FormSupport.class, new FormSupportAdapter(formSupport) {
@Override
public <T> void store(T component, ComponentAction<T> action) {
actionSink.store(component, action);
}
@Override
public <T> void storeCancel(T component, ComponentAction<T> action) {
actionSink.storeCancel(component, action);
}
@Override
public <T> void storeAndExecute(T component, ComponentAction<T> action) {
store(component, action);
action.execute(component);
}
});
}
heartbeat.begin();
}
use of org.apache.tapestry5.corelib.components.Zone in project tapestry-5 by apache.
the class AbstractComponentEventLink method beginRender.
void beginRender(MarkupWriter writer) {
if (isDisabled())
return;
Link link = createLink(context);
writeLink(writer, link);
writer.attributes("data-update-zone", zone);
if (async) {
javaScriptSupport.require("t5/core/zone");
writer.attributes("data-async-trigger", true);
}
}
use of org.apache.tapestry5.corelib.components.Zone in project tapestry-5 by apache.
the class Select method beginRender.
void beginRender(MarkupWriter writer) {
writer.element("select", "name", getControlName(), "id", getClientId(), "class", cssClass);
putPropertyNameIntoBeanValidationContext("value");
validate.render(writer);
removePropertyNameFromBeanValidationContext();
resources.renderInformalParameters(writer);
decorateInsideField();
if (this.zone != null) {
javaScriptSupport.require("t5/core/select");
Link link = resources.createEventLink(CHANGE_EVENT, context);
writer.attributes("data-update-zone", zone, "data-update-url", link);
}
}
Aggregations