use of org.apache.tapestry5.services.ajax.JavaScriptCallback in project tapestry-5 by apache.
the class AlertManagerImpl method addCallbackForAlert.
private void addCallbackForAlert(final Alert alert) {
ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
public void run(JavaScriptSupport javascriptSupport) {
javascriptSupport.require("t5/core/alert").with(alert.toJSON());
}
});
addAlertStorageCleanupCallback();
}
use of org.apache.tapestry5.services.ajax.JavaScriptCallback in project tapestry-5 by apache.
the class AlertManagerImpl method addAlertStorageCleanupCallback.
private void addAlertStorageCleanupCallback() {
if (needAlertStorageCleanup.get(true)) {
ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
public void run(JavaScriptSupport javascriptSupport) {
// In an Ajax request, the Alerts are added, just so that they can be removed if not persistent.
// Again, this is for the rare case where there's a redirect to another page.
getAlertStorage().dismissNonPersistent();
}
});
needAlertStorageCleanup.set(false);
}
}
use of org.apache.tapestry5.services.ajax.JavaScriptCallback 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