Package org.jungrapht.visualization.util
Class DefaultChangeEventSupport
- java.lang.Object
-
- org.jungrapht.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
-
-
Field Summary
Fields Modifier and Type Field Description protected ChangeEventchangeEventOnly oneChangeEventis needed instance since the event's only state is the source property.protected EventListenerListlistenerListholds the registered listeners
-
Constructor Summary
Constructors Constructor Description DefaultChangeEventSupport(Object eventSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(ChangeListener l)voidfireStateChanged()Notifies all listeners that have registered interest for notification on this event type.ChangeListener[]getChangeListeners()Returns an array of all theChangeListeners added with addChangeListener().voidremoveChangeListener(ChangeListener l)Removes a ChangeListener.
-
-
-
Field Detail
-
listenerList
protected EventListenerList listenerList
holds the registered listeners
-
changeEvent
protected transient ChangeEvent changeEvent
Only oneChangeEventis 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:
addChangeListenerin interfaceChangeEventSupport
-
removeChangeListener
public void removeChangeListener(ChangeListener l)
Description copied from interface:ChangeEventSupportRemoves a ChangeListener.- Specified by:
removeChangeListenerin interfaceChangeEventSupport- Parameters:
l- the listener to be removed
-
getChangeListeners
public ChangeListener[] getChangeListeners()
Description copied from interface:ChangeEventSupportReturns an array of all theChangeListeners added with addChangeListener().- Specified by:
getChangeListenersin interfaceChangeEventSupport- 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:
fireStateChangedin interfaceChangeEventSupport- See Also:
EventListenerList
-
-