ca.nengo.config
Interface ConfigurationHandler
- All Known Implementing Classes:
- BaseHandler, BooleanHandler, EnumHandler, FloatHandler, IntegerHandler, LongHandler, MainHandler, MatrixHandler, MatrixHandlerBase, StringHandler, UnitsHandler, VectorHandler
public interface ConfigurationHandler
Manages configuration of Property
s of of a certain Class.
A ConfigurationHandler provides default property values as well as user interface
components that can be used to display and edit a Property.
Not all classes need a ConfigurationHandler. If a Property value does not have
an associated handler, then a property editor must create a Configuration for
it based on its accessor methods. This Configuration may in turn include property values
for which there is no ConfigurationHandler, so that a tree of Configurations results.
The leaves of this tree are the values with ConfigurationHandlers.
- Author:
- Bryan Tripp
canHandle
boolean canHandle(java.lang.Class<?> c)
- Parameters:
c
- A Class
- Returns:
- True if this handler can handle values of the given class
getRenderer
java.awt.Component getRenderer(java.lang.Object o)
- Parameters:
o
- An object for which canHandle(o.getClass()) == true
- Returns:
- A UI component (eg JLabel) that shows the object's value.
If null, the calling property editor will attempt to create
a default display, possibly using toString(o).
getEditor
java.awt.Component getEditor(java.lang.Object o,
ConfigurationChangeListener listener,
javax.swing.JComponent parent)
- Parameters:
o
- An object for which canHandle(o.getClass()) == truelistener
- An ActionListener. The returned editor component must 1) add this listener
to the part of itself that produces an event when editing is complete, and 2) call
setProxy() with an EditorProxy through which the listener can retrieve a
new object value when editing is complete
- Returns:
- A UI component (eg JTextField) that allows the user to change the
object's value. If null, the calling property editor will attempt
to create a default editor, possibly using fromString(...).
toString
java.lang.String toString(java.lang.Object o)
- Parameters:
o
- An object for which canHandle(o.getClass()) == true
- Returns:
- A String representation of the object, suitable for user display
fromString
java.lang.Object fromString(java.lang.String s)
- Parameters:
s
- A String representation of an object, eg from toString(o) or user
input
- Returns:
- An object built from the given string
getDefaultValue
java.lang.Object getDefaultValue(java.lang.Class<?> c)
- Parameters:
c
- A class for which canHandle(c) == true
- Returns:
- A default value of the given class