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

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

Introduction

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

Prototype

public boolean isMultipart() 

Source Link

Document

Returns whether the form submit is multipart.

Usage

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

License:Apache License

/**
 * /*w w  w.  j  ava 2s .c o  m*/
 * @param component
 * @param attributes
 * @return the attributes as string in JSON format
 */
protected final CharSequence renderAjaxAttributes(final Component component,
        final AjaxRequestAttributes attributes) {
    final JSONObject attributesJson = new JSONObject();

    try {
        attributesJson.put("u", getCallbackUrl());

        appendIfNotEmpty(attributesJson, "f", attributes.getFormId());
        appendBooleanIf(attributesJson, "mp", attributes.isMultipart(), true);
        appendIfNotEmpty(attributesJson, "sc", attributes.getSubmittingComponentName());
        appendIfNotEmpty(attributesJson, "i", findIndicatorId());
        appendListenerAtts(attributesJson, attributes.getAjaxCallListeners());
        appendDynamicExtraParameters(attributes.getDynamicExtraParameters(), attributesJson);
        appendBooleanIf(attributesJson, "async", attributes.isAsynchronous(), false);
        appendBooleanIf(attributesJson, "ad", attributes.isAllowDefault(), true);
        appendBooleanIf(attributesJson, "wr", attributes.isWicketAjaxResponse(), false);

        appendSpecial(attributesJson, attributes);

        final ThrottlingSettings throttlingSettings = attributes.getThrottlingSettings();
        if (throttlingSettings != null) {
            final JSONObject throttlingSettingsJson = new JSONObject();
            throttlingSettingsJson.put("id", throttlingSettings.getId());
            throttlingSettingsJson.put("d", throttlingSettings.getDelay().getMilliseconds());
            appendBooleanIf(throttlingSettingsJson, "p", throttlingSettings.getPostponeTimerOnUpdate(), true);
            attributesJson.put("tr", throttlingSettingsJson);
        }

        postprocessConfiguration(attributesJson, component);
    } catch (JSONException e) {
        throw new WicketRuntimeException(e);
    }

    return attributesJson.toString();
}