org.progeeks.meta.util
Class PropertyLink

java.lang.Object
  extended by org.progeeks.meta.util.PropertyLink

public class PropertyLink
extends java.lang.Object

Synchronizes a property on one object with a property on another. Objects are denoted as primary and secondary but the link works in both directions. The primary designation is used to define the initial value that should be pushed to the secondary. The secondary object is passive during initialization.

This object supports linking both meta-objects and beans. It will also auto-create links to beans created by a BeanConfigurator if the secondary of the link is a BeanConfigurator.

One example use for this class would be linking a user preferences object to factory created user interface components. In that case, the primary object would be the preferences object (potentially persisted or backed by Java preferences) and would be automatically linked to the UI beans created by the BeanConfigurator set as the secondary object.

Version:
$Revision: 1.3 $
Author:
Paul Speed

Constructor Summary
PropertyLink()
           
 
Method Summary
protected  void addListeners(java.lang.Object obj, java.lang.String propertyName)
          Adds the appropriate listeners to the object depending on its type.
 java.lang.Object getPrimaryObject()
           
 java.lang.String getPrimaryProperty()
           
 java.lang.Object getSecondaryObject()
           
 java.lang.String getSecondaryProperty()
           
protected  void refreshSecondary(java.lang.Object skip)
          Pushes the primary's property value to any existing secondary objects.
protected  void removeListeners(java.lang.Object obj, java.lang.String propertyName)
          Removes the appropriate listeners from the object depending on its type.
 void setPrimaryObject(java.lang.Object primary)
           
 void setPrimaryProperty(java.lang.String name)
           
 void setSecondaryObject(java.lang.Object secondary)
           
 void setSecondaryProperty(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyLink

public PropertyLink()
Method Detail

setPrimaryObject

public void setPrimaryObject(java.lang.Object primary)

getPrimaryObject

public java.lang.Object getPrimaryObject()

setPrimaryProperty

public void setPrimaryProperty(java.lang.String name)

getPrimaryProperty

public java.lang.String getPrimaryProperty()

setSecondaryObject

public void setSecondaryObject(java.lang.Object secondary)

getSecondaryObject

public java.lang.Object getSecondaryObject()

setSecondaryProperty

public void setSecondaryProperty(java.lang.String name)

getSecondaryProperty

public java.lang.String getSecondaryProperty()

refreshSecondary

protected void refreshSecondary(java.lang.Object skip)
Pushes the primary's property value to any existing secondary objects.


addListeners

protected void addListeners(java.lang.Object obj,
                            java.lang.String propertyName)
Adds the appropriate listeners to the object depending on its type.


removeListeners

protected void removeListeners(java.lang.Object obj,
                               java.lang.String propertyName)
Removes the appropriate listeners from the object depending on its type.



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