Since editing enumeration properties (properties which have a fixed limited range of allowed values e.g. Gender: male, female, unknown)
is very common in information systems, RCPForms offers mechanisms to do this automatically, so individual form programmers just bind
a combo or radio group to an enumeration type property and everything else
(filling the combo, transforming values to strings, creating radio buttons according to enum values) is handled by the system.
When you bind a property to a combo or radio group using the ValidationManager.bindValue() method, it asks the model adapter for an EnumRangeAdapter calling
ValidationManager.handleRangeAdapter() which asks the ModelAdapter of your model object for an IRangeAdapter implementation.
If an IRangeAdapter implemetation is available, this is used to create a content provider, label provider and input for the combo viewer.
For a radio group the content provider is used to determine the model values associated with the radio buttons, and the label provider is used to create labels for the buttons.
Thus if a suitable IRangeAdapter is provided, enumeration ranges are automatically filled in the user interface.
The default BeanAdapter supports two range adapter which you can check as an example implementation:
Usually big projects create specific data types for handling enumeration values which are not java enums, but may be read from a database,
may be versioned or extensible by an admin or the user.
To enable the above mechanism for your enumeration implementation you have to do the following:
Binding a property of your enum type to a combo should now result in the combo viewer configured with the input, label and content providers from the Range Adapter.
Change the representation of java enums to a different one by overriding the toString() method of the enum.