public class PropertyChangeHandlerSupport extends Object
HasPropertyChangeHandlers
.
It manages a list of handlers and dispatches PropertyChangeEvent
s.Constructor and Description |
---|
PropertyChangeHandlerSupport() |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeHandler(PropertyChangeHandler<?> handler)
Adds a
PropertyChangeHandler that will be notified when any property of the bound
object changes. |
void |
addPropertyChangeHandler(String name,
PropertyChangeHandler<?> handler)
Adds a
PropertyChangeHandler that will be notified only when the given property of the
bound object changes. |
void |
notifyHandlers(PropertyChangeEvent<?> event)
Notify registered
PropertyChangeHandlers of a PropertyChangeEvent . |
void |
removePropertyChangeHandler(PropertyChangeHandler<?> handler)
Removes a
PropertyChangeHandler from the list of handlers. |
void |
removePropertyChangeHandler(String name,
PropertyChangeHandler<?> handler)
Removes a
PropertyChangeHandler , causing it no longer to be notified only when the
given property of the bound object changes. |
public void addPropertyChangeHandler(PropertyChangeHandler<?> handler)
PropertyChangeHandler
that will be notified when any property of the bound
object changes. Multiple handlers can be registered. If the same handler instance is passed
multiple times, it will be notified multiple times.handler
- The PropertyChangeHandler
to add, must not be null.public void addPropertyChangeHandler(String name, PropertyChangeHandler<?> handler)
PropertyChangeHandler
that will be notified only when the given property of the
bound object changes. Multiple handlers can be registered for each property. If the same
handler instance is passed for the same property multiple times, it will be notified multiple
times. If the property name does not correspond to a property of the bound object, no exception
is thrown, but no events will ever be delivered to the handler.name
- The property name for which notifications should be sent.handler
- The PropertyChangeHandler
to add, must not be null.public void removePropertyChangeHandler(PropertyChangeHandler<?> handler)
PropertyChangeHandler
from the list of handlers. If the handler was added
more than once to the same event source, it will be notified one less time after being removed.
If handler is null, or was never added, no exception is thrown and no action is taken.handler
- The PropertyChangeHandler
to remove.public void removePropertyChangeHandler(String name, PropertyChangeHandler<?> handler)
PropertyChangeHandler
, causing it no longer to be notified only when the
given property of the bound object changes. If the same handler instance was added for the same
property multiple times, it will be notified one less time per change than before. If handler
is null, was never added, or the property name does not correspond to a property of the bound
object, no exception is thrown and no action is taken.name
- The property name for which notifications should be sent.handler
- The PropertyChangeHandler
to add, must not be null.public void notifyHandlers(PropertyChangeEvent<?> event)
PropertyChangeHandlers
of a PropertyChangeEvent
. Will only
dispatch events that represent a change. If oldValue and newValue are equal, the event will be
ignored.event
- PropertyChangeEvent
to provide to handlers.Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.