Interface ContentRect

    • Field Detail

      • ATTR_SAME_AS

        static final String ATTR_SAME_AS
        A node attribute that links to an equivalent node (e.g. produced by copying a node to another tree).
        See Also:
        Constant Field Values
    • Method Detail

      • getId

        int getId()
        Obtains a unique ID of the area within the page.
        Returns:
        the area ID
      • getPageIri

        org.eclipse.rdf4j.model.IRI getPageIri()
        Obtains the IRI of the page this block belongs to.
        Returns:
        the page IRI
      • getBounds

        Rectangular getBounds()
        Obtains the pixel position within in the page.
        Returns:
        The rectangular pixel position.
      • setBounds

        void setBounds​(Rectangular bounds)
        Sets the pixel position within the page.
        Parameters:
        bounds - the new position
      • getBackgroundColor

        Color getBackgroundColor()
        Obtains the background color of the area.
        Returns:
        A color or null for transparent background
      • getBackgroundImagePng

        byte[] getBackgroundImagePng()
        Gets the PNG image data of the background image if present. The image should have the same size as the content bounds.
        Returns:
        the image data or null if no image is present in the background
      • hasBackground

        boolean hasBackground()
        Checks whether the box has a background color or image.
        Returns:
        true when the box has a defined background color or image
      • getTextStyle

        TextStyle getTextStyle()
        Gets the text style statistics of the content.
        Returns:
        the text style statistics
      • getLine

        ContentLine getLine()
        Returns the content line the area belongs to.
        Returns:
        The content line or null when the area does not belong to any line
      • setLine

        void setLine​(ContentLine line)
        Assigns the content line to the area.
        Parameters:
        line - the content line to be assigned.
      • getBorderCount

        int getBorderCount()
        Obtains the number of defined borders for the box.
        Returns:
        the number of defined borders (0..4)
      • hasTopBorder

        boolean hasTopBorder()
        Checks whether the box has the top border defined.
        Returns:
        true if the box has a top border
      • getTopBorder

        int getTopBorder()
        Obtains the top border width.
        Returns:
        the width of the border or 0 when there is no border
      • hasBottomBorder

        boolean hasBottomBorder()
        Checks whether the box has the bottom border defined.
        Returns:
        true if the box has a bottom border
      • getBottomBorder

        int getBottomBorder()
        Obtains the bottom border width.
        Returns:
        the width of the border or 0 when there is no border
      • hasLeftBorder

        boolean hasLeftBorder()
        Checks whether the box has the left border defined.
        Returns:
        true if the box has a left border
      • getLeftBorder

        int getLeftBorder()
        Obtains the left border width.
        Returns:
        the width of the border or 0 when there is no border
      • hasRightBorder

        boolean hasRightBorder()
        Checks whether the box has right top border defined.
        Returns:
        true if the box has a right border
      • getRightBorder

        int getRightBorder()
        Obtains the right border width.
        Returns:
        the width of the border or 0 when there is no border
      • getBorderStyle

        Border getBorderStyle​(Border.Side side)
        Obtains the properties of the box border at the given side.
        Parameters:
        side - the border side.
        Returns:
        the corresponding border properties.
      • isBackgroundSeparated

        boolean isBackgroundSeparated()
        Checks whether the box is separated by background, i.e. its background color is not transparent and it is different from the ancestor background.
        Returns:
        true for background-separated boxes
      • setBackgroundSeparated

        void setBackgroundSeparated​(boolean backgroundSeparated)
        Sets whether the box is separated by background. This is typically determined and set during the box tree construction.
        Parameters:
        backgroundSeparated -
      • addUserAttribute

        void addUserAttribute​(String name,
                              Object value)
        Sets a user-defined attribute for the tree node. This allows to assign multiple attributes identified by their names.
        Parameters:
        name - the attribute name
        value - the attribute value
      • getUserAttribute

        <P> P getUserAttribute​(String name,
                               Class<P> clazz)
        Obtains the user-defined attribute value assigned to the node.
        Parameters:
        name - the attribute name
        clazz - the class of the required attribute
        Returns:
        an object of the given class representing the value of the attribute (application-specific) or null when no such attribute is present.