wt.clients.beans.selectors
Class ComponentDelegateAdapter

java.lang.Object
  extended bywt.clients.beans.selectors.ComponentDelegateAdapter
All Implemented Interfaces:
ComponentDelegate, Externalizable, Serializable
Direct Known Subclasses:
BooleanComponentDelegate, DateTimeComponentDelegate, DecimalComponentDelegate, EnumeratedTypeComponentDelegate, IntegerComponentDelegate, LifeCycleComponentDelegate, LocationComponentDelegate, PrincipalComponentDelegate, ProjectComponentDelegate, QuantityComponentDelegate, StringComponentDelegate, TeamTemplatesComponentDelegate, ViewComponentDelegate

public class ComponentDelegateAdapter
extends Object
implements ComponentDelegate, Externalizable

This is an adapter class which provides default implementations of many of the methods required for the ComponentDelegate interface. It is intended to be subclassed by concrete implementations of the ComponentDelegate interface.

Supported API: true

Extendable: true

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
private  Component currentComponent
           
private  ComponentContext currentComponentContext
           
private  Object currentObject
           
private  PropertyDescriptor currentPropertyDescriptor
           
private  Object currentValue
           
private  Vector objectPropertyChangeListeners
           
private  PropertyItem propertyItem
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
private static String versionID
           
 
Constructor Summary
ComponentDelegateAdapter()
           
 
Method Summary
 void addObjectPropertyChangeListener(PropertyChangeListener listener)
          Add a property change listener which should be notified when the attribute value changes in the component.
protected  void firePropertyChangeEvent(Object oldValue, Object newValue)
           
 Component getComponent()
          Return the component to be used.
 Dimension getComponentPreferredGridSize()
          Return the preferred grid size of the component.
protected  Component getCurrentComponent()
          Gets the value of the attribute: currentComponent.
protected  ComponentContext getCurrentComponentContext()
          Gets the value of the attribute: currentComponentContext.
protected  Object getCurrentObject()
          Gets the value of the attribute: currentObject.
protected  PropertyDescriptor getCurrentPropertyDescriptor()
          Gets the value of the attribute: currentPropertyDescriptor.
protected  Object getCurrentValue()
          Gets the value of the attribute: currentValue.
 Object getObject()
           
protected  Vector getObjectPropertyChangeListeners()
          Gets the value of the attribute: objectPropertyChangeListeners.
protected  PropertyItem getPropertyItem()
          Gets the value of the attribute: propertyItem.
 Object getValue()
          Return the current value for the attribute as contained in the component used to display the attribute value.
 boolean hasOwnLabel()
          Returns true if the component supplies its own label and one should not be created for it by the AttributesForm.
 boolean isDirect()
          Return true if the ComponentDelegate works directly with the object containing the attribute, instead of with the individual attribute.
 boolean isDirty()
          Return true if the value of the attribute has been modified in user interface.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  void readOldVersion(ObjectInput input, long readSerialVersionUID)
          Reads the non-transient fields of this class from an external source, which is not the current version.
 void removeObjectPropertyChangeListener(PropertyChangeListener listener)
          Remove a property change listener.
 void setComponentContext(ComponentContext context)
          Set the context for the component.
protected  void setCurrentComponent(Component a_CurrentComponent)
          Sets the value of the attribute: currentComponent.
protected  void setCurrentComponentContext(ComponentContext a_CurrentComponentContext)
          Sets the value of the attribute: currentComponentContext.
protected  void setCurrentObject(Object a_CurrentObject)
          Sets the value of the attribute: currentObject.
protected  void setCurrentPropertyDescriptor(PropertyDescriptor a_CurrentPropertyDescriptor)
          Sets the value of the attribute: currentPropertyDescriptor.
protected  void setCurrentValue(Object a_CurrentValue)
          Sets the value of the attribute: currentValue.
 void setObject(Object object)
           
protected  void setObjectPropertyChangeListeners(Vector a_ObjectPropertyChangeListeners)
          Sets the value of the attribute: objectPropertyChangeListeners.
 void setPropertyDescriptor(PropertyDescriptor descriptor)
          Sets the property descriptor for the attribute.
protected  void setPropertyItem(PropertyItem a_PropertyItem)
          Sets the value of the attribute: propertyItem.
 void setValue(Object value)
          Sets the current value for the attribute.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

versionID

private static final String versionID
See Also:
Constant Field Values

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

currentComponent

private Component currentComponent

currentValue

private Object currentValue

currentObject

private Object currentObject

currentPropertyDescriptor

private PropertyDescriptor currentPropertyDescriptor

currentComponentContext

private ComponentContext currentComponentContext

objectPropertyChangeListeners

private transient Vector objectPropertyChangeListeners

propertyItem

private PropertyItem propertyItem
Constructor Detail

ComponentDelegateAdapter

public ComponentDelegateAdapter()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readOldVersion

private void readOldVersion(ObjectInput input,
                            long readSerialVersionUID)
                     throws IOException,
                            ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
Throws:
IOException
ClassNotFoundException

getCurrentComponent

protected Component getCurrentComponent()
Gets the value of the attribute: currentComponent.

Returns:
Component

setCurrentComponent

protected void setCurrentComponent(Component a_CurrentComponent)
                            throws WTPropertyVetoException
Sets the value of the attribute: currentComponent.

Parameters:
a_CurrentComponent -
Throws:
WTPropertyVetoException

getCurrentValue

protected Object getCurrentValue()
Gets the value of the attribute: currentValue.

Returns:
Object

setCurrentValue

protected void setCurrentValue(Object a_CurrentValue)
                        throws WTPropertyVetoException
Sets the value of the attribute: currentValue.

Parameters:
a_CurrentValue -
Throws:
WTPropertyVetoException

getCurrentObject

protected Object getCurrentObject()
Gets the value of the attribute: currentObject.

Returns:
Object

setCurrentObject

protected void setCurrentObject(Object a_CurrentObject)
                         throws WTPropertyVetoException
Sets the value of the attribute: currentObject.

Parameters:
a_CurrentObject -
Throws:
WTPropertyVetoException

getCurrentPropertyDescriptor

protected PropertyDescriptor getCurrentPropertyDescriptor()
Gets the value of the attribute: currentPropertyDescriptor.

Returns:
PropertyDescriptor

setCurrentPropertyDescriptor

protected void setCurrentPropertyDescriptor(PropertyDescriptor a_CurrentPropertyDescriptor)
                                     throws WTPropertyVetoException
Sets the value of the attribute: currentPropertyDescriptor.

Parameters:
a_CurrentPropertyDescriptor -
Throws:
WTPropertyVetoException

getCurrentComponentContext

protected ComponentContext getCurrentComponentContext()
Gets the value of the attribute: currentComponentContext.

Returns:
wt.clients.beans.selectors.ComponentContext

setCurrentComponentContext

protected void setCurrentComponentContext(ComponentContext a_CurrentComponentContext)
                                   throws WTPropertyVetoException
Sets the value of the attribute: currentComponentContext.

Parameters:
a_CurrentComponentContext -
Throws:
WTPropertyVetoException

getObjectPropertyChangeListeners

protected Vector getObjectPropertyChangeListeners()
Gets the value of the attribute: objectPropertyChangeListeners.

Returns:
Vector

setObjectPropertyChangeListeners

protected void setObjectPropertyChangeListeners(Vector a_ObjectPropertyChangeListeners)
                                         throws WTPropertyVetoException
Sets the value of the attribute: objectPropertyChangeListeners.

Parameters:
a_ObjectPropertyChangeListeners -
Throws:
WTPropertyVetoException

getPropertyItem

protected PropertyItem getPropertyItem()
Gets the value of the attribute: propertyItem.

Returns:
PropertyItem

setPropertyItem

protected void setPropertyItem(PropertyItem a_PropertyItem)
                        throws WTPropertyVetoException
Sets the value of the attribute: propertyItem.

Parameters:
a_PropertyItem -
Throws:
WTPropertyVetoException

firePropertyChangeEvent

protected void firePropertyChangeEvent(Object oldValue,
                                       Object newValue)
Parameters:
oldValue -
newValue -

getComponent

public Component getComponent()
Return the component to be used. The delegate is responsible for creating a component appropriate for the datatype and context.

Specified by:
getComponent in interface ComponentDelegate
Returns:
Component

isDirect

public boolean isDirect()
Return true if the ComponentDelegate works directly with the object containing the attribute, instead of with the individual attribute. If this method returns true, the setObject() and getObject() methods should be invoked instead of the getValue() and setValue() methods.

Specified by:
isDirect in interface ComponentDelegate
Returns:
boolean

isDirty

public boolean isDirty()
Return true if the value of the attribute has been modified in user interface.

Specified by:
isDirty in interface ComponentDelegate
Returns:
boolean

getValue

public Object getValue()
                throws WTException,
                       WTPropertyVetoException
Return the current value for the attribute as contained in the component used to display the attribute value.

Specified by:
getValue in interface ComponentDelegate
Returns:
Object
Throws:
WTException
WTPropertyVetoException

setValue

public void setValue(Object value)
              throws WTException
Sets the current value for the attribute.

Specified by:
setValue in interface ComponentDelegate
Parameters:
value -
Throws:
WTException

getObject

public Object getObject()
                 throws WTException
Specified by:
getObject in interface ComponentDelegate
Returns:
Object
Throws:
WTException

setObject

public void setObject(Object object)
               throws WTException
Specified by:
setObject in interface ComponentDelegate
Parameters:
object -
Throws:
WTException

setPropertyDescriptor

public void setPropertyDescriptor(PropertyDescriptor descriptor)
Sets the property descriptor for the attribute. This contains information about the minimum and maximum lengths, whether the attribute is required, etc.

Specified by:
setPropertyDescriptor in interface ComponentDelegate
Parameters:
descriptor -

setComponentContext

public void setComponentContext(ComponentContext context)
Set the context for the component. This contains information about the mode ( UPDATE_MODE, VIEW_MODE, or CREATE_MODE).

Specified by:
setComponentContext in interface ComponentDelegate
Parameters:
context -

hasOwnLabel

public boolean hasOwnLabel()
Returns true if the component supplies its own label and one should not be created for it by the AttributesForm.

Specified by:
hasOwnLabel in interface ComponentDelegate
Returns:
boolean

getComponentPreferredGridSize

public Dimension getComponentPreferredGridSize()
Return the preferred grid size of the component. The default value is (1,1) which gives it a grid width and height of 1 in the AttributesForm. To take up two grid positions horizontally, return a preferred grid size of (2,1).

Specified by:
getComponentPreferredGridSize in interface ComponentDelegate
Returns:
Dimension

addObjectPropertyChangeListener

public void addObjectPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener which should be notified when the attribute value changes in the component.

Specified by:
addObjectPropertyChangeListener in interface ComponentDelegate
Parameters:
listener -

removeObjectPropertyChangeListener

public void removeObjectPropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener.

Specified by:
removeObjectPropertyChangeListener in interface ComponentDelegate
Parameters:
listener -