PropertyChangeSupport

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.beans
Class PropertyChangeSupport

    java.lang.Object
      java.beans.PropertyChangeSupport

All Implemented Interfaces:
  Serializable

    public class PropertyChangeSupport

extends Object
implements Serializable

This is a utility class that can be used by beans that support bound properties. You can use an instance of this class as a member field of your bean and delegate various work to it. This class is serializable. When it is serialized it will save (and restore) any listeners that are themselves serializable. Any non-serializable listeners will be skipped during serialization.

See Also:
  Serialized Form

Constructor Summary
`PropertyChangeSupport(Object sourceBean)` Constructs a `PropertyChangeSupport` object.

Method Summary
`void` | `addPropertyChangeListener(PropertyChangeListener listener)` Add a PropertyChangeListener to the listener list.
`void` | `firePropertyChange(String propertyName, Object oldValue, Object newValue)` Report a bound property update to any registered listeners.
`PropertyChangeListener[]` | `getPropertyChangeListeners()` Returns an array of all the listeners that were added to the PropertyChangeSupport object with addPropertyChangeListener().
`void` | `removePropertyChangeListener(PropertyChangeListener listener)` Remove a PropertyChangeListener from the listener list.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PropertyChangeSupport

    public PropertyChangeSupport(Object sourceBean)

  Constructs a `PropertyChangeSupport` object.

  Parameters:
    `sourceBean` - The bean to be given as the source for any events.

Method Detail

### addPropertyChangeListener

    public void addPropertyChangeListener(PropertyChangeListener listener)

  Add a PropertyChangeListener to the listener list. The listener is registered for all properties.

  Parameters:
    `listener` - The PropertyChangeListener to be added

### removePropertyChangeListener

    public void removePropertyChangeListener(PropertyChangeListener listener)

  Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

  Parameters:
    `listener` - The PropertyChangeListener to be removed

### getPropertyChangeListeners

    public PropertyChangeListener[] getPropertyChangeListeners()

  Returns an array of all the listeners that were added to the PropertyChangeSupport object with addPropertyChangeListener().

  Returns:
    all of the `PropertyChangeListeners` added or an empty array if no listeners have been added
  Since:
    1.4

### firePropertyChange

    public void firePropertyChange(String propertyName,
                                   Object oldValue,
                                   Object newValue)

  Report a bound property update to any registered listeners. No event is fired if old and new are equal and non-null.

  Parameters:
    `propertyName` - The programmatic name of the property that was changed.
    `oldValue` - The old value of the property.
    `newValue` - The new value of the property.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD