You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Sven Meier <sv...@meiers.net> on 2016/06/17 18:17:12 UTC

AjaxButton#onXXX(AjaxRequestTarget, Form)

Hi,

AjaxButton's hook method currently get the form as second argument:

     protected void onSubmit(AjaxRequestTarget target, Form<?> form)
     protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form)
     protected void onError(AjaxRequestTarget target, Form<?> form)

Would anyone be missing them, if we'd remove the argument in 8.x?

     protected void onSubmit(AjaxRequestTarget target)
     protected void onAfterSubmit(AjaxRequestTarget target)
     protected void onError(AjaxRequestTarget target)

AFAIKS subclasses of AjaxButton can just call #getForm() to get hold of 
the submitted form.

This would bring these methods in line with the new lambda factories 
(which don't have a Form argument):

     public static AjaxButton onSubmit(String id, 
WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit)
     public static AjaxButton onSubmit(String id,
WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit,
WicketBiConsumer<AjaxButton, AjaxRequestTarget> onError)

Or perhaps this isn't worth an API break - WDYT?

Have fun
Sven

Re: AjaxButton#onXXX(AjaxRequestTarget, Form)

Posted by Martin Grigorov <mg...@apache.org>.
What about adding lambda methods to Button? As with Link
On Jun 17, 2016 8:43 PM, "Martin Grigorov" <ma...@gmail.com>
wrote:

> +1 to remove the Form as a parameter
>
> I have never needed to use it in my applications
> On Jun 17, 2016 8:17 PM, "Sven Meier" <sv...@meiers.net> wrote:
>
>> Hi,
>>
>> AjaxButton's hook method currently get the form as second argument:
>>
>>     protected void onSubmit(AjaxRequestTarget target, Form<?> form)
>>     protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form)
>>     protected void onError(AjaxRequestTarget target, Form<?> form)
>>
>> Would anyone be missing them, if we'd remove the argument in 8.x?
>>
>>     protected void onSubmit(AjaxRequestTarget target)
>>     protected void onAfterSubmit(AjaxRequestTarget target)
>>     protected void onError(AjaxRequestTarget target)
>>
>> AFAIKS subclasses of AjaxButton can just call #getForm() to get hold of
>> the submitted form.
>>
>> This would bring these methods in line with the new lambda factories
>> (which don't have a Form argument):
>>
>>     public static AjaxButton onSubmit(String id,
>> WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit)
>>     public static AjaxButton onSubmit(String id,
>> WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit,
>> WicketBiConsumer<AjaxButton, AjaxRequestTarget> onError)
>>
>> Or perhaps this isn't worth an API break - WDYT?
>>
>> Have fun
>> Sven
>>
>

Re: AjaxButton#onXXX(AjaxRequestTarget, Form)

Posted by Martin Grigorov <ma...@gmail.com>.
+1 to remove the Form as a parameter

I have never needed to use it in my applications
On Jun 17, 2016 8:17 PM, "Sven Meier" <sv...@meiers.net> wrote:

> Hi,
>
> AjaxButton's hook method currently get the form as second argument:
>
>     protected void onSubmit(AjaxRequestTarget target, Form<?> form)
>     protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form)
>     protected void onError(AjaxRequestTarget target, Form<?> form)
>
> Would anyone be missing them, if we'd remove the argument in 8.x?
>
>     protected void onSubmit(AjaxRequestTarget target)
>     protected void onAfterSubmit(AjaxRequestTarget target)
>     protected void onError(AjaxRequestTarget target)
>
> AFAIKS subclasses of AjaxButton can just call #getForm() to get hold of
> the submitted form.
>
> This would bring these methods in line with the new lambda factories
> (which don't have a Form argument):
>
>     public static AjaxButton onSubmit(String id,
> WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit)
>     public static AjaxButton onSubmit(String id,
> WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit,
> WicketBiConsumer<AjaxButton, AjaxRequestTarget> onError)
>
> Or perhaps this isn't worth an API break - WDYT?
>
> Have fun
> Sven
>

Re: AjaxButton#onXXX(AjaxRequestTarget, Form)

Posted by Martijn Dashorst <ma...@gmail.com>.
The whole idea of a major release is to break API. Making something
more consistent is a rather good use case.

+1

Martijn


On Fri, Jun 17, 2016 at 8:17 PM, Sven Meier <sv...@meiers.net> wrote:
> Hi,
>
> AjaxButton's hook method currently get the form as second argument:
>
>     protected void onSubmit(AjaxRequestTarget target, Form<?> form)
>     protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form)
>     protected void onError(AjaxRequestTarget target, Form<?> form)
>
> Would anyone be missing them, if we'd remove the argument in 8.x?
>
>     protected void onSubmit(AjaxRequestTarget target)
>     protected void onAfterSubmit(AjaxRequestTarget target)
>     protected void onError(AjaxRequestTarget target)
>
> AFAIKS subclasses of AjaxButton can just call #getForm() to get hold of the
> submitted form.
>
> This would bring these methods in line with the new lambda factories (which
> don't have a Form argument):
>
>     public static AjaxButton onSubmit(String id,
> WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit)
>     public static AjaxButton onSubmit(String id,
> WicketBiConsumer<AjaxButton, AjaxRequestTarget> onSubmit,
> WicketBiConsumer<AjaxButton, AjaxRequestTarget> onError)
>
> Or perhaps this isn't worth an API break - WDYT?
>
> Have fun
> Sven



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com