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

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

public class ObservableListChangeSupport<E>
extends Object
implements Serializable

A support class that can be used via delegation to provide ListChangeListener and VetoableListChangeListener management.

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

Constructor Summary
protected ObservableListChangeSupport()
          Create a new support class meant to be subclassed.
  ObservableListChangeSupport(ObservableList<E> source)
          Create a new support class that fires list change and vetoable list change events with the specified source as the source of the events.
 
Method Summary
 void addListChangeListener(ListChangeListener<E> l)
          Add the specified list change listener.
 void addVetoableListChangeListener(VetoableListChangeListener<E> l)
          Add the specified vetoable list change listener.
 void fireListChanged()
          Fire a change event to all registered ListChangeListeners.
 void fireListChanged(ListChangeEvent<E> e)
          Fire the specified change event to all registered ListChangeListeners.
 void fireListWillChange()
          Fire a will change event to all registered VetoableListChangeListeners.
 void fireListWillChange(VetoableListChangeEvent<E> e)
          Fire the specified will change event to all registered VetoableListChangeListeners.
protected  EventListenerList getEventListenerList()
          Return the EventListenerList backing this observable list support class.
 int getListChangeListenerCount()
          Return the number of ListChangeListeners registered to this observable list support class.
 ListChangeListener<E>[] getListChangeListeners()
          Return an array of all ListChangeListeners, or an empty array if none are registered.
 int getVetoableListChangeListenerCount()
          Return the number of VetoableListChangeListeners registered to this observable list support class.
 VetoableListChangeListener<E>[] getVetoableListChangeListeners()
          Return an array of all VetoableListChangeListeners, or an empty array if none are registered.
 void removeListChangeListener(ListChangeListener<E> l)
          Remove the specified list change listener.
 void removeVetoableListChangeListener(VetoableListChangeListener<E> l)
          Remove the specified vetoable list change listener.
protected  void setSource(ObservableList<E> source)
          Set the source of list change and vetoable list change events to source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObservableListChangeSupport

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


ObservableListChangeSupport

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

Parameters:
source - the event source
Method Detail

setSource

protected void setSource(ObservableList<E> source)
Set the source of list change and vetoable list 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 list support class.

Returns:
the EventListenerList backing this observable list support class.

addListChangeListener

public final void addListChangeListener(ListChangeListener<E> l)
Add the specified list change listener.

Parameters:
l - list change listener to add

removeListChangeListener

public final void removeListChangeListener(ListChangeListener<E> l)
Remove the specified list change listener.

Parameters:
l - list change listener to remove

addVetoableListChangeListener

public final void addVetoableListChangeListener(VetoableListChangeListener<E> l)
Add the specified vetoable list change listener.

Parameters:
l - vetoable list change listener to add

removeVetoableListChangeListener

public final void removeVetoableListChangeListener(VetoableListChangeListener<E> l)
Remove the specified vetoable list change listener.

Parameters:
l - vetoable list change listener to remove

getListChangeListeners

public final ListChangeListener<E>[] getListChangeListeners()
Return an array of all ListChangeListeners, or an empty array if none are registered.

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

getListChangeListenerCount

public final int getListChangeListenerCount()
Return the number of ListChangeListeners registered to this observable list support class.

Returns:
the number of ListChangeListeners registered to this observable list support class

getVetoableListChangeListeners

public final VetoableListChangeListener<E>[] getVetoableListChangeListeners()
Return an array of all VetoableListChangeListeners, or an empty array if none are registered.

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

getVetoableListChangeListenerCount

public final int getVetoableListChangeListenerCount()
Return the number of VetoableListChangeListeners registered to this observable list support class.

Returns:
the number of VetoableListChangeListeners registered to this observable list support class

fireListWillChange

public void fireListWillChange()
                        throws ListChangeVetoException
Fire a will change event to all registered VetoableListChangeListeners.

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

fireListWillChange

public void fireListWillChange(VetoableListChangeEvent<E> e)
                        throws ListChangeVetoException
Fire the specified will change event to all registered VetoableListChangeListeners.

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

fireListChanged

public void fireListChanged()
Fire a change event to all registered ListChangeListeners.


fireListChanged

public void fireListChanged(ListChangeEvent<E> e)
Fire the specified change event to all registered ListChangeListeners.

Parameters:
e - change event


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