Package adams.gui.goe
Class AbstractGenericObjectEditorHandler
- java.lang.Object
-
- adams.gui.goe.AbstractGenericObjectEditorHandler
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AdamsGenericObjectEditorHandler
,DefaultGenericObjectEditorHandler
,WekaGenericObjectEditorHandler
public abstract class AbstractGenericObjectEditorHandler extends Object implements Serializable
Ancestor for classes that handle commandline options for various frameworks.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static Hashtable<Class,Class>
m_Cache
the cache for object class / handler relation.protected static Class[]
m_HandlerClasses
the handlers (classes) currently available.protected static String[]
m_Handlers
the handlers (classnames) currently available.
-
Constructor Summary
Constructors Constructor Description AbstractGenericObjectEditorHandler()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
getCanChangeClassInDialog(PropertyEditor editor)
Returns whether the class can be changed in the dialog.abstract Class
getClassType(PropertyEditor editor)
Returns the class type currently in use.abstract JPanel
getCustomPanel(PropertyEditor editor)
Returns the custom panel of the editor.static AbstractGenericObjectEditorHandler
getHandler(Class cls)
Returns a handler for the specified class.static AbstractGenericObjectEditorHandler
getHandler(Object obj)
Returns a handler for the specified object.static String[]
getHandlers()
Returns a list with classnames of handlers.abstract Object
getValue(PropertyEditor editor)
Returns the value currently being edited.abstract boolean
handles(Class cls)
Checks whether the given class can be processed.boolean
handles(Object obj)
Checks whether the given objects can be processed.abstract boolean
hasCustomPanel(PropertyEditor editor)
Checks whether the editor supplies its own panel.protected static void
initHandlers()
Initializes the handlers.abstract boolean
setCanChangeClassInDialog(PropertyEditor editor, boolean canChange)
Sets whether the class can be changed in the dialog.abstract boolean
setClassType(PropertyEditor editor, Class cls)
Sets the class type to use.abstract boolean
setValue(PropertyEditor editor, Object value)
Sets the editor value.
-
-
-
Field Detail
-
m_Cache
protected static Hashtable<Class,Class> m_Cache
the cache for object class / handler relation.
-
m_Handlers
protected static String[] m_Handlers
the handlers (classnames) currently available.
-
m_HandlerClasses
protected static Class[] m_HandlerClasses
the handlers (classes) currently available.
-
-
Method Detail
-
setClassType
public abstract boolean setClassType(PropertyEditor editor, Class cls)
Sets the class type to use.- Parameters:
editor
- the editor to updatecls
- the class to set- Returns:
- true if successfully set
-
getClassType
public abstract Class getClassType(PropertyEditor editor)
Returns the class type currently in use.- Parameters:
editor
- the editor to query- Returns:
- the class type
-
setCanChangeClassInDialog
public abstract boolean setCanChangeClassInDialog(PropertyEditor editor, boolean canChange)
Sets whether the class can be changed in the dialog.- Parameters:
editor
- the editor to updatecanChange
- if true the class can be changed in the dialog- Returns:
- true if successfully set
-
getCanChangeClassInDialog
public abstract boolean getCanChangeClassInDialog(PropertyEditor editor)
Returns whether the class can be changed in the dialog.- Parameters:
editor
- the editor to query- Returns:
- true if the class can be changed in the dialog
-
setValue
public abstract boolean setValue(PropertyEditor editor, Object value)
Sets the editor value.- Parameters:
editor
- the editor to updatevalue
- the object to set- Returns:
- true if successfully set
-
getValue
public abstract Object getValue(PropertyEditor editor)
Returns the value currently being edited.- Parameters:
editor
- the editor to query- Returns:
- the current editor value
-
handles
public boolean handles(Object obj)
Checks whether the given objects can be processed.- Parameters:
obj
- the object to inspect- Returns:
- true if the handler can process the object
-
handles
public abstract boolean handles(Class cls)
Checks whether the given class can be processed.- Parameters:
cls
- the class to inspect- Returns:
- true if the handler can process the class
-
hasCustomPanel
public abstract boolean hasCustomPanel(PropertyEditor editor)
Checks whether the editor supplies its own panel.- Parameters:
editor
- the editor to check- Returns:
- true if the editor provides a panel
-
getCustomPanel
public abstract JPanel getCustomPanel(PropertyEditor editor)
Returns the custom panel of the editor.- Parameters:
editor
- the editor to obtain the panel from- Returns:
- the custom panel, null if none available
-
initHandlers
protected static void initHandlers()
Initializes the handlers.
-
getHandler
public static AbstractGenericObjectEditorHandler getHandler(Object obj)
Returns a handler for the specified object.- Parameters:
obj
- the object to get a commandline handler for- Returns:
- the handler
-
getHandler
public static AbstractGenericObjectEditorHandler getHandler(Class cls)
Returns a handler for the specified class.- Parameters:
cls
- the class to get a commandline handler for- Returns:
- the handler
-
getHandlers
public static String[] getHandlers()
Returns a list with classnames of handlers.- Returns:
- the handler classnames
-
-