Placeholder image for AJAX indicator in IndicatingAjaxButton
------------------------------------------------------------

                 Key: WICKET-2940
                 URL: https://issues.apache.org/jira/browse/WICKET-2940
             Project: Wicket
          Issue Type: Improvement
          Components: wicket
    Affects Versions: 1.4.9
            Reporter: Pierre Wargnier


The current IndicatingAjaxButton has a indicator that is set visible when AJAX 
is running. This usually breaks the HTML. A solution given by other frameworks 
like RichFaces is to have a "blank image" of the same size that is visible when 
AJAX is not running. This function can be optional because it adds mode HTML.

I managed to implement this (but the original Wicket AJAX author will find 
cleaner ways to do it):
1) I overloaded AjaxIndicatorAppender.onRendered to add another <span> with the 
blank image. The ID is the same as the indicator + "blank".
2) I created interface IAjaxIndicatorAware2 extending IAjaxIndicatorAware and I 
made a IndicatingAjaxButton implementing this interface.
3) I modified AjaxButton.generateCallbackScript like this:

On line 157:
boolean blankIndicator = getComponent() instanceof IAjaxIndicatorAware2; //to 
test if the component has a placeholder

One line 169:
if(blankIndicator){
        hide += "wicketShow('" + indicatorId + 
IAjaxIndicatorAware2.BLANK_SUFFIX + "');";
}

On line 213:
StringBuilder sb = new 
StringBuilder("wicketShow('").append(indicatorId).append("');");
if(blankIndicator){
        
sb.append("wicketHide('").append(indicatorId).append(IAjaxIndicatorAware2.BLANK_SUFFIX).append("');");
}       
sb.append(call);



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to