Search in sources :

Example 1 with JavaScriptCallback

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();
}
Also used : JavaScriptSupport(org.apache.tapestry5.services.javascript.JavaScriptSupport) JavaScriptCallback(org.apache.tapestry5.services.ajax.JavaScriptCallback)

Example 2 with JavaScriptCallback

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);
    }
}
Also used : JavaScriptSupport(org.apache.tapestry5.services.javascript.JavaScriptSupport) JavaScriptCallback(org.apache.tapestry5.services.ajax.JavaScriptCallback)

Example 3 with JavaScriptCallback

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);
}
Also used : JavaScriptSupport(org.apache.tapestry5.services.javascript.JavaScriptSupport) MultiZoneUpdate(org.apache.tapestry5.ajax.MultiZoneUpdate) JavaScriptCallback(org.apache.tapestry5.services.ajax.JavaScriptCallback)

Aggregations

JavaScriptCallback (org.apache.tapestry5.services.ajax.JavaScriptCallback)3 JavaScriptSupport (org.apache.tapestry5.services.javascript.JavaScriptSupport)3 MultiZoneUpdate (org.apache.tapestry5.ajax.MultiZoneUpdate)1