|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.infonode.properties.propertymap.PropertyMapImpl
public class PropertyMapImpl
Nested Class Summary | |
---|---|
private class |
PropertyMapImpl.PropertyObjectMap
|
Field Summary | |
---|---|
private MapAdapter |
childMaps
|
private java.util.ArrayList |
listeners
|
private PropertyMapImpl.PropertyObjectMap |
map
|
private SignalListener |
mapListener
|
private PropertyMapImpl |
parent
|
private PropertyMapProperty |
property
|
private java.util.HashMap |
propertyChangeListeners
|
private PropertyMapGroup |
propertyGroup
|
private static int |
SERIALIZE_VERSION
|
private ConstChangeNotifyVectorMap |
superMap
|
private java.util.ArrayList |
superMaps
|
private java.util.ArrayList |
treeListeners
|
private ChangeNotifyMapWrapper |
values
|
private ConstVectorMap |
vectorMap
|
Constructor Summary | |
---|---|
PropertyMapImpl(PropertyMapGroup propertyGroup)
|
|
PropertyMapImpl(PropertyMapGroup propertyGroup,
PropertyMapImpl superObject)
|
|
PropertyMapImpl(PropertyMapGroup propertyGroup,
PropertyMapImpl parent,
PropertyMapProperty property)
|
|
PropertyMapImpl(PropertyMapImpl inheritFrom)
|
|
PropertyMapImpl(PropertyMapImpl parent,
PropertyMapProperty property)
|
Method Summary | |
---|---|
void |
addListener(PropertyMapListener listener)
Adds a listener that listens for value changes in this PropertyMap. |
private void |
addParentSuperMap(PropertyMapImpl propertyObjectImpl,
int parentIndex)
|
void |
addPropertyChangeListener(Property property,
PropertyChangeListener listener)
Adds a property listener that listens for value changes for a specific property. |
private void |
addSuperMap(int index,
PropertyMapImpl propertyObjectImpl)
|
void |
addSuperMap(PropertyMap superMap)
Adds a super map to this map. |
private void |
addSuperMap(PropertyMapImpl propertyObjectImpl)
|
void |
addTreeListener(PropertyMapTreeListener listener)
Adds a tree listener that listens for value changes in this PropertyMap or any child maps. |
private boolean |
checkListeners(java.util.Set visited)
|
private void |
checkProperty(Property property)
|
void |
clear(boolean recursive)
Removes all property values in this property map. |
PropertyMap |
copy(boolean copySuperMaps,
boolean recursive)
Creates a copy of this map. |
java.lang.Object |
createRelativeRef(Property fromProperty,
PropertyMap toObject,
Property toProperty)
Creates a relative reference from one property value to another property value. |
private void |
doClear(boolean recursive)
|
private void |
doCopy(PropertyMapImpl map,
boolean copySuperMaps,
boolean recursive,
boolean topMap)
|
private void |
doRead(java.io.ObjectInputStream in)
|
private static void |
doSkip(java.io.ObjectInputStream in)
|
private boolean |
doValuesEqual(PropertyMapImpl propertyObject,
boolean recursive)
|
private void |
doWrite(java.io.ObjectOutputStream out,
boolean recursive)
|
void |
dump()
|
void |
dump(Printer printer,
java.util.Set printed)
|
void |
dumpSuperMaps(Printer printer)
|
protected void |
firePropertyTreeValuesChanged(java.util.Map changes)
|
void |
firePropertyValueChanged(Property property,
ValueChange change)
|
(package private) void |
firePropertyValuesChanged(java.util.Map changes)
|
PropertyMap |
getChildMap(PropertyMapProperty property)
|
PropertyMapImpl |
getChildMapImpl(PropertyMapProperty property)
|
ConstChangeNotifyMap |
getMap()
|
PropertyMapImpl |
getParent()
|
private PropertyValue |
getParentDefaultValue(PropertyPath path)
|
private PropertyMapRef |
getPathFrom(PropertyMapImpl parentObject)
|
PropertyMapProperty |
getProperty()
|
PropertyMapGroup |
getPropertyGroup()
|
private PropertyMapRef |
getRelativePathTo(PropertyMapImpl propertyObject)
|
PropertyMap |
getSuperMap()
Returns the most recently added super map. |
int |
getSuperMapCount()
|
PropertyValue |
getValue(Property property)
|
private PropertyValue |
getValue(PropertyPath propertyPath)
|
PropertyValue |
getValueWithDefault(Property property)
|
private boolean |
hasListener()
|
private boolean |
hasTreeListener()
|
private PropertyValue |
internalSetValue(Property property,
PropertyValue value)
|
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 PropertyMap.addListener(PropertyMapListener) . |
private void |
removeParentSuperMap(int parentIndex)
|
void |
removePropertyChangeListener(Property property,
PropertyChangeListener listener)
Removes a previously added property listener. |
PropertyMap |
removeSuperMap()
Removes the most recently added super map. |
private void |
removeSuperMap(int index)
|
boolean |
removeSuperMap(PropertyMap superMap)
Removes a super map that has previously been added using PropertyMap.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 PropertyMap.addSuperMap(PropertyMap) . |
PropertyValue |
setValue(Property property,
PropertyValue value)
|
static void |
skip(java.io.ObjectInputStream in)
|
private void |
updateListener()
|
private void |
updateListenerRecursive()
|
boolean |
valueIsSet(Property property)
|
boolean |
valuesEqualTo(PropertyMap propertyObject,
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int SERIALIZE_VERSION
private PropertyMapGroup propertyGroup
private PropertyMapImpl parent
private PropertyMapProperty property
private ChangeNotifyMapWrapper values
private ConstChangeNotifyVectorMap superMap
private ConstVectorMap vectorMap
private PropertyMapImpl.PropertyObjectMap map
private java.util.ArrayList superMaps
private MapAdapter childMaps
private java.util.HashMap propertyChangeListeners
private java.util.ArrayList listeners
private java.util.ArrayList treeListeners
private SignalListener mapListener
Constructor Detail |
---|
public PropertyMapImpl(PropertyMapGroup propertyGroup)
public PropertyMapImpl(PropertyMapImpl inheritFrom)
public PropertyMapImpl(PropertyMapGroup propertyGroup, PropertyMapImpl superObject)
public PropertyMapImpl(PropertyMapImpl parent, PropertyMapProperty property)
public PropertyMapImpl(PropertyMapGroup propertyGroup, PropertyMapImpl parent, PropertyMapProperty property)
Method Detail |
---|
private boolean hasTreeListener()
private boolean hasListener()
private void updateListenerRecursive()
private void updateListener()
private boolean checkListeners(java.util.Set visited)
public ConstChangeNotifyMap getMap()
public PropertyMap getSuperMap()
PropertyMap
getSuperMap
in interface PropertyMap
public java.lang.Object removeValue(Property property) throws InvalidPropertyException
PropertyMap
removeValue
in interface PropertyMap
property
- the property
InvalidPropertyException
- if values for this property can't be stored in this property mapprivate PropertyMapRef getPathFrom(PropertyMapImpl parentObject)
private PropertyMapRef getRelativePathTo(PropertyMapImpl propertyObject)
public java.lang.Object createRelativeRef(Property fromProperty, PropertyMap toObject, Property toProperty)
PropertyMap
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.
createRelativeRef
in interface PropertyMap
fromProperty
- the property value that will hold the referencetoObject
- the property map that holds the property value that is referencedtoProperty
- the property which value is referenced
public int getSuperMapCount()
public void addSuperMap(PropertyMap superMap)
PropertyMap
addSuperMap
in interface PropertyMap
superMap
- the super mappublic PropertyMap removeSuperMap()
PropertyMap
removeSuperMap
in interface PropertyMap
public boolean removeSuperMap(PropertyMap superMap)
PropertyMap
PropertyMap.addSuperMap(PropertyMap)
.
removeSuperMap
in interface PropertyMap
superMap
- the super map to remove
public boolean replaceSuperMap(PropertyMap oldSuperMap, PropertyMap newSuperMap)
PropertyMap
PropertyMap.addSuperMap(PropertyMap)
.
replaceSuperMap
in interface PropertyMap
oldSuperMap
- the super map to replacenewSuperMap
- the super map to replace it with
private void removeParentSuperMap(int parentIndex)
private void removeSuperMap(int index)
private void addSuperMap(PropertyMapImpl propertyObjectImpl)
private void addParentSuperMap(PropertyMapImpl propertyObjectImpl, int parentIndex)
private void addSuperMap(int index, PropertyMapImpl propertyObjectImpl)
public void addTreeListener(PropertyMapTreeListener listener)
PropertyMap
addTreeListener
in interface PropertyMap
listener
- the listenerpublic void removeTreeListener(PropertyMapTreeListener listener)
PropertyMap
removeTreeListener
in interface PropertyMap
listener
- the listenerpublic void addListener(PropertyMapListener listener)
PropertyMap
addListener
in interface PropertyMap
listener
- the listenerpublic void removeListener(PropertyMapListener listener)
PropertyMap
PropertyMap.addListener(PropertyMapListener)
.
removeListener
in interface PropertyMap
listener
- the listenerpublic PropertyMapGroup getPropertyGroup()
public void addPropertyChangeListener(Property property, PropertyChangeListener listener)
PropertyMap
addPropertyChangeListener
in interface PropertyMap
property
- the property to listen to changes onlistener
- the listenerpublic void removePropertyChangeListener(Property property, PropertyChangeListener listener)
PropertyMap
removePropertyChangeListener
in interface PropertyMap
property
- the property which the listener listens to changes onlistener
- the listenerpublic PropertyMapImpl getParent()
public PropertyMapProperty getProperty()
private void checkProperty(Property property)
public PropertyMap getChildMap(PropertyMapProperty property)
public PropertyMapImpl getChildMapImpl(PropertyMapProperty property)
private PropertyValue getParentDefaultValue(PropertyPath path)
public PropertyValue getValueWithDefault(Property property)
private PropertyValue getValue(PropertyPath propertyPath)
public PropertyValue getValue(Property property)
private PropertyValue internalSetValue(Property property, PropertyValue value)
public PropertyValue setValue(Property property, PropertyValue value)
public boolean valueIsSet(Property property)
public void firePropertyValueChanged(Property property, ValueChange change)
protected void firePropertyTreeValuesChanged(java.util.Map changes)
void firePropertyValuesChanged(java.util.Map changes)
public void dump()
public void dump(Printer printer, java.util.Set printed)
public void dumpSuperMaps(Printer printer)
public void clear(boolean recursive)
PropertyMap
clear
in interface PropertyMap
recursive
- true if child maps should be cleared recursivelyprivate void doClear(boolean recursive)
public boolean isEmpty(boolean recursive)
PropertyMap
isEmpty
in interface PropertyMap
recursive
- true if child maps should be recursively checked
private void doRead(java.io.ObjectInputStream in) throws java.io.IOException
java.io.IOException
public void write(java.io.ObjectOutputStream out, boolean recursive) throws java.io.IOException
PropertyMap
Serializable
interface will not be written to the stream. The properties are identified using their names.
write
in interface PropertyMap
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 streampublic void write(java.io.ObjectOutputStream out) throws java.io.IOException
PropertyMap
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 PropertyMap
write
in interface Writable
out
- the stream
java.io.IOException
- if there is a stream errorprivate void doWrite(java.io.ObjectOutputStream out, boolean recursive) throws java.io.IOException
java.io.IOException
public void read(java.io.ObjectInputStream in) throws java.io.IOException
PropertyMap
read
in interface PropertyMap
read
in interface Readable
in
- the stream from which to read property values
java.io.IOException
- if there is an error in the streampublic static void skip(java.io.ObjectInputStream in) throws java.io.IOException
java.io.IOException
private static void doSkip(java.io.ObjectInputStream in) throws java.io.IOException
java.io.IOException
private boolean doValuesEqual(PropertyMapImpl propertyObject, boolean recursive)
public boolean valuesEqualTo(PropertyMap propertyObject, boolean recursive)
PropertyMap
Object.equals(java.lang.Object)
.
valuesEqualTo
in interface PropertyMap
propertyObject
- the map to compare values withrecursive
- true if child maps should be recursively checked
public PropertyMap copy(boolean copySuperMaps, boolean recursive)
PropertyMap
copy
in interface PropertyMap
copySuperMaps
- if true, copies the references to super mapsrecursive
- if true, copies all child maps as well
private void doCopy(PropertyMapImpl map, boolean copySuperMaps, boolean recursive, boolean topMap)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |