You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gohan <ha...@gmail.com> on 2009/01/13 11:10:37 UTC

PropertyModel that add/read element from collection

Hi, 

Is there a good way to add an element to a collection using a PropertyModel?
What I'd like to do is this: 
..
form.add(new DefaultValueDropDownChoice("id, new PropertyModel(model,
"categories"), jobTypes));
..

This obviously doesn't work since "categories" is mapped to a java.util.Set.

/Johan
-- 
View this message in context: http://www.nabble.com/PropertyModel-that-add-read-element-from-collection-tp21432582p21432582.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: PropertyModel that add/read element from collection

Posted by Gohan <ha...@gmail.com>.
Well it doesn't work for me, but mabey I'm doing something wrong.
"categories" in my case is a set of Strings and the result/value selected
from the DropDownChoice is a String and not a Set. Wicket says that it
cannot find method "setCategories" which is reasonable because there's no
such method and even if there were that's not the method I'd like to call.
Add like to call the add method of the Set itself.

-- 
View this message in context: http://www.nabble.com/PropertyModel-that-add-read-element-from-collection-tp21432582p21433055.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: PropertyModel that add/read element from collection

Posted by Michael Sparer <mi...@gmx.at>.
sure about that? did you try it?
I'm using the Palette component exactly that way (also backed with a Set)
and it just works

regards,
Michael


Gohan wrote:
> 
> Hi, 
> 
> Is there a good way to add an element to a collection using a
> PropertyModel? What I'd like to do is this: 
> ..
> form.add(new DefaultValueDropDownChoice("id, new PropertyModel(model,
> "categories"), jobTypes));
> ..
> 
> This obviously doesn't work since "categories" is mapped to a
> java.util.Set.
> 
> /Johan
> 


-----
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: http://www.nabble.com/PropertyModel-that-add-read-element-from-collection-tp21432582p21432878.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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