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

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

public class ObservableSetChangeSupport<E>
extends Object
implements Serializable

A support class that can be used via delegation to provide SetChangeListener and VetoableSetChangeListener management.

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

Constructor Summary
protected ObservableSetChangeSupport()
          Create a new support class meant to be subclassed.
  ObservableSetChangeSupport(ObservableSet<E> source)
          Create a new support class that fires set change and vetoable set change events with the specified source as the source of the events.
 
Method Summary
 void addSetChangeListener(SetChangeListener<E> l)
          Add the specified set change listener.
 void addVetoableSetChangeListener(VetoableSetChangeListener<E> l)
          Add the specified vetoable set change listener.
 void fireSetChanged()
          Fire a change event to all registered SetChangeListeners.
 void fireSetChanged(SetChangeEvent<E> e)
          Fire the specified change event to all registered SetChangeListeners.
 void fireSetWillChange()
          Fire a will change event to all registered VetoableSetChangeListeners.
 void fireSetWillChange(VetoableSetChangeEvent<E> e)
          Fire the specified will change event to all registered VetoableSetChangeListeners.
protected  EventListenerList getEventListenerList()
          Return the EventListenerList backing this observable set support class.
 int getSetChangeListenerCount()
          Return the number of SetChangeListeners registered to this observable set support class.
 SetChangeListener<E>[] getSetChangeListeners()
          Return an array of all SetChangeListeners, or an empty array if none are registered.
 int getVetoableSetChangeListenerCount()
          Return the number of VetoableSetChangeListeners registered to this observable set support class.
 VetoableSetChangeListener<E>[] getVetoableSetChangeListeners()
          Return an array of all VetoableSetChangeListeners, or an empty array if none are registered.
 void removeSetChangeListener(SetChangeListener<E> l)
          Remove the specified set change listener.
 void removeVetoableSetChangeListener(VetoableSetChangeListener<E> l)
          Remove the specified vetoable set change listener.
protected  void setSource(ObservableSet<E> source)
          Set the source of set change and vetoable set change events to source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObservableSetChangeSupport

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


ObservableSetChangeSupport

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

Parameters:
source - the event source
Method Detail

setSource

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

Returns:
the EventListenerList backing this observable set support class.

addSetChangeListener

public final void addSetChangeListener(SetChangeListener<E> l)
Add the specified set change listener.

Parameters:
l - set change listener to add

removeSetChangeListener

public final void removeSetChangeListener(SetChangeListener<E> l)
Remove the specified set change listener.

Parameters:
l - set change listener to remove

addVetoableSetChangeListener

public final void addVetoableSetChangeListener(VetoableSetChangeListener<E> l)
Add the specified vetoable set change listener.

Parameters:
l - vetoable set change listener to add

removeVetoableSetChangeListener

public final void removeVetoableSetChangeListener(VetoableSetChangeListener<E> l)
Remove the specified vetoable set change listener.

Parameters:
l - vetoable set change listener to remove

getSetChangeListeners

public final SetChangeListener<E>[] getSetChangeListeners()
Return an array of all SetChangeListeners, or an empty array if none are registered.

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

getSetChangeListenerCount

public final int getSetChangeListenerCount()
Return the number of SetChangeListeners registered to this observable set support class.

Returns:
the number of SetChangeListeners registered to this observable set support class

getVetoableSetChangeListeners

public final VetoableSetChangeListener<E>[] getVetoableSetChangeListeners()
Return an array of all VetoableSetChangeListeners, or an empty array if none are registered.

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

getVetoableSetChangeListenerCount

public final int getVetoableSetChangeListenerCount()
Return the number of VetoableSetChangeListeners registered to this observable set support class.

Returns:
the number of VetoableSetChangeListeners registered to this observable set support class

fireSetWillChange

public void fireSetWillChange()
                       throws SetChangeVetoException
Fire a will change event to all registered VetoableSetChangeListeners.

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

fireSetWillChange

public void fireSetWillChange(VetoableSetChangeEvent<E> e)
                       throws SetChangeVetoException
Fire the specified will change event to all registered VetoableSetChangeListeners.

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

fireSetChanged

public void fireSetChanged()
Fire a change event to all registered SetChangeListeners.


fireSetChanged

public void fireSetChanged(SetChangeEvent<E> e)
Fire the specified change event to all registered SetChangeListeners.

Parameters:
e - change event


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