public class PropertyChangeSupport extends Object implements Serializable
Constructor and Description |
---|
PropertyChangeSupport(Object source)
Create a PropertyChangeSupport to work with a specific source bean.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener l)
Adds a PropertyChangeListener to the list of global listeners.
|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener l)
Adds a PropertyChangeListener listening on the specified property.
|
void |
fireIndexedPropertyChange(String name,
int index,
boolean oldValue,
boolean newValue)
Fire an indexed property change event.
|
void |
fireIndexedPropertyChange(String name,
int index,
int oldValue,
int newValue)
Fire an indexed property change event.
|
void |
fireIndexedPropertyChange(String name,
int index,
Object oldValue,
Object newValue)
Fire an indexed property change event.
|
void |
firePropertyChange(PropertyChangeEvent event)
Fire a PropertyChangeEvent to all the global listeners, and to all the
listeners for the specified property name.
|
void |
firePropertyChange(String propertyName,
boolean oldVal,
boolean newVal)
Fire a PropertyChangeEvent containing the old and new values of the
property to all the global listeners, and to all the listeners for the
specified property name.
|
void |
firePropertyChange(String propertyName,
int oldVal,
int newVal)
Fire a PropertyChangeEvent containing the old and new values of the
property to all the global listeners, and to all the listeners for the
specified property name.
|
void |
firePropertyChange(String propertyName,
Object oldVal,
Object newVal)
Fire a PropertyChangeEvent containing the old and new values of the
property to all the global listeners, and to all the listeners for the
specified property name.
|
PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all registered property change listeners.
|
PropertyChangeListener[] |
getPropertyChangeListeners(String propertyName)
Returns an array of all property change listeners registered under the
given property name.
|
boolean |
hasListeners(String propertyName)
Tell whether the specified property is being listened on or not.
|
void |
removePropertyChangeListener(PropertyChangeListener l)
Removes a PropertyChangeListener from the list of global listeners.
|
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener l)
Removes a PropertyChangeListener from listening to a specific property.
|
public PropertyChangeSupport(Object source)
source
- the source bean to useNullPointerException
- if source is nullpublic void addPropertyChangeListener(PropertyChangeListener l)
l
- the listener to addpublic void removePropertyChangeListener(PropertyChangeListener l)
add()
has been called multiple times for a
particular listener, remove()
will have to be called the
same number of times to deregister it. This method will unwrap a
PropertyChangeListenerProxy, removing the underlying delegate from the
named property list.l
- the listener to removepublic PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListenerProxy
, so you must check whether the
listener is an instance of the proxy class in order to see what name the
real listener is registered under. If there are no registered listeners,
this returns an empty array.PropertyChangeListenerProxy
public void addPropertyChangeListener(String propertyName, PropertyChangeListener l)
propertyName
- the name of the property to listen onl
- the listener to addNullPointerException
- if propertyName is nullpublic void removePropertyChangeListener(String propertyName, PropertyChangeListener l)
add()
has been called multiple times for a particular
listener on a property, remove()
will have to be called the
same number of times to deregister it. This method will unwrap a
PropertyChangeListenerProxy, removing the underlying delegate from the
named property list if the names match.propertyName
- the property to stop listening onl
- the listener to removeNullPointerException
- if propertyName is nullpublic PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
public void firePropertyChange(String propertyName, Object oldVal, Object newVal)
propertyName
- the name of the property that changedoldVal
- the old valuenewVal
- the new valuepublic void firePropertyChange(String propertyName, int oldVal, int newVal)
propertyName
- the name of the property that changedoldVal
- the old valuenewVal
- the new valuepublic void firePropertyChange(String propertyName, boolean oldVal, boolean newVal)
propertyName
- the name of the property that changedoldVal
- the old valuenewVal
- the new valuepublic void firePropertyChange(PropertyChangeEvent event)
event
- the event to fireNullPointerException
- if event is nullpublic void fireIndexedPropertyChange(String name, int index, Object oldValue, Object newValue)
name
- the name of the property which changedindex
- the index of the property which changedoldValue
- the old value of the propertynewValue
- the new value of the propertypublic void fireIndexedPropertyChange(String name, int index, int oldValue, int newValue)
name
- the name of the property which changedindex
- the index of the property which changedoldValue
- the old value of the propertynewValue
- the new value of the propertypublic void fireIndexedPropertyChange(String name, int index, boolean oldValue, boolean newValue)
name
- the name of the property which changedindex
- the index of the property which changedoldValue
- the old value of the propertynewValue
- the new value of the propertypublic boolean hasListeners(String propertyName)
true
if there are listeners on all
properties or if there is a listener specifically on this property.propertyName
- the property that may be listened on