org.openbp.common.generic.propertybrowser
Class ObjectDescriptor

java.lang.Object
  extended by org.openbp.common.generic.description.DescriptionObjectImpl
      extended by org.openbp.common.generic.description.DisplayObjectImpl
          extended by org.openbp.common.generic.propertybrowser.ObjectDescriptor
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable, Copyable, DescriptionObject, Displayable, DisplayObject, Validatable

public class ObjectDescriptor
extends DisplayObjectImpl

An object descriptor describes an object that can be edited by an property browser. A particular object descriptor always refers to the class of the object to be edited. This class can also be an interface. The OD describes the object in general (display name, description) and all of its properties (PropertyDescriptor objects). The object descriptor can be serialized to/deserialized from XML. The XML file will reside in the same location as the object's class file. Use the ObjectDescriptorMgr class to access object descriptors for a particular class. The manager will automatically locate and locate the object descriptor for this class. After loading the OD, the object descriptor manager will iterate the property list. The manager will try to resolve attribute information of a property that is not set (e. g. description, type name, editor class name) from the OD of the super class or from the OD of its implemented interfaces.
This means that for common attributes you only need to specify their property name in the property descriptor list; the remaining information about the property will be retrieved from the base class.

Author:
Heiko Erhardt
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.openbp.common.generic.Copyable
COPY_DEEP, COPY_FIRST_LEVEL, COPY_SHALLOW
 
Constructor Summary
ObjectDescriptor()
          Default constructor.
 
Method Summary
 void addProperty(PropertyDescriptor property)
          Adds a property.
 void clearProperties()
          Clears the list of properties.
 void copyFrom(java.lang.Object source, int copyMode)
          Copies the values of the source object to this object.
 java.lang.Class getObjectClass()
          Gets the object class this descriptor is suitable for.
 java.lang.String getObjectClassName()
          Gets the name of the object class this descriptor is suitable for.
 java.util.Iterator getProperties()
          Gets the list of properties.
 PropertyDescriptor getProperty(java.lang.String name)
          Gets the property descriptor for a particular property.
 java.util.List getPropertyList()
          Gets the list of properties.
 java.lang.Class getValidatorClass()
          Gets the validator class.
 java.lang.String getValidatorClassName()
          Gets the validator class name.
 boolean isCustomDescriptor()
          Gets the flag if this descriptor is a custom descriptor (see ObjectDescriptorMgr).
 boolean isPropertiesResolved()
          Gets the flag if the properties of this descriptor have been resolved (see implementation of ObjectDescriptorMgr).
 void setCustomDescriptor(boolean customDescriptor)
          Sets the flag if this descriptor is a custom descriptor (see ObjectDescriptorMgr).
 void setObjectClass(java.lang.Class objectClass)
          Sets the object class this descriptor is suitable for.
 void setObjectClassName(java.lang.String objectClassName)
          Sets the name of the object class this descriptor is suitable for.
 void setPropertiesResolved(boolean propertiesResolved)
          Sets the flag if the properties of this descriptor have been resolved (see implementation of ObjectDescriptorMgr).
 void setValidatorClass(java.lang.Class validatorClass)
          Sets the validator class.
 void setValidatorClassName(java.lang.String validatorClassName)
          Sets the validator class name.
 
Methods inherited from class org.openbp.common.generic.description.DisplayObjectImpl
getDisplayName, getDisplayText, setDisplayName
 
Methods inherited from class org.openbp.common.generic.description.DescriptionObjectImpl
clone, compareTo, getDescription, getDescriptionEscape, getDescriptionText, getName, setDescription, setDescriptionEscape, setName, toString, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openbp.common.generic.description.DescriptionObject
clone, getDescription, getDescriptionText, getName, setDescription, setName
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

ObjectDescriptor

public ObjectDescriptor()
Default constructor.

Method Detail

copyFrom

public void copyFrom(java.lang.Object source,
                     int copyMode)
              throws java.lang.CloneNotSupportedException
Copies the values of the source object to this object.

Specified by:
copyFrom in interface Copyable
Overrides:
copyFrom in class DisplayObjectImpl
Parameters:
source - The source object. Must be of the same type as this object.
copyMode - Determines if a deep copy, a first level copy or a shallow copy is to be performed. See the constants of the org.openbp.common.generic.description.Copyable class.
Throws:
java.lang.CloneNotSupportedException - If the cloning of one of the contained objects failed

getObjectClassName

public java.lang.String getObjectClassName()
Gets the name of the object class this descriptor is suitable for.


setObjectClassName

public void setObjectClassName(java.lang.String objectClassName)
Sets the name of the object class this descriptor is suitable for.


getObjectClass

public java.lang.Class getObjectClass()
Gets the object class this descriptor is suitable for.


setObjectClass

public void setObjectClass(java.lang.Class objectClass)
Sets the object class this descriptor is suitable for.


getValidatorClassName

public java.lang.String getValidatorClassName()
Gets the validator class name.

Returns:
Specifies a class that implements the ObjectValidator interface

setValidatorClassName

public void setValidatorClassName(java.lang.String validatorClassName)
Sets the validator class name.

Parameters:
validatorClassName - Specifies a class that implements the ObjectValidator interface

getValidatorClass

public java.lang.Class getValidatorClass()
Gets the validator class.

Returns:
A class that implements the ObjectValidator interface

setValidatorClass

public void setValidatorClass(java.lang.Class validatorClass)
Sets the validator class.

Parameters:
validatorClass - A class that implements the ObjectValidator interface

getProperty

public PropertyDescriptor getProperty(java.lang.String name)
Gets the property descriptor for a particular property.

Parameters:
name - Name of the property
Returns:
The property descriptor or null if no such property exists

getProperties

public java.util.Iterator getProperties()
Gets the list of properties.

Returns:
An iterator of PropertyDescriptor objects

addProperty

public void addProperty(PropertyDescriptor property)
Adds a property.

Parameters:
property - The property to add

clearProperties

public void clearProperties()
Clears the list of properties.


getPropertyList

public java.util.List getPropertyList()
Gets the list of properties.

Returns:
A list of PropertyDescriptor objects

isCustomDescriptor

public boolean isCustomDescriptor()
Gets the flag if this descriptor is a custom descriptor (see ObjectDescriptorMgr).


setCustomDescriptor

public void setCustomDescriptor(boolean customDescriptor)
Sets the flag if this descriptor is a custom descriptor (see ObjectDescriptorMgr).


isPropertiesResolved

public boolean isPropertiesResolved()
Gets the flag if the properties of this descriptor have been resolved (see implementation of ObjectDescriptorMgr).


setPropertiesResolved

public void setPropertiesResolved(boolean propertiesResolved)
Sets the flag if the properties of this descriptor have been resolved (see implementation of ObjectDescriptorMgr).



Copyright © 2011. All Rights Reserved.