Re: How to make a Wiket DropDownChoice with complex a model return a simple String

2014-02-13 Thread Andrea Del Bene
Your welcome! I will try to publish this snippet somewhere in the guide. Thanks Andrea, I was trying what you sent in your previous message and I was having trouble figuring out how to get the value set on the target property model. Your code here, especially this line:

Re: How to make a Wiket DropDownChoice with complex a model return a simple String

2014-02-12 Thread Andrea Del Bene
Here is some code of a possible solution: public class DropDownChoiceForStringT extends DropDownChoiceT { private IModelString targetModel; public DropDownChoiceForString(String id, IModelT model, IModelString targetModel, List? extends T choices, IChoiceRenderer? super T

RE: How to make a Wiket DropDownChoice with complex a model return a simple String

2014-02-12 Thread Bruce Lombardi
Thanks Andrea, I was trying what you sent in your previous message and I was having trouble figuring out how to get the value set on the target property model. Your code here, especially this line: targetModel.setObject(getChoiceRenderer().getIdValue(newSelection, choiceIndex)); was

Re: How to make a Wiket DropDownChoice with complex a model return a simple String

2014-02-11 Thread Andrea Del Bene
Hi, I needed something similar in a couple of projects. One solution is to create a custom DropDownChoice which takes also the string model to update. Then you can override onModelChanged to update the string model with the new value that can be extracted with the ChoiceRenderer. To make