public class VetoableChangeSupport extends Object implements Serializable
Constructor and Description |
---|
VetoableChangeSupport(Object source)
Create a VetoableChangeSupport to work with a specific source bean.
|
Modifier and Type | Method and Description |
---|---|
void |
addVetoableChangeListener(String propertyName,
VetoableChangeListener l)
Adds a VetoableChangeListener listening on the specified property.
|
void |
addVetoableChangeListener(VetoableChangeListener l)
Adds a VetoableChangeListener to the list of global listeners.
|
void |
fireVetoableChange(PropertyChangeEvent event)
Fire a PropertyChangeEvent to all the global listeners, and to all the
listeners for the specified property name.
|
void |
fireVetoableChange(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 |
fireVetoableChange(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 |
fireVetoableChange(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.
|
VetoableChangeListener[] |
getVetoableChangeListeners()
Returns an array of all registered vetoable change listeners.
|
VetoableChangeListener[] |
getVetoableChangeListeners(String propertyName)
Returns an array of all vetoable change listeners registered under the
given property name.
|
boolean |
hasListeners(String propertyName)
Tell whether the specified property is being listened on or not.
|
void |
removeVetoableChangeListener(String propertyName,
VetoableChangeListener l)
Removes a VetoableChangeListener from listening to a specific property.
|
void |
removeVetoableChangeListener(VetoableChangeListener l)
Removes a VetoableChangeListener from the list of global listeners.
|
public VetoableChangeSupport(Object source)
source
- the source bean to useNullPointerException
- if source is nullpublic void addVetoableChangeListener(VetoableChangeListener l)
l
- the listener to add (null
ignored).public void removeVetoableChangeListener(VetoableChangeListener 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
VetoableChangeListenerProxy, removing the underlying delegate from the
named property list.l
- the listener to removepublic VetoableChangeListener[] getVetoableChangeListeners()
VetoableChangeListenerProxy
, 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.VetoableChangeListenerProxy
public void addVetoableChangeListener(String propertyName, VetoableChangeListener l)
propertyName
- the name of the property to listen onl
- the listener to addpublic void removeVetoableChangeListener(String propertyName, VetoableChangeListener 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
VetoableChangeListenerProxy, 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 VetoableChangeListener[] getVetoableChangeListeners(String propertyName)
NullPointerException
- if propertyName is nullpublic void fireVetoableChange(String propertyName, Object oldVal, Object newVal) throws PropertyVetoException
propertyName
- the name of the property that changedoldVal
- the old valuenewVal
- the new valuePropertyVetoException
- if the change is vetoed by a listenerpublic void fireVetoableChange(String propertyName, int oldVal, int newVal) throws PropertyVetoException
propertyName
- the name of the property that changedoldVal
- the old valuenewVal
- the new valuePropertyVetoException
- if the change is vetoed by a listenerpublic void fireVetoableChange(String propertyName, boolean oldVal, boolean newVal) throws PropertyVetoException
propertyName
- the name of the property that changedoldVal
- the old valuenewVal
- the new valuePropertyVetoException
- if the change is vetoed by a listenerpublic void fireVetoableChange(PropertyChangeEvent event) throws PropertyVetoException
event
- the event to fireNullPointerException
- if event is nullPropertyVetoException
- if the change is vetoed by a listenerpublic 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 onNullPointerException
- if propertyName is null