I guess I prefer the convention of changing the mouse pointer to
"busy" rather than putting a little throbber by the link for two
reasons:
1. the throbber risks messing with the layout of the page
2. Changing the cursor has a much longer history as a UI convention
for computer busyness

Now Firefox was already changing the cursor for Ajax operations for
some cases, but it was inconsistent,
I think this small class deals with that:

/**
 * AjaxFallbackLink that changes mouse pointer to "progress" (i.e.
busy) during Ajax operations
 * for the link itself (in case the pointer is still hovering over it)
and the whole document
 * (if the pointer has been moved)
 *
 */
public abstract class ProgressPointerAjaxFallbackLink extends AjaxFallbackLink {
    public ProgressPointerAjaxFallbackLink(final String id) {
        this(id, null);
    }
    public ProgressPointerAjaxFallbackLink(final String id, final IModel model){
        super(id, model);
    }
    @Override
    protected IAjaxCallDecorator getAjaxCallDecorator() {
        return new AjaxCallDecorator(){
            private static final long serialVersionUID = 1L;
            public CharSequence decorateScript(CharSequence pScript) {
                return
"this.style.cursor='progress';document.body.style.cursor='progress';"+pScript;
            }

            public CharSequence decorateOnSuccessScript(CharSequence pScript) {
                return
"this.style.cursor='pointer';document.body.style.cursor='auto';"+pScript;
            }

            public CharSequence decorateOnFailureScript(CharSequence pScript) {
                return
"this.style.cursor='pointer';document.body.style.cursor='auto';"+pScript;
            }
        };
    }
}


"ProgressPointerAjaxFallbackLink" is more concise but probably less
readable than my coworker's suggestion "BusyCursorAjaxFallbackLink".
Actually I might switch to the latter.

Feedback to this approach and/or implementation welcome.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to