org.progeeks.util.beans
Class PropertyChangeLink

java.lang.Object
  extended by org.progeeks.util.beans.PropertyChangeLink
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener

public class PropertyChangeLink
extends java.lang.Object
implements java.beans.PropertyChangeListener

Property change listener that can listen for changes in a property on one bean and use them to modify the property of another bean. The property name can even be transformed in the process.

Version:
$Revision: 1.5 $
Author:
Paul Speed

Constructor Summary
PropertyChangeLink()
           
PropertyChangeLink(java.lang.Object delegateBean)
           
PropertyChangeLink(java.lang.String source, java.lang.String target, java.lang.Object delegate)
           
 
Method Summary
 java.lang.Object getDelegate()
           
 java.lang.String getSourceProperty()
           
 java.lang.String getTargetProperty()
           
 void initializeProperty(java.lang.Object sourceBean)
          Initializes the property value on the delegate bean to the value read from the source bean.
 void propertyChange(java.beans.PropertyChangeEvent event)
           
 void setDelegate(java.lang.Object delegateBean)
           
 void setSourceProperty(java.lang.String name)
          Sets the name of the source property to which this PropertyChangeLink will respond.
 void setTargetProperty(java.lang.String name)
          Sets the property that will be set when change events are received for the source property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyChangeLink

public PropertyChangeLink()

PropertyChangeLink

public PropertyChangeLink(java.lang.Object delegateBean)

PropertyChangeLink

public PropertyChangeLink(java.lang.String source,
                          java.lang.String target,
                          java.lang.Object delegate)
Method Detail

initializeProperty

public void initializeProperty(java.lang.Object sourceBean)
Initializes the property value on the delegate bean to the value read from the source bean.


setDelegate

public void setDelegate(java.lang.Object delegateBean)

getDelegate

public java.lang.Object getDelegate()

setSourceProperty

public void setSourceProperty(java.lang.String name)
Sets the name of the source property to which this PropertyChangeLink will respond. It acts as a sort of filter in case the link is added as a global change listener to a bean. Defaults to target property.


getSourceProperty

public java.lang.String getSourceProperty()

setTargetProperty

public void setTargetProperty(java.lang.String name)
Sets the property that will be set when change events are received for the source property. If neither the source or target are specified then all properties will be passed along.


getTargetProperty

public java.lang.String getTargetProperty()

propertyChange

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


Copyright © 2002-2003 Paul Speed. All Rights Reserved.