Example usage for org.apache.wicket.ajax.attributes IAjaxCallListener getBeforeHandler

List of usage examples for org.apache.wicket.ajax.attributes IAjaxCallListener getBeforeHandler

Introduction

In this page you can find the example usage for org.apache.wicket.ajax.attributes IAjaxCallListener getBeforeHandler.

Prototype

default CharSequence getBeforeHandler(Component component) 

Source Link

Document

The JavaScript that will be executed before the Ajax call, as early as possible.

Usage

From source file:com.comcast.cdn.traffic_control.traffic_monitor.wicket.behaviors.AbstractMultiAjaxBehavior.java

License:Apache License

private void appendListenerAtts(final JSONObject attributesJson,
        final List<IAjaxCallListener> ajaxCallListeners) throws JSONException {
    for (IAjaxCallListener ajaxCallListener : ajaxCallListeners) {
        if (ajaxCallListener == null) {
            continue;
        }/*from  ww w .  j  a v a2 s  .co  m*/
        appendListenerHandler(ajaxCallListener.getBeforeHandler(component), attributesJson, "bh", FUNC_STR);
        appendListenerHandler(ajaxCallListener.getBeforeSendHandler(component), attributesJson, "bsh",
                "function(attrs, jqXHR, settings){%s}");
        appendListenerHandler(ajaxCallListener.getAfterHandler(component), attributesJson, "ah", FUNC_STR);
        appendListenerHandler(ajaxCallListener.getSuccessHandler(component), attributesJson, "sh",
                "function(attrs, jqXHR, data, textStatus){%s}");
        appendListenerHandler(ajaxCallListener.getFailureHandler(component), attributesJson, "fh",
                "function(attrs, jqXHR, errorMessage, textStatus){%s}");
        appendListenerHandler(ajaxCallListener.getCompleteHandler(component), attributesJson, "coh",
                "function(attrs, jqXHR, textStatus){%s}");
        appendListenerHandler(ajaxCallListener.getPrecondition(component), attributesJson, "pre", FUNC_STR);
    }
}