DESY ACOP Beans Home

com.cosylab.application.state
Interface State

All Known Implementing Classes:
DefaultState

public interface State

This interface should be implemented by the object which will be exchanged with a component in the state saving/restoring process. This is basically java.util.Properties with extension for other useful types of objects that are not strings. A State can be used to create and store other State object as well and in such way the hierarchy can be builded easily. For example a component can use this code snippet to produce a State object which has two child object 'Window' and 'Splitter'. This allows the component to easy distinguish between parts of the state later in process of restoring.

 
         public State getState() {
          State state = StateFactory.createState();
          State s = state.createChild("Window");
          getWindow().setProperties(s);
          s = state.createChild("Splitter");
          getSplitter().setProperties(s);
         }
 
 
Beside that the enumeration of stored objects is added to allow different StateStorage objects to iterate over.

Author:
dvitas

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.
 void writeXML(java.io.Writer writer)
          DOCUMENT ME!
 

Method Detail

putState

void putState(java.lang.String key,
              State state)
Adds child State with given key.

Parameters:
key - the key under state is stored
state - the state to be added

createState

State createState(java.lang.String key)
Creates new child and adds it to contaiment with provided key.

Parameters:
key - the key of new state inside this containment
Returns:
new state contained with provided key

getBoolean

boolean getBoolean(java.lang.String key,
                   boolean defaultValue)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
defaultValue - DOCUMENT ME!
Returns:
DOCUMENT ME!

getState

State getState(java.lang.String key)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getClass

java.lang.Class getClass(java.lang.String key)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getColor

java.awt.Color getColor(java.lang.String key)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getColorSeq

java.awt.Color[] getColorSeq(java.lang.String key)

getDimension

java.awt.Dimension getDimension(java.lang.String key)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getDouble

double getDouble(java.lang.String key,
                 double defaultValue)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
defaultValue - DOCUMENT ME!
Returns:
DOCUMENT ME!

getDoubleSeq

double[] getDoubleSeq(java.lang.String key)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getFont

java.awt.Font getFont(java.lang.String key)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getFontSeq

java.awt.Font[] getFontSeq(java.lang.String key)

getID

java.lang.String getID()
Returns ID, which is used to distinguish different states.

Returns:
state identification

setID

void setID(java.lang.String id)
Sets ID to state.

Parameters:
id - the new ID string

getInt

int getInt(java.lang.String key,
           int defaultValue)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
defaultValue - DOCUMENT ME!
Returns:
DOCUMENT ME!

getIntSeq

int[] getIntSeq(java.lang.String key)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getObject

java.lang.Object getObject(java.lang.String key)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getType

java.lang.Class getType(java.lang.String key)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

getRectangle

java.awt.Rectangle getRectangle(java.lang.String key)

getString

java.lang.String getString(java.lang.String key,
                           java.lang.String defaultValue)

getStringSeq

java.lang.String[] getStringSeq(java.lang.String key)

keySet

java.util.Set keySet()

putBoolean

void putBoolean(java.lang.String key,
                boolean value)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putClass

void putClass(java.lang.String key,
              java.lang.Class value)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putColor

void putColor(java.lang.String key,
              java.awt.Color value)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putColorSeq

void putColorSeq(java.lang.String key,
                 java.awt.Color[] value)

putDimension

void putDimension(java.lang.String key,
                  java.awt.Dimension value)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putDouble

void putDouble(java.lang.String key,
               double value)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putDoubleSeq

void putDoubleSeq(java.lang.String key,
                  double[] value)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putFont

void putFont(java.lang.String key,
             java.awt.Font value)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putFontSeq

void putFontSeq(java.lang.String key,
                java.awt.Font[] value)

putInt

void putInt(java.lang.String key,
            int value)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putIntSeq

void putIntSeq(java.lang.String key,
               int[] value)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putRectangle

void putRectangle(java.lang.String key,
                  java.awt.Rectangle value)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putString

void putString(java.lang.String key,
               java.lang.String value)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

putStringSeq

void putStringSeq(java.lang.String key,
                  java.lang.String[] value)
DOCUMENT ME!

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

writeXML

void writeXML(java.io.Writer writer)
              throws java.io.IOException
DOCUMENT ME!

Parameters:
writer - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!


Copyright © 2010. All Rights Reserved.