Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package de.agilecoders.wicket.core.markup.html.bootstrap.button;
 
 
import static de.agilecoders.wicket.core.markup.html.bootstrap.button.ButtonJqueryFunction.button;
import static de.agilecoders.wicket.jquery.JQuery.$;

A LoadingBehavior that deactivates a button and shows a loading message.

Author(s):
miha
    private final IModel<Stringmodel;
    private Component component;

    
Construct.

Parameters:
model The loading message
    public LoadingBehavior(IModel<Stringmodel) {
        this. = model;
    }
    @Override
    public void onComponentTag(Component componentComponentTag tag) {
        super.onComponentTag(componenttag);
        tag.put("onclick"$(component).chain(button("loading")).get());
        tag.put("data-loading-text".getObject());
    }
    @Override
    public void bind(Component component) {
        super.bind(component);
        component.setOutputMarkupId(true);
        this. = component;
    }
    @Override
    public void unbind(Component component) {
        super.unbind(component);
        this. = null;
    }
    @Override
    public void detach(Component component) {
        super.detach(component);
        .detach();
    }

    
appends a javascript that resets the loading state.

Parameters:
component The button component
ajaxRequestTarget The org.apache.wicket.ajax.AjaxRequestTarget
    public static void reset(final Component componentfinal AjaxRequestTarget ajaxRequestTarget) {
        Args.notNull(component"component");
        Args.notNull(ajaxRequestTarget"ajaxRequestTarget");
        ajaxRequestTarget.appendJavaScript($(component).chain(button("reset")).get());
    }

    
appends a javascript that resets the loading state.

Parameters:
ajaxRequestTarget The org.apache.wicket.ajax.AjaxRequestTarget
    public void reset(final AjaxRequestTarget ajaxRequestTarget) {
        if ( != null) {
            reset(ajaxRequestTarget);
        }
    }
New to GrepCode? Check out our FAQ X