com.miginfocom.util
Class PropertyValidator

java.lang.Object
  extended by com.miginfocom.util.PropertyValidator

public abstract class PropertyValidator
extends java.lang.Object

An empty class to extend if you want to create a validator for property keys.

Since:
6.0

Constructor Summary
PropertyValidator()
           
 
Method Summary
 void validateRemove(PropertyConsumer pc, PropertyKey key)
          Validated the removal of the value for key.
 java.util.Map validateSet(PropertyConsumer pc, java.util.Map keyValueMap)
          Validates the property values for a number of keys.
 java.lang.Object validateSet(PropertyConsumer pc, PropertyKey key, java.lang.Object newValue)
          Validates the property value for a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyValidator

public PropertyValidator()
Method Detail

validateSet

public java.lang.Object validateSet(PropertyConsumer pc,
                                    PropertyKey key,
                                    java.lang.Object newValue)
                             throws java.beans.PropertyVetoException
Validates the property value for a key. Can both refuse the setting of the property by throwning an exception and exchange the to-be setted value.

Default implementation does nothing but return newValue.

Parameters:
pc - The PropertyConsumer that the value will be set on. May for instance be an Activity or a Category. Note that the old value for key can be obtained from this object.
key - The property key that identifies what key is to be changed.
newValue - The value that is going to be set. May be null. This value should never be changed/altered!
Returns:
The actual object to be set. Should be newValue for a normal ok set. May be another object instead but newValue should never be changed! If null then that will be set!
Throws:
java.beans.PropertyVetoException - The PropertyChangeEvent can be set to null since it will not be used.
Since:
6.0

validateSet

public java.util.Map validateSet(PropertyConsumer pc,
                                 java.util.Map keyValueMap)
                          throws java.beans.PropertyVetoException
Validates the property values for a number of keys.

Default implementation does nothing but return keyValueMap.

Parameters:
pc - The PropertyConsumer that the values will be set on. May for instance be an Activity or a Category.
keyValueMap - The keys are PropertyKeys and the value are the values that will be set. This map will throw an exception if you try to modify it.
Returns:
The same map (keyValueMap) if the changes should be commited as is. If one or more keys are exchanged or removed from the map a new Map must be returned since keyValueMap can not be changed.
Throws:
java.beans.PropertyVetoException - The PropertyChangeEvent can be set to null since it will not be used. Should only be fired if the whole map should be rejected.
Since:
6.0

validateRemove

public void validateRemove(PropertyConsumer pc,
                           PropertyKey key)
                    throws java.beans.PropertyVetoException
Validated the removal of the value for key.

Default implementation does nothing.

Parameters:
pc - The PropertyConsumer that the value will be set on. May for instance be an Activity or a Category.
key - The property key that identifies what key is to be removed.
Throws:
java.beans.PropertyVetoException - The PropertyChangeEvent can be set to null since it will not be used.
Since:
6.0


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.