Class BoxNode

    • Field Detail

      • box

        protected org.fit.cssbox.layout.Box box
        The CSSBox box that forms this node
      • transform

        protected BoxTransform transform
        The transformation that should be applied to the box
    • Constructor Detail

      • BoxNode

        public BoxNode​(org.fit.cssbox.layout.Box box,
                       org.eclipse.rdf4j.model.IRI pageIri,
                       float zoom)
        Creates a new node containing a box with a transparent background.
        Parameters:
        box - the contained box
        pageIri - containing page IRI
        zoom - zoom factor to apply
      • BoxNode

        public BoxNode​(org.fit.cssbox.layout.Box box,
                       org.eclipse.rdf4j.model.IRI pageIri,
                       Color bgColor,
                       float zoom)
        Creates a new node containing a box with a computed background. The background is computed separately when creating the nodes because the Viewport (and some table elements) are treated in a special way.
        Parameters:
        box - the contained box
        pageIri - containing page IRI
        bgColor - computed backgound color to be used for the box
        zoom - zoom factor to apply
    • Method Detail

      • getIntrinsicBounds

        public Rectangular getIntrinsicBounds()
        Gets the original bounds of a box as provided by CSSBox.
        Returns:
        the intrinsic bounds
      • getIntrinsicTopBorder

        public int getIntrinsicTopBorder()
      • getIntrinsicBottomBorder

        public int getIntrinsicBottomBorder()
      • getIntrinsicLeftBorder

        public int getIntrinsicLeftBorder()
      • getIntrinsicRightBorder

        public int getIntrinsicRightBorder()
      • getIntrinsicBorderStyle

        public Border getIntrinsicBorderStyle​(Border.Side side)
      • getBox

        public org.fit.cssbox.layout.Box getBox()
        Returns:
        the contained box
      • getIntrinsicFontSize

        public float getIntrinsicFontSize()
      • getIntrinsicFontStyle

        public float getIntrinsicFontStyle()
      • getIntrinsicFontWeight

        public float getIntrinsicFontWeight()
      • getIntrinsicUnderline

        public float getIntrinsicUnderline()
      • getIntrinsicLineThrough

        public float getIntrinsicLineThrough()
      • getIntrinsicColor

        public Color getIntrinsicColor()
      • getIntrinsicFontFamily

        public String getIntrinsicFontFamily()
      • getIntrinsicContentObject

        public ContentObject getIntrinsicContentObject()
      • getIntrinsicType

        public Box.Type getIntrinsicType()
      • getDOMNode

        public Node getDOMNode()
      • getSourceNodeId

        public String getSourceNodeId()
        Description copied from interface: Box
        Obtains a unique identification of the box source (e.g. the source DOM node). This may be used for recognizing the boxes generated by the same DOM node.
        Specified by:
        getSourceNodeId in interface Box
        Overrides:
        getSourceNodeId in class DefaultBox
      • getTagName

        public String getTagName()
        Description copied from interface: Box
        When the box is generated by a DOM element, obtains the corresponding tag name.
        Specified by:
        getTagName in interface Box
        Overrides:
        getTagName in class DefaultBox
        Returns:
        the tag name or null for boxes that do not correspond to a DOM element.
      • getAttribute

        public String getAttribute​(String name)
        Description copied from interface: Box
        Obtains a value of an additional attribute. The existing attribute names depend on the box implementation; they may correspond to HTML (DOM) attributes or they may be purely virtual. The typical attributes to be implemented are class or href.
        Specified by:
        getAttribute in interface Box
        Overrides:
        getAttribute in class DefaultBox
        Parameters:
        name - the attribute name
        Returns:
        the attribute value or null if the value is not specified.
      • getAttributes

        public Map<String,​String> getAttributes()
        Description copied from interface: Box
        Obtains the names and values of all the box attributes. The existing attribute names depend on the box implementation; they may correspond to HTML (DOM) attributes or they may be purely virtual. The typical attributes to be implemented are class or href.
        Specified by:
        getAttributes in interface Box
        Overrides:
        getAttributes in class DefaultBox
        Returns:
        A map assigning values to the individual attribute names. An empty map is returned when no attributes are defined.
      • getElementAttribute

        protected String getElementAttribute​(Node node,
                                             String attrName)
      • getAncestorAttribute

        protected String getAncestorAttribute​(Node node,
                                              String elementName,
                                              String attrName)
      • getDisplayType

        public Box.DisplayType getDisplayType()
        Description copied from interface: Box
        Obtains the display type of the element according to the CSS display: property.
        Specified by:
        getDisplayType in interface Box
        Overrides:
        getDisplayType in class DefaultBox
        Returns:
        The display type of NULL if the box does not correspond to an element
      • getSubstringBounds

        public Rectangular getSubstringBounds​(int startPos,
                                              int endPos)
        Description copied from interface: Box
        Returns the bounds of a substring of the own text of the box starting at startPos and ending at endPos.
        Specified by:
        getSubstringBounds in interface Box
        Overrides:
        getSubstringBounds in class DefaultBox
        Parameters:
        startPos - the starting position in the own text of the box (as obtained by )
        endPos - the ending position in the own text of the box
        Returns:
        the visual bounds in pixels or null when there is no own text contained in the box