SPT Core API

com.sptci.echo.binding
Class PropertyChangeListener

java.lang.Object
  extended by com.sptci.PropertyChangeListener
      extended by com.sptci.echo.binding.PropertyChangeListener
All Implemented Interfaces:
PropertyChangeListener, EventListener
Direct Known Subclasses:
ModelPropertyChangeListener, ViewPropertyChangeListener

public abstract class PropertyChangeListener
extends PropertyChangeListener

An implementation of PropertyChangeListener used to synchronise changes made to properties in UI components or the PropertyChangeListener.bean java bean with each other.

Copyright 2006 Sans Pareil Technologies, Inc.

Version:
$Id: PropertyChangeListener.java 4553 2008-12-24 10:34:16Z rakesh $
Author:
Rakesh Vidyadharan 2006-01-22

Field Summary
 
Fields inherited from class com.sptci.PropertyChangeListener
bean, properties, typeMapping
 
Constructor Summary
protected PropertyChangeListener()
          Default constructor.
  PropertyChangeListener(Object bean)
          Create a new instance of the class using the specified java bean.
 
Method Summary
protected  void modifyObject(PropertyChangeEvent event, PropertyDescriptor descriptor)
          Over-ridden to handle special events generated by the Echo2 framework.
protected  String parseName(String name)
          Parse the field name specified, and remove any complex components used to set the name as actionCommands.
protected  void processList(List list, PropertyChangeEvent event, PropertyDescriptor descriptor)
          Process a field with type List in PropertyChangeListener.bean.
protected  void processMap(Map map, PropertyChangeEvent event, PropertyDescriptor descriptor)
          Process a field with type Map in PropertyChangeListener.bean.
 
Methods inherited from class com.sptci.PropertyChangeListener
getBean, getProperties, initProperties, modifyPrimitive, objectFromString, propertyChange, setBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyChangeListener

protected PropertyChangeListener()
Default constructor. Just invokes super class constructor.


PropertyChangeListener

public PropertyChangeListener(Object bean)
                       throws IntrospectionException
Create a new instance of the class using the specified java bean.

Parameters:
bean - The data object which is to be managed.
Throws:
IntrospectionException - If errors are encountered while introspecting the PropertyChangeListener.bean class.
Method Detail

modifyObject

protected void modifyObject(PropertyChangeEvent event,
                            PropertyDescriptor descriptor)
                     throws BindingException
Over-ridden to handle special events generated by the Echo2 framework. Events that require special handling are usually CheckBox, AbstractList and RadioButton components. These components must be modelled as Map and List fields in the PropertyChangeListener.bean.

Overrides:
modifyObject in class PropertyChangeListener
Parameters:
event - A PropertyChangeEvent object that contains the property to change and the old and new values.
descriptor - A PropertyDescriptor object that describes the property
Throws:
BindingException - If errors are encountered while trying to invoke the appropriate method.
See Also:
ReflectionUtility.fetchObject(java.lang.String, java.lang.Object), processMap(java.util.Map, java.beans.PropertyChangeEvent, java.beans.PropertyDescriptor), processList(java.util.List, java.beans.PropertyChangeEvent, java.beans.PropertyDescriptor)

processMap

protected void processMap(Map map,
                          PropertyChangeEvent event,
                          PropertyDescriptor descriptor)
Process a field with type Map in PropertyChangeListener.bean. Adds an entry to the map using the name and value in the event.

Parameters:
map - The map that is to be updated.
event - A PropertyChangeEvent object that contains the property to change and the old and new values.
descriptor - A PropertyDescriptor object that describes the property

processList

protected void processList(List list,
                           PropertyChangeEvent event,
                           PropertyDescriptor descriptor)
Process a field with type List in PropertyChangeListener.bean. Sets the value of the list entry at the appropriate index using the values in the event.

Parameters:
list - The list that is to be updated.
event - A PropertyChangeEvent object that contains the property to change and the old and new values.
descriptor - A PropertyDescriptor object that describes the property

parseName

protected String parseName(String name)
Parse the field name specified, and remove any complex components used to set the name as actionCommands.

Parameters:
name - The name that is to be parsed.
Returns:
String The parsed and corrected (if necessary) name.

SPT Core API