DESY ACOP Beans Home

com.cosylab.application.state.impl
Class AWTStateKeeper

java.lang.Object
  extended by com.cosylab.application.state.impl.AWTStateKeeper
All Implemented Interfaces:
StateKeeper

public class AWTStateKeeper
extends java.lang.Object
implements StateKeeper

This class is an implementation of the StateKeeper interface and stores application state by traversing through its AWT tree. Each component in the tree which implements StateOriginator is called to create a State object in the process of the aplication state saving. The created State will be marked with the full path to the component so later it can be delivered to it.
If the AWT hierarchy of the components at the time of restoring the state is different than at the time of saving, the state keeper might not be able to deliver data to the StateOriginator these cases should be handled separately inside the application.

Author:
dvitas

Field Summary
protected static char indexSeparator
           
protected static char pathSeparator
           
protected  java.awt.Container rootContainer
           
protected static java.lang.String tokenizerDelimiter
           
 
Constructor Summary
AWTStateKeeper(java.awt.Container rootContainer)
           
 
Method Summary
protected  void fillState(java.awt.Container container, java.lang.String path, java.util.HashMap paths, java.util.HashMap indexes, java.util.List states)
           
protected  java.lang.Object getObject(java.awt.Container container, java.lang.String name, int index)
           
protected  StateOriginator getOriginator(java.awt.Container root, java.lang.String ID)
           
protected  java.util.List getStates()
           
 void restore(java.lang.String filePath, java.lang.String applicationName)
          DOCUMENT ME!
 void save(java.lang.String filePath, java.lang.String applicationName)
          DOCUMENT ME!
protected  void setStates(java.util.List states)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pathSeparator

protected static final char pathSeparator
See Also:
Constant Field Values

indexSeparator

protected static final char indexSeparator
See Also:
Constant Field Values

tokenizerDelimiter

protected static final java.lang.String tokenizerDelimiter
See Also:
Constant Field Values

rootContainer

protected java.awt.Container rootContainer
Constructor Detail

AWTStateKeeper

public AWTStateKeeper(java.awt.Container rootContainer)
Method Detail

fillState

protected void fillState(java.awt.Container container,
                         java.lang.String path,
                         java.util.HashMap paths,
                         java.util.HashMap indexes,
                         java.util.List states)

getObject

protected java.lang.Object getObject(java.awt.Container container,
                                     java.lang.String name,
                                     int index)

getOriginator

protected StateOriginator getOriginator(java.awt.Container root,
                                        java.lang.String ID)

restore

public void restore(java.lang.String filePath,
                    java.lang.String applicationName)
             throws java.io.IOException
Description copied from interface: StateKeeper
DOCUMENT ME!

Specified by:
restore in interface StateKeeper
Parameters:
filePath - DOCUMENT ME!
applicationName - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

setStates

protected void setStates(java.util.List states)

getStates

protected java.util.List getStates()

save

public void save(java.lang.String filePath,
                 java.lang.String applicationName)
          throws java.io.IOException
Description copied from interface: StateKeeper
DOCUMENT ME!

Specified by:
save in interface StateKeeper
Parameters:
filePath - DOCUMENT ME!
applicationName - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!


Copyright © 2010. All Rights Reserved.