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

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

Introduction

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

Prototype

public ThrottlingSettings(final String id, final Duration delay) 

Source Link

Document

Construct.

Usage

From source file:com.gmail.volodymyrdotsenko.jqxwicket.core.ajax.JQueryAjaxBehavior.java

License:Apache License

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
    super.updateAjaxAttributes(attributes);

    if (this.duration != Duration.NONE) {
        attributes.setThrottlingSettings(new ThrottlingSettings("jquery-throttle", this.duration));
    }// w  w w .j ava  2 s  .  co  m
}

From source file:org.efaps.ui.wicket.components.split.AjaxStorePositionBehavior.java

License:Apache License

@Override
protected void updateAjaxAttributes(final AjaxRequestAttributes _attributes) {
    super.updateAjaxAttributes(_attributes);
    _attributes.setThrottlingSettings(new ThrottlingSettings("storeThrottel", Duration.seconds(2)));
    _attributes.setMethod(Method.POST);
}

From source file:org.hippoecm.frontend.widgets.AjaxUpdatingWidget.java

License:Apache License

/**
 * Adds an ajax updating form component//from   ww  w. j  a  va2s  . co  m
 */
protected void addFormField(final FormComponent<T> component) {
    add(formComponent = component);
    component.setOutputMarkupId(true);
    if (throttleDelay == null) {
        component.add(new AjaxFormComponentUpdatingBehavior("onChange") {

            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                AjaxUpdatingWidget.this.onUpdate(target);
            }
        });
    } else {
        component.add(new OnChangeAjaxBehavior() {

            @Override
            protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
                super.updateAjaxAttributes(attributes);
                attributes
                        .setThrottlingSettings(new ThrottlingSettings(component.getMarkupId(), throttleDelay));
            }

            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                AjaxUpdatingWidget.this.onUpdate(target);
            }

        });
    }
}

From source file:org.hippoecm.frontend.widgets.NameUriField.java

License:Apache License

private FormComponent<String> createNameComponent() {
    final FormComponent<String> newNameComponent = new TextField<>("name", nameModel);
    newNameComponent.setRequired(true);// w  w w.j ava2  s  .c o  m
    newNameComponent.add(new OnChangeAjaxBehavior() {

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            if (!urlIsEditable) {
                // the value of the url field is controlled by the name value, redraw when name changes
                target.add(urlComponent);
            }
        }

        @Override
        protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
            super.updateAjaxAttributes(attributes);
            attributes.setChannel(ajaxChannel);
            attributes
                    .setThrottlingSettings(new ThrottlingSettings(getPath(), NAME_COMPONENT_THROTTLE_DURATION));
        }
    });
    newNameComponent.setOutputMarkupId(true);
    return newNameComponent;
}

From source file:org.onexus.ui.api.wizards.AbstractNewResourceWizard.java

License:Apache License

protected RequiredTextField<String> getFieldResourceName() {
    final RequiredTextField<String> resourceName = new RequiredTextField<String>("resource.label");
    resourceName.setOutputMarkupId(true);
    resourceName.add(new PatternValidator("[\\w-.\\+]*"));
    resourceName.add(new DuplicatedResourceValidator());

    resourceName.add(new AjaxFormValidatingBehavior(getForm(), "onchange") {
        @Override/*ww  w . j a v a  2 s  . com*/
        protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
            super.updateAjaxAttributes(attributes);

            String id = "throttle-" + resourceName.getMarkupId();
            ThrottlingSettings throttlingSettings = new ThrottlingSettings(id, Duration.seconds(1));
            attributes.setThrottlingSettings(throttlingSettings);
        }
    });

    return resourceName;
}