com.taursys.model
Interface ValueHolder

All Known Subinterfaces:
CollectionValueHolder, ListValueHolder
All Known Implementing Classes:
AbstractCollectionValueHolder, AbstractListValueHolder, AbstractValueHolder, ObjectArrayValueHolder, VOListValueHolder

public interface ValueHolder

A ValueHolder is a foundation subcomponent for MapperXML which is used by TextModels to store/retrieve the current "state" or value. A ValueHolder can be used exclusively by a single TextModel or shared by multiple TextModels. A specific property of the ValueHolder host object can also be targeted. The targeted property can be specified by setting the propertyName property. (Note: the ValueHolder implementation must be one that actually supports access to individual properties for this feature to work, otherwise the propertyName setting is ignored and the whole host object is accessed).

The data type of the targeted host object property (or the host object itself) is available via the getJavaDataType method.

The alias property provides a way of naming this ValueHolder. This name is required when using the ComponentFactory to automatically create and bind MapperXML components from an HTML/XML document.

The ValueHolder also provides notification to ChangeListeners whenever the "state" or value changes. Interested listeners can register or unregister to receive notification of ChangeEvents by using the addChangeListener or removeChangeListener methods.

Note: This interface is subject to change. You should extend one of the existing classes rather than directly implementing this interface.


Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Adds the specified change listener to receive change events from this value holder.
 java.lang.String getAlias()
          Get the alias name for this ValueHolder.
 int getJavaDataType(java.lang.String propertyName)
          Get the java data type for the given property
 java.lang.Object getPropertyValue(java.lang.String propertyName)
          Get the value of the given property in the valueObject.
 java.lang.Object[] getPropertyValues(java.lang.String[] propertyNames)
          Get the values for the given property names.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Removes the specified change listener so that it no longer receives change events from this value holder.
 void setPropertyValue(java.lang.String propertyName, java.lang.Object value)
          Set the value of the given property in the valueObject.
 void setPropertyValues(java.lang.String[] propertyNames, java.lang.Object[] values)
          Set the values for the given properties in the valueObject.
 

Method Detail

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String propertyName)
                                  throws ModelException
Get the value of the given property in the valueObject.

Returns:
the value of the given property in the valueObject.
Throws:
ModelException

getPropertyValues

public java.lang.Object[] getPropertyValues(java.lang.String[] propertyNames)
                                     throws ModelException
Get the values for the given property names. This method returns an empty Object array if the given propertyNames is null or empty.

Parameters:
propertyNames - array of property names
Returns:
the values for the given property names.
Throws:
ModelException

setPropertyValue

public void setPropertyValue(java.lang.String propertyName,
                             java.lang.Object value)
                      throws ModelException
Set the value of the given property in the valueObject. Fires a StateChanged event to any listeners.

Parameters:
propertyName - the property name to set
value - the value to set the property to
Throws:
ModelException

setPropertyValues

public void setPropertyValues(java.lang.String[] propertyNames,
                              java.lang.Object[] values)
                       throws ModelException
Set the values for the given properties in the valueObject. Fires a StateChanged event to any listeners.

Parameters:
propertyNames - the property names to set
values - the values to set the properties to
Throws:
ModelException

getJavaDataType

public int getJavaDataType(java.lang.String propertyName)
                    throws ModelException
Get the java data type for the given property

Returns:
the java data type for the given property
Throws:
ModelException

getAlias

public java.lang.String getAlias()
Get the alias name for this ValueHolder. This property is used by the ComponentFactory to bind Components to ValueHolders by matching it to the first part of the Component's ID property.

Returns:
the alias name for this ValueHolder

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Removes the specified change listener so that it no longer receives change events from this value holder. Change events are generated whenever the contents of the value holder change.

Parameters:
l - the change listener to remove

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Adds the specified change listener to receive change events from this value holder. Change events are generated whenever the contents of the value holder change.

Parameters:
l - the change listener to add


Copyright © 2007 Martin T Phelan. All Rights Reserved.