|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sptci.PropertyChangeListener
public class PropertyChangeListener
An implementation of PropertyChangeListener used
to synchronise changes made to properties in UI components to the
bean java bean.
Copyright 2006 Sans Pareil Technologies, Inc.
| Field Summary | |
|---|---|
protected Object |
bean
The java bean which is to be kept synchronised with updates made to UI components. |
protected HashMap<String,PropertyDescriptor> |
properties
A HashMap of all the properties defined in the bean. |
protected static HashMap<String,String> |
typeMapping
A HashMap that provides the mapping for primitives
to their object wrappers. |
| Constructor Summary | |
|---|---|
protected |
PropertyChangeListener()
Default constructor. |
|
PropertyChangeListener(Object bean)
Create a new instance of the class using the specified java bean. |
| Method Summary | |
|---|---|
Object |
getBean()
Returns bean. |
HashMap<String,PropertyDescriptor> |
getProperties()
Returns a shallow-clone of properties. |
protected void |
initProperties()
Populate properties by introspecting the bean. |
protected void |
modifyObject(PropertyChangeEvent event,
PropertyDescriptor descriptor)
Modify an object property in bean. |
protected void |
modifyPrimitive(PropertyChangeEvent event,
PropertyDescriptor descriptor)
Modify a primitive property in bean. |
protected Object |
objectFromString(PropertyChangeEvent event,
PropertyDescriptor descriptor)
Convert the given String value to an Object wrapper of the appropriate kind. |
void |
propertyChange(PropertyChangeEvent event)
Implementation of the method defined in
PropertyChangeListener. |
void |
setBean(Object bean)
Set bean. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final HashMap<String,String> typeMapping
HashMap that provides the mapping for primitives
to their object wrappers.
protected Object bean
protected HashMap<String,PropertyDescriptor> properties
HashMap of all the properties defined in the bean.
| Constructor Detail |
|---|
protected PropertyChangeListener()
properties.
public PropertyChangeListener(Object bean)
throws IntrospectionException
bean - The data object which is to be managed.
IntrospectionException - If errors are encountered while
introspecting the bean class.setBean(java.lang.Object)| Method Detail |
|---|
public void propertyChange(PropertyChangeEvent event)
PropertyChangeListener.
propertyChange in interface PropertyChangeListenerevent - A PropertyChangeEvent object describing
the event source and the property that has changed.modifyPrimitive(java.beans.PropertyChangeEvent, java.beans.PropertyDescriptor),
modifyObject(java.beans.PropertyChangeEvent, java.beans.PropertyDescriptor)
protected void initProperties()
throws IntrospectionException
properties by introspecting the bean.
IntrospectionException - If errors are encountered while
introspecting the bean class.
protected void modifyPrimitive(PropertyChangeEvent event,
PropertyDescriptor descriptor)
throws RuntimeException
bean.
event - A PropertyChangeEvent object that
contains the property to change and the old and new values.descriptor - A PropertyDescriptor object that
describes the property
RuntimeException - If the appropriate mutator method
for the property cannot be accessed, or if the specified value
does not directly match a primitive type or is not a string.
protected Object objectFromString(PropertyChangeEvent event,
PropertyDescriptor descriptor)
throws RuntimeException
event - A PropertyChangeEvent object that
contains the property to change and the old and new values.descriptor - A PropertyDescriptor object that
describes the property
RuntimeException - If errors are encountered while trying
to initialise the wrapper object.
protected void modifyObject(PropertyChangeEvent event,
PropertyDescriptor descriptor)
throws RuntimeException
bean.
event - A PropertyChangeEvent object that
contains the property to change and the old and new values.descriptor - A PropertyDescriptor object that
describes the property
RuntimeException - If errors are encountered while trying
to invoke the mutator method.public final Object getBean()
bean.
public void setBean(Object bean)
throws IntrospectionException
bean. Re-initialises properties.
bean - The value to set.
IntrospectionException - If errors are encountered while
introspecting the bean class.initProperties()public final HashMap<String,PropertyDescriptor> getProperties()
properties.
|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||