Wouldn't it be nice to have 

        class AjaxButton<T,F> {

                T getModelObject();

                onSubmit(AjaxRequestTarget target, Form<F> form)
        }

Of course only if Components will still be generic. I think this is a nice case 
where Generic Components make sense.

Stefan

-----Ursprüngliche Nachricht-----
Von: Igor Vaynberg [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 23. Juni 2008 06:41
An: [email protected]
Betreff: Re: Wicket 1.4: AjaxButton inconsitency

the types of form and button do not have to correlate. furthremore the model of 
the button dictates the value attribute, so it should really be class 
ajaxbutton extends button<string>

-igor

On Sun, Jun 22, 2008 at 2:18 PM, Stefan Lindner <[EMAIL PROTECTED]> wrote:
> Yes, I know that the wicket developers are rethinking Generics. But I 
> think the current 1.4M2 implementation of AjaxButton is not very 
> helpful. The AjaxButton componet is the replacement for 
> AjaxsubmitButton (written down in the JavaDoc).
>
> Now I have a Form
>
>        MyForm<X> {
>           ...
>           new AjaxButon<X> {
>              onSubmit(AjaxRequestTarget target, Form<?> form) {
>              }
>           }
>        }
>
> Why is the Form in the onSubmit method marked as <?> ? Why is the 
> method in the M2 implementation
>
>        public abstract class AjaxButton<T> extends Button<T> {
>           ...
>           public AjaxButton(String id, final Form< ? > form)
>           ...
>        }
>
> Should the implementaion not be
>
>        public abstract class AjaxButton<T> extends Button<T> {
>           ...
>           public AjaxButton(String id, final Form<T> form)
>           ...
>         onSubmit(AjaxRequestTarget target, Form<?> form)
>           ...
>        }
>
> so that the onSubmit method can be overrritten like
>
>        @Override
>        onSubmit(AjaxRequestTarget target, Form<X> form) {
>           X modelObject = form.getModelObject();
>        }
>
> Currently the situation is
>
>        @Override
>        onSubmit(AjaxRequestTarget target, Form<?> form) {
>           Object modelObject = form.getModelObject();
>        }
>
> and a typecat is needed.
>
> Stefan
>

Reply via email to