org.robokind.api.common.property
Class PropertyChangeMonitor

java.lang.Object
  extended by org.robokind.api.common.property.PropertyChangeMonitor
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class PropertyChangeMonitor
extends Object
implements PropertyChangeListener

A support class for listening to PropertyChangeEvents. This class is useful for class inheritance hierarchies which need to listen for property change events. This class holds property event names and property change actions. When a property change event is received, all PropertyChangeActions associated with the given event name will be fired in the order they were added.

Author:
Matthew Stevenson

Field Summary
protected  Map<String,List<PropertyChangeActionBase>> myPropertyActions
          A map associating PropertyChangeActions with an event name.
 
Constructor Summary
PropertyChangeMonitor()
           
 
Method Summary
 void addAction(String property, PropertyChangeActionBase action)
          Adds a PropertyChangeAction to be fired when an event with the given name is found.
 void propertyChange(PropertyChangeEvent evt)
          Fires all actions associated with the name of the given event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myPropertyActions

protected Map<String,List<PropertyChangeActionBase>> myPropertyActions
A map associating PropertyChangeActions with an event name.

Constructor Detail

PropertyChangeMonitor

public PropertyChangeMonitor()
Method Detail

addAction

public void addAction(String property,
                      PropertyChangeActionBase action)
Adds a PropertyChangeAction to be fired when an event with the given name is found.

Parameters:
property - event name to listen for
action - action to fire

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Fires all actions associated with the name of the given event.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
evt - PropertyChangeEvent for the property being changed


Copyright © 2011. All Rights Reserved.