| org.apache.commons.events.observable.BoundCollection
All known Subclasses: org.apache.commons.events.observable.BoundBag, org.apache.commons.events.observable.BoundList, org.apache.commons.events.observable.BoundSet, org.apache.commons.events.observable.BoundBuffer,
BoundCollection | public class BoundCollection extends AbstractCollectionDecorator (Code) | |
Decorates a Collection implementation with a bound
property named "collection".
Each modifying method call made on this Collection is
handled as a change to the "collection" property. This
facility serves to notify subscribers of a change to the collection
but does not allow users the option of vetoing the change. To
gain the ability to veto the change, use a
ConstrainedCollection decorater.
Registered listeners must implement the
java.beans.PropertyChangeListener interface. Each change request causes a
CollectionChangeEvent to be fired after the request
has been executed. The
CollectionChangeEvent provides an
indication of the type of change, the element participating in the
change, and whether or not the collection was actually affected by the
change request. As such, receiving a CollectionChangeEvent
is merely an indication that a change was attempted, not that the
Collection is actually different.
See Also: java.beans.PropertyChangeListener since: Commons Events 1.0 version: $Revision: 155443 $ $Date: 2005-02-26 06:19:51 -0700 (Sat, 26 Feb 2005) $ author: Stephen Colebourne, Bryce Nordgren |
Inner Class :protected class BoundIterator extends AbstractIteratorDecorator | |
BoundCollection | protected BoundCollection(Collection coll, CollectionChangeEventFactory eventFactory)(Code) | | Constructor that wraps (not copies) and takes a
CollectionChangeEventFactory .
This should be used if the client wants to provide a user-specific
CollectionChangeEventFactory implementation. Note that the
same instance of the factory may not be used with multiple
collection decorators.
Parameters: coll - the collection to decorate, must not be null Parameters: eventFactory - the factory which instantiates CollectionChangeEvents. throws: IllegalArgumentException - if the collection or event factoryis null. throws: UnsupportedOperationException - if the eventFactory has already been used with another collection decorator. |
BoundCollection | protected BoundCollection(Collection coll)(Code) | | Constructor that wraps (not copies) and uses the
DefaultCollectionChangeEventFactory .
This should be used if the default change events are considered
adequate to the task of monitoring changes to the collection.
Parameters: coll - the collection to decorate, must not be null throws: IllegalArgumentException - if the collection is null |
addPropertyChangeListener | public void addPropertyChangeListener(PropertyChangeListener l)(Code) | | Registers a listener with this decorator. The Listener must
implement the PropertyChangeListener interface.
Adding a listener more than once will result in more than
one notification for each change event.
Parameters: l - The listener to register with this decorator. |
clear | public void clear()(Code) | | |
createEventRepeater | EventRepeater createEventRepeater()(Code) | | Package private method to create an EventRepeater from within the
context of a particular BoundCollection object. This event repeater
will relay events to all property change listeners subscribed to this
bound collection.
the event repeater object. |
firePropertyChange | protected void firePropertyChange(PropertyChangeEvent evt)(Code) | | This is a utility method to allow subclasses to fire property change
events.
Parameters: evt - The pre-constructed event. |
removePropertyChangeListener | public void removePropertyChangeListener(PropertyChangeListener l)(Code) | | Unregisters a listener from this decorator. The Listener must
implement the PropertyChangeListener interface.
If the listener was registered more than once, calling this method
cancels out a single registration. If the listener is not
registered with this object, no action is taken.
Parameters: l - The listener to register with this decorator. |
|
|