[ 
https://issues.apache.org/jira/browse/WICKET-2991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12902639#action_12902639
 ] 

Peter Ertl commented on WICKET-2991:
------------------------------------

I am against that because:

- adding to a NullAjaxRequestTarget will still be an computational overhead
- AjaxRequestTarget is not only about updating components but also about 
invoking javascript on the client side

Just filling a dummy object, then dropping it, is no replacement for correctly 
handing [regular request] vs. [asynchronous request]

@Don: If you want to avoid null checks all the time why not try something like 
that:

public abstract class DonAjaxFallbackLink<T> extends AjaxFallbackLink<T>
{
        protected DonAjaxFallbackLink(String id)
        {
                super(id);
        }

        protected DonAjaxFallbackLink(String id, IModel<T> tiModel)
        {
                super(id, tiModel);
        }

        @Override
        public void onClick(AjaxRequestTarget target)
        {
                if (target == null)
                        onFallbackClick();
                else
                        onAjaxClick(target);
        }

        public abstract void onFallbackClick();

        public abstract void onAjaxClick(AjaxRequestTarget target);
}


> Ajax Fallback LInk should pass a NullAjaxRequestTarget when javascript not 
> supported
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-2991
>                 URL: https://issues.apache.org/jira/browse/WICKET-2991
>             Project: Wicket
>          Issue Type: Improvement
>            Reporter: Don Ferguson
>
> When javascript is not supported, AjaxFallbackLink calls onClick(target) with 
> target = null.  I propose that instead it should pass a NullAjaxRequestTarget 
> whose addComponent() method is a noop (since the whole page is going to be 
> re-rendered anyway).
> This will make it possible to call write the onClick() method without a null 
> check, as in:
>    @Override
>    public void onClick(AjaxRequestTarget target) {
>          target.addComponent(...);
>    }
> rather than always worrying about whether javascript is enabled by the 
> browser, and wrapping a null check around the target,

-- 
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