Class PropertyList

    • Field Detail

      • inheritableProperty

        private static boolean[] inheritableProperty
      • parentPropertyList

        protected PropertyList parentPropertyList
        reference to the parent FO's propertyList
      • fobj

        private FObj fobj
      • log

        private static org.apache.commons.logging.Log log
    • Constructor Detail

      • PropertyList

        public PropertyList​(FObj fObjToAttach,
                            PropertyList parentPropertyList)
        Basic constructor.
        Parameters:
        fObjToAttach - the FO this PropertyList should be attached to
        parentPropertyList - the PropertyList belonging to the new objects parent
    • Method Detail

      • getFObj

        public FObj getFObj()
        Returns:
        the FObj object to which this propertyList is attached
      • getParentFObj

        public FObj getParentFObj()
        Returns:
        the FObj object attached to the parentPropertyList
      • validatePropertyValue

        public void validatePropertyValue​(java.lang.String propertyValue,
                                          Property output,
                                          Property property)
        Adds an unknown property value to the property list so that if necessary, a warning can be displayed.
        Parameters:
        propertyValue - The unknown property value
        output - The output of the property to validate
        property - The original property containing the full value
      • getUnknownPropertyValues

        public java.util.Map<java.lang.String,​Property> getUnknownPropertyValues()
        Gets the current list of unknown property values
        Returns:
        The set containing the list of unknown property values
      • getParentPropertyList

        public PropertyList getParentPropertyList()
        Returns:
        the FObj object attached to the parentPropetyList
      • getExplicitOrShorthand

        public Property getExplicitOrShorthand​(int propId)
                                        throws PropertyException
        Return the value explicitly specified on this FO.
        Parameters:
        propId - The id of the property whose value is desired.
        Returns:
        The value if the property is explicitly set or set by a shorthand property, otherwise null.
        Throws:
        PropertyException - ...
      • getExplicit

        public abstract Property getExplicit​(int propId)
        Return the value explicitly specified on this FO.
        Parameters:
        propId - The ID of the property whose value is desired.
        Returns:
        The value if the property is explicitly set, otherwise null.
      • putExplicit

        public abstract void putExplicit​(int propId,
                                         Property value)
        Set an value defined explicitly on this FO.
        Parameters:
        propId - The ID of the property to set.
        value - The value of the property.
      • getInherited

        public Property getInherited​(int propId)
                              throws PropertyException
        Return the value of this property inherited by this FO. Implements the inherited-property-value function. The property must be inheritable!
        Parameters:
        propId - The ID of the property whose value is desired.
        Returns:
        The inherited value, otherwise null.
        Throws:
        PropertyException - ...
      • get

        public Property get​(int propId)
                     throws PropertyException
        Return the property on the current FlowObject. If it isn't set explicitly, this will try to compute it based on other properties, or if it is inheritable, to return the inherited value. If all else fails, it returns the default value.
        Parameters:
        propId - The Constants ID of the property whose value is desired.
        Returns:
        the Property corresponding to that name
        Throws:
        PropertyException - if there is a problem evaluating the property
      • get

        public Property get​(int propId,
                            boolean bTryInherit,
                            boolean bTryDefault)
                     throws PropertyException
        Return the property on the current FlowObject. Depending on the passed flags, this will try to compute it based on other properties, or if it is inheritable, to return the inherited value. If all else fails, it returns the default value.
        Parameters:
        propId - the property's id
        bTryInherit - true for inherited properties, or when the inherited value is needed
        bTryDefault - true when the default value may be used as a last resort
        Returns:
        the property
        Throws:
        PropertyException - if there is a problem evaluating the property
      • getNearestSpecified

        public Property getNearestSpecified​(int propId)
                                     throws PropertyException
        Return the "nearest" specified value for the given property. Implements the from-nearest-specified-value function.
        Parameters:
        propId - The ID of the property whose value is desired.
        Returns:
        The computed value if the property is explicitly set on some ancestor of the current FO, else the initial value.
        Throws:
        PropertyException - if there an error occurred when getting the property
      • getFromParent

        public Property getFromParent​(int propId)
                               throws PropertyException
        Return the value of this property on the parent of this FO. Implements the from-parent function.
        Parameters:
        propId - The Constants ID of the property whose value is desired.
        Returns:
        The computed value on the parent or the initial value if this FO is the root or is in a different namespace from its parent.
        Throws:
        PropertyException - ...
      • selectFromWritingMode

        public int selectFromWritingMode​(int lrtb,
                                         int rltb,
                                         int tbrl,
                                         int tblr)
        Select a writing mode dependent property ID based on value of writing mode property.
        Parameters:
        lrtb - the property ID to return under lrtb writingmode.
        rltb - the property ID to return under rltb writingmode.
        tbrl - the property ID to return under tbrl writingmode.
        tblr - the property ID to return under tblr writingmode.
        Returns:
        one of the property IDs, depending on the writing mode.
      • addAttributeToList

        private java.lang.String addAttributeToList​(org.xml.sax.Attributes attributes,
                                                    java.lang.String attributeName)
                                             throws ValidationException
        Throws:
        ValidationException
      • addAttributesToList

        public void addAttributesToList​(org.xml.sax.Attributes attributes)
                                 throws ValidationException

        Adds the attributes, passed in by the parser to the PropertyList.

        Note that certain attributes are given priority in terms of order of processing due to conversion dependencies, where the order is as follows:

        1. writing-mode
        2. column-number
        3. number-columns-spanned
        4. font
        5. font-size
        6. all others in order of appearance
        Parameters:
        attributes - Collection of attributes passed to us from the parser.
        Throws:
        ValidationException - if there is an attribute that does not map to a property id (strict validation only)
      • isValidPropertyName

        protected boolean isValidPropertyName​(java.lang.String propertyName)
        Validates a property name.
        Parameters:
        propertyName - the property name to check
        Returns:
        true if the base property name and the subproperty name (if any) can be correctly mapped to an id
      • getPropertyForAttribute

        public Property getPropertyForAttribute​(org.xml.sax.Attributes attributes,
                                                java.lang.String attributeName,
                                                java.lang.String attributeValue)
                                         throws FOPException
        Throws:
        FOPException
      • convertAttributeToProperty

        private void convertAttributeToProperty​(org.xml.sax.Attributes attributes,
                                                java.lang.String attributeName,
                                                java.lang.String attributeValue)
                                         throws ValidationException
        Parameters:
        attributes - Collection of attributes
        attributeName - Attribute name to convert
        attributeValue - Attribute value to assign to property
        Throws:
        ValidationException - in case the property name is invalid for the FO namespace
      • handleInvalidProperty

        protected void handleInvalidProperty​(org.apache.xmlgraphics.util.QName attr)
                                      throws ValidationException
        Handles an invalid property.
        Parameters:
        attr - the invalid attribute
        Throws:
        ValidationException - if an exception needs to be thrown depending on the validation settings
      • findBasePropertyName

        protected static java.lang.String findBasePropertyName​(java.lang.String attributeName)
        Finds the first or base part (up to any period) of an attribute name. For example, if input is "space-before.minimum", should return "space-before".
        Parameters:
        attributeName - String to be atomized
        Returns:
        the base portion of the attribute
      • findSubPropertyName

        protected static java.lang.String findSubPropertyName​(java.lang.String attributeName)
        Finds the second or sub part (portion past any period) of an attribute name. For example, if input is "space-before.minimum", should return "minimum".
        Parameters:
        attributeName - String to be atomized
        Returns:
        the sub portion of the attribute
      • getShorthand

        private Property getShorthand​(int propId)
                               throws PropertyException
        Parameters:
        propId - ID of property
        Returns:
        new Property object
        Throws:
        PropertyException - if there's a problem while processing the property
      • makeProperty

        private Property makeProperty​(int propId)
                               throws PropertyException
        Parameters:
        propId - ID of property
        Returns:
        new Property object
        Throws:
        PropertyException - if there's a problem while processing the property
      • isInherited

        private boolean isInherited​(int propId)
        Parameters:
        propId - ID of property
        Returns:
        isInherited value from the requested Property.Maker
      • findMaker

        private static PropertyMaker findMaker​(int propId)
        Parameters:
        propId - Id of property
        Returns:
        the Property.Maker for this property