@ALDDataIOProvider public class ALDOperatorDataIOSwing extends Object implements ALDDataIOSwing
This class provides GUI elements and functionality for configuring operators in GUI. Note that the class has to operation modes:
ALDOperatorControlFrame
:If you do any changes to this class, please make sure that the panel is always properly built, independent of how the class object in constructed!
Modifier and Type | Class and Description |
---|---|
private class |
ALDOperatorDataIOSwing.OperatorConfigPanel
GUI element for configuring a single operator.
|
protected class |
ALDOperatorDataIOSwing.OperatorConfigWindow
Configuration window for operator.
|
private class |
ALDOperatorDataIOSwing.OperatorHierarchyConfigPanel
Element for handling operator inheritance hierarchies in configuration.
|
private class |
ALDOperatorDataIOSwing.OperatorShowButton
GUI element for displaying configuration of a single operator.
|
Modifier and Type | Field and Description |
---|---|
(package private) ALDOperatorDataIOSwing.OperatorConfigPanel |
confPanel
Configure button for operator as parameter.
|
private boolean |
debug
Local debug flag, not accessible from outside of the class.
|
protected ALDOperator |
op
The operator of this frame, may be abstract!
|
protected LinkedList<ALDOpParameterDescriptor> |
opParamDescrips
List of all parameter descriptors associated with operator.
|
private ALDOperatorDataIOSwing.OperatorHierarchyConfigPanel |
subClassHandler
Panel to configure sub-classed or abstract operators as parameters.
|
protected boolean |
topLevelCall
Local flag to indicate if object is created on OpRunner top level or not;
flag modules if deep validation is done or not.
|
Constructor and Description |
---|
ALDOperatorDataIOSwing()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
ALDSwingComponent |
createGUIElement(Field field,
Class<?> cl,
Object obj,
ALDParameterDescriptor descr)
Interface method to create a GUI element for data input.
|
ALDSwingComponent |
createGUIElement(Field field,
Class<?> cl,
Object obj,
ALDParameterDescriptor descr,
boolean checkDerivedClasses)
Method to actually create the GUI element for the parameter requested.
|
Object |
getInitialGUIValue(Field field,
Class<?> cl,
Object obj,
ALDParameterDescriptor descr)
Interface method to request initial GUI values of provider.
|
private boolean |
guiUsageAllowed(Class<?> c)
Internal helper to request GUI-suitability of an operator.
|
Collection<Class<?>> |
providedClasses()
Interface method to announce all classes handled by this provider.
|
Object |
readData(Field field,
Class<?> cl,
ALDSwingComponent guiElement)
Interface method for getting parameter values via a GUI element.
|
void |
setValue(Field field,
Class<?> cl,
ALDSwingComponent guiElement,
Object value)
Interface method for setting new parameter values in GUI.
|
JComponent |
writeData(Object obj,
ALDParameterDescriptor descr)
Interface method for displaying an object in the GUI.
|
private boolean debug
protected boolean topLevelCall
private ALDOperatorDataIOSwing.OperatorHierarchyConfigPanel subClassHandler
protected ALDOperator op
protected LinkedList<ALDOpParameterDescriptor> opParamDescrips
ALDOperatorDataIOSwing.OperatorConfigPanel confPanel
public Object getInitialGUIValue(Field field, Class<?> cl, Object obj, ALDParameterDescriptor descr) throws ALDDataIOProviderException
ALDDataIOSwing
Note that while the object is allowed to be null
the descriptor has to be different from null
in any
case.
getInitialGUIValue
in interface ALDDataIOSwing
field
- Field of the parameter the GUI element is linked to.cl
- Class of the parameter and the returned object.obj
- The current value of corresponding parameter.descr
- Optional descriptor to provide additional information.ALDDataIOProviderException
- Thrown in case of failure.public ALDSwingComponent createGUIElement(Field field, Class<?> cl, Object obj, ALDParameterDescriptor descr)
ALDDataIOSwing
Optionally an object may be supplied which is assumed to be of
type cl
and used as default.
createGUIElement
in interface ALDDataIOSwing
field
- Field of the parameter the GUI element is linked to.cl
- Class of object to be returned.obj
- The value of this object to be set as inital value.descr
- Optional descriptor to provide additional information.public ALDSwingComponent createGUIElement(Field field, Class<?> cl, Object obj, ALDParameterDescriptor descr, boolean checkDerivedClasses)
Most important here is the boolean to enable or disable checks of derived classes. Particularly nested usage of operators or, e.g., using operators as elements of collections requires to handle the existence of derived classes differently.
field
- Field of corresponding parameter.cl
- Class of corresponding parameter.obj
- Initial parameter value.descr
- Corresponding parameter descriptor.checkDerivedClasses
- If true, derived classes are checked.public void setValue(Field field, Class<?> cl, ALDSwingComponent guiElement, Object value) throws ALDDataIOProviderException
ALDDataIOSwing
setValue
in interface ALDDataIOSwing
field
- Field of parameter object to be handled.cl
- Class of parameter object to be handled.guiElement
- Corresponding GUI element.value
- New value of the parameter.ALDDataIOProviderException
- Thrown in case of failure.public Object readData(Field field, Class<?> cl, ALDSwingComponent guiElement) throws ALDDataIOProviderException
ALDDataIOSwing
readData
in interface ALDDataIOSwing
field
- Field associated with object to be returned.cl
- Class of object to be returned.guiElement
- Component from where to read data.null
.ALDDataIOProviderException
- Thrown in case of failure.public JComponent writeData(Object obj, ALDParameterDescriptor descr)
ALDDataIOSwing
writeData
in interface ALDDataIOSwing
obj
- Object to be displayed or saved.descr
- Optional descriptor to hand over additional information.public Collection<Class<?>> providedClasses()
ALDDataIO
providedClasses
in interface ALDDataIO
private boolean guiUsageAllowed(Class<?> c)
c
- Operator class to check.Copyright © 2010–2021 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.