public abstract class AbstractObservable extends Object implements Observable
Modifier and Type | Field and Description |
---|---|
protected PropertyChangeSupport |
pcs |
Constructor and Description |
---|
AbstractObservable() |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds the given PropertyChangeListener to the listener list.
|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Removes the given PropertyChangeListener from the listener list.
|
protected void |
firePropertyChange(PropertyChangeEvent event) |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue) |
PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all the listeners that were added with addPropertyChangeListener().
|
PropertyChangeListener[] |
getPropertyChangeListeners(String propertyName)
Returns an array of all the listeners which have been associated
with the named property.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes the given PropertyChangeListener from the listener list.
|
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Removes the given PropertyChangeListener from the listener list.
|
protected final PropertyChangeSupport pcs
public void addPropertyChangeListener(@Nullable PropertyChangeListener listener)
Observable
The listener is registered for all bound properties of this class.
addPropertyChangeListener
in interface Observable
listener
- the PropertyChangeListener to be addedObservable.removePropertyChangeListener(PropertyChangeListener)
public void addPropertyChangeListener(@Nullable String propertyName, @Nullable PropertyChangeListener listener)
Observable
The listener is registered an specific property of this class.
addPropertyChangeListener
in interface Observable
propertyName
- The name of the property to listen on.listener
- the PropertyChangeListener to be addedObservable.removePropertyChangeListener(String, PropertyChangeListener)
public void removePropertyChangeListener(@Nullable PropertyChangeListener listener)
Observable
This method should be used to remove PropertyChangeListeners that were registered for all bound properties of this class.
removePropertyChangeListener
in interface Observable
listener
- the PropertyChangeListener to be removedObservable.addPropertyChangeListener(PropertyChangeListener)
public void removePropertyChangeListener(@Nullable String propertyName, @Nullable PropertyChangeListener listener)
Observable
This method should be used to remove PropertyChangeListeners that were registered for an specific property of this class.
removePropertyChangeListener
in interface Observable
propertyName
- The name of the property that was listened on.listener
- the PropertyChangeListener to be removedObservable.addPropertyChangeListener(String, PropertyChangeListener)
@Nonnull public PropertyChangeListener[] getPropertyChangeListeners()
Observable
getPropertyChangeListeners
in interface Observable
PropertyChangeListeners
added or an empty array if no
listeners have been added.@Nonnull public PropertyChangeListener[] getPropertyChangeListeners(@Nullable String propertyName)
Observable
getPropertyChangeListeners
in interface Observable
propertyName
- The name of the property being listened toPropertyChangeListeners
associated with
the named property. If no such listeners have been added,
or if propertyName
is null, an empty array is
returned.protected void firePropertyChange(@Nonnull PropertyChangeEvent event)