Okay, thanks.  That's helpful.

I should be able to translate to 1.4 from what's in the book much more
easily now.

I really appreciate the help.

Andy

On Thu, Oct 15, 2009 at 4:36 PM, Jeremy Thomerson
<jer...@wickettraining.com> wrote:
> getDefaultModel still requires a cast - that was the direct migration.
> getModel was then added back in to "genericized" components.  So, where you
> want to use generics, you must use the getModel variation.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Thu, Oct 15, 2009 at 5:30 PM, Andrig T. Miller <andrig.t.mil...@gmail.com
>> wrote:
>
>> Ah, thanks, that did the trick.
>>
>> The migration guide says to use getDefaultModel instead of getModel,
>> but I guess that's not true all the time.
>>
>> Andy
>>
>> On Thu, Oct 15, 2009 at 4:26 PM, Jeremy Thomerson
>> <jer...@wickettraining.com> wrote:
>> > Ah, yes - sorry I missed it.  There are a couple of errors.
>> >
>> > 1 - change your Cheese cheese = (Cheese) line (see below)
>> > 2 - change getDefaultModel to getModel - the generic version of the
>> method
>> >
>> >    public Index() {
>> >
>> >        add(new ListView<Cheese>("cheeses", getCheeses()) {
>> >
>> >            private static final long serialVersionUID =
>> > -6160450216067455300L;
>> >
>> >           �...@override
>> >            protected void populateItem(ListItem<Cheese> item) {
>> >
>> >                Cheese cheese = item.getModelObject();
>> >
>> >                item.add(new Label("name", cheese.getName()));
>> >                item.add(new Label("description",
>> cheese.getDescription()));
>> >                item.add(new Label("price", "$" + cheese.getName()));
>> >                item.add(new Link<Cheese>("add", item.getModel()) {
>> >
>> >                    private static final long serialVersionUID =
>> > 3724016761964076585L;
>> >
>> >                   �...@override
>> >                    public void onClick() {
>> >                        Cheese selected = getModelObject();
>> >                        getCart().getCheeses().add(selected);
>> >                    }
>> >                });
>> >            }
>> >        });
>> >
>> >    }
>> >
>> >
>> > --
>> > Jeremy Thomerson
>> > http://www.wickettraining.com
>> >
>> >
>> >
>> > On Thu, Oct 15, 2009 at 5:17 PM, Andrig T. Miller <
>> andrig.t.mil...@gmail.com
>> >> wrote:
>> >
>> >>
>> >>        public Index() {
>> >>
>> >>                add(new ListView<Cheese>("cheeses", getCheeses()) {
>> >>
>> >>                        private static final long serialVersionUID =
>> >> -6160450216067455300L;
>> >>
>> >>                       �...@override
>> >>                        protected void populateItem(ListItem<Cheese>
>> item) {
>> >>
>> >>                                Cheese cheese = (Cheese)
>> >> getDefaultModelObject();
>> >>
>> >>                                item.add(new Label("name",
>> >> cheese.getName()));
>> >>                                item.add(new Label("description",
>> >> cheese.getDescription()));
>> >>                                item.add(new Label("price", "$" +
>> >> cheese.getPrice()));
>> >>                                item.add(new Link<Cheese>("add",
>> >> item.getDefaultModel()) {
>> >>
>> >>                                        private static final long
>> >> serialVersionUID = 3724016761964076585L;
>> >>
>> >>                                       �...@override
>> >>                                        public void onClick() {
>> >>
>> >>                                                Cheese selected =
>> (Cheese)
>> >> getDefaultModelObject();
>> >>
>> >>  getCart().getCheeses().add(selected);
>> >>
>> >>                                        }
>> >>                                });
>> >>                        }
>> >>                });
>> >>
>> >>        }
>> >
>>
>

Reply via email to