now change listview to take imodel<? extends List<? extends T>>
-igor On Fri, Mar 13, 2009 at 1:00 PM, James Carman <[email protected]> wrote: > Ok, what part are you talking about that doesn't compile? In my IDE > right now, I have: > > public class ListManager<T> extends Panel > { > public ListManager(String id, IModel<List<T>> entries) > { > super(id); > add(new ListView<T>("list", entries) > { > protected void populateItem(ListItem<T> item) > { > > } > }); > } > } > > This all checks out fine. I didn't use the form part because Panel's > getDefaultModelObject() method returns Object, and you can't call > add() on that, so I assumed that was just for illustrative purposes. > > > On Fri, Mar 13, 2009 at 2:57 PM, Igor Vaynberg <[email protected]> > wrote: >> yes, sorry >> >> class listmanager<t> extends panel { >> >> public listmanager(string id, imodel<list<t>> entries) { >> add(new form("form") { onsubmit() { >> listmanager.this.getmodelobject().add(someentry);}} >> add(new listview<t>("list", entries){}); >> >> >> -igor >> >> On Fri, Mar 13, 2009 at 11:51 AM, James Carman >> <[email protected]> wrote: >>> If T is the element type, then you can't use an IModel<T> for the choices. >>> You can't do that with the current API. Did you mean to pass in an >>> IModel<List<T>> to the constructor? >>> >>> On Mar 13, 2009 2:45 PM, "Igor Vaynberg" <[email protected]> wrote: >>> >>> t is the type of a list element, see below >>> >>> class listmanager<t> extends panel { >>> >>> public listmanager(string id, imodel<t> entries) { >>> add(new form("form") { onsubmit() { >>> listmanager.this.getmodelobject().add(someentry);}} >>> add(new listview<t>("list", entries){}); >>> >>> ^ wont compile because you cant assign imodel<t> to imodel<? extends list<? >>> extends t>> so we ha... >>> >>> On Fri, Mar 13, 2009 at 8:59 AM, James Carman <[email protected]> >>> wrote: > T has to be a ... >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
