Class FactoryPropertyHandle


  • public class FactoryPropertyHandle
    extends ElementDetailHandle
    A specialized handle for use when creating the Factory data structures. This handle caches the element definition and property value. It uses specialized property resolution rules:

    • A property value is either a style property or a non-style property.
    • A non-style property is set if this element, or any of its ancestor elements, provide a value. It is also considered set if the system provides a default value.
    • A property value is considered set only if it is set in the private style of this element or an ancestor element; it is not considered set if it is inherited from a shared style.

    The various "get" methods also have special meanings: they convert property values to the format needed by the Factory.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.eclipse.birt.report.model.metadata.ElementPropertyDefn propDefn
      Handle to the design element.
      protected java.lang.Object value
      The cached property value.
    • Constructor Summary

      Constructors 
      Constructor Description
      FactoryPropertyHandle​(DesignElementHandle element, org.eclipse.birt.report.model.metadata.ElementPropertyDefn prop)
      Constructs a factory property handle with the given DesignElementHandle and the definition of the property.
    • Field Detail

      • propDefn

        protected org.eclipse.birt.report.model.metadata.ElementPropertyDefn propDefn
        Handle to the design element.
      • value

        protected java.lang.Object value
        The cached property value.
    • Constructor Detail

      • FactoryPropertyHandle

        public FactoryPropertyHandle​(DesignElementHandle element,
                                     org.eclipse.birt.report.model.metadata.ElementPropertyDefn prop)
        Constructs a factory property handle with the given DesignElementHandle and the definition of the property.
        Parameters:
        element - handle to the design element. It provides the Factory context.
        prop - the definition of the property
    • Method Detail

      • getValue

        public java.lang.Object getValue()
        Returns the cached factory property value.
        Returns:
        the cached factory property value.
        See Also:
        DesignElement.getFactoryProperty(Module, ElementPropertyDefn)
      • isStyleProperty

        public boolean isStyleProperty()
        Tests whether this is a style property.
        Returns:
        true if this is a style property, otherwise false.
      • isSet

        public boolean isSet()
        Tests whether this property value is set for this element. It is set if it is defined on this element or any of its parents, or in the element's private style. It is considered unset if it is set on a shared style.
        Returns:
        true if the value is set, false if it is not set
      • getIntValue

        public int getIntValue()
        Returns the property value as an integer.
        Returns:
        The value as an integer. Returns 0 if the value cannot be converted to an integer.
      • getStringValue

        public java.lang.String getStringValue()
        Returns the value as a non-localized string.
        Returns:
        The value as a non-localized string.
      • getFloatValue

        public double getFloatValue()
        Returns the value as a double.
        Returns:
        The value as a double. Returns 0 if the value cannot be converted to a double.
      • getNumberValue

        public java.math.BigDecimal getNumberValue()
        Returns the value as a number (BigDecimal).
        Returns:
        The value as a number. Returns null if the value cannot be converted to a number.
      • getBooleanValue

        public boolean getBooleanValue()
        Returns the value as a Boolean.

        Note: This method returns false if the value is unset. It DOES NOT return the default value for the property. Call isSet before calling this method to determine if the property is set.

        Returns:
        the value as a boolean. Returns false if the value cannot be converted to a boolean, or if the value is not set.
      • getColorValue

        public java.lang.String getColorValue()
        Gets the CSS color value. This is either a CSS (pre-defined) color name or an RGB value encoded in CSS format: rgb(r,g,b). Returns null if the property is not set.
        Returns:
        the color value as a string