|
||||||||||
| 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 java.lang.Object |
bean
The java bean which is to be kept synchronised with updates made to UI components. |
private static java.util.logging.Logger |
logger
The logger used to log errors/warnings. |
protected java.util.HashMap<java.lang.String,java.beans.PropertyDescriptor> |
properties
A HashMap of all the properties defined in the bean. |
protected static java.util.HashMap<java.lang.String,java.lang.String> |
typeMapping
A HashMap that provides the mapping for primitives
to their object wrappers. |
| Constructor Summary | |
|---|---|
protected |
PropertyChangeListener()
Default constructor. |
|
PropertyChangeListener(java.lang.Object bean)
Create a new instance of the class using the specified java bean. |
| Method Summary | |
|---|---|
java.lang.Object |
getBean()
Returns bean. |
java.util.HashMap<java.lang.String,java.beans.PropertyDescriptor> |
getProperties()
Returns a shallow-clone of properties. |
protected void |
initProperties()
Populate properties by introspecting the bean. |
protected void |
modifyObject(java.beans.PropertyChangeEvent event,
java.beans.PropertyDescriptor descriptor)
Modify an object property in bean. |
protected void |
modifyPrimitive(java.beans.PropertyChangeEvent event,
java.beans.PropertyDescriptor descriptor)
Modify a primitive property in bean. |
protected java.lang.Object |
objectFromString(java.beans.PropertyChangeEvent event,
java.beans.PropertyDescriptor descriptor)
Convert the given String value to an Object wrapper of the appropriate kind. |
void |
propertyChange(java.beans.PropertyChangeEvent event)
Implementation of the method defined in
PropertyChangeListener. |
void |
setBean(java.lang.Object bean)
Set bean. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
protected static final java.util.HashMap<java.lang.String,java.lang.String> typeMapping
HashMap that provides the mapping for primitives
to their object wrappers.
protected java.lang.Object bean
protected java.util.HashMap<java.lang.String,java.beans.PropertyDescriptor> properties
HashMap of all the properties defined in the bean.
| Constructor Detail |
|---|
protected PropertyChangeListener()
properties.
public PropertyChangeListener(java.lang.Object bean)
throws java.beans.IntrospectionException
bean - The data object which is to be managed.
java.beans.IntrospectionException - If errors are encountered while
introspecting the bean class.setBean(java.lang.Object)| Method Detail |
|---|
public void propertyChange(java.beans.PropertyChangeEvent event)
PropertyChangeListener.
propertyChange in interface java.beans.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 java.beans.IntrospectionException
properties by introspecting the bean.
java.beans.IntrospectionException - If errors are encountered while
introspecting the bean class.
protected void modifyPrimitive(java.beans.PropertyChangeEvent event,
java.beans.PropertyDescriptor descriptor)
throws java.lang.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
java.lang.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 java.lang.Object objectFromString(java.beans.PropertyChangeEvent event,
java.beans.PropertyDescriptor descriptor)
throws java.lang.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
java.lang.RuntimeException - If errors are encountered while trying
to initialise the wrapper object.
protected void modifyObject(java.beans.PropertyChangeEvent event,
java.beans.PropertyDescriptor descriptor)
throws java.lang.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
java.lang.RuntimeException - If errors are encountered while trying
to invoke the mutator method.public final java.lang.Object getBean()
bean.
public void setBean(java.lang.Object bean)
throws java.beans.IntrospectionException
bean. Re-initialises properties.
bean - The value to set.
java.beans.IntrospectionException - If errors are encountered while
introspecting the bean class.initProperties()public final java.util.HashMap<java.lang.String,java.beans.PropertyDescriptor> getProperties()
properties.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||