To use an Enum class in a PropertyModel you can write:
new PropertyModel(MyObject, "MyEnumClass");
Now this only works if MyEnumClass
is defined within the MyObject
-class.
How can I use a stand-alone Enum-class in a model?
Edit: I concretize:
RadioGroup<MyEnum> rg = new RadioGroup<MyEnum>("radioGroupID", new Model<MyEnum>(MyEnum.NORMAL));
rg.add(new Radio<MyEnum>("radioNormal", new Model<MyEnum>(MyEnum.NORMAL)));
rg.add(new Radio<MyEnum>("radioSpecial", new Model<MyEnum>(MyEnum.SPECIAL)));
The problem here is that changing the radio button doesn't change the model on the RadioGroup
.