< prev index next >

src/java.desktop/share/classes/java/beans/PropertyChangeSupport.java

Print this page

        

*** 81,91 **** */ public class PropertyChangeSupport implements Serializable { private PropertyChangeListenerMap map = new PropertyChangeListenerMap(); /** ! * Constructs a <code>PropertyChangeSupport</code> object. * * @param sourceBean The bean to be given as the source for any events. */ public PropertyChangeSupport(Object sourceBean) { if (sourceBean == null) { --- 81,91 ---- */ public class PropertyChangeSupport implements Serializable { private PropertyChangeListenerMap map = new PropertyChangeListenerMap(); /** ! * Constructs a {@code PropertyChangeSupport} object. * * @param sourceBean The bean to be given as the source for any events. */ public PropertyChangeSupport(Object sourceBean) { if (sourceBean == null) {
*** 97,107 **** /** * Add a PropertyChangeListener 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 PropertyChangeListener to be added */ public void addPropertyChangeListener(PropertyChangeListener listener) { --- 97,107 ---- /** * Add a PropertyChangeListener 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 PropertyChangeListener to be added */ public void addPropertyChangeListener(PropertyChangeListener listener) {
*** 121,133 **** /** * Remove a PropertyChangeListener from the listener list. * This removes a PropertyChangeListener 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 PropertyChangeListener to be removed */ public void removePropertyChangeListener(PropertyChangeListener listener) { --- 121,133 ---- /** * Remove a PropertyChangeListener from the listener list. * This removes a PropertyChangeListener 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 PropertyChangeListener to be removed */ public void removePropertyChangeListener(PropertyChangeListener listener) {
*** 149,162 **** * Returns an array of all the listeners that were added to the * PropertyChangeSupport object with addPropertyChangeListener(). * <p> * If some listeners have been added with a named property, then * the returned array will be a mixture of PropertyChangeListeners ! * and <code>PropertyChangeListenerProxy</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>PropertyChangeListenerProxy</code>, perform the cast, and examine * the parameter. * * <pre>{@code * PropertyChangeListener[] listeners = bean.getPropertyChangeListeners(); * for (int i = 0; i < listeners.length; i++) { --- 149,162 ---- * Returns an array of all the listeners that were added to the * PropertyChangeSupport object with addPropertyChangeListener(). * <p> * If some listeners have been added with a named property, then * the returned array will be a mixture of PropertyChangeListeners ! * and {@code PropertyChangeListenerProxy}s. If the calling * method is interested in distinguishing the listeners then it must * test each element to see if it's a ! * {@code PropertyChangeListenerProxy}, perform the cast, and examine * the parameter. * * <pre>{@code * PropertyChangeListener[] listeners = bean.getPropertyChangeListeners(); * for (int i = 0; i < listeners.length; i++) {
*** 170,180 **** * } * } * }</pre> * * @see PropertyChangeListenerProxy ! * @return all of the <code>PropertyChangeListeners</code> added or an * empty array if no listeners have been added * @since 1.4 */ public PropertyChangeListener[] getPropertyChangeListeners() { return this.map.getListeners(); --- 170,180 ---- * } * } * }</pre> * * @see PropertyChangeListenerProxy ! * @return all of the {@code PropertyChangeListeners} added or an * empty array if no listeners have been added * @since 1.4 */ public PropertyChangeListener[] getPropertyChangeListeners() { return this.map.getListeners();
*** 185,195 **** * will be invoked only when a call on firePropertyChange 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 PropertyChangeListener to be added * @since 1.2 --- 185,195 ---- * will be invoked only when a call on firePropertyChange 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 PropertyChangeListener to be added * @since 1.2
*** 206,221 **** } } /** * Remove a PropertyChangeListener 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 PropertyChangeListener to be removed * @since 1.2 --- 206,221 ---- } } /** * Remove a PropertyChangeListener 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 PropertyChangeListener 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 of the <code>PropertyChangeListeners</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 PropertyChangeListener[] getPropertyChangeListeners(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 of the {@code PropertyChangeListeners} 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 PropertyChangeListener[] getPropertyChangeListeners(String propertyName) { return this.map.getListeners(propertyName);
*** 409,419 **** } } /** * 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 --- 409,419 ---- } } /** * 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
*** 421,431 **** public boolean hasListeners(String propertyName) { return this.map.hasListeners(propertyName); } /** ! * @serialData Null terminated list of <code>PropertyChangeListeners</code>. * <p> * At serialization time we skip non-serializable listeners and * only serialize the serializable listeners. */ private void writeObject(ObjectOutputStream s) throws IOException { --- 421,431 ---- public boolean hasListeners(String propertyName) { return this.map.hasListeners(propertyName); } /** ! * @serialData Null terminated list of {@code PropertyChangeListeners}. * <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 >