use of org.apache.tapestry5.ajax.MultiZoneUpdate in project tapestry-5 by apache.
the class MultiZoneUpdateInsideForm method onValueChangedFromSelectValue1.
@Log
public Object onValueChangedFromSelectValue1(SelectObj selectObj, Integer integer, RetentionPolicy retentionPolicy) {
final String suffix = String.format(", number %03d, retention policy %s", integer, retentionPolicy);
List<SelectObj> select2List = new ArrayList();
select2List.add(new SelectObj(4, "4 post ajax" + suffix));
select2List.add(new SelectObj(5, "5 post ajax" + suffix));
select2List.add(new SelectObj(6, "6 post ajax" + suffix));
select2List.add(new SelectObj(7, "7 post ajax" + suffix));
select2Model = new SelectObjModel(select2List);
if (request.isXHR()) {
return new MultiZoneUpdate("select1ValueZone", select1ValueZone.getBody()).add("select2ValueZone", select2ValueZone.getBody());
} else {
return this;
}
}
use of org.apache.tapestry5.ajax.MultiZoneUpdate in project tapestry-5 by apache.
the class MultiZoneUpdateEventResultProcessor method processResultValue.
public void processResultValue(final MultiZoneUpdate value) throws IOException {
Map<String, Object> map = value.getZoneToRenderMap();
for (String zoneId : map.keySet()) {
Object provided = map.get(zoneId);
// The AjaxResponseRenderer will convert the object to a RenderCommand, but does nothing special if there's a failure
// (because the stack trace will clearly identify what's going on). We do the conversion here so that we can relate
// a failure to a zone id. It will just be a pass-thru on the second type coercion.
RenderCommand zoneRenderCommand = toRenderer(zoneId, provided);
ajaxResponseRenderer.addRender(zoneId, zoneRenderCommand);
}
// This is actually executed deferred:
partialRenderer.renderPartialPageMarkup();
}
use of org.apache.tapestry5.ajax.MultiZoneUpdate in project tapestry-5 by apache.
the class MultiZoneUpdateDemo method onActionFromUpdate.
Object onActionFromUpdate() {
wilmaMessage = "His Wife, Wilma.";
// Do one the new way
ajaxResponseRenderer.addRender("fred", fredBlock);
ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
public void run(JavaScriptSupport javascriptSupport) {
javascriptSupport.require("app/multi-zone-update").with("message", "Updated");
}
});
return new MultiZoneUpdate("barney", barneyBlock).add("dino", "His dog, Dino.").add(wilmaZone);
}
Aggregations