com.fruitioninc.jwc
Class DefaultStateManager

java.lang.Object
  |
  +--com.fruitioninc.jwc.DefaultStateManager
All Implemented Interfaces:
StateManager

public class DefaultStateManager
extends java.lang.Object
implements StateManager

Default component state manager used by most components. FIXME: change this to make it possible to extend it to support the marshalling/unmarshalling of more types with the need to modify it.


Constructor Summary
DefaultStateManager()
           
 
Method Summary
 void getProperties(Memento state, Component component)
          Add the state of a component to a momento.
 java.lang.String[] marshall(Component component, java.lang.String name, java.lang.Object value)
          Converts an value from a model to a string representation.
 void setProperty(Component component, java.lang.String name, java.lang.String[] values)
          Set a property on a component.
 java.lang.Object unmarshall(Component component, java.lang.String name, java.lang.String[] values)
          Converts an array of strings to an appropriate object for a components model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultStateManager

public DefaultStateManager()
Method Detail

getProperties

public void getProperties(Memento state,
                          Component component)
Add the state of a component to a momento.

Specified by:
getProperties in interface StateManager

setProperty

public void setProperty(Component component,
                        java.lang.String name,
                        java.lang.String[] values)
Set a property on a component.

Specified by:
setProperty in interface StateManager

marshall

public java.lang.String[] marshall(Component component,
                                   java.lang.String name,
                                   java.lang.Object value)
Description copied from interface: StateManager
Converts an value from a model to a string representation.

Specified by:
marshall in interface StateManager
Parameters:
component - the component the value is being converted for
name - the name of the field on the component's model that the value is from
value - the value to convert

unmarshall

public java.lang.Object unmarshall(Component component,
                                   java.lang.String name,
                                   java.lang.String[] values)
Description copied from interface: StateManager
Converts an array of strings to an appropriate object for a components model.

Specified by:
unmarshall in interface StateManager
Parameters:
component - the component the values are being converted for
name - the name of the field on the component's model that the values are for
values - the array of strings to convert