Class UserPropertyDefn

java.lang.Object
org.eclipse.birt.report.model.metadata.PropertyDefn
org.eclipse.birt.report.model.metadata.ElementPropertyDefn
org.eclipse.birt.report.model.api.core.UserPropertyDefn
All Implemented Interfaces:
Cloneable, IStructure, IElementPropertyDefn, IPropertyDefn, org.eclipse.birt.report.model.core.IPropertySet, org.eclipse.birt.report.model.metadata.IContainerDefn, org.eclipse.birt.report.model.validators.ISemanticTriggerDefnSetProvider

public final class UserPropertyDefn extends org.eclipse.birt.report.model.metadata.ElementPropertyDefn implements IStructure
Represents a user-defined property. User-defined properties are created by the user and reside on elements. If element E has a user-defined property, and element C extends E, then element C also has all the user-defined properties defined on element E.

The user property definition implements the IStructure interface so that it can be accessed generically, and changes can be done though the command mechanism to allow undo/redo of style changes.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Name of the choices member.
    static final String
    Name of the default member.
    static final String
    Name of the display name ID member.
    static final String
    Name of the display name member.
    static final String
    Name of the isVisible member.
    static final String
    Name of the name member.
    static final String
    Name of the structure itself.
    static final String
    Name of the type member.

    Fields inherited from class org.eclipse.birt.report.model.metadata.ElementPropertyDefn

    groupNameKey, isInheritable, useOwnSearch

    Fields inherited from class org.eclipse.birt.report.model.metadata.PropertyDefn

    allowedChoices, allowedUnits, allowExpression, context, defaultUnit, defaultValue, definedBy, details, displayNameID, expressionType, intrinsic, isEncryptable, isList, messages, name, nameConfig, returnType, runtimeSettable, since, subType, triggers, trimOption, type, valueRequired, valueValidator

    Fields inherited from interface org.eclipse.birt.report.model.api.metadata.IPropertyDefn

    COMMERCIAL_PROPERTY, EXTENSION_MODEL_PROPERTY, EXTENSION_PROPERTY, ODA_PROPERTY, SYSTEM_PROPERTY, USER_PROPERTY
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Builds the semantic information for this property.
    void
    checkUserPropertyDefn(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.core.DesignElement element)
    Checks whether the element can take the given user property definition and the definition is valid.
    Makes a copy of this user property definition.
    Gets valid types for user property.
    Gets the definition of the structure which represents the user property definition.
    Gets the display name of this user property definition.
    getLocalProperty(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.metadata.PropertyDefn propDefn)
    Gets the locale value of a property.
    User-defined methods are not supported.
    Gets the object definition of the user property definition.
    getProperty(org.eclipse.birt.report.model.core.Module module, String memberName)
    Gets the locale value of a property.
    getProperty(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.metadata.PropertyDefn prop)
    Gets the value of property by the given property definition.
    Returns the structure definition for this value.
    Gets the name predefined for this structure.
    int
    Gets the property type.
    boolean
    Justifies whether the structure is generated in design time or not.
    boolean
    Justifies whether the structure can be referred by other design elements.
    boolean
    Checks whether the property is visible to the property sheet.
    void
    setChoices(UserChoice[] choiceArray)
    Sets the (anonymous) set of choices for a property.
    void
    Sets the default value for the property.
    void
    Sets the display name of the property.
    void
    setProperty(org.eclipse.birt.report.model.metadata.PropertyDefn prop, Object value)
    Sets the value for the given property definition.
    void
    setType(org.eclipse.birt.report.model.metadata.PropertyType typeDefn)
    Sets the property type.
    void
    setVisible(boolean isVisible)
    Sets whether the property is visible to the property sheet.
    protected String
    validateExtendedChoicesByDisplayName(org.eclipse.birt.report.model.core.Module module, String displayName)
    Checks whether displayName matches any items in the choice set for an extended choice property type on a user defined choice set.

    Methods inherited from class org.eclipse.birt.report.model.metadata.ElementPropertyDefn

    canInherit, enableContextSearch, getGroupName, getGroupNameKey, hasOwnModel, isEditable, isReadOnly, isStyleProperty

    Methods inherited from class org.eclipse.birt.report.model.metadata.PropertyDefn

    allowExpression, buildDefn, buildTriggerDefnSet, buildTrimOption, canContain, canContain, definedBy, doValidateValueWithExpression, getAllowedChoices, getAllowedElements, getAllowedElements, getAllowedUnits, getBooleanValue, getChoices, getCompatibleTypeAndValue, getContext, getDefault, getDefaultUnit, getDetails, getDisplayNameID, getDisplayValue, getFloatValue, getIntValue, getMessages, getName, getNameConfig, getNumberValue, getReturnType, getSince, getStringValue, getSubType, getSubTypeCode, getTargetElementType, getTriggerDefnSet, getType, getTypeCode, getXmlValue, hasChoices, isElementType, isEncryptable, isExtended, isIntrinsic, isList, isListType, isRuntimeSettable, isStructureMember, isSupportedSubType, isSystemProperty, isUserProperty, isValueRequired, setContext, setDetails, setDisplayNameID, setIsList, setMessages, setName, setNameConfig, setOwner, setReturnType, setRuntimeSettable, setSince, setTrimOption, toString, validateValue, validateXml

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.birt.report.model.metadata.IContainerDefn

    canContain, canContain, getAllowedElements, getAllowedElements, getName, getNameConfig
  • Field Details

  • Constructor Details

    • UserPropertyDefn

      public UserPropertyDefn()
      Default constructor.
  • Method Details

    • getAllowedTypes

      public static List<IPropertyType> getAllowedTypes()
      Gets valid types for user property. Each one in the list is an instance of IPropertyType.
      Returns:
      the list of allowed property types for user property.
    • getProperty

      public Object getProperty(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.metadata.PropertyDefn prop)
      Gets the value of property by the given property definition.
      Specified by:
      getProperty in interface org.eclipse.birt.report.model.core.IPropertySet
      Parameters:
      module - the module
      prop - definition of the property to get
      Returns:
      value of the property.
    • setProperty

      public void setProperty(org.eclipse.birt.report.model.metadata.PropertyDefn prop, Object value)
      Sets the value for the given property definition.
      Specified by:
      setProperty in interface org.eclipse.birt.report.model.core.IPropertySet
      Parameters:
      prop - definition of the property to set
      value - value to set
    • getStructName

      public String getStructName()
      Gets the name predefined for this structure.
      Specified by:
      getStructName in interface IStructure
      Returns:
      structure name "UserProperty".
    • getValueType

      public int getValueType()
      Gets the property type.
      Specified by:
      getValueType in interface IPropertyDefn
      Specified by:
      getValueType in class org.eclipse.birt.report.model.metadata.PropertyDefn
      Returns:
      integer represented user property type.
    • copy

      public IStructure copy()
      Makes a copy of this user property definition.
      Specified by:
      copy in interface IStructure
      Returns:
      IStructure of this property definition, or null if this property definition can not be cloned.
    • getDefn

      public IStructureDefn getDefn()
      Gets the definition of the structure which represents the user property definition.
      Specified by:
      getDefn in interface IStructure
      Returns:
      structure definition.
    • getObjectDefn

      public IObjectDefn getObjectDefn()
      Gets the object definition of the user property definition.
      Specified by:
      getObjectDefn in interface org.eclipse.birt.report.model.core.IPropertySet
      Returns:
      object definition.
    • getDisplayName

      public String getDisplayName()
      Gets the display name of this user property definition. The search will check the translation dictionary firstly, then look at the instance itself. If no display name defined, the XML name will be returned.
      Specified by:
      getDisplayName in interface org.eclipse.birt.report.model.metadata.IContainerDefn
      Overrides:
      getDisplayName in class org.eclipse.birt.report.model.metadata.PropertyDefn
      Returns:
      display name of this user property.
    • setDisplayName

      public void setDisplayName(String theName)
      Sets the display name of the property. Use this only for testing; you should normally set the display name message ID so that the name can be retrieved from a message catalog and localized.
      Parameters:
      theName - the display name to set
    • setChoices

      public void setChoices(UserChoice[] choiceArray)
      Sets the (anonymous) set of choices for a property. The choices are stored here directly, they are not named and stored in the data dictionary as are choices for system properties.
      Parameters:
      choiceArray - choice array to be set.
    • validateExtendedChoicesByDisplayName

      protected String validateExtendedChoicesByDisplayName(org.eclipse.birt.report.model.core.Module module, String displayName)
      Checks whether displayName matches any items in the choice set for an extended choice property type on a user defined choice set. If displayName exists in the choice set, return the name of this choice. Otherwise, return null.
      Overrides:
      validateExtendedChoicesByDisplayName in class org.eclipse.birt.report.model.metadata.PropertyDefn
      Parameters:
      module - the module
      displayName - the candidate display name
      Returns:
      the choice name if found. Otherwise, return null.
    • getStructDefn

      public IStructureDefn getStructDefn()
      Description copied from class: org.eclipse.birt.report.model.metadata.PropertyDefn
      Returns the structure definition for this value.
      Specified by:
      getStructDefn in interface IPropertyDefn
      Overrides:
      getStructDefn in class org.eclipse.birt.report.model.metadata.PropertyDefn
      Returns:
      the structure definition, or null if this value is not a list of structures
    • getMethodInfo

      public IMethodInfo getMethodInfo()
      User-defined methods are not supported.
      Specified by:
      getMethodInfo in interface IElementPropertyDefn
      Overrides:
      getMethodInfo in class org.eclipse.birt.report.model.metadata.ElementPropertyDefn
      Returns:
      null
    • setType

      public void setType(org.eclipse.birt.report.model.metadata.PropertyType typeDefn)
      Sets the property type.
      Overrides:
      setType in class org.eclipse.birt.report.model.metadata.PropertyDefn
      Parameters:
      typeDefn - the property type
    • checkUserPropertyDefn

      public void checkUserPropertyDefn(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.core.DesignElement element) throws UserPropertyException, org.eclipse.birt.report.model.metadata.MetaDataException
      Checks whether the element can take the given user property definition and the definition is valid.
      Parameters:
      module - the module
      element - the design element that holds the user-defined property
      Throws:
      UserPropertyException - if the element is not allowed to have user property or the user property definition is invalid.
      org.eclipse.birt.report.model.metadata.MetaDataException - if the user property definition is inconsistent.
    • getLocalProperty

      public Object getLocalProperty(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.metadata.PropertyDefn propDefn)
      Description copied from interface: IStructure
      Gets the locale value of a property.
      Specified by:
      getLocalProperty in interface IStructure
      Parameters:
      module - the module
      propDefn - definition of the property to get
      Returns:
      value of the item as an object, or null if the item is not set locally or is not found.
    • getProperty

      public Object getProperty(org.eclipse.birt.report.model.core.Module module, String memberName)
      Description copied from interface: IStructure
      Gets the locale value of a property.
      Specified by:
      getProperty in interface IStructure
      Parameters:
      module - the module
      memberName - the name of the property definition
      Returns:
      value of the item as an object, or null if the item is not set locally or is not found.
    • isReferencable

      public boolean isReferencable()
      Description copied from interface: IStructure
      Justifies whether the structure can be referred by other design elements.
      Specified by:
      isReferencable in interface IStructure
      Returns:
      true if the structure is referencable, otherwise false
    • setDefault

      public void setDefault(Object value)
      Description copied from class: org.eclipse.birt.report.model.metadata.PropertyDefn
      Sets the default value for the property.
      Overrides:
      setDefault in class org.eclipse.birt.report.model.metadata.PropertyDefn
      Parameters:
      value - The default value to set.
    • build

      public void build() throws org.eclipse.birt.report.model.metadata.MetaDataException
      Description copied from class: org.eclipse.birt.report.model.metadata.ElementPropertyDefn
      Builds the semantic information for this property. Called once while loading the meta-data. The build must succeed, or a programming error has occurred.
      Overrides:
      build in class org.eclipse.birt.report.model.metadata.ElementPropertyDefn
      Throws:
      org.eclipse.birt.report.model.metadata.MetaDataException - if the build is failed
    • isDesignTime

      public boolean isDesignTime()
      Description copied from interface: IStructure
      Justifies whether the structure is generated in design time or not.
      Specified by:
      isDesignTime in interface IStructure
      Returns:
      if the structure is generated in design time, otherwise return .
    • isVisible

      public boolean isVisible()
      Checks whether the property is visible to the property sheet.
      Specified by:
      isVisible in interface IElementPropertyDefn
      Overrides:
      isVisible in class org.eclipse.birt.report.model.metadata.ElementPropertyDefn
      Returns:
      true if property is visible.
    • setVisible

      public void setVisible(boolean isVisible)
      Sets whether the property is visible to the property sheet.
      Parameters:
      isVisible -