You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Cyril <cy...@gmail.com> on 2010/02/26 11:38:18 UTC

Same model for ListMultipleChoice and ListView

Hello,

I'm looking for the way to use the same IModel for a
ListMultipleChoice<User> and a ListView<User>.

My model implements IModel<List<User>> because the ListView object needs a
IModel<? extends java.util.List<? extends T>>. But the ListMutipleChoice
needs a IModel<java.util.Collection<T>> model.

I can't use my model with the listMultipleChoice because parameterized types
are invariant, so List<User> don't extends Collection<User>.

Thanks

Re: Same model for ListMultipleChoice and ListView

Posted by James Carman <jc...@carmanconsulting.com>.
That should have been fixed.  We should have probably done IModel<?
extends Collection<T>> when we (I believe I submitted a patch) changed
all the rest of the stuff to take IModel<? extends List<? extends T>>
and stuff.  We could change it without breaking anything.  Widening it
up would only allow it to accept more stuff, so existing code wouldn't
break (but need to be recompiled I guess).  For now, just cast it I
guess.


On Fri, Feb 26, 2010 at 5:38 AM, Cyril <cy...@gmail.com> wrote:
> Hello,
>
> I'm looking for the way to use the same IModel for a
> ListMultipleChoice<User> and a ListView<User>.
>
> My model implements IModel<List<User>> because the ListView object needs a
> IModel<? extends java.util.List<? extends T>>. But the ListMutipleChoice
> needs a IModel<java.util.Collection<T>> model.
>
> I can't use my model with the listMultipleChoice because parameterized types
> are invariant, so List<User> don't extends Collection<User>.
>
> Thanks
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org