org.eigenbase.util.property
Class TriggerableProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by org.eigenbase.util.property.TriggerableProperties
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>
Direct Known Subclasses:
PropertyTest.MyProperties

public class TriggerableProperties
extends Properties

Base class for properties which can respond to triggers.

If you wish to be notified of changes to properties, use the Property.addTrigger(Trigger) method to register a callback.

Since:
5 July 2005
Version:
$Id: //open/dev/farrago/src/org/eigenbase/util/property/TriggerableProperties.java#9 $
Author:
Julian Hyde
See Also:
Serialized Form

Field Summary
protected  Map properties
           
protected  Map triggers
           
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
protected TriggerableProperties()
           
 
Method Summary
(package private) static boolean equals(Object o1, Object o2)
           
 Collection getProperties()
          Returns a collection of registered properties.
 Property getPropertyDefinition(String path)
          Returns the definition of a named property, or null if there is no such property.
 List getPropertyList()
          Returns a list of every Property.
 void register(Property property)
          Registers a property with this properties object to make it available for callbacks.
 Object setProperty(String key, String value)
          Sets the value of a property.
private  void superSetProperty(String key, String oldValue)
          This is ONLY called during a veto operation.
 boolean triggersAreEnabled()
          Whether triggers are enabled.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

triggers

protected final Map triggers

properties

protected final Map properties
Constructor Detail

TriggerableProperties

protected TriggerableProperties()
Method Detail

setProperty

public Object setProperty(String key,
                          String value)
Sets the value of a property.

If the previous value does not equal the new value, executes any Triggers associated with the property, in order of their phase.

Overrides:
setProperty in class Properties
Parameters:
key - Name of property
value - Value
Returns:
the old value

triggersAreEnabled

public boolean triggersAreEnabled()
Whether triggers are enabled. Derived class can override.


getPropertyDefinition

public Property getPropertyDefinition(String path)
Returns the definition of a named property, or null if there is no such property.

Parameters:
path - Name of the property
Returns:
Definition of property, or null if there is no property with this name

superSetProperty

private void superSetProperty(String key,
                              String oldValue)
This is ONLY called during a veto operation. It calls the super class setProperty(java.lang.String, java.lang.String).

Parameters:
key - Property name
oldValue - Previous value of property

equals

static boolean equals(Object o1,
                      Object o2)

register

public void register(Property property)
Registers a property with this properties object to make it available for callbacks.


getProperties

public Collection getProperties()
Returns a collection of registered properties.

Returns:
registered properties

getPropertyList

public List getPropertyList()
Returns a list of every Property.

Returns:
List of properties