|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PropertyMap
A property map contains values for some or all properties in a PropertyMapGroup
. A property map
can have any number of super maps from which property values are inherited. Super maps that are searched for
values in the reverse order they were added to the property map. Property values are always set in the property
map specified.
Properties of type PropertyMapProperty
in the PropertyMapGroup
will automatically be assigned
new PropertyMap's as values. These PropertyMap's are called child maps. These property values cannot be
modified.
Listeners can be added to a PropertyMap. The listeners are notified when a property value is modified in the PropertyMap or, if the property value is not overridden, one of it's super maps. A tree listener can also be added that listens for value changes in the property map, it's super maps and it's child mapss.
Property maps are created using the factory methods in PropertyMapFactory
.
Method Summary | |
---|---|
void |
addListener(PropertyMapListener listener)
Adds a listener that listens for value changes in this PropertyMap. |
void |
addPropertyChangeListener(Property property,
PropertyChangeListener listener)
Adds a property listener that listens for value changes for a specific property. |
void |
addSuperMap(PropertyMap superMap)
Adds a super map to this map. |
void |
addTreeListener(PropertyMapTreeListener listener)
Adds a tree listener that listens for value changes in this PropertyMap or any child maps. |
void |
clear(boolean recursive)
Removes all property values in this property map. |
PropertyMap |
copy(boolean copySuperMapRefs,
boolean recursive)
Creates a copy of this map. |
java.lang.Object |
createRelativeRef(Property fromProperty,
PropertyMap toMap,
Property toProperty)
Creates a relative reference from one property value to another property value. |
PropertyMap |
getSuperMap()
Returns the most recently added super map. |
boolean |
isEmpty(boolean recursive)
Returns true if this property map doesn't contain any property values. |
void |
read(java.io.ObjectInputStream in)
Reads property values from a stream and sets them in this map. |
void |
removeListener(PropertyMapListener listener)
Removes a listener which was previously added with addListener(PropertyMapListener) . |
void |
removePropertyChangeListener(Property property,
PropertyChangeListener listener)
Removes a previously added property listener. |
PropertyMap |
removeSuperMap()
Removes the most recently added super map. |
boolean |
removeSuperMap(PropertyMap superMap)
Removes a super map that has previously been added using addSuperMap(PropertyMap) . |
void |
removeTreeListener(PropertyMapTreeListener listener)
Removes a previously added tree listener. |
java.lang.Object |
removeValue(Property property)
Removes a property value. |
boolean |
replaceSuperMap(PropertyMap oldSuperMap,
PropertyMap newSuperMap)
Replaces a super map that has previously been added using addSuperMap(PropertyMap) . |
boolean |
valuesEqualTo(PropertyMap propertyMap,
boolean recursive)
Returns true if all the values in this property map is equal to the values in the given map. |
void |
write(java.io.ObjectOutputStream out)
Serializes the serializable values of this property map. |
void |
write(java.io.ObjectOutputStream out,
boolean recursive)
Serializes the serializable values of this property map. |
Method Detail |
---|
void addListener(PropertyMapListener listener)
listener
- the listenervoid removeListener(PropertyMapListener listener)
addListener(PropertyMapListener)
.
listener
- the listenervoid addTreeListener(PropertyMapTreeListener listener)
listener
- the listenervoid removeTreeListener(PropertyMapTreeListener listener)
listener
- the listenervoid addPropertyChangeListener(Property property, PropertyChangeListener listener)
property
- the property to listen to changes onlistener
- the listenervoid removePropertyChangeListener(Property property, PropertyChangeListener listener)
property
- the property which the listener listens to changes onlistener
- the listenervoid addSuperMap(PropertyMap superMap)
superMap
- the super mapPropertyMap removeSuperMap()
boolean removeSuperMap(PropertyMap superMap)
addSuperMap(PropertyMap)
.
superMap
- the super map to remove
boolean replaceSuperMap(PropertyMap oldSuperMap, PropertyMap newSuperMap)
addSuperMap(PropertyMap)
.
oldSuperMap
- the super map to replacenewSuperMap
- the super map to replace it with
PropertyMap getSuperMap()
java.lang.Object createRelativeRef(Property fromProperty, PropertyMap toMap, Property toProperty) throws InvalidPropertyTypeException
When the value of the fromProperty is read, it will return the value of the toProperty in the toMap.
Sub maps of this property map will inherit this reference relative to themselves, ie the reference in the sub map is converted to a reference relative to the sub map if possible, otherwise the reference is the same as for the super map. Here is an example:
Changes to the referenced property value will be propagated to listeners of this property.
fromProperty
- the property value that will hold the referencetoMap
- the property map that holds the property value that is referencedtoProperty
- the property which value is referenced
InvalidPropertyTypeException
java.lang.Object removeValue(Property property) throws InvalidPropertyException
property
- the property
InvalidPropertyException
- if values for this property can't be stored in this property mapboolean isEmpty(boolean recursive)
recursive
- true if child maps should be recursively checked
void clear(boolean recursive)
recursive
- true if child maps should be cleared recursivelyboolean valuesEqualTo(PropertyMap propertyMap, boolean recursive)
Object.equals(java.lang.Object)
.
propertyMap
- the map to compare values withrecursive
- true if child maps should be recursively checked
void write(java.io.ObjectOutputStream out, boolean recursive) throws java.io.IOException
Serializable
interface will not be written to the stream. The properties are identified using their names.
out
- the stream on which to serialize this maprecursive
- true if child maps should be recursively serialized
java.io.IOException
- if there is an error in the streamvoid write(java.io.ObjectOutputStream out) throws java.io.IOException
Serializes the serializable values of this property map. Values not implementing the Serializable
interface will not be written to the stream. The properties are identified using their names.
This method recursively writes all child maps.
write
in interface Writable
out
- the stream
java.io.IOException
- if there is a stream errorvoid read(java.io.ObjectInputStream in) throws java.io.IOException
read
in interface Readable
in
- the stream from which to read property values
java.io.IOException
- if there is an error in the streamPropertyMap copy(boolean copySuperMapRefs, boolean recursive)
copySuperMapRefs
- if true, copies the references to super mapsrecursive
- if true, copies all child maps as well
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |