com.taursys.model
Class ObjectValueHolder

java.lang.Object
  extended bycom.taursys.model.AbstractValueHolder
      extended bycom.taursys.model.ObjectValueHolder
All Implemented Interfaces:
javax.swing.event.ChangeListener, java.util.EventListener, ValueHolder
Direct Known Subclasses:
VariantValueHolder, VOValueHolder

public class ObjectValueHolder
extends AbstractValueHolder
implements javax.swing.event.ChangeListener

ValueHolder which stores a Single Object value internally.


Field Summary
protected  java.lang.Object obj
           
 
Constructor Summary
ObjectValueHolder()
          Constructs a new ObjectValueHolder
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Adds the specified change listener to receive change events from this ObjectValueHolder.
 void fireContentValueChanged()
          Notifies all ChangeListeners that the contents of this value holder have changed.
 int getJavaDataType(java.lang.String propertyName)
          Get javaDataType always returns DataTypes.TYPE_UNDEFINED (propertyName is ignored)
 java.lang.Object getObject()
          Get the internal object for this holder.
 java.lang.String getParentPropertyName()
          Get the property name of the Collection in the parentValueHolder for this VOCollectionValueHolder.
 ValueHolder getParentValueHolder()
          Get the parent ValueHolder for this VOCollectionValueHolder.
 java.lang.Object getPropertyValue(java.lang.String propertyName)
          Get the internal value (propertyName is ignored).
protected  java.lang.Object getPropertyValue(java.lang.String propertyName, java.lang.Object vo)
          Get the value for the given property in the given obj.
protected  java.lang.Object[] getPropertyValues(java.lang.String[] propertyNames, java.lang.Object vo)
          Get the values for the given properties in the given obj.
 void setObject(java.lang.Object obj)
          Set the internal object for this holder.
 void setObject(java.lang.Object obj, javax.swing.event.ChangeEvent e)
          Set the internal object for this holder.
 void setParentPropertyName(java.lang.String parentPropertyName)
          Set the property name of the Collection in the parentValueHolder for this VOCollectionValueHolder.
 void setParentValueHolder(ValueHolder parentValueHolder)
          Set the parent ValueHolder for this VOCollectionValueHolder.
 void setPropertyValue(java.lang.String propertyName, java.lang.Object value)
          Sets the internal object (propertyName is ignored).
protected  void setPropertyValues(java.lang.String[] propertyNames, java.lang.Object[] values, java.lang.Object vo)
          Unsupported operation has no effect.
protected  void setPropertyValues(java.lang.String propertyName, java.lang.Object value, java.lang.Object vo)
          Unsupported operation has no effect.
 void stateChanged(javax.swing.event.ChangeEvent e)
          Invoked by the parentValueHolder whenever there is a change in its value.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class com.taursys.model.AbstractValueHolder
checkArrays, fireStateChanged, getAlias, getPropertyValues, isMultiplePropertiesChanging, removeChangeListener, setAlias, setMultiplePropertiesChanging, setPropertyValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

obj

protected java.lang.Object obj
Constructor Detail

ObjectValueHolder

public ObjectValueHolder()
Constructs a new ObjectValueHolder

Method Detail

getObject

public java.lang.Object getObject()
Get the internal object for this holder.

Returns:
the internal object for this holder.

setObject

public void setObject(java.lang.Object obj)
Set the internal object for this holder.

Parameters:
obj - the internal object for this holder.

setObject

public void setObject(java.lang.Object obj,
                      javax.swing.event.ChangeEvent e)
Set the internal object for this holder. It then fires the given ChangeEvent to all ChangeListeners (if e is not null).

Parameters:
obj - the internal object for this holder.
e - ChangeEvent to fire to all ChangeListeners (if not null)

getJavaDataType

public int getJavaDataType(java.lang.String propertyName)
                    throws ModelException
Get javaDataType always returns DataTypes.TYPE_UNDEFINED (propertyName is ignored)

Specified by:
getJavaDataType in interface ValueHolder
Specified by:
getJavaDataType in class AbstractValueHolder
Returns:
always returns DataTypes.TYPE_UNDEFINED (propertyName is ignored)
Throws:
ModelException

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String propertyName)
                                  throws ModelException
Get the internal value (propertyName is ignored).

Specified by:
getPropertyValue in interface ValueHolder
Specified by:
getPropertyValue in class AbstractValueHolder
Parameters:
propertyName - ignored
Returns:
the internal value
Throws:
ModelException

setPropertyValue

public void setPropertyValue(java.lang.String propertyName,
                             java.lang.Object value)
                      throws ModelException
Sets the internal object (propertyName is ignored). Fires a StateChanged event to any listeners.

Specified by:
setPropertyValue in interface ValueHolder
Specified by:
setPropertyValue in class AbstractValueHolder
Parameters:
propertyName - the property to update
Throws:
ModelException

setPropertyValues

protected void setPropertyValues(java.lang.String propertyName,
                                 java.lang.Object value,
                                 java.lang.Object vo)
                          throws ModelException
Unsupported operation has no effect.

Throws:
ModelException

setPropertyValues

protected void setPropertyValues(java.lang.String[] propertyNames,
                                 java.lang.Object[] values,
                                 java.lang.Object vo)
                          throws ModelException
Unsupported operation has no effect.

Throws:
ModelException

setParentValueHolder

public void setParentValueHolder(ValueHolder parentValueHolder)
Set the parent ValueHolder for this VOCollectionValueHolder. The parent ValueHolder will provide the Collection for this ValueHolder. If the parent is also a CollectionValueHolder, then whenever the parent moves to a new row, this VOCollectionValueHolder will receive a notification and will retrieve its new collection from the parent.

Parameters:
parentValueHolder - the parent ValueHolder for this VOCollectionValueHolder.

getParentValueHolder

public ValueHolder getParentValueHolder()
Get the parent ValueHolder for this VOCollectionValueHolder. The parent ValueHolder will provide the Collection for this ValueHolder. If the parent is also a CollectionValueHolder, then whenever the parent moves to a new row, this VOCollectionValueHolder will receive a notification and will retrieve its new collection from the parent.

Returns:
the parent ValueHolder for this VOCollectionValueHolder.

setParentPropertyName

public void setParentPropertyName(java.lang.String parentPropertyName)
Set the property name of the Collection in the parentValueHolder for this VOCollectionValueHolder. The parent ValueHolder will provide the Collection for this ValueHolder. If the parent is also a CollectionValueHolder, then whenever the parent moves to a new row, this VOCollectionValueHolder will receive a notification and will retrieve its new collection from the parent.


getParentPropertyName

public java.lang.String getParentPropertyName()
Get the property name of the Collection in the parentValueHolder for this VOCollectionValueHolder. The parent ValueHolder will provide the Collection for this ValueHolder. If the parent is also a CollectionValueHolder, then whenever the parent moves to a new row, this VOCollectionValueHolder will receive a notification and will retrieve its new collection from the parent.

Returns:
the property name of the Collection in the parentValueHolder for this VOCollectionValueHolder.

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Invoked by the parentValueHolder whenever there is a change in its value. The parent ValueHolder will provide the Collection for this ValueHolder. If the parent is also a CollectionValueHolder, then whenever the parent moves to a new row, this VOCollectionValueHolder will receive a notification and will retrieve its new collection from the parent.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e - the ChangeEvent from the parentValueHolder

getPropertyValue

protected java.lang.Object getPropertyValue(java.lang.String propertyName,
                                            java.lang.Object vo)
                                     throws ModelException
Get the value for the given property in the given obj.

Throws:
ModelException

getPropertyValues

protected java.lang.Object[] getPropertyValues(java.lang.String[] propertyNames,
                                               java.lang.Object vo)
                                        throws ModelException
Get the values for the given properties in the given obj.

Throws:
ModelException

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Adds the specified change listener to receive change events from this ObjectValueHolder. Fires an initial ContentChangedEvent to the given listener if the internal object has a value (not null). Change events are normally generated whenever the contents of the value holder change.

Specified by:
addChangeListener in interface ValueHolder
Overrides:
addChangeListener in class AbstractValueHolder
Parameters:
l - the specified change listener to receive change events from this ObjectValueHolder

fireContentValueChanged

public void fireContentValueChanged()
Notifies all ChangeListeners that the contents of this value holder have changed. A ContentChangeEvent event is fired which specifies whether or not the current contents are null.


toString

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

Overrides:
toString in class AbstractValueHolder
Returns:
a string representation of this object


Copyright © 2007 Martin T Phelan. All Rights Reserved.