eu.beesoft.gantt.undo
Class StateEditableObject

java.lang.Object
  extended by eu.beesoft.gantt.undo.StateEditableObject
All Implemented Interfaces:
javax.swing.undo.StateEditable

public class StateEditableObject
extends java.lang.Object
implements javax.swing.undo.StateEditable

This StateEditable implementation serves as a bridge to undo / redo operations for general objects or beans.

Object which is used to construct instance of StateEditableObject is stored / restored via reflection without any programming.


Field Summary
 
Fields inherited from interface javax.swing.undo.StateEditable
RCSID
 
Constructor Summary
StateEditableObject(java.lang.Object object)
          Creates a new instance of StateEditableObject.
 
Method Summary
 java.lang.Object getObject()
          Returns object which state is undo/redoable.
 void restoreState(java.util.Hashtable<?,?> state)
          Restores state from given state to the object.
 void storeState(java.util.Hashtable<java.lang.Object,java.lang.Object> state)
          Stores state from object to the given state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateEditableObject

public StateEditableObject(java.lang.Object object)
Creates a new instance of StateEditableObject.

Parameters:
object - - object which state is undo/redoable.
Method Detail

getObject

public java.lang.Object getObject()
Returns object which state is undo/redoable.

Returns:
object which state is undo/redoable

restoreState

public void restoreState(java.util.Hashtable<?,?> state)
Restores state from given state to the object. First it tries to set value via setter, and if not found or exception was thrown, field access is used.

Specified by:
restoreState in interface javax.swing.undo.StateEditable
Parameters:
state - - values to set to the object

storeState

public void storeState(java.util.Hashtable<java.lang.Object,java.lang.Object> state)
Stores state from object to the given state. Object is introspected via reflection and value from each non-static, non-final and non-transient field is stored to state. Field access is used to obtain values.

Specified by:
storeState in interface javax.swing.undo.StateEditable
Parameters:
state - - where to store object state