GUI Usage of an Enumerated Type
The localizable display field for an enumerated type can be displayed by using getDisplay() or getDisplay(locale).
To use enumerated types in GUI drop-down list selections, wt.clients.util.EnumeratedChoice is provided as a generic control for enumerated types. The following is a simple example of using the control:
// construct and initialize a ChoiceBox for an EnumeratedType
EnumeratedChoice mySizeChoice = new EnumeratedChoice();
mySizeChoice.setEnumeratedTypeClassName( "wt.example.MySize" );

// set current choice selection to the current value
mySizeChoice.setSelectedEnumeratedType( myItem.getSize() );

... user makes selection

// obtain the chosen selection
MySize selection =
(MySize)mySizeChoice.getSelectedEnumeratedType();
Was this helpful?