de.unihalle.informatik.Alida.dataio
Class ALDDataIOManagerSwing

java.lang.Object
  extended by de.unihalle.informatik.Alida.dataio.ALDDataIOManager
      extended by de.unihalle.informatik.Alida.dataio.ALDDataIOManagerSwing

public class ALDDataIOManagerSwing
extends ALDDataIOManager

This class implements a DataIO Mangager for reading/writing from a graphical user interface.

For IO, it essentially looks up the correct provider for command line execution using the method of its super class and invokes its method.

It does its work in collaboration with ALDDataIOSwing.

Author:
posch

Field Summary
(package private) static ALDDataIOManagerSwing instance
          The singleton instance of this class
 
Fields inherited from class de.unihalle.informatik.Alida.dataio.ALDDataIOManager
debug, mapTable
 
Constructor Summary
private ALDDataIOManagerSwing()
          private constructor
 
Method Summary
 javax.swing.JComponent createGUIElement(java.lang.reflect.Field field, java.lang.Class<?> cl, java.lang.Object obj)
          Create a gui element which may be used to request the user to input data of class cl.
static ALDDataIOManagerSwing getInstance()
          Return the single instance of this class
 java.lang.Object readData(java.lang.reflect.Field field, java.lang.Class<?> cl, javax.swing.JComponent guiElement)
          Reads data of given class from a specified source.
 void setValue(java.lang.reflect.Field field, java.lang.Class<?> cl, javax.swing.JComponent guiElement, java.lang.Object value)
          Update the value of a parameter in the GUI component.
 javax.swing.JComponent writeData(java.lang.Object obj)
          Return a gui element displaying the obj or null.
 
Methods inherited from class de.unihalle.informatik.Alida.dataio.ALDDataIOManager
getProvider, getProviderMap, initMapTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

static final ALDDataIOManagerSwing instance
The singleton instance of this class

Constructor Detail

ALDDataIOManagerSwing

private ALDDataIOManagerSwing()
private constructor

Method Detail

createGUIElement

public javax.swing.JComponent createGUIElement(java.lang.reflect.Field field,
                                               java.lang.Class<?> cl,
                                               java.lang.Object obj)
                                        throws ALDDataIOException
Create a gui element which may be used to request the user to input data of class cl. This element may later be forwarded to readData to extract an object representig this data. Null may be returned if no provider was found. 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.

Parameters:
cl - Class of data to be read.
obj - The value of this object to set as inital value
Returns:
gui element of null if no provider was found
Throws:
ALDDataIOException

getInstance

public static ALDDataIOManagerSwing getInstance()
Return the single instance of this class

Returns:
single instance

readData

public java.lang.Object readData(java.lang.reflect.Field field,
                                 java.lang.Class<?> cl,
                                 javax.swing.JComponent guiElement)
                          throws ALDDataIOException
Reads data of given class from a specified source.

Parameters:
cl - Class of data to be read.
guiElement - gui element from where to read data.
Returns:
data object read or null if no provider was found
Throws:
ALDDataIOException

setValue

public void setValue(java.lang.reflect.Field field,
                     java.lang.Class<?> cl,
                     javax.swing.JComponent guiElement,
                     java.lang.Object value)
              throws ALDDataIOException
Update the value of a parameter in the GUI component.

Parameters:
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.
Throws:
ALDDataIOException

writeData

public javax.swing.JComponent writeData(java.lang.Object obj)
                                 throws ALDDataIOException
Return a gui element displaying the obj or null. In the latter case the obj may have been shown otherwise, e.g. in an own window.

Parameters:
obj - Object to write.
Returns:
gui element created
Throws:
ALDDataIOException