Class SwingEnumEditor

  • All Implemented Interfaces:
    BindablePropertyEditor, java.awt.event.ActionListener, java.beans.PropertyEditor, java.util.EventListener

    public class SwingEnumEditor
    extends SwingEditorSupport
    implements java.awt.event.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 Detail

      • combobox

        public javax.swing.JComboBox combobox
    • Constructor Detail

      • SwingEnumEditor

        public SwingEnumEditor()
    • Method Detail

      • setValue

        public void setValue​(java.lang.Object value)
        Specified by:
        setValue in interface java.beans.PropertyEditor
        Overrides:
        setValue in class java.beans.PropertyEditorSupport
      • init

        protected void init​(java.beans.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​(java.awt.event.ActionEvent evt)
        Event is set when a combo selection changes.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener