using ChoiceRenderer? Eyal Golan [email protected]
Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary On Thu, Aug 20, 2009 at 1:17 AM, Eirik Lygre <[email protected]> wrote: > I'm looking for the best way to implement a drop-down, where the type of > the > model property is not the type of the lists: > > For example, with the model below, I want to implement a drop-down to > select > languages for a user. > > class User { > String languageId; > } > > class Language { > String languageId; > String languageName; > } > > // From MyForm extends Form<User> > // here, this.getModelObject returns a User > // Somewhere in the constructor... > ... > List<Language> languages = getLanguagesFromDatabase(); > form.add (new DropDownChoice("languageDropDown", ...eh...? > ... > > My workaround involves creating a separate model for the language, and copy > from the language model to the user model whenever I use the user model. > But > it's cumbersome... > > 1) Is there a better way? > 2) Is there an established "best practice" for this (probaly common) > scenario? > > > Eirik >
