public final class WeakPropertyChangeSupport
extends java.lang.Object
WeakPropertyChangeSupport
is similar to PropertyChangeSupport
, but holds the PropertyChangeListener
s with a WeakReference
. This allows listeners
to be garbage collected without having to explicitly be removed.Constructor and Description |
---|
WeakPropertyChangeSupport(java.lang.Object source)
Construct a new
WeakPropertyChangeSupport . |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a
PropertyChangeListener to the listener list. |
void |
firePropertyChange(java.beans.PropertyChangeEvent event)
Fires a
PropertyChangeEvent to each added listener. |
void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Fires a
PropertyChangeEvent to each added listener. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a
PropertyChangeListener from the listener list. |
public WeakPropertyChangeSupport(java.lang.Object source)
WeakPropertyChangeSupport
.source
- the source of the property changes to manage.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener
to the listener list. If the
listener is already present it is not added a second time.listener
- the listener to addpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener
from the listener list.listener
- the listener to removepublic void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
PropertyChangeEvent
to each added listener. If the values
are equal, the event will not be fired.public void firePropertyChange(java.beans.PropertyChangeEvent event)
PropertyChangeEvent
to each added listener. If the values
are equal, the event will not be fired.