edu.uci.ics.jung.visualization.util
Class DefaultChangeEventSupport

java.lang.Object
  extended by edu.uci.ics.jung.visualization.util.DefaultChangeEventSupport
All Implemented Interfaces:
ChangeEventSupport

public class DefaultChangeEventSupport
extends Object
implements ChangeEventSupport

Basic implementation of ChangeEventSupport, using standard jdk classes

Author:
Tom Nelson - tomnelson@dev.java.net

Field Summary
protected  ChangeEvent changeEvent
          Only one ChangeEvent is needed instance since the event's only state is the source property.
protected  EventListenerList listenerList
          holds the registered listeners
 
Constructor Summary
DefaultChangeEventSupport(Object eventSource)
           
 
Method Summary
 void addChangeListener(ChangeListener l)
           
 void fireStateChanged()
          Notifies all listeners that have registered interest for notification on this event type.
 ChangeListener[] getChangeListeners()
          Returns an array of all the ChangeListeners added with addChangeListener().
 void removeChangeListener(ChangeListener l)
          Removes a ChangeListener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerList

protected EventListenerList listenerList
holds the registered listeners


changeEvent

protected transient ChangeEvent changeEvent
Only one ChangeEvent is needed instance since the event's only state is the source property. The source of events generated is always "this".

Constructor Detail

DefaultChangeEventSupport

public DefaultChangeEventSupport(Object eventSource)
Method Detail

addChangeListener

public void addChangeListener(ChangeListener l)
Specified by:
addChangeListener in interface ChangeEventSupport

removeChangeListener

public void removeChangeListener(ChangeListener l)
Description copied from interface: ChangeEventSupport
Removes a ChangeListener.

Specified by:
removeChangeListener in interface ChangeEventSupport
Parameters:
l - the listener to be removed

getChangeListeners

public ChangeListener[] getChangeListeners()
Description copied from interface: ChangeEventSupport
Returns an array of all the ChangeListeners added with addChangeListener().

Specified by:
getChangeListeners in interface ChangeEventSupport
Returns:
all of the ChangeListeners added or an empty array if no listeners have been added

fireStateChanged

public void fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created. The primary listeners will be views that need to be repainted because of changes in this model instance

Specified by:
fireStateChanged in interface ChangeEventSupport
See Also:
EventListenerList


Copyright © 2009. All Rights Reserved.