public class ALDDataIOManagerSwing extends ALDDataIOManager
For I/O, it essentially looks up the correct provider for GUI-based execution using the method of its super class and invokes its method.
It does its work in collaboration with
ALDDataIOSwing
.
Modifier and Type | Class and Description |
---|---|
static class |
ALDDataIOManagerSwing.ProviderInteractionLevel
Levels to enable/disable interactive provider behaviour.
|
Modifier and Type | Field and Description |
---|---|
(package private) static ALDDataIOManagerSwing |
instance
The singleton instance of this class
|
private ALDDataIOManagerSwing.ProviderInteractionLevel |
provInterLevel
Interaction level the providers should obey.
|
private boolean |
triggerValueChangeEvents
Flag to indicate if change value events should be triggered or not.
|
debug, mapTable
Modifier | Constructor and Description |
---|---|
private |
ALDDataIOManagerSwing()
private constructor
|
Modifier and Type | Method and Description |
---|---|
ALDSwingComponent |
createGUIElement(Field field,
Class<?> cl,
Object obj,
ALDParameterDescriptor descr)
Create a gui element which may be used to request the user to
input data of class
cl . |
Object |
getInitialGUIValue(Field field,
Class<?> cl,
Object obj,
ALDParameterDescriptor descr)
Method to request initial value a provider sets in GUI.
|
static ALDDataIOManagerSwing |
getInstance()
Return the single instance of this class
|
ALDDataIOManagerSwing.ProviderInteractionLevel |
getProviderInteractionLevel()
Returns the current level of provider interaction.
|
boolean |
isTriggerValueChangeEvents()
Returns value of event trigger flag.
|
Object |
readData(Field field,
Class<?> cl,
ALDSwingComponent guiElement)
Reads data of given class from a specified source.
|
void |
setProviderInteractionLevel(ALDDataIOManagerSwing.ProviderInteractionLevel level)
Set the level of provider interaction which is allowed.
|
void |
setTriggerValueChangeEvents(boolean b)
Set the value change event trigger flag.
|
void |
setValue(Field field,
Class<?> cl,
ALDSwingComponent guiElement,
Object value)
Update the value of a parameter in the GUI component.
|
JComponent |
writeData(Object obj,
ALDParameterDescriptor descr)
Returns a GUI element visualizing the given parameter object.
|
getProvider, getProviderMap, initMapTable
private ALDDataIOManagerSwing.ProviderInteractionLevel provInterLevel
private boolean triggerValueChangeEvents
static final ALDDataIOManagerSwing instance
public static ALDDataIOManagerSwing getInstance()
public ALDDataIOManagerSwing.ProviderInteractionLevel getProviderInteractionLevel()
public void setProviderInteractionLevel(ALDDataIOManagerSwing.ProviderInteractionLevel level)
level
- New level of interaction providers have to obey.public boolean isTriggerValueChangeEvents()
public void setTriggerValueChangeEvents(boolean b)
b
- New value of the event trigger flag.public Object getInitialGUIValue(Field field, Class<?> cl, Object obj, ALDParameterDescriptor descr) throws ALDDataIOException
Providers are allowed to set specific initial values in GUI elements, i.e. change an operators configuration during the build process of the GUI. To nevertheless allow for proper configuration of operator objects and simulate the initialization procedure in advance, this methods allows to request providers for these initial values prior to initiating the actual build process.
Examples for providers setting initial values are for example providers for images which automatically select available images as inputs, or providers for numerical wrappers.
Note that the initial value a provider sets may depend on the
characteristics of the parameter, accessible via the descriptor,
as well as on the current value of the parameter in the operator
object. Note that the value object is allowed to be
null
while the descriptor is not.
field
- Field of the parameter the GUI element is linked to.cl
- Class of parameter object to handled.obj
- The current value of the object.descr
- Descriptor to provide additional information.ALDDataIOException
- Thrown if no provider could be found.public ALDSwingComponent createGUIElement(Field field, Class<?> cl, Object obj, ALDParameterDescriptor descr) throws ALDDataIOException
cl
.
This element may later be forwarded to the method
readData(Field, Class, ALDSwingComponent)
to extract an
object representig this data.
If no suitable provider is found, the method throws an exception.
Additionally, an object may be supplied which is assumed to be of
type cl
. If it is non-null its value may be used to
set up an inital value in the GUI element.
field
- Field of the parameter the GUI element is linked to.cl
- Class of data to be read.obj
- The value of this object to set as inital value.descr
- Optional descriptor to provide additional information.ALDDataIOException
- Thrown if no provider could be found.public void setValue(Field field, Class<?> cl, ALDSwingComponent guiElement, Object value) throws ALDDataIOException
field
- Related field of parameter to be updated.cl
- Class of object to be handled.guiElement
- Corresponding GUI element.value
- New value to be set.ALDDataIOException
- Thrown in case of failure.public Object readData(Field field, Class<?> cl, ALDSwingComponent guiElement) throws ALDDataIOException
field
- Field linked to parameter to be read.cl
- Class of data to be read.guiElement
- GUI element from where to read data.ALDDataIOException
- Thrown in case of failure.public JComponent writeData(Object obj, ALDParameterDescriptor descr) throws ALDDataIOException
If null
is returned, either the given object is
null
or the object may have been displayed otherwise,
e.g., in its own independent window.
obj
- Object to write or display, respectively.descr
- Optional descriptor for additional information.ALDDataIOException
- Thrown in case of write failure.Copyright © 2010–2021 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.