Re: DropDownChoice and generics

2010-09-02 Thread bht
Hi,

IModel personModel = getPersonModel();

List genders = getGenderList();

DropDownChoice dropDownChoiceGender = new 
DropDownChoice("genderFieldId", new PropertyModel(personModel,
"gender"), genderList);

Regards,

Bernard


On Thu, 2 Sep 2010 10:02:27 +0300, you wrote:

>Hello,
>the generics solution for the DropdownChoice is weird in my opinion.
>
>I want to write like this:
>
>List genders = getGenderList();
>DropdownChoice new DropDownChoice("fieldId", new
>PropertyModel(currentPerson, "gender"), genders);
>
>But the compilation fails because of the mismatch between generics.
>Actually how to solve such situations? Wicket's generic's are quite
>weird in my opinion and I cannot understand them probably correctly...
>
>I want to assign object(in my case Gender to Person) from the list via
>PropertyModel to my object but cannot understand, how to do it. Did
>not find even any examples from the manual.
>
>Sigmar
>
>-
>To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>For additional commands, e-mail: users-h...@wicket.apache.org


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



Re: DropDownChoice and generics

2010-09-02 Thread Wilhelmsen Tor Iver
> List genders = getGenderList();
> DropdownChoice new DropDownChoice("fieldId", new
> PropertyModel(currentPerson, "gender"), genders);

The class type parameter for the dropdown and models there should be Gender: 
That the model delegates to a property in a Person object should not matter.

List genders = getGenderList();
DropdownChoice new DropDownChoice("fieldId", new
PropertyModel(currentPerson, "gender"), genders);

> I want to assign object(in my case Gender to Person

No, you want to set a Gender property in a Person object. But that the 
PropertyModel uses a Person object is not something the dropdown really cares 
about.

- Tor Iver


DropDownChoice and generics

2010-09-02 Thread Sigmar Muuga
Hello,
the generics solution for the DropdownChoice is weird in my opinion.

I want to write like this:

List genders = getGenderList();
DropdownChoice new DropDownChoice("fieldId", new
PropertyModel(currentPerson, "gender"), genders);

But the compilation fails because of the mismatch between generics.
Actually how to solve such situations? Wicket's generic's are quite
weird in my opinion and I cannot understand them probably correctly...

I want to assign object(in my case Gender to Person) from the list via
PropertyModel to my object but cannot understand, how to do it. Did
not find even any examples from the manual.

Sigmar

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