public class CollectionChangeSupport<T>
extends java.lang.Object
CollectionListener
management.
T
is the type of item stored in the collection.Constructor and Description |
---|
CollectionChangeSupport(java.lang.Object source)
Creates a collection change support.
|
Modifier and Type | Method and Description |
---|---|
void |
addCollectionListener(CollectionListener<T> listener)
Adds the
listener in parameter to the list of listeners that may be notified. |
void |
fireCollectionChanged(T item,
CollectionEvent.Type eventType)
Fires a collection event about
item . |
void |
fireCollectionChanged(T item,
int index,
CollectionEvent.Type eventType)
Fires a collection event about
item at a given index . |
void |
removeCollectionListener(CollectionListener<T> listener)
Removes the
listener in parameter to the list of listeners that may be notified. |
public CollectionChangeSupport(java.lang.Object source)
source
- the collection to which data will be added.public void addCollectionListener(CollectionListener<T> listener)
listener
in parameter to the list of listeners that may be notified.listener
- the listener to addpublic void removeCollectionListener(CollectionListener<T> listener)
listener
in parameter to the list of listeners that may be notified.listener
- the listener to remove. If it doesn't exist, it's simply ignored.public void fireCollectionChanged(T item, CollectionEvent.Type eventType)
item
.item
- the added ore deleted itemeventType
- CollectionEvent.Type.ADD
or CollectionEvent.Type.DELETE
public void fireCollectionChanged(T item, int index, CollectionEvent.Type eventType)
item
at a given index
.item
- the added ore deleted itemindex
- the optional index at which the item was added or deletedeventType
- CollectionEvent.Type.ADD
or CollectionEvent.Type.DELETE
© Copyright 2024 Space Mushrooms
Distributed under GNU General Public License