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

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

2014-02-11 Thread Bruce Lombardi
To make this easier to understand, let's say that I have a list of state abbreviations for example AL, AK, AZ, AR etcetera (the actual example has two letter abbreviations also, but much longer names). I need a DropDownChoice that shows the abbreviations for selection (e.g., AK) but will show the

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