Class UserPropertyDefn

  • All Implemented Interfaces:
    java.lang.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 java.lang.String CHOICES_MEMBER
      Name of the choices member.
      static java.lang.String DEFAULT_MEMBER
      Name of the default member.
      static java.lang.String DISPLAY_NAME_ID_MEMBER
      Name of the display name ID member.
      static java.lang.String DISPLAY_NAME_MEMBER
      Name of the display name member.
      static java.lang.String ISVISIBLE_MEMBER
      Name of the isVisible member.
      static java.lang.String NAME_MEMBER
      Name of the name member.
      static java.lang.String STRUCTURE_NAME
      Name of the structure itself.
      static java.lang.String TYPE_MEMBER
      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
    • Constructor Summary

      Constructors 
      Constructor Description
      UserPropertyDefn()
      Default constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void build()
      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.
      IStructure copy()
      Makes a copy of this user property definition.
      static java.util.List<IPropertyType> getAllowedTypes()
      Gets valid types for user property.
      IStructureDefn getDefn()
      Gets the definition of the structure which represents the user property definition.
      java.lang.String getDisplayName()
      Gets the display name of this user property definition.
      java.lang.Object getLocalProperty​(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.metadata.PropertyDefn propDefn)
      Gets the locale value of a property.
      IMethodInfo getMethodInfo()
      User-defined methods are not supported.
      IObjectDefn getObjectDefn()
      Gets the object definition of the user property definition.
      java.lang.Object getProperty​(org.eclipse.birt.report.model.core.Module module, java.lang.String memberName)
      Gets the locale value of a property.
      java.lang.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.
      IStructureDefn getStructDefn()
      Returns the structure definition for this value.
      java.lang.String getStructName()
      Gets the name predefined for this structure.
      int getValueType()
      Gets the property type.
      boolean isDesignTime()
      Justifies whether the structure is generated in design time or not.
      boolean isReferencable()
      Justifies whether the structure can be referred by other design elements.
      boolean isVisible()
      Checks whether the property is visible to the property sheet.
      void setChoices​(UserChoice[] choiceArray)
      Sets the (anonymous) set of choices for a property.
      void setDefault​(java.lang.Object value)
      Sets the default value for the property.
      void setDisplayName​(java.lang.String theName)
      Sets the display name of the property.
      void setProperty​(org.eclipse.birt.report.model.metadata.PropertyDefn prop, java.lang.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 java.lang.String validateExtendedChoicesByDisplayName​(org.eclipse.birt.report.model.core.Module module, java.lang.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 Detail

      • TYPE_MEMBER

        public static final java.lang.String TYPE_MEMBER
        Name of the type member.
        See Also:
        Constant Field Values
      • NAME_MEMBER

        public static final java.lang.String NAME_MEMBER
        Name of the name member.
        See Also:
        Constant Field Values
      • ISVISIBLE_MEMBER

        public static final java.lang.String ISVISIBLE_MEMBER
        Name of the isVisible member.
        See Also:
        Constant Field Values
      • DEFAULT_MEMBER

        public static final java.lang.String DEFAULT_MEMBER
        Name of the default member.
        See Also:
        Constant Field Values
      • DISPLAY_NAME_MEMBER

        public static final java.lang.String DISPLAY_NAME_MEMBER
        Name of the display name member.
        See Also:
        Constant Field Values
      • DISPLAY_NAME_ID_MEMBER

        public static final java.lang.String DISPLAY_NAME_ID_MEMBER
        Name of the display name ID member.
        See Also:
        Constant Field Values
      • STRUCTURE_NAME

        public static final java.lang.String STRUCTURE_NAME
        Name of the structure itself. This is the name used to identify the structure in the meta-data dictionary.
        See Also:
        Constant Field Values
      • CHOICES_MEMBER

        public static final java.lang.String CHOICES_MEMBER
        Name of the choices member.
        See Also:
        Constant Field Values
    • Constructor Detail

      • UserPropertyDefn

        public UserPropertyDefn()
        Default constructor.
    • Method Detail

      • getAllowedTypes

        public static java.util.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 java.lang.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,
                                java.lang.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 java.lang.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 java.lang.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​(java.lang.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 java.lang.String validateExtendedChoicesByDisplayName​(org.eclipse.birt.report.model.core.Module module,
                                                                        java.lang.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 java.lang.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 java.lang.Object getProperty​(org.eclipse.birt.report.model.core.Module module,
                                            java.lang.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​(java.lang.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 -