de.unihalle.informatik.Alida.dataio.provider.swing
Class ALDCollectionDataIOSwing.CollectionConfigWindow

java.lang.Object
  extended by de.unihalle.informatik.Alida.dataio.provider.swing.events.ALDSwingValueChangeReporter
      extended by de.unihalle.informatik.Alida.dataio.provider.swing.ALDCollectionDataIOSwing.CollectionConfigWindow
All Implemented Interfaces:
ALDSwingValueChangeListener, java.awt.event.ActionListener, java.util.EventListener
Enclosing class:
ALDCollectionDataIOSwing

private class ALDCollectionDataIOSwing.CollectionConfigWindow
extends ALDSwingValueChangeReporter
implements java.awt.event.ActionListener, ALDSwingValueChangeListener

Collection configuration window.

Author:
moeller

Field Summary
private  javax.swing.JButton addButton
          Button to add an element.
private  javax.swing.JButton closeButton
          Button to close the configuration window.
private  java.lang.Object defObject
          Default collection object.
private  javax.swing.JButton delButton
          Button to delete an element;
private  javax.swing.JButton downButton
          Button to move an element downwards.
private  java.lang.Class<?> elemClass
          Collection element class.
private  java.util.LinkedList<ALDSwingComponent> elemComps
          List of current GUI components in window.
private  int elemCounter
          Number of elements.
private  java.lang.reflect.Field elemField
          Collection element field.
private  java.lang.reflect.Type elemFieldType
          Collection element type.
private  int frameWidth
          Fixed width of window.
private  int lastAdded
          Stores the index of last element added (may vary due to element swaps).
private  javax.swing.JPanel mainPanel
          Main panel of main frame.
private  javax.swing.JButton upButton
          Button to move an element upwards.
private  javax.swing.JFrame window
          Main frame.
 
Fields inherited from class de.unihalle.informatik.Alida.dataio.provider.swing.events.ALDSwingValueChangeReporter
listenerList
 
Constructor Summary
ALDCollectionDataIOSwing.CollectionConfigWindow(java.lang.reflect.Field field, java.lang.Class<?> cl, java.lang.Object obj, ALDParameterDescriptor descr)
          Default constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void disableComponent()
          Deactivates the configuration window to prohibit value changes.
 void enableComponent()
          Reactivates the configuration window to allow for value changes.
 void handleValueChangeEvent(ALDSwingValueChangeEvent event)
          Method which is called on event occurence.
 java.util.Collection<?> readData(java.lang.reflect.Field field, java.lang.Class<?> cl)
          Extracts current collection data.
 void setValue(java.lang.Object value)
          Updates current collection data.
private  void updateWindow()
          Updates the collection in the window.
 
Methods inherited from class de.unihalle.informatik.Alida.dataio.provider.swing.events.ALDSwingValueChangeReporter
addValueChangeEventListener, fireALDSwingValueChangeEvent, removeValueChangeEventListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

addButton

private javax.swing.JButton addButton
Button to add an element.


closeButton

private javax.swing.JButton closeButton
Button to close the configuration window.


defObject

private java.lang.Object defObject
Default collection object.


delButton

private javax.swing.JButton delButton
Button to delete an element;


downButton

private javax.swing.JButton downButton
Button to move an element downwards.


elemClass

private java.lang.Class<?> elemClass
Collection element class.


elemComps

private java.util.LinkedList<ALDSwingComponent> elemComps
List of current GUI components in window.


elemCounter

private int elemCounter
Number of elements.


elemField

private java.lang.reflect.Field elemField
Collection element field.


elemFieldType

private java.lang.reflect.Type elemFieldType
Collection element type.


frameWidth

private final int frameWidth
Fixed width of window.

See Also:
Constant Field Values

lastAdded

private int lastAdded
Stores the index of last element added (may vary due to element swaps).


mainPanel

private javax.swing.JPanel mainPanel
Main panel of main frame.


upButton

private javax.swing.JButton upButton
Button to move an element upwards.


window

private javax.swing.JFrame window
Main frame.

Constructor Detail

ALDCollectionDataIOSwing.CollectionConfigWindow

public ALDCollectionDataIOSwing.CollectionConfigWindow(java.lang.reflect.Field field,
                                                       java.lang.Class<?> cl,
                                                       java.lang.Object obj,
                                                       ALDParameterDescriptor descr)
Default constructor.

Parameters:
field - Field to specify input data objects.
cl - Class of collection elements.
obj - Initial value of collection.
descr - Optional descriptor for additional information.
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

disableComponent

public void disableComponent()
Deactivates the configuration window to prohibit value changes.


enableComponent

public void enableComponent()
Reactivates the configuration window to allow for value changes.


handleValueChangeEvent

public void handleValueChangeEvent(ALDSwingValueChangeEvent event)
Description copied from interface: ALDSwingValueChangeListener
Method which is called on event occurence.

Specified by:
handleValueChangeEvent in interface ALDSwingValueChangeListener
Parameters:
event - Event to be handled.

readData

public java.util.Collection<?> readData(java.lang.reflect.Field field,
                                        java.lang.Class<?> cl)
Extracts current collection data.

Parameters:
field - Field of collection elements.
cl - Class of collection elements.
Returns:
Current collection.

setValue

public void setValue(java.lang.Object value)
Updates current collection data.

Parameters:
value - New value.

updateWindow

private void updateWindow()
Updates the collection in the window.

This function is called each time an element is added or removed or if two elements have been swapped.