Class DefaultContentRect

    • Constructor Detail

      • DefaultContentRect

        public DefaultContentRect()
      • DefaultContentRect

        public DefaultContentRect​(ContentRect src)
    • Method Detail

      • getId

        public int getId()
        Description copied from interface: ContentRect
        Obtains a unique ID of the area within the page.
        Specified by:
        getId in interface ContentRect
        Returns:
        the area ID
      • setId

        public void setId​(int id)
      • getPageIri

        public org.eclipse.rdf4j.model.IRI getPageIri()
        Description copied from interface: ContentRect
        Obtains the IRI of the page this block belongs to.
        Specified by:
        getPageIri in interface ContentRect
        Returns:
        the page IRI
      • setPageIri

        public void setPageIri​(org.eclipse.rdf4j.model.IRI pageIri)
      • getBackgroundColor

        public Color getBackgroundColor()
        Description copied from interface: ContentRect
        Obtains the background color of the area.
        Specified by:
        getBackgroundColor in interface ContentRect
        Returns:
        A color or null for transparent background
      • setBackgroundColor

        public void setBackgroundColor​(Color backgroundColor)
      • getBackgroundImagePng

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

        public boolean hasBackground()
        Description copied from interface: ContentRect
        Checks whether the box has a background color or image.
        Specified by:
        hasBackground in interface ContentRect
        Returns:
        true when the box has a defined background color or image
      • setBackgroundImagePng

        public void setBackgroundImagePng​(byte[] backgroundImagePng)
      • isBackgroundSeparated

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

        public void setBackgroundSeparated​(boolean backgroundSeparated)
        Description copied from interface: ContentRect
        Sets whether the box is separated by background. This is typically determined and set during the box tree construction.
        Specified by:
        setBackgroundSeparated in interface ContentRect
      • getTextStyle

        public TextStyle getTextStyle()
        Description copied from interface: ContentRect
        Gets the text style statistics of the content.
        Specified by:
        getTextStyle in interface ContentRect
        Returns:
        the text style statistics
      • recomputeTextStyle

        protected void recomputeTextStyle()
        Recomputes the text style after the style of some children has changed.
      • setTextStyle

        public void setTextStyle​(TextStyle textStyle)
      • getLine

        public ContentLine getLine()
        Description copied from interface: ContentRect
        Returns the content line the area belongs to.
        Specified by:
        getLine in interface ContentRect
        Returns:
        The content line or null when the area does not belong to any line
      • setLine

        public void setLine​(ContentLine line)
        Description copied from interface: ContentRect
        Assigns the content line to the area.
        Specified by:
        setLine in interface ContentRect
        Parameters:
        line - the content line to be assigned.
      • getTopBorder

        public int getTopBorder()
        Description copied from interface: ContentRect
        Obtains the top border width.
        Specified by:
        getTopBorder in interface ContentRect
        Returns:
        the width of the border or 0 when there is no border
      • getBottomBorder

        public int getBottomBorder()
        Description copied from interface: ContentRect
        Obtains the bottom border width.
        Specified by:
        getBottomBorder in interface ContentRect
        Returns:
        the width of the border or 0 when there is no border
      • getLeftBorder

        public int getLeftBorder()
        Description copied from interface: ContentRect
        Obtains the left border width.
        Specified by:
        getLeftBorder in interface ContentRect
        Returns:
        the width of the border or 0 when there is no border
      • getRightBorder

        public int getRightBorder()
        Description copied from interface: ContentRect
        Obtains the right border width.
        Specified by:
        getRightBorder in interface ContentRect
        Returns:
        the width of the border or 0 when there is no border
      • hasTopBorder

        public boolean hasTopBorder()
        Description copied from interface: ContentRect
        Checks whether the box has the top border defined.
        Specified by:
        hasTopBorder in interface ContentRect
        Returns:
        true if the box has a top border
      • hasBottomBorder

        public boolean hasBottomBorder()
        Description copied from interface: ContentRect
        Checks whether the box has the bottom border defined.
        Specified by:
        hasBottomBorder in interface ContentRect
        Returns:
        true if the box has a bottom border
      • hasLeftBorder

        public boolean hasLeftBorder()
        Description copied from interface: ContentRect
        Checks whether the box has the left border defined.
        Specified by:
        hasLeftBorder in interface ContentRect
        Returns:
        true if the box has a left border
      • hasRightBorder

        public boolean hasRightBorder()
        Description copied from interface: ContentRect
        Checks whether the box has right top border defined.
        Specified by:
        hasRightBorder in interface ContentRect
        Returns:
        true if the box has a right border
      • getBorderStyle

        public Border getBorderStyle​(Border.Side side)
        Description copied from interface: ContentRect
        Obtains the properties of the box border at the given side.
        Specified by:
        getBorderStyle in interface ContentRect
        Parameters:
        side - the border side.
        Returns:
        the corresponding border properties.
      • getBounds

        public Rectangular getBounds()
        Description copied from interface: ContentRect
        Obtains the pixel position within in the page.
        Specified by:
        getBounds in interface ContentRect
        Returns:
        The rectangular pixel position.
      • setBounds

        public void setBounds​(Rectangular bounds)
        Description copied from interface: ContentRect
        Sets the pixel position within the page.
        Specified by:
        setBounds in interface ContentRect
        Parameters:
        bounds - the new position
      • getBorderCount

        public int getBorderCount()
        Description copied from interface: ContentRect
        Obtains the number of defined borders for the box.
        Specified by:
        getBorderCount in interface ContentRect
        Returns:
        the number of defined borders (0..4)
      • getX1

        public int getX1()
        Specified by:
        getX1 in interface Rect
      • getY1

        public int getY1()
        Specified by:
        getY1 in interface Rect
      • getX2

        public int getX2()
        Specified by:
        getX2 in interface Rect
      • getY2

        public int getY2()
        Specified by:
        getY2 in interface Rect
      • getWidth

        public int getWidth()
        Specified by:
        getWidth in interface Rect
      • getHeight

        public int getHeight()
        Specified by:
        getHeight in interface Rect
      • move

        public void move​(int xofs,
                         int yofs)
        Specified by:
        move in interface Rect
      • getUserAttribute

        public <P> P getUserAttribute​(String name,
                                      Class<P> clazz)
        Description copied from interface: ContentRect
        Obtains the user-defined attribute value assigned to the node.
        Specified by:
        getUserAttribute in interface ContentRect
        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.
      • addUserAttribute

        public void addUserAttribute​(String name,
                                     Object value)
        Description copied from interface: ContentRect
        Sets a user-defined attribute for the tree node. This allows to assign multiple attributes identified by their names.
        Specified by:
        addUserAttribute in interface ContentRect
        Parameters:
        name - the attribute name
        value - the attribute value
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object