ok, I see where you're going with this.
very cool.
My enum is in a helper class and I started writing conversion methods in the
helper class. But I like the way you wrapped your conversion methods
in a class to use on the Page class.
I also gave some thought last night to using a MapInteger,
Greetings,
I am trying to take the value (only) of a DropDownChoice
and put it in a model set on the Form.
Ideally, I'd like to use a (java 5) enum, but any type of
name value pair will work.
For example, if I'm trying to set the size of a Shirt class,
here is my Shirt, and a sample enum:
IChoiceRenderer allows you to specify the id and display values for a
DropDownChoice. It's exactly what you're looking for. To explain a bit:
getDisplayValue(...) - returns the value you want the user to see. Small,
Medium, etc. This is where you'd return SIZE.getName().
getIdValue(...)
I tried this:
DropDownChoice severityChoice = new
DropDownChoice(size,
Arrays.asList(SIZE.values()),
new ChoiceRenderer()
{
public Object
Can I see a bit more of your code? What you've posted looks good, so it's
possible something else is causing the problem.
You could try ##wicket on Freenode for more help.
On 12/30/06, Flavius [EMAIL PROTECTED] wrote:
I tried this:
DropDownChoice severityChoice =
you are passing a list of enum objects into the list model of the dropdown
choice, that means the one selected object out of that list - of type enum -
will be set into the model object.
so there are two ways to do this
you can pass in a list of ints into the choice component, that way the
not sure what's wrong with your code, but i've done enum selection in
voicetribe with code that looks like the following:
add(new DropDownChoice(genre, new Model()
{
@Override
public Object getObject(Component component)
{