org.dishevelled.observable.event
Class ObservableCollectionChangeSupport<E>

java.lang.Object
  extended by org.dishevelled.observable.event.ObservableCollectionChangeSupport<E>
Type Parameters:
E - collection element type
All Implemented Interfaces:
Serializable

public class ObservableCollectionChangeSupport<E>
extends Object
implements Serializable

A support class that can be used via delegation to provide CollectionChangeListener and VetoableCollectionChangeListener management.

Version:
$Revision$ $Date$
Author:
Michael Heuer
See Also:
Serialized Form

Constructor Summary
protected ObservableCollectionChangeSupport()
          Create a new support class meant to be subclassed.
  ObservableCollectionChangeSupport(ObservableCollection<E> source)
          Create a new support class that fires collection change and vetoable collection change events with the specified source as the source of the events.
 
Method Summary
 void addCollectionChangeListener(CollectionChangeListener<E> l)
          Add the specified collection change listener.
 void addVetoableCollectionChangeListener(VetoableCollectionChangeListener<E> l)
          Add the specified vetoable collection change listener.
 void fireCollectionChanged()
          Fire a change event to all registered CollectionChangeListeners.
 void fireCollectionChanged(CollectionChangeEvent<E> e)
          Fire the specified change event to all registered CollectionChangeListeners.
 void fireCollectionWillChange()
          Fire a will change event to all registered VetoableCollectionChangeListeners.
 void fireCollectionWillChange(VetoableCollectionChangeEvent<E> e)
          Fire the specified will change event to all registered VetoableCollectionChangeListeners.
 int getCollectionChangeListenerCount()
          Return the number of CollectionChangeListeners registered to this observable collection support class.
 CollectionChangeListener<E>[] getCollectionChangeListeners()
          Return an array of all CollectionChangeListeners, or an empty array if none are registered.
protected  EventListenerList getEventListenerList()
          Return the EventListenerList backing this observable collection support class.
 int getVetoableCollectionChangeListenerCount()
          Return the number of VetoableCollectionChangeListeners registered to this observable collection support class.
 VetoableCollectionChangeListener<E>[] getVetoableCollectionChangeListeners()
          Return an array of all VetoableCollectionChangeListeners, or an empty array if none are registered.
 void removeCollectionChangeListener(CollectionChangeListener<E> l)
          Remove the specified collection change listener.
 void removeVetoableCollectionChangeListener(VetoableCollectionChangeListener<E> l)
          Remove the specified vetoable collection change listener.
protected  void setSource(ObservableCollection<E> source)
          Set the source of collection change and vetoable collection change events to source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObservableCollectionChangeSupport

protected ObservableCollectionChangeSupport()
Create a new support class meant to be subclassed.


ObservableCollectionChangeSupport

public ObservableCollectionChangeSupport(ObservableCollection<E> source)
Create a new support class that fires collection change and vetoable collection change events with the specified source as the source of the events.

Parameters:
source - the event source
Method Detail

setSource

protected void setSource(ObservableCollection<E> source)
Set the source of collection change and vetoable collection change events to source. Subclasses should call this method before any of the fireX methods.

Parameters:
source - the event source

getEventListenerList

protected final EventListenerList getEventListenerList()
Return the EventListenerList backing this observable collection support class.

Returns:
the EventListenerList backing this observable collection support class.

addCollectionChangeListener

public final void addCollectionChangeListener(CollectionChangeListener<E> l)
Add the specified collection change listener.

Parameters:
l - collection change listener to add

removeCollectionChangeListener

public final void removeCollectionChangeListener(CollectionChangeListener<E> l)
Remove the specified collection change listener.

Parameters:
l - collection change listener to remove

addVetoableCollectionChangeListener

public final void addVetoableCollectionChangeListener(VetoableCollectionChangeListener<E> l)
Add the specified vetoable collection change listener.

Parameters:
l - vetoable collection change listener to add

removeVetoableCollectionChangeListener

public final void removeVetoableCollectionChangeListener(VetoableCollectionChangeListener<E> l)
Remove the specified vetoable collection change listener.

Parameters:
l - vetoable collection change listener to remove

getCollectionChangeListeners

public final CollectionChangeListener<E>[] getCollectionChangeListeners()
Return an array of all CollectionChangeListeners, or an empty array if none are registered.

Returns:
an array of all CollectionChangeListeners, or an empty array if none are registered

getCollectionChangeListenerCount

public final int getCollectionChangeListenerCount()
Return the number of CollectionChangeListeners registered to this observable collection support class.

Returns:
the number of CollectionChangeListeners registered to this observable collection support class

getVetoableCollectionChangeListeners

public final VetoableCollectionChangeListener<E>[] getVetoableCollectionChangeListeners()
Return an array of all VetoableCollectionChangeListeners, or an empty array if none are registered.

Returns:
an array of all VetoableCollectionChangeListeners, or an empty array if none are registered

getVetoableCollectionChangeListenerCount

public final int getVetoableCollectionChangeListenerCount()
Return the number of VetoableCollectionChangeListeners registered to this observable collection support class.

Returns:
the number of VetoableCollectionChangeListeners registered to this observable collection support class

fireCollectionWillChange

public void fireCollectionWillChange()
                              throws CollectionChangeVetoException
Fire a will change event to all registered VetoableCollectionChangeListeners.

Throws:
CollectionChangeVetoException - if any of the listeners veto the change

fireCollectionWillChange

public void fireCollectionWillChange(VetoableCollectionChangeEvent<E> e)
                              throws CollectionChangeVetoException
Fire the specified will change event to all registered VetoableCollectionChangeListeners.

Parameters:
e - will change event
Throws:
CollectionChangeVetoException - if any of the listeners veto the change

fireCollectionChanged

public void fireCollectionChanged()
Fire a change event to all registered CollectionChangeListeners.


fireCollectionChanged

public void fireCollectionChanged(CollectionChangeEvent<E> e)
Fire the specified change event to all registered CollectionChangeListeners.

Parameters:
e - change event


Copyright (c) 2003-2012 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).