public interface IValueEditor
The IValueEditor interface represents the implementation of an editor for values of a given type. The primary use of value editors is to edit property values in a property inspector. A class provides a value editor by implementing a public static inner class named "Editor" which in turn implements the IValueEditor interface. This method of implementation allows the value editor to be separated from the class itself in situations where the value editor is not required (such as when the class is deployed). The following example shows a class called Color and its associated value editor:
public class Color { // Members of class Color public static class Editor implements IValueEditor { // Implementations of IValueEditor methods } }
When a class implements a value editor, the value editor implementation is automatically inherited by subclasses that don't implement their own value editors.
To create an instance of a value editor, the component manager first looks for a constructor that takes a single argument of type java.lang.Class. If such a constructor exists, it is called with the actual Class object for which the value editor is being created. Otherwise, the component manager calls the parameterless constructor of the value editor class.
The ComponentManager provides the ability to register value editors for a particular type through the registerValueEditorClass() method. This is useful for value editors that aren't implemented as inner classes.
The core.ValueEditor class provides a default implementation of the IValueEditor interface. Value editors may choose to inherit from ValueEditor instead of implementing the entire IValueEditor interface.
Fields
Name | Description |
---|---|
STYLE_DROPDOWNARROW | Bit mask for getStyle() method. |
STYLE_EDITVALUE | Bit mask for getStyle() method. |
STYLE_IMMEDIATE | Bit mask for getStyle() method. |
STYLE_NOARRAYEXPANSION | Topic under construction. |
STYLE_NOVALUEFROMTEXT | Bit mask for getStyle() method. |
STYLE_PAINTVALUE | Bit mask for getStyle() method. |
STYLE_PROPERTIES | Bit mask for getStyle() method. |
STYLE_SHOWFIELDS | Bit mask for getStyle() method. |
STYLE_VALUES | Bit mask for getStyle() method. |
Methods
Name | Description |
---|---|
editValue(IValueAccess valueAccess) | Topic under construction. |
getConstantName(Object value) | Returns the fully qualified name of a constant that represents the given value, or returns null if there is no constant for the value. |
getStyle() | Returns the style flags for the value editor. |
getSubProperties(Object value) | Returns the subproperties to be displayed under the object. |
getTextFromValue(Object value) | Converts the given value to a text string. |
getValueFromText(String text) | Converts the given text string to a value. |
getValues() | Returns a list of possible values for the value editor's type. |
paintValue(Object value, Graphics g, Rectangle rect) | Paints a representation of the given value in the given Rectangle of the given Graphics. |
Topic under construction.
Returns the fully qualified name of a constant that represents the given value, or returns null if there is no constant for the value. The returned value must consist of a fully qualified class name followed by a period followed by the identifier of a public static final field of the given class, for example, "wfc.ui.Color.BLACK". This method is typically used by a design-time environment that generates source code to initialize a component's properties.
Returns the style flags for the value editor. The returned value must be a combination of the STYLE_XXX bit masks defined in this interface.
Returns the subproperties to be displayed under the object.
Converts the given value to a text string. The return value may be null if the value cannot be converted to a text string.
Converts the given text string to a value. This method is not called if the value editor specifies the STYLE_NOVALUEFROMTEXT style.
Returns a list of possible values for the value editor's type. To display these values in a drop-down list, a property editor typically calls getTextFromValue() for each of the values in the list.
Paints a representation of the given value in the given Rectangle of the given Graphics. This method is called only if the value editor specifies the STYLE_PAINTVALUE style.