DESY ACOP Beans Home

com.cosylab.application.state.impl
Class DefaultState

java.lang.Object
  extended by com.cosylab.application.state.impl.DefaultState
All Implemented Interfaces:
State, java.io.Serializable

public class DefaultState
extends java.lang.Object
implements State, java.io.Serializable

This is the default implementation of the State interface. It is basically extended properties. It uses the LinkedHashMap for the intermidiate storage. This implementation should be sufficient for the majority application and it is not likely that a component need to implement its own state object to exchange with the StateKeeper

Author:
dvitas
See Also:
Serialized Form

Field Summary
protected  java.util.LinkedHashMap map
           
 
Constructor Summary
DefaultState()
           
 
Method Summary
 State createState(java.lang.String key)
          Creates new child and adds it to contaiment with provided key.
 boolean getBoolean(java.lang.String key, boolean defaultValue)
          DOCUMENT ME!
 java.lang.Class getClass(java.lang.String key)
          DOCUMENT ME!
 java.awt.Color getColor(java.lang.String key)
          DOCUMENT ME!
 java.awt.Color[] getColorSeq(java.lang.String key)
           
 java.awt.Dimension getDimension(java.lang.String key)
          DOCUMENT ME!
 double getDouble(java.lang.String key, double defaultValue)
          DOCUMENT ME!
 double[] getDoubleSeq(java.lang.String key)
          DOCUMENT ME!
 java.awt.Font getFont(java.lang.String key)
          DOCUMENT ME!
 java.awt.Font[] getFontSeq(java.lang.String key)
           
 java.lang.String getID()
          Returns ID, which is used to distinguish different states.
 int getInt(java.lang.String key, int defaultValue)
          DOCUMENT ME!
 int[] getIntSeq(java.lang.String key)
          DOCUMENT ME!
 java.lang.Object getObject(java.lang.String key)
          DOCUMENT ME!
 java.awt.Rectangle getRectangle(java.lang.String key)
           
 State getState(java.lang.String key)
          DOCUMENT ME!
 java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
           
 java.lang.String[] getStringSeq(java.lang.String key)
           
 java.lang.Class getType(java.lang.String key)
          DOCUMENT ME!
 java.util.Set keySet()
           
 void putBoolean(java.lang.String key, boolean value)
          DOCUMENT ME!
 void putClass(java.lang.String key, java.lang.Class value)
          DOCUMENT ME!
 void putColor(java.lang.String key, java.awt.Color value)
          DOCUMENT ME!
 void putColorSeq(java.lang.String key, java.awt.Color[] value)
           
 void putDimension(java.lang.String key, java.awt.Dimension value)
          DOCUMENT ME!
 void putDouble(java.lang.String key, double value)
          DOCUMENT ME!
 void putDoubleSeq(java.lang.String key, double[] value)
          DOCUMENT ME!
 void putFont(java.lang.String key, java.awt.Font value)
          DOCUMENT ME!
 void putFontSeq(java.lang.String key, java.awt.Font[] value)
           
 void putInt(java.lang.String key, int value)
          DOCUMENT ME!
 void putIntSeq(java.lang.String key, int[] value)
          DOCUMENT ME!
 void putRectangle(java.lang.String key, java.awt.Rectangle value)
          DOCUMENT ME!
 void putState(java.lang.String key, State state)
          Adds child State with given key.
 void putString(java.lang.String key, java.lang.String value)
          DOCUMENT ME!
 void putStringSeq(java.lang.String key, java.lang.String[] value)
          DOCUMENT ME!
 void setID(java.lang.String ID)
          Sets ID to state.
static void setTyped(boolean typed)
          Turn on/off storing type information about stored objects.
 java.lang.String toString()
           
 void writeXML(java.io.Writer writer)
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

map

protected java.util.LinkedHashMap map
Constructor Detail

DefaultState

public DefaultState()
Method Detail

setTyped

public static void setTyped(boolean typed)
Turn on/off storing type information about stored objects. Default is off - objects are stored without information about its type. If it is turned on, all objects are written with its type information so the function getType() can be used.

Parameters:
typed - on/off

putState

public void putState(java.lang.String key,
                     State state)
Description copied from interface: State
Adds child State with given key.

Specified by:
putState in interface State
Parameters:
key - the key under state is stored
state - the state to be added

createState

public State createState(java.lang.String key)
Description copied from interface: State
Creates new child and adds it to contaiment with provided key.

Specified by:
createState in interface State
Parameters:
key - the key of new state inside this containment
Returns:
new state contained with provided key

getBoolean

public boolean getBoolean(java.lang.String key,
                          boolean defaultValue)
Description copied from interface: State
DOCUMENT ME!

Specified by:
getBoolean in interface State
Parameters:
key - DOCUMENT ME!
defaultValue - DOCUMENT ME!
Returns:
DOCUMENT ME!

getState

public State getState(java.lang.String key)
Description copied from interface: State
DOCUMENT ME!

Specified by:
getState in interface State
Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getClass

public java.lang.Class getClass(java.lang.String key)
Description copied from interface: State
DOCUMENT ME!

Specified by:
getClass in interface State
Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getColor

public java.awt.Color getColor(java.lang.String key)
Description copied from interface: State
DOCUMENT ME!

Specified by:
getColor in interface State
Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getDimension

public java.awt.Dimension getDimension(java.lang.String key)
Description copied from interface: State
DOCUMENT ME!

Specified by:
getDimension in interface State
Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getDouble

public double getDouble(java.lang.String key,
                        double defaultValue)
Description copied from interface: State
DOCUMENT ME!

Specified by:
getDouble in interface State
Parameters:
key - DOCUMENT ME!
defaultValue - DOCUMENT ME!
Returns:
DOCUMENT ME!

getDoubleSeq

public double[] getDoubleSeq(java.lang.String key)
Description copied from interface: State
DOCUMENT ME!

Specified by:
getDoubleSeq in interface State
Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getColorSeq

public java.awt.Color[] getColorSeq(java.lang.String key)
Specified by:
getColorSeq in interface State

getFont

public java.awt.Font getFont(java.lang.String key)
Description copied from interface: State
DOCUMENT ME!

Specified by:
getFont in interface State
Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getFontSeq

public java.awt.Font[] getFontSeq(java.lang.String key)
Specified by:
getFontSeq in interface State

getID

public java.lang.String getID()
Description copied from interface: State
Returns ID, which is used to distinguish different states.

Specified by:
getID in interface State
Returns:
state identification

getInt

public int getInt(java.lang.String key,
                  int defaultValue)
Description copied from interface: State
DOCUMENT ME!

Specified by:
getInt in interface State
Parameters:
key - DOCUMENT ME!
defaultValue - DOCUMENT ME!
Returns:
DOCUMENT ME!

getIntSeq

public int[] getIntSeq(java.lang.String key)
Description copied from interface: State
DOCUMENT ME!

Specified by:
getIntSeq in interface State
Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getObject

public java.lang.Object getObject(java.lang.String key)
Description copied from interface: State
DOCUMENT ME!

Specified by:
getObject in interface State
Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getType

public java.lang.Class getType(java.lang.String key)
Description copied from interface: State
DOCUMENT ME!

Specified by:
getType in interface State
Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getRectangle

public java.awt.Rectangle getRectangle(java.lang.String key)
Specified by:
getRectangle in interface State

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String defaultValue)
Specified by:
getString in interface State

getStringSeq

public java.lang.String[] getStringSeq(java.lang.String key)
Specified by:
getStringSeq in interface State

keySet

public java.util.Set keySet()
Specified by:
keySet in interface State

putBoolean

public void putBoolean(java.lang.String key,
                       boolean value)
Description copied from interface: State
DOCUMENT ME!

Specified by:
putBoolean in interface State
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putClass

public void putClass(java.lang.String key,
                     java.lang.Class value)
Description copied from interface: State
DOCUMENT ME!

Specified by:
putClass in interface State
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putColor

public void putColor(java.lang.String key,
                     java.awt.Color value)
Description copied from interface: State
DOCUMENT ME!

Specified by:
putColor in interface State
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putDimension

public void putDimension(java.lang.String key,
                         java.awt.Dimension value)
Description copied from interface: State
DOCUMENT ME!

Specified by:
putDimension in interface State
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putDouble

public void putDouble(java.lang.String key,
                      double value)
Description copied from interface: State
DOCUMENT ME!

Specified by:
putDouble in interface State
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putDoubleSeq

public void putDoubleSeq(java.lang.String key,
                         double[] value)
Description copied from interface: State
DOCUMENT ME!

Specified by:
putDoubleSeq in interface State
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putColorSeq

public void putColorSeq(java.lang.String key,
                        java.awt.Color[] value)
Specified by:
putColorSeq in interface State

putFont

public void putFont(java.lang.String key,
                    java.awt.Font value)
Description copied from interface: State
DOCUMENT ME!

Specified by:
putFont in interface State
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putFontSeq

public void putFontSeq(java.lang.String key,
                       java.awt.Font[] value)
Specified by:
putFontSeq in interface State

putInt

public void putInt(java.lang.String key,
                   int value)
Description copied from interface: State
DOCUMENT ME!

Specified by:
putInt in interface State
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putIntSeq

public void putIntSeq(java.lang.String key,
                      int[] value)
Description copied from interface: State
DOCUMENT ME!

Specified by:
putIntSeq in interface State
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putRectangle

public void putRectangle(java.lang.String key,
                         java.awt.Rectangle value)
Description copied from interface: State
DOCUMENT ME!

Specified by:
putRectangle in interface State
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putString

public void putString(java.lang.String key,
                      java.lang.String value)
Description copied from interface: State
DOCUMENT ME!

Specified by:
putString in interface State
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putStringSeq

public void putStringSeq(java.lang.String key,
                         java.lang.String[] value)
Description copied from interface: State
DOCUMENT ME!

Specified by:
putStringSeq in interface State
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

setID

public void setID(java.lang.String ID)
Description copied from interface: State
Sets ID to state.

Specified by:
setID in interface State
Parameters:
ID - the new ID string

writeXML

public void writeXML(java.io.Writer writer)
              throws java.io.IOException
Description copied from interface: State
DOCUMENT ME!

Specified by:
writeXML in interface State
Parameters:
writer - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2010. All Rights Reserved.