org.dishevelled.observable.event
Class ObservableMapChangeSupport<K,V>

java.lang.Object
  extended by org.dishevelled.observable.event.ObservableMapChangeSupport<K,V>
Type Parameters:
K - map key type
V - map value type
All Implemented Interfaces:
Serializable

public class ObservableMapChangeSupport<K,V>
extends Object
implements Serializable

A support class that can be used via delegation to provide MapChangeListener and VetoableMapChangeListener management.

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

Constructor Summary
protected ObservableMapChangeSupport()
          Create a new support class meant to be subclassed.
  ObservableMapChangeSupport(ObservableMap<K,V> source)
          Create a new support class that fires map change and vetoable map change events with the specified source as the source of the events.
 
Method Summary
 void addMapChangeListener(MapChangeListener<K,V> l)
          Add the specified map change listener.
 void addVetoableMapChangeListener(VetoableMapChangeListener<K,V> l)
          Add the specified vetoable map change listener.
 void fireMapChanged()
          Fire a change event to all registered MapChangeListeners.
 void fireMapChanged(MapChangeEvent<K,V> e)
          Fire the specified change event to all registered MapChangeListeners.
 void fireMapWillChange()
          Fire a will change event to all registered VetoableMapChangeListeners.
 void fireMapWillChange(VetoableMapChangeEvent<K,V> e)
          Fire the specified will change event to all registered VetoableMapChangeListeners.
protected  EventListenerList getEventListenerList()
          Return the EventListenerList backing this observable map support class.
 int getMapChangeListenerCount()
          Return the number of MapChangeListeners registered to this observable map support class.
 MapChangeListener<K,V>[] getMapChangeListeners()
          Return an array of all MapChangeListeners, or an empty array if none are registered.
 int getVetoableMapChangeListenerCount()
          Return the number of VetoableMapChangeListeners registered to this observable map support class.
 VetoableMapChangeListener<K,V>[] getVetoableMapChangeListeners()
          Return an array of all VetoableMapChangeListeners, or an empty array if none are registered.
 void removeMapChangeListener(MapChangeListener<K,V> l)
          Remove the specified map change listener.
 void removeVetoableMapChangeListener(VetoableMapChangeListener<K,V> l)
          Remove the specified vetoable map change listener.
protected  void setSource(ObservableMap<K,V> source)
          Set the source of map change and vetoable map change events to source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObservableMapChangeSupport

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


ObservableMapChangeSupport

public ObservableMapChangeSupport(ObservableMap<K,V> source)
Create a new support class that fires map change and vetoable map change events with the specified source as the source of the events.

Parameters:
source - the event source
Method Detail

setSource

protected void setSource(ObservableMap<K,V> source)
Set the source of map change and vetoable map 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 map support class.

Returns:
the EventListenerList backing this observable map support class.

addMapChangeListener

public final void addMapChangeListener(MapChangeListener<K,V> l)
Add the specified map change listener.

Parameters:
l - map change listener to add

removeMapChangeListener

public final void removeMapChangeListener(MapChangeListener<K,V> l)
Remove the specified map change listener.

Parameters:
l - map change listener to remove

addVetoableMapChangeListener

public final void addVetoableMapChangeListener(VetoableMapChangeListener<K,V> l)
Add the specified vetoable map change listener.

Parameters:
l - vetoable map change listener to add

removeVetoableMapChangeListener

public final void removeVetoableMapChangeListener(VetoableMapChangeListener<K,V> l)
Remove the specified vetoable map change listener.

Parameters:
l - vetoable map change listener to remove

getMapChangeListeners

public final MapChangeListener<K,V>[] getMapChangeListeners()
Return an array of all MapChangeListeners, or an empty array if none are registered.

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

getMapChangeListenerCount

public final int getMapChangeListenerCount()
Return the number of MapChangeListeners registered to this observable map support class.

Returns:
the number of MapChangeListeners registered to this observable map support class

getVetoableMapChangeListeners

public final VetoableMapChangeListener<K,V>[] getVetoableMapChangeListeners()
Return an array of all VetoableMapChangeListeners, or an empty array if none are registered.

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

getVetoableMapChangeListenerCount

public final int getVetoableMapChangeListenerCount()
Return the number of VetoableMapChangeListeners registered to this observable map support class.

Returns:
the number of VetoableMapChangeListeners registered to this observable map support class

fireMapWillChange

public void fireMapWillChange()
                       throws MapChangeVetoException
Fire a will change event to all registered VetoableMapChangeListeners.

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

fireMapWillChange

public void fireMapWillChange(VetoableMapChangeEvent<K,V> e)
                       throws MapChangeVetoException
Fire the specified will change event to all registered VetoableMapChangeListeners.

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

fireMapChanged

public void fireMapChanged()
Fire a change event to all registered MapChangeListeners.


fireMapChanged

public void fireMapChanged(MapChangeEvent<K,V> e)
Fire the specified change event to all registered MapChangeListeners.

Parameters:
e - change event


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