edu.ucsb.nceas.morpho.util
Class StateChangeMonitor
java.lang.Object
|
+--edu.ucsb.nceas.morpho.util.StateChangeMonitor
- public class StateChangeMonitor
- extends java.lang.Object
Maintain a registry of objects that are interested in changes in
application state. When the application state changes (through
posting a notification to this class), distribute the StateChangeEvent
to all of the registered listeners. This class follows the singleton
pattern because we never need or want more than a single instance to
manage all of the change events.
- Author:
- Matt Jones
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
getInstance
public static StateChangeMonitor getInstance()
- Get the single instance of the StateChangeMonitor,
creating it if needed.
- Returns:
- the single instance of the StateChangeMonitor
addStateChangeListener
public void addStateChangeListener(java.lang.String stateChange,
StateChangeListener listener)
- This method is called by objects to register a listener for changes in
the application state. Any change in the state will trigger
notification.
- Parameters:
stateChange
- the name of the state change for which notifications
should be sentlistener
- a reference to the object to be notified of changes
removeStateChangeListener
public void removeStateChangeListener(java.lang.String stateChange,
StateChangeListener listener)
- This method is called by objects to remove a listener for changes in
the application state. Any change in the state will trigger
notification.
- Parameters:
stateChange
- the name of the state change for which the listener
should be removedlistener
- a reference to the object to be removed
notifyStateChange
public void notifyStateChange(StateChangeEvent event)
- Notify the monitor of an application state change so that it in turn
can notify all of the registered listeners of that state change.
- Parameters:
event
- the StateChangeEvent that has occurred
Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.