@ALDDataIOProvider public class ALDNativeDataIOSwing extends Object implements ALDDataIOSwing
Constructor and Description |
---|
ALDNativeDataIOSwing() |
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.
|
private Object |
getDummyInitializer(Class<?> cl)
Method to instantiate dummy object of requested class for default.
|
Object |
getInitialGUIValue(Field field,
Class<?> cl,
Object obj,
ALDParameterDescriptor descr)
Interface method to request initial GUI values of provider.
|
Collection<Class<?>> |
providedClasses()
Interface method to announce class for which IO is provided for.
|
Object |
readData(Field field,
Class<?> cl,
ALDSwingComponent guiElement)
Interface method for getting parameter values via a GUI element.
|
private String |
reformatInfoString(String infoMsg)
Reformats an info message to multiple lines if it contains newlines.
|
void |
setValue(Field field,
Class<?> cl,
ALDSwingComponent guiElement,
Object value)
Interface method for setting new parameter values in GUI.
|
private boolean |
supported1DArray(Class<?> cl)
Checks if a given class is supported or not.
|
JComponent |
writeData(Object obj,
ALDParameterDescriptor descr)
Interface method for displaying an object in the GUI.
|
public Collection<Class<?>> providedClasses()
providedClasses
in interface ALDDataIO
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) throws ALDDataIOProviderException
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.ALDDataIOProviderException
- Thrown in case of failure.private Object getDummyInitializer(Class<?> cl) throws ALDDataIOProviderException
cl
- Class of parameter object.ALDDataIOProviderException
- Thrown if class is not supported.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) throws ALDDataIOProviderException
ALDDataIOSwing
writeData
in interface ALDDataIOSwing
obj
- Object to be displayed or saved.descr
- Optional descriptor to hand over additional information.ALDDataIOProviderException
- Thrown in case of failure.private boolean supported1DArray(Class<?> cl)
cl
- Class to check.Copyright © 2010–2021 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.