|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.scopemvc.core.ModelManager
|
+--org.scopemvc.core.PropertyManager
|
+--org.scopemvc.model.beans.BeansPropertyManager
BeansPropertyManager is a PropertyManager that
handles the properties of JavaBean model objects.
| Constructor Summary | |
BeansPropertyManager()
|
|
| Method Summary | |
java.lang.Object |
get(java.lang.Object inModel,
Selector inSelector)
Return the value of the property identified by the passed Selector. |
java.lang.Class |
getPropertyClass(java.lang.Object inModel,
Selector inSelector)
Return the Class of a property. |
Selector |
getSelectorFor(java.lang.Object inModel,
java.lang.Object inProperty)
Tries to find a Selector that would get() a property equals() to the passed Object. |
java.util.Iterator |
getSelectorIterator(java.lang.Object inModel)
Return an Iterator that iterates over Selectors for all properties of the passed model object. |
boolean |
hasProperty(java.lang.Object inModel,
Selector inSelector)
Set the value of the property identified by a Selector in the
passed model object to a new value. |
boolean |
isReadOnly(java.lang.Object inModel,
Selector inSelector)
Is a property read-only? If the passed Selector is null then is the model object as a whole read-only? |
void |
set(java.lang.Object inModel,
Selector inSelector,
java.lang.Object inValue)
Set the value of the property identified by a Selector in the
passed model object to a new value. |
| Methods inherited from class org.scopemvc.core.PropertyManager |
getInstance, getInstance |
| Methods inherited from class org.scopemvc.core.ModelManager |
getModelClass, make |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public BeansPropertyManager()
| Method Detail |
public java.lang.Object get(java.lang.Object inModel,
Selector inSelector)
throws java.lang.Exception
Return the value of the property identified by the passed Selector. If the passed Selector is null, return the model object
itself.
get in class PropertyManagerinModel - model to get property frominSelector - identify the property to be returned or null for the
model object itself.
java.lang.Exception - If the value of the property could not be retrieved
public boolean isReadOnly(java.lang.Object inModel,
Selector inSelector)
throws java.lang.Exception
Is a property read-only? If the passed Selector is null then is the model object as a whole read-only?
Enforcement of the access state must be implemented by the model itself by using the DynamicReadOnly interface.
isReadOnly in class PropertyManagerinModel - model object to test the property on.inSelector - The property to test or null to test the whole model
object.
java.lang.Exception - If the read-only state of the property could not be
testedDynamicReadOnly
public java.lang.Class getPropertyClass(java.lang.Object inModel,
Selector inSelector)
throws java.lang.Exception
getPropertyClass in class PropertyManagerinModel - model to test the property for.inSelector - property to test.
java.lang.Exception - If the class of the property could not be retrievedpublic java.util.Iterator getSelectorIterator(java.lang.Object inModel)
Return an Iterator that iterates over Selectors for all properties of the passed model object.
getSelectorIterator in class PropertyManagerinModel - model to make an Iterator for.
public Selector getSelectorFor(java.lang.Object inModel,
java.lang.Object inProperty)
Tries to find a Selector that would get() a property equals() to the passed Object. If the model is a java.util.List, call indexOf() to search contents first. For Object[] search through contents. Else get an Iterator over all properties and iterate over to find a match.
Note: doesn't search through JavaBeans indexed properties for a match.
getSelectorFor in class PropertyManagerinProperty - the property Object to find.inModel - the model to get the property from.
public void set(java.lang.Object inModel,
Selector inSelector,
java.lang.Object inValue)
throws java.lang.Exception
Set the value of the property identified by a Selector in the
passed model object to a new value.
The implementation should not set the value if the new value has the same Object reference as the original. It could also avoid setting the value if the new value is equivalent to the old value, and the value is of an immutable Class (like Integer, String). Otherwise the property must be set to the new value, even if it equals() the old value.
Usually, a ModelChangeEvent for ModelChangeEvent#VALUE_CHANGED should be broadcast by the model when the
property is set so that interested listeners know that the model's state
has changed.
If the property is a sub-model object then the parent model should be
registered as a ModelChangeListener to be able to propagate
events properly. This propagation is partially implemented in BasicModel but it relies on child Models being
listened to by their parent. (Note: deregister from the old Model then
register with the new one). See the sample code for examples using BasicModel.listenNewSubmodel(org.scopemvc.core.Selector) and BasicModel.unlistenOldSubmodel(org.scopemvc.core.Selector).
set in class PropertyManagerinModel - model to set the property on.inSelector - identify the property to be set. Can't be null.inValue - the value to set the property to.
java.lang.Exception - if the value could not be set in the model
public boolean hasProperty(java.lang.Object inModel,
Selector inSelector)
Set the value of the property identified by a Selector in the
passed model object to a new value.
The implementation should not set the value if the new value has the same Object reference as the original. It could also avoid setting the value if the new value is equivalent to the old value, and the value is of an immutable Class (like Integer, String). Otherwise the property must be set to the new value, even if it equals() the old value.
Usually, a ModelChangeEvent for ModelChangeEvent#VALUE_CHANGED should be broadcast by the model when the
property is set so that interested listeners know that the model's state
has changed.
If the property is a sub-model object then the parent model should be
registered as a ModelChangeListener to be able to propagate
events properly. This propagation is partially implemented in BasicModel but it relies on child Models being
listened to by their parent. (Note: deregister from the old Model then
register with the new one). See the sample code for examples using BasicModel.listenNewSubmodel(org.scopemvc.core.Selector) and BasicModel.unlistenOldSubmodel(org.scopemvc.core.Selector).
hasProperty in class PropertyManagerinModel - model to set the property on.inSelector - identify the property to be set. Can't be null.
java.lang.Exception - if the value could not be set in the model
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||