All Implemented Interfaces:
BindablePropertyEditor, ActionListener, PropertyEditor, EventListener

public class SwingEnumEditor extends SwingEditorSupport implements ActionListener, BindablePropertyEditor
A property editor for a swing enumerated type. Handles the case in which the PropertyDescriptor has a value for "enumerationValues". Note: the init() method must be called before the set/get methods can be called.
  • Field Details

  • Constructor Details

    • SwingEnumEditor

      public SwingEnumEditor()
  • Method Details

    • setValue

      public void setValue(Object value)
      Specified by:
      setValue in interface PropertyEditor
      Overrides:
      setValue in class PropertyEditorSupport
    • init

      protected void init(FeatureDescriptor descriptor)
      Initializes this property editor with the enumerated items. Instances can be shared but there are issues.

      This method does a lot of jiggery pokery since enumerated types are unlike any other homogenous types. Enumerated types may not represent the same set of values.

      One method would be to empty the list of values which would have the side effect of firing notification events. Another method would be to recreate the combobox.

      Overrides:
      init in class SwingEditorSupport
    • actionPerformed

      public void actionPerformed(ActionEvent evt)
      Event is set when a combo selection changes.
      Specified by:
      actionPerformed in interface ActionListener
    • isBindableEnabled

      public boolean isBindableEnabled()
      Specified by:
      isBindableEnabled in interface BindablePropertyEditor
    • setBindableEnabled

      public void setBindableEnabled(boolean b)
      Specified by:
      setBindableEnabled in interface BindablePropertyEditor