< prev index next >
src/java.desktop/share/classes/java/beans/VetoableChangeSupport.java
Print this page
*** 81,91 ****
*/
public class VetoableChangeSupport implements Serializable {
private VetoableChangeListenerMap map = new VetoableChangeListenerMap();
/**
! * Constructs a <code>VetoableChangeSupport</code> object.
*
* @param sourceBean The bean to be given as the source for any events.
*/
public VetoableChangeSupport(Object sourceBean) {
if (sourceBean == null) {
--- 81,91 ----
*/
public class VetoableChangeSupport implements Serializable {
private VetoableChangeListenerMap map = new VetoableChangeListenerMap();
/**
! * Constructs a {@code VetoableChangeSupport} object.
*
* @param sourceBean The bean to be given as the source for any events.
*/
public VetoableChangeSupport(Object sourceBean) {
if (sourceBean == null) {
*** 97,107 ****
/**
* Add a VetoableChangeListener to the listener list.
* The listener is registered for all properties.
* The same listener object may be added more than once, and will be called
* as many times as it is added.
! * If <code>listener</code> is null, no exception is thrown and no action
* is taken.
*
* @param listener The VetoableChangeListener to be added
*/
public void addVetoableChangeListener(VetoableChangeListener listener) {
--- 97,107 ----
/**
* Add a VetoableChangeListener to the listener list.
* The listener is registered for all properties.
* The same listener object may be added more than once, and will be called
* as many times as it is added.
! * If {@code listener} is null, no exception is thrown and no action
* is taken.
*
* @param listener The VetoableChangeListener to be added
*/
public void addVetoableChangeListener(VetoableChangeListener listener) {
*** 121,133 ****
/**
* Remove a VetoableChangeListener from the listener list.
* This removes a VetoableChangeListener that was registered
* for all properties.
! * If <code>listener</code> was added more than once to the same event
* source, it will be notified one less time after being removed.
! * If <code>listener</code> is null, or was never added, no exception is
* thrown and no action is taken.
*
* @param listener The VetoableChangeListener to be removed
*/
public void removeVetoableChangeListener(VetoableChangeListener listener) {
--- 121,133 ----
/**
* Remove a VetoableChangeListener from the listener list.
* This removes a VetoableChangeListener that was registered
* for all properties.
! * If {@code listener} was added more than once to the same event
* source, it will be notified one less time after being removed.
! * If {@code listener} is null, or was never added, no exception is
* thrown and no action is taken.
*
* @param listener The VetoableChangeListener to be removed
*/
public void removeVetoableChangeListener(VetoableChangeListener listener) {
*** 149,162 ****
* Returns an array of all the listeners that were added to the
* VetoableChangeSupport object with addVetoableChangeListener().
* <p>
* If some listeners have been added with a named property, then
* the returned array will be a mixture of VetoableChangeListeners
! * and <code>VetoableChangeListenerProxy</code>s. If the calling
* method is interested in distinguishing the listeners then it must
* test each element to see if it's a
! * <code>VetoableChangeListenerProxy</code>, perform the cast, and examine
* the parameter.
*
* <pre>{@code
* VetoableChangeListener[] listeners = bean.getVetoableChangeListeners();
* for (int i = 0; i < listeners.length; i++) {
--- 149,162 ----
* Returns an array of all the listeners that were added to the
* VetoableChangeSupport object with addVetoableChangeListener().
* <p>
* If some listeners have been added with a named property, then
* the returned array will be a mixture of VetoableChangeListeners
! * and {@code VetoableChangeListenerProxy}s. If the calling
* method is interested in distinguishing the listeners then it must
* test each element to see if it's a
! * {@code VetoableChangeListenerProxy}, perform the cast, and examine
* the parameter.
*
* <pre>{@code
* VetoableChangeListener[] listeners = bean.getVetoableChangeListeners();
* for (int i = 0; i < listeners.length; i++) {
*** 170,180 ****
* }
* }
* }</pre>
*
* @see VetoableChangeListenerProxy
! * @return all of the <code>VetoableChangeListeners</code> added or an
* empty array if no listeners have been added
* @since 1.4
*/
public VetoableChangeListener[] getVetoableChangeListeners(){
return this.map.getListeners();
--- 170,180 ----
* }
* }
* }</pre>
*
* @see VetoableChangeListenerProxy
! * @return all of the {@code VetoableChangeListeners} added or an
* empty array if no listeners have been added
* @since 1.4
*/
public VetoableChangeListener[] getVetoableChangeListeners(){
return this.map.getListeners();
*** 185,195 ****
* will be invoked only when a call on fireVetoableChange names that
* specific property.
* The same listener object may be added more than once. For each
* property, the listener will be invoked the number of times it was added
* for that property.
! * If <code>propertyName</code> or <code>listener</code> is null, no
* exception is thrown and no action is taken.
*
* @param propertyName The name of the property to listen on.
* @param listener The VetoableChangeListener to be added
* @since 1.2
--- 185,195 ----
* will be invoked only when a call on fireVetoableChange names that
* specific property.
* The same listener object may be added more than once. For each
* property, the listener will be invoked the number of times it was added
* for that property.
! * If {@code propertyName} or {@code listener} is null, no
* exception is thrown and no action is taken.
*
* @param propertyName The name of the property to listen on.
* @param listener The VetoableChangeListener to be added
* @since 1.2
*** 206,221 ****
}
}
/**
* Remove a VetoableChangeListener for a specific property.
! * If <code>listener</code> was added more than once to the same event
* source for the specified property, it will be notified one less time
* after being removed.
! * If <code>propertyName</code> is null, no exception is thrown and no
* action is taken.
! * If <code>listener</code> is null, or was never added for the specified
* property, no exception is thrown and no action is taken.
*
* @param propertyName The name of the property that was listened on.
* @param listener The VetoableChangeListener to be removed
* @since 1.2
--- 206,221 ----
}
}
/**
* Remove a VetoableChangeListener for a specific property.
! * If {@code listener} was added more than once to the same event
* source for the specified property, it will be notified one less time
* after being removed.
! * If {@code propertyName} is null, no exception is thrown and no
* action is taken.
! * If {@code listener} is null, or was never added for the specified
* property, no exception is thrown and no action is taken.
*
* @param propertyName The name of the property that was listened on.
* @param listener The VetoableChangeListener to be removed
* @since 1.2
*** 235,247 ****
/**
* Returns an array of all the listeners which have been associated
* with the named property.
*
* @param propertyName The name of the property being listened to
! * @return all the <code>VetoableChangeListeners</code> associated with
* the named property. If no such listeners have been added,
! * or if <code>propertyName</code> is null, an empty array is
* returned.
* @since 1.4
*/
public VetoableChangeListener[] getVetoableChangeListeners(String propertyName) {
return this.map.getListeners(propertyName);
--- 235,247 ----
/**
* Returns an array of all the listeners which have been associated
* with the named property.
*
* @param propertyName The name of the property being listened to
! * @return all the {@code VetoableChangeListeners} associated with
* the named property. If no such listeners have been added,
! * or if {@code propertyName} is null, an empty array is
* returned.
* @since 1.4
*/
public VetoableChangeListener[] getVetoableChangeListeners(String propertyName) {
return this.map.getListeners(propertyName);
*** 398,408 ****
}
}
/**
* Check if there are any listeners for a specific property, including
! * those registered on all properties. If <code>propertyName</code>
* is null, only check for listeners registered on all properties.
*
* @param propertyName the property name.
* @return true if there are one or more listeners for the given property
* @since 1.2
--- 398,408 ----
}
}
/**
* Check if there are any listeners for a specific property, including
! * those registered on all properties. If {@code propertyName}
* is null, only check for listeners registered on all properties.
*
* @param propertyName the property name.
* @return true if there are one or more listeners for the given property
* @since 1.2
*** 410,420 ****
public boolean hasListeners(String propertyName) {
return this.map.hasListeners(propertyName);
}
/**
! * @serialData Null terminated list of <code>VetoableChangeListeners</code>.
* <p>
* At serialization time we skip non-serializable listeners and
* only serialize the serializable listeners.
*/
private void writeObject(ObjectOutputStream s) throws IOException {
--- 410,420 ----
public boolean hasListeners(String propertyName) {
return this.map.hasListeners(propertyName);
}
/**
! * @serialData Null terminated list of {@code VetoableChangeListeners}.
* <p>
* At serialization time we skip non-serializable listeners and
* only serialize the serializable listeners.
*/
private void writeObject(ObjectOutputStream s) throws IOException {
< prev index next >