Example usage for org.apache.wicket.ajax.attributes ThrottlingSettings getPostponeTimerOnUpdate

List of usage examples for org.apache.wicket.ajax.attributes ThrottlingSettings getPostponeTimerOnUpdate

Introduction

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

Prototype

public boolean getPostponeTimerOnUpdate() 

Source Link

Document

If it is set to true, then the timer is reset each time the throttle function gets called.

Usage

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

License:Apache License

/**
 * /*w  w  w  . j a v  a 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();
}