org.ocd.dcf.property.editor
Class EnumEditor

java.lang.Object
  |
  +--java.beans.PropertyEditorSupport
        |
        +--org.ocd.dcf.property.editor.EditorSupport
              |
              +--org.ocd.dcf.property.editor.EnumEditor
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, java.beans.PropertyEditor

public class EnumEditor
extends EditorSupport
implements java.awt.event.ActionListener


Field Summary
 javax.swing.JComboBox combobox
           
 
Fields inherited from class org.ocd.dcf.property.editor.EditorSupport
MEDIUM_DIMENSION, panel, SMALL_DIMENSION
 
Constructor Summary
EnumEditor()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          Event is set when a combo selection changes.
 void init(java.beans.PropertyDescriptor descriptor)
          Initializes this property editor with the enumerated items.
 void setValue(java.lang.Object value)
          Set the Value of this Property
 
Methods inherited from class org.ocd.dcf.property.editor.EditorSupport
getCustomEditor, setAlignment, supportsCustomEditor
 
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getAsText, getJavaInitializationString, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setAsText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

combobox

public javax.swing.JComboBox combobox
Constructor Detail

EnumEditor

public EnumEditor()
Method Detail

setValue

public void setValue(java.lang.Object value)
Description copied from class: EditorSupport
Set the Value of this Property
Overrides:
setValue in class EditorSupport
Following copied from class: org.ocd.dcf.property.editor.EditorSupport
Parameters:
pValue - new Value

init

public void init(java.beans.PropertyDescriptor 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 EditorSupport

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