Class FObj

    • Field Detail

      • firstChild

        protected FONode firstChild
        pointer to the descendant subtree
      • lastChild

        protected FONode lastChild
        pointer to the end of the descendant subtree
    • Constructor Detail

      • FObj

        public FObj​(FONode parent)
        Create a new formatting object.
        Parameters:
        parent - the parent node
    • Method Detail

      • clone

        public FONode clone​(FONode parent,
                            boolean removeChildren)
                     throws FOPException
        Performs a shallow cloning operation, sets the clone's parent, and optionally cleans the list of child nodes
        Overrides:
        clone in class FONode
        Parameters:
        parent - the intended parent of the clone
        removeChildren - if true, clean the list of child nodes
        Returns:
        the cloned FO node
        Throws:
        FOPException - if there's a problem while cloning the node
      • getPropertyMakerFor

        public static PropertyMaker getPropertyMakerFor​(int propId)
        Returns the PropertyMaker for a given property ID.
        Parameters:
        propId - the property ID
        Returns:
        the requested Property Maker
      • processNode

        public void processNode​(java.lang.String elementName,
                                org.xml.sax.Locator locator,
                                org.xml.sax.Attributes attlist,
                                PropertyList pList)
                         throws FOPException
        Initialize the node with its name, location information, and attributes The attributes must be used immediately as the sax attributes will be altered for the next element.
        Overrides:
        processNode in class FONode
        Parameters:
        elementName - element name (e.g., "fo:block")
        locator - Locator object (ignored by default)
        attlist - Collection of attributes passed to us from the parser.
        pList - the property list of the parent node
        Throws:
        FOPException - for errors or inconsistencies in the attributes
      • createPropertyList

        protected PropertyList createPropertyList​(PropertyList parent,
                                                  FOEventHandler foEventHandler)
                                           throws FOPException
        Create a default property list for this element. Create a property list for this node. Return null if the node does not need a property list.
        Overrides:
        createPropertyList in class FONode
        Parameters:
        parent - the closest parent propertylist.
        foEventHandler - The FOEventHandler where the PropertyListMaker instance can be found.
        Returns:
        A new property list.
        Throws:
        FOPException - if there's a problem during processing
      • bind

        public void bind​(PropertyList pList)
                  throws FOPException
        Bind property values from the property list to the FO node. Must be overridden in all FObj subclasses that have properties applying to it.
        Overrides:
        bind in class FONode
        Parameters:
        pList - the PropertyList where the properties can be found.
        Throws:
        FOPException - if there is a problem binding the values
      • startOfNode

        public void startOfNode()
                         throws FOPException
        Called after processNode() is called. Subclasses can do additional processing.
        Overrides:
        startOfNode in class FONode
        Throws:
        FOPException - FOP Exception
      • addChildNode

        protected void addChildNode​(FONode child)
                             throws FOPException
        Adds a node as a child of this node. The default implementation of this method just ignores any child node being added.
        Overrides:
        addChildNode in class FONode
        Parameters:
        child - child node to be added to the childNodes of this node
        Throws:
        FOPException - if there's a problem during processing
      • addChildTo

        protected static void addChildTo​(FONode child,
                                         FONode parent)
                                  throws FOPException
        Used by RetrieveMarker during Marker-subtree cloning
        Parameters:
        child - the (cloned) child node
        parent - the (cloned) parent node
        Throws:
        FOPException - when the child could not be added to the parent
      • removeChild

        public void removeChild​(FONode child)
        Removes a child node. Used by the child nodes to remove themselves, for example table-body if it has no children.
        Overrides:
        removeChild in class FONode
        Parameters:
        child - child node to be removed
      • findNearestAncestorFObj

        public FObj findNearestAncestorFObj()
        Find the nearest parent, grandparent, etc. FONode that is also an FObj
        Returns:
        FObj the nearest ancestor FONode that is an FObj
      • generatesReferenceAreas

        public boolean generatesReferenceAreas()
        Check if this formatting object generates reference areas.
        Returns:
        true if generates reference areas TODO see if needed
      • getChildNodes

        public FONode.FONodeIterator getChildNodes()
        Return an iterator over all the child nodes of this node.
        Overrides:
        getChildNodes in class FONode
        Returns:
        the iterator over the FO's childnodes
      • hasChildren

        public boolean hasChildren()
        Indicates whether this formatting object has children.
        Returns:
        true if there are children
      • getChildNodes

        public FONode.FONodeIterator getChildNodes​(FONode childNode)
        Return an iterator over the object's childNodes starting at the passed-in node (= first call to iterator.next() will return childNode)
        Overrides:
        getChildNodes in class FONode
        Parameters:
        childNode - First node in the iterator
        Returns:
        A FONodeIterator or null if childNode isn't a child of this FObj.
      • addMarker

        protected void addMarker​(Marker marker)
        Add the marker to this formatting object. If this object can contain markers it checks that the marker has a unique class-name for this object and that it is the first child.
        Parameters:
        marker - Marker to add.
      • hasMarkers

        public boolean hasMarkers()
        Returns:
        true if there are any Markers attached to this object
      • getMarkers

        public java.util.Map<java.lang.String,​Marker> getMarkers()
        Returns:
        the collection of Markers attached to this object
      • getContextInfoAlt

        protected java.lang.String getContextInfoAlt()
        Returns a String containing as some context information about a node. It does not take the locator into consideration and returns null if no useful context information can be found. Call this method only in exceptional conditions because this method may perform quite extensive information gathering inside the FO tree. All text returned by this method that is not extracted from document content needs to be locale-independent.
        Overrides:
        getContextInfoAlt in class FONode
        Returns:
        a String containing context information
      • gatherContextInfo

        protected java.lang.String gatherContextInfo()
        Gathers context information for the getContextInfo() method.
        Overrides:
        gatherContextInfo in class FONode
        Returns:
        the collected context information or null, if none is available
      • isBlockItem

        protected boolean isBlockItem​(java.lang.String nsURI,
                                      java.lang.String lName)
        Convenience method for validity checking. Checks if the incoming node is a member of the "%block;" parameter entity as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations
        Parameters:
        nsURI - namespace URI of incoming node
        lName - local name (i.e., no prefix) of incoming node
        Returns:
        true if a member, false if not
      • isInlineItem

        protected boolean isInlineItem​(java.lang.String nsURI,
                                       java.lang.String lName)
        Convenience method for validity checking. Checks if the incoming node is a member of the "%inline;" parameter entity as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations
        Parameters:
        nsURI - namespace URI of incoming node
        lName - local name (i.e., no prefix) of incoming node
        Returns:
        true if a member, false if not
      • isBlockOrInlineItem

        protected boolean isBlockOrInlineItem​(java.lang.String nsURI,
                                              java.lang.String lName)
        Convenience method for validity checking. Checks if the incoming node is a member of the "%block;" parameter entity or "%inline;" parameter entity
        Parameters:
        nsURI - namespace URI of incoming node
        lName - local name (i.e., no prefix) of incoming node
        Returns:
        true if a member, false if not
      • isNeutralItem

        protected boolean isNeutralItem​(java.lang.String nsURI,
                                        java.lang.String lName)
        Convenience method for validity checking. Checks if the incoming node is a member of the neutral item list as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations
        Parameters:
        nsURI - namespace URI of incoming node
        lName - local name (i.e., no prefix) of incoming node
        Returns:
        true if a member, false if not
      • findAncestor

        protected int findAncestor​(int ancestorID)
        Convenience method for validity checking. Checks if the current node has an ancestor of a given name.
        Parameters:
        ancestorID - ID of node name to check for (e.g., FO_ROOT)
        Returns:
        number of levels above FO where ancestor exists, -1 if not found
      • clearChildNodes

        public void clearChildNodes()
        Clears the list of child nodes.
      • getId

        public java.lang.String getId()
        Returns:
        the "id" property.
      • hasId

        public boolean hasId()
        Returns:
        whether this object has an id set
      • getLayer

        public java.lang.String getLayer()
        Returns:
        the "layer" property.
      • hasLayer

        public boolean hasLayer()
        Returns:
        whether this object has an layer set
      • getNamespaceURI

        public java.lang.String getNamespaceURI()
        Returns the namespace URI for this node
        Overrides:
        getNamespaceURI in class FONode
        Returns:
        the namespace URI for this node
      • getNormalNamespacePrefix

        public java.lang.String getNormalNamespacePrefix()
        Returns the normally used namespace prefix for this node
        Specified by:
        getNormalNamespacePrefix in class FONode
        Returns:
        the normally used namespace prefix for this kind of node (ex. "fo" for XSL-FO)
      • isBidiRangeBlockItem

        public boolean isBidiRangeBlockItem()
        Determine if this node is a new bidi RANGE block item.
        Overrides:
        isBidiRangeBlockItem in class FONode
        Returns:
        true if this node is a new bidi RANGE block item
      • setBidiLevel

        public void setBidiLevel​(int bidiLevel)
        Recursively set resolved bidirectional level of FO (and its ancestors) if and only if it is non-negative and if either the current value is reset (-1) or the new value is less than the current value.
        Parameters:
        bidiLevel - a non-negative bidi embedding level
      • getBidiLevel

        public int getBidiLevel()
        Obtain resolved bidirectional level of FO.
        Returns:
        either a non-negative bidi embedding level or -1 in case no bidi levels have been assigned
      • getBidiLevelRecursive

        public int getBidiLevelRecursive()
        Obtain resolved bidirectional level of FO or nearest FO ancestor that has a resolved level.
        Returns:
        either a non-negative bidi embedding level or -1 in case no bidi levels have been assigned to this FO or any ancestor
      • isBidiBoundary

        protected boolean isBidiBoundary​(boolean propagate)
      • getExtensionAttachments

        public java.util.List<ExtensionAttachment> getExtensionAttachments()
        Returns:
        the extension attachments of this FObj.
      • hasExtensionAttachments

        public boolean hasExtensionAttachments()
        Returns:
        true if this FObj has extension attachments
      • addForeignAttribute

        public void addForeignAttribute​(org.apache.xmlgraphics.util.QName attributeName,
                                        java.lang.String value)
        Adds a foreign attribute to this FObj.
        Parameters:
        attributeName - the attribute name as a QName instance
        value - the attribute value
      • getForeignAttributes

        public java.util.Map getForeignAttributes()
        Returns:
        the map of foreign attributes
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object