JHotDraw 7.4.1

Class WeakPropertyChangeListener

  extended by org.jhotdraw.beans.WeakPropertyChangeListener
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener

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

Property change listener that holds weak reference to a target property change listener. If the weak reference becomes null (meaning the delegate has been GC'ed) then this listener will remove itself from any beans that it receives events from. It isn't perfect, but it's a lot better than nothing... and presumably beans that no longer send out events probably don't care if their listeners weren't properly cleaned up. Design pattern: Proxy.

$Id: WeakPropertyChangeListener.java 604 2010-01-09 12:00:29Z rawcoder $
Paul Speed

Constructor Summary
WeakPropertyChangeListener(java.beans.PropertyChangeListener target)
Method Summary
 java.beans.PropertyChangeListener getTarget()
          Returns the target of this proxy.
 void propertyChange(java.beans.PropertyChangeEvent event)
protected  void removeFromSource(java.beans.PropertyChangeEvent event)
          Method that can be subclassed to provide additional remove support.
 java.lang.String toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public WeakPropertyChangeListener(java.beans.PropertyChangeListener target)
Method Detail


protected void removeFromSource(java.beans.PropertyChangeEvent event)
Method that can be subclassed to provide additional remove support. Default implementation only supports StandardBeans.


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


public java.beans.PropertyChangeListener getTarget()
Returns the target of this proxy. Returns null if the target has been garbage collected.

The target or null.


public java.lang.String toString()
toString in class java.lang.Object

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.