Package adams.gui.goe
Class EnumEditor
- java.lang.Object
-
- java.beans.PropertyEditorSupport
-
- adams.gui.goe.EnumEditor
-
- All Implemented Interfaces:
MultiSelectionEditor
,PropertyEditor
public class EnumEditor extends PropertyEditorSupport implements MultiSelectionEditor
A PropertyEditor that displays Enums. Based on Weka's SelectedTagEditor.- Author:
- FracPete (fracpete at waikato dot ac dot nz), Len Trigg ([email protected])
- See Also:
SelectedTagEditor
-
-
Field Summary
Fields Modifier and Type Field Description protected static HashSet<Class>
m_Registered
whether the editor has been registered for the enum class.
-
Constructor Summary
Constructors Constructor Description EnumEditor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAsText()
Gets the current value as text.String
getJavaInitializationString()
Returns a description of the property value as java source.Object[]
getSelectedObjects(Container parent)
Returns the selected objects.String[]
getTags()
Gets the list of tags that can be selected from.protected Object[]
newArray(List<String> values, Class type)
Creates a new array of field objects from the strings.static void
registerEditor(EnumOption option)
Registers the EnumEditor for the enum option if necessary.void
setAsText(String text)
Sets the current property value as text.-
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getCustomEditor, getSource, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor
-
-
-
-
Method Detail
-
getJavaInitializationString
public String getJavaInitializationString()
Returns a description of the property value as java source.- Specified by:
getJavaInitializationString
in interfacePropertyEditor
- Overrides:
getJavaInitializationString
in classPropertyEditorSupport
- Returns:
- a value of type 'String'
-
getAsText
public String getAsText()
Gets the current value as text.- Specified by:
getAsText
in interfacePropertyEditor
- Overrides:
getAsText
in classPropertyEditorSupport
- Returns:
- a value of type 'String'
-
setAsText
public void setAsText(String text)
Sets the current property value as text.- Specified by:
setAsText
in interfacePropertyEditor
- Overrides:
setAsText
in classPropertyEditorSupport
- Parameters:
text
- the text of the selected tag.
-
getTags
public String[] getTags()
Gets the list of tags that can be selected from.- Specified by:
getTags
in interfacePropertyEditor
- Overrides:
getTags
in classPropertyEditorSupport
- Returns:
- an array of string tags.
-
newArray
protected Object[] newArray(List<String> values, Class type)
Creates a new array of field objects from the strings.- Parameters:
values
- the field names to usetype
- the type of the fields- Returns:
- the field array
-
getSelectedObjects
public Object[] getSelectedObjects(Container parent)
Returns the selected objects.- Specified by:
getSelectedObjects
in interfaceMultiSelectionEditor
- Parameters:
parent
- the parent container- Returns:
- the objects
-
registerEditor
public static void registerEditor(EnumOption option)
Registers the EnumEditor for the enum option if necessary.- Parameters:
option
- the option to check
-
-