com.taursys.model
Class AbstractValueHolder

java.lang.Object
  extended bycom.taursys.model.AbstractValueHolder
All Implemented Interfaces:
ValueHolder
Direct Known Subclasses:
ObjectArrayValueHolder, ObjectValueHolder

public abstract class AbstractValueHolder
extends java.lang.Object
implements ValueHolder

AbstractValueHolder is a partial implementation of the ValueHolder Interface.

Version:
1.0
Author:
Marty Phelan

Constructor Summary
AbstractValueHolder()
          Constructs a new AbstractValueHolder
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Adds the specified change listener to receive change events from this value holder.
protected  void checkArrays(java.lang.String[] propertyNames, java.lang.Object[] values)
          Check to ensure arrays are not null and same size
protected  void fireStateChanged(javax.swing.event.ChangeEvent e)
          Reports a state change to all change listeners.
 java.lang.String getAlias()
          Gets the alias name for this VOValueHolder.
abstract  int getJavaDataType(java.lang.String propertyName)
          Get the java data type for the given propertyName
abstract  java.lang.Object getPropertyValue(java.lang.String propertyName)
          Get the value for the given property name.
 java.lang.Object[] getPropertyValues(java.lang.String[] propertyNames)
          Get the values for the given property names.
protected  boolean isMultiplePropertiesChanging()
          Get flag indicating that multiple properties are being changed.
 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 setAlias(java.lang.String newAlias)
          Sets the alias name for this VOValueHolder.
protected  void setMultiplePropertiesChanging(boolean multiplePropertiesChanging)
          Set flag indicating that multiple properties are being changed.
abstract  void setPropertyValue(java.lang.String propertyName, java.lang.Object value)
          Set the named property's value to the given value.
 void setPropertyValues(java.lang.String[] propertyNames, java.lang.Object[] values)
          Set the the named property's values to the given values This method also sets the multiplePropertiesChanging to true while it is updating properties.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractValueHolder

public AbstractValueHolder()
Constructs a new AbstractValueHolder

Method Detail

getJavaDataType

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

Specified by:
getJavaDataType in interface ValueHolder
Returns:
the java data type for the given propertyName
Throws:
ModelException

getPropertyValue

public abstract java.lang.Object getPropertyValue(java.lang.String propertyName)
                                           throws ModelException
Get the value for the given property name.

Specified by:
getPropertyValue in interface ValueHolder
Returns:
the value for the given property name.
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.

Specified by:
getPropertyValues in interface ValueHolder
Parameters:
propertyNames - array of property names
Returns:
the values for the given property names.
Throws:
ModelException

setPropertyValue

public abstract void setPropertyValue(java.lang.String propertyName,
                                      java.lang.Object value)
                               throws ModelException
Set the named property's value to the given value. Fires a StateChanged event to any listeners.

Specified by:
setPropertyValue in interface ValueHolder
Parameters:
propertyName - the property to update
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 the named property's values to the given values This method also sets the multiplePropertiesChanging to true while it is updating properties. Implementations of setPropertyValue method should not generate events if this flag is true. When complete, this method fires a StateChanged event to any listeners. This method does nothing if either propertyNames or values are null, or if they are different sizes.

Specified by:
setPropertyValues in interface ValueHolder
Parameters:
propertyNames - the names of the properties to update
values - the array of values to update the properties with
Throws:
ModelException

checkArrays

protected void checkArrays(java.lang.String[] propertyNames,
                           java.lang.Object[] values)
                    throws ModelException
Check to ensure arrays are not null and same size

Parameters:
propertyNames - the list of property names
values - the corresponding values
Throws:
ModelException.REASON_MULTI_PROPERTY_MISMATCH - if either array is null or they are not the same size.
ModelException

setAlias

public void setAlias(java.lang.String newAlias)
Sets the alias name for this VOValueHolder. 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.

Parameters:
newAlias - the alias name for this VOValueHolder

getAlias

public java.lang.String getAlias()
Gets the alias name for this VOValueHolder. 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.

Specified by:
getAlias in interface ValueHolder
Returns:
the alias name for this VOValueHolder

setMultiplePropertiesChanging

protected void setMultiplePropertiesChanging(boolean multiplePropertiesChanging)
Set flag indicating that multiple properties are being changed. This flag is intended to avoid multiple events from being fired for a single batch update.

Parameters:
multiplePropertiesChanging - flag indicating that multiple properties are being changed.

isMultiplePropertiesChanging

protected boolean isMultiplePropertiesChanging()
Get flag indicating that multiple properties are being changed. This flag is intended to avoid multiple events from being fired for a single batch update.

Returns:
flag indicating that multiple properties are being changed.

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.

Specified by:
removeChangeListener in interface ValueHolder
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.

Specified by:
addChangeListener in interface ValueHolder
Parameters:
l - the change listener to add

fireStateChanged

protected void fireStateChanged(javax.swing.event.ChangeEvent e)
Reports a state change to all change listeners.


toString

public java.lang.String toString()
Returns a string representation of this object. This contains the object identity and state information.

Returns:
a string representation of this object


Copyright © 2007 Martin T Phelan. All Rights Reserved.