ca.nengo.config.handlers
Class BaseHandler
java.lang.Object
ca.nengo.config.handlers.BaseHandler
- All Implemented Interfaces:
- ConfigurationHandler
- Direct Known Subclasses:
- BooleanHandler, EnumHandler, FloatHandler, IntegerHandler, LongHandler, MatrixHandlerBase, StringHandler, UnitsHandler
public abstract class BaseHandler
- extends java.lang.Object
- implements ConfigurationHandler
Base class that provides default behaviour for ConfigurationHandlers.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BaseHandler
public BaseHandler(java.lang.Class<?> c)
- Parameters:
c
- Class of objects handled by this handler
canHandle
public boolean canHandle(java.lang.Class<?> c)
- Specified by:
canHandle
in interface ConfigurationHandler
- Parameters:
c
- A Class
- Returns:
- true if arg matches class given in constructor
- See Also:
ConfigurationHandler.canHandle(java.lang.Class)
fromString
public java.lang.Object fromString(java.lang.String s)
- Specified by:
fromString
in interface ConfigurationHandler
- Parameters:
s
- A String representation of an object, eg from toString(o) or user
input
- Returns:
- myClass.getConstructor(new Class[]{String.class}).newInstance(new Object[]{s})
- See Also:
ConfigurationHandler.fromString(java.lang.String)
getEditor
public java.awt.Component getEditor(java.lang.Object o,
ConfigurationChangeListener listener,
javax.swing.JComponent parent)
- Returns a JTextField. An object is built from the text using fromString().
- Specified by:
getEditor
in interface ConfigurationHandler
- 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 completeparent
- Parent component
- 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(...).
- See Also:
ConfigurationHandler.getEditor(java.lang.Object, ConfigurationChangeListener, JComponent)
getRenderer
public java.awt.Component getRenderer(java.lang.Object o)
- Specified by:
getRenderer
in interface ConfigurationHandler
- Parameters:
o
- An object for which canHandle(o.getClass()) == true
- Returns:
- null
- See Also:
ConfigurationHandler.getRenderer(java.lang.Object)
toString
public java.lang.String toString(java.lang.Object o)
- Specified by:
toString
in interface ConfigurationHandler
- Parameters:
o
- An object for which canHandle(o.getClass()) == true
- Returns:
- o.toString()
- See Also:
ConfigurationHandler.toString(java.lang.Object)