public class PropertyChangeEventForwarder extends java.lang.Object implements java.beans.PropertyChangeListener
PropertyChangeEvents to a collection of other PropertyChangeListeners and
optionally adds a prefix to the property name. The source of the delegated events will be identical
with the initial source.
One application of this class is delegating property change events from bean objects to their parent objects containing them with an according prefix.
| Constructor and Description |
|---|
PropertyChangeEventForwarder(java.lang.String prefix,
java.util.Collection<java.beans.PropertyChangeListener> targets)
Creates a new instance of this class.
|
PropertyChangeEventForwarder(java.lang.String prefix,
java.beans.PropertyChangeListener target)
Creates a new instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getPrefix() |
java.util.Collection<java.beans.PropertyChangeListener> |
getTargets() |
void |
propertyChange(java.beans.PropertyChangeEvent event) |
public PropertyChangeEventForwarder(java.lang.String prefix, java.util.Collection<java.beans.PropertyChangeListener> targets)
The specified collection will be used directly, i.e. later changes to that collection will automatically
be reflected by this instance. (Note that this may lead to a ConcurrentModificationException if
that collection is modified in another thread while propertyChange(PropertyChangeEvent) is
executed, even if the collection is thread save.)
prefix - the prefix to be add in front of the property name (Maybe null or "".)targets - the collection of property change listeners to delegate the events tojava.lang.NullPointerException - if targets is nullpublic PropertyChangeEventForwarder(java.lang.String prefix, java.beans.PropertyChangeListener target)
prefix - the prefix to be add in front of the property name (Maybe null or "".)target - a single property change listener to forward events to (More may be add later.)public java.lang.String getPrefix()
public java.util.Collection<java.beans.PropertyChangeListener> getTargets()
public void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange in interface java.beans.PropertyChangeListener