Example usage for org.apache.wicket.ajax.attributes AjaxRequestAttributes getEventNames

List of usage examples for org.apache.wicket.ajax.attributes AjaxRequestAttributes getEventNames

Introduction

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

Prototype

public String[] getEventNames() 

Source Link

Usage

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

License:Apache License

private void appendSpecial(final JSONObject attributesJson, final AjaxRequestAttributes attributes)
        throws JSONException {
    final Method method = attributes.getMethod();
    if (Method.POST == method) {
        attributesJson.put("m", method);
    }/*from  w  w  w .j a va2s . c  o m*/
    if (component instanceof Page == false) {
        final String componentId = component.getMarkupId();
        attributesJson.put("c", componentId);
    }
    final JSONArray extraParameters = JsonUtils.asArray(attributes.getExtraParameters());
    if (extraParameters.length() > 0) {
        attributesJson.put("ep", extraParameters);
    }

    final String[] eventNames = attributes.getEventNames();
    if (eventNames.length == 1) {
        attributesJson.put("e", eventNames[0]);
    } else {
        for (String eventName : eventNames) {
            attributesJson.append("e", eventName);
        }
    }
    final AjaxChannel channel = attributes.getChannel();
    if (channel != null) {
        attributesJson.put("ch", channel);
    }
    final Duration requestTimeout = attributes.getRequestTimeout();
    if (requestTimeout != null) {
        attributesJson.put("rt", requestTimeout.getMilliseconds());
    }
    final String dataType = attributes.getDataType();
    if (AjaxRequestAttributes.XML_DATA_TYPE.equals(dataType) == false) {
        attributesJson.put("dt", dataType);
    }
}