edu.washington.cs.supple.beanlike
Class BeanlikeValue

java.lang.Object
  extended byedu.washington.cs.supple.rep.values.Variable
      extended byedu.washington.cs.supple.beanlike.BeanlikeValue
All Implemented Interfaces:
java.util.EventListener, java.beans.PropertyChangeListener, ValueBinding

public class BeanlikeValue
extends Variable
implements ValueBinding, java.beans.PropertyChangeListener

BeanlikeValue allows a Supple UI variable to be bound to a beanlike property. The value of the property may be simple (String, Integer, etc.) or complex (i.e. a ValueObject).

Author:
dbc1

Constructor Summary
BeanlikeValue(java.lang.Object beanlike, BeanlikePropertyDescriptor pd, BeanlikeValueDescriptor bvd)
          Create a value binding that listens to a beanlike property.
BeanlikeValue(java.lang.Object beanlike, java.lang.String propertyName)
          Create a value binding that listens to a beanlike property.
BeanlikeValue(java.lang.Object beanlike, java.lang.String propertyName, BeanlikeValueDescriptor bvd)
          Create a value binding that listens to a beanlike property, and binds
 
Method Summary
 java.lang.Object fromBeanlike(java.lang.Object value)
          Convert a value from a bean property into a usable value object.
 java.lang.Object getValue()
          Get the bound value.
 java.lang.Class getValueClass()
          Get the class of this variable
protected  void postLastListener()
          Subclasses can use this to implement post-last-listener cleanup.
protected  void preFirstListener()
          Subclasses can use this to implement pre-first-listener setup.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 void setValue(java.lang.Object value)
          Set the value of this variable.
 java.lang.Object toBeanlike(java.lang.Object value)
          Extract the beanlike from an incoming value object.
 java.lang.String toString()
           
 
Methods inherited from class edu.washington.cs.supple.rep.values.Variable
addListener, processUpdate, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.washington.cs.supple.rep.values.ValueBinding
addListener, removeListener
 

Constructor Detail

BeanlikeValue

public BeanlikeValue(java.lang.Object beanlike,
                     java.lang.String propertyName)
Create a value binding that listens to a beanlike property.


BeanlikeValue

public BeanlikeValue(java.lang.Object beanlike,
                     java.lang.String propertyName,
                     BeanlikeValueDescriptor bvd)
Create a value binding that listens to a beanlike property, and binds


BeanlikeValue

public BeanlikeValue(java.lang.Object beanlike,
                     BeanlikePropertyDescriptor pd,
                     BeanlikeValueDescriptor bvd)
Create a value binding that listens to a beanlike property.

Method Detail

getValueClass

public java.lang.Class getValueClass()
Description copied from interface: ValueBinding
Get the class of this variable

Specified by:
getValueClass in interface ValueBinding
Returns:

getValue

public java.lang.Object getValue()
Description copied from interface: ValueBinding
Get the bound value.

Specified by:
getValue in interface ValueBinding
Returns:

setValue

public void setValue(java.lang.Object value)
Description copied from interface: ValueBinding
Set the value of this variable.

Specified by:
setValue in interface ValueBinding
Parameters:
value -

preFirstListener

protected void preFirstListener()
Description copied from class: Variable
Subclasses can use this to implement pre-first-listener setup.

Overrides:
preFirstListener in class Variable

postLastListener

protected void postLastListener()
Description copied from class: Variable
Subclasses can use this to implement post-last-listener cleanup.

Overrides:
postLastListener in class Variable

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

fromBeanlike

public java.lang.Object fromBeanlike(java.lang.Object value)
Convert a value from a bean property into a usable value object.

Parameters:
value -
Returns:

toBeanlike

public java.lang.Object toBeanlike(java.lang.Object value)
Extract the beanlike from an incoming value object.

Parameters:
value -
Returns:

toString

public java.lang.String toString()