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 full name as a tooltip whenever the mouse hovers over one of the choice (e.g., AK shows Alaska).
I have developed a solution that is based on the example presented here: http://stackoverflow.com/questions/12234738/wicket-dropdownchoice-titles-too ltips-for-options that develops a subclass of DropDownChoice and overrides appendOptionHtml to append a "title" to the buffer. My class takes a StateDisplay object as its model, and the model has two fields, an "id" that is displayed in the list, and a "fullName" which is added as the title by the appendOptionHtml method. This works fine for displaying thedropdown with the tooltip, but the problem is that the model is a complex object( StateDisplay) with two fields, but the underlying domain object needs a simple String with the state ID. Prior to implementing the tooltip, the DrowdownChoice was formed using: Item.add(new DropDownChoice<String>("state", new PropertyModel<String>((CompanyDTO) item.getDefaultModelObject(), "state"), stateList))); Note: "item "is there because this is used in the populateItem method of a ListView. Now the code is: Model< StateDisplay > selectedState = new Model<>(); ChoiceRenderer<StateDisplay> choiceRenderer = new ChoiceRenderer<ModifierDisplayDto>("id", "id"); Item.add(new StateDropDownChoice< StateDisplay >("state", selectedState, stateList, choiceRenderer)); After the selection is made the model (selectedState) is set to the chosen StateDisplay, but there is no easy way to the simple String value set on the CompanyDTO. How can I make the dropdown selection update the domain model's simple String. Thanks Bruce