Working on Wicket frontend for AppFuse I had to implement a drop down
choice of countries. I did it, but don't like the solution and I wonder
if it could be done easier/prettier?

1. In domain model there is a country represented as a String field (a
country code) in an address class. In my Wicket component I wanted to
use a Country class with a code and name. It forced me to create
CountryDropDownChoice component which embed String model into Country
model(with EmbeddedCountryModel):

public class CountryDropDownChoice extends DropDownChoice<Country> {
    public CountryDropDownChoice(String id, PropertyModel<String>
country, Locale locale) {
        super(id, new EmbeddedCountryModel(country, locale), new
CountriesModel(locale), new ChoiceRenderer<>("name", "locale"));

with a call in my panel/fragment:
add(new CountryDropDownChoice("country", new
PropertyModel<String>(getDefaultModel(), "country"), getLocale()));

2. I would like to have country names depending on current user locales.
I don't have access to Session in a model and there for I needed to pass
current locale to both models (they call CountryService implemented as
String bean using given locale). Could it be simplified?

My files:

Thanks in advance

http://blog.solidsoft.info/ - Working code is not enough

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

Reply via email to