Class DefaultBox

    • Constructor Detail

      • DefaultBox

        public DefaultBox()
      • DefaultBox

        public DefaultBox​(Box src)
    • Method Detail

      • getOrder

        public int getOrder()
        Description copied from interface: Box
        Gets the order of precedence of the box in the page. A box that precedes another box in the page must have a lower order number.
        Specified by:
        getOrder in interface Box
        Returns:
        the document order for the box
      • setOrder

        public void setOrder​(int order)
      • isVisible

        public boolean isVisible()
        Description copied from interface: Box
        Checks whether the box is visible.
        Specified by:
        isVisible in interface Box
        Returns:
        true when the box is visible
      • setVisible

        public void setVisible​(boolean visible)
      • getColor

        public Color getColor()
        Description copied from interface: Box
        Obtains the box text color.
        Specified by:
        getColor in interface Box
        Returns:
        the text color
      • setColor

        public void setColor​(Color color)
      • getFontFamily

        public String getFontFamily()
        Description copied from interface: Box
        Obtains the font family name used by the box.
        Specified by:
        getFontFamily in interface Box
        Returns:
        The font family name.
      • setFontFamily

        public void setFontFamily​(String fontFamily)
      • getText

        public String getText()
        Description copied from interface: Box
        Obtains the complete text contained in this box. For the leaf boxes, it returns the corresponding string. For non-leaft boxes, it returns the concatentaion of the leaf box strings using the default concatenator defined by Concatenators.getDefaultBoxConcatenator().
        Specified by:
        getText in interface Box
        Returns:
        a text string (possibly empty)
      • getText

        public String getText​(BoxConcatenator concatenator)
        Description copied from interface: Box
        Obtains the complete text contained in this box. For the leaf boxes, it returns the corresponding string. For non-leaft boxes, it returns the concatentaion of the leaf box strings using a given concatenator.
        Specified by:
        getText in interface Box
        Parameters:
        concatenator - The concatenator to be used to join the boxes.
        Returns:
        a text string (possibly empty)
      • getOwnText

        public String getOwnText()
        Description copied from interface: Box
        Obtains the text contained directly in this box without considering its child boxes.
        Specified by:
        getOwnText in interface Box
        Returns:
        a text string for leaf boxes, null for non-leaf boxes
      • setOwnText

        public void setOwnText​(String text)
      • getContentObject

        public ContentObject getContentObject()
        Description copied from interface: Box
        Obtains the content object contained in this box.
        Specified by:
        getContentObject in interface Box
        Returns:
        the content object or null when there is no object contained.
      • setContentObject

        public void setContentObject​(ContentObject contentObject)
      • getContentBounds

        public Rectangular getContentBounds()
        Description copied from interface: Box
        Returns the content bounds. They correspond to the background bounds of the box; however, when a border is present, it is included in the contents. Moreover, the box is clipped by its clipping box.
        Specified by:
        getContentBounds in interface Box
        Returns:
        the content bounds of the box
      • setContentBounds

        public void setContentBounds​(Rectangular contentBounds)
        Description copied from interface: Box
        Sets the content bounds of the box.
        Specified by:
        setContentBounds in interface Box
        Parameters:
        contentBounds - the new content bounds.
      • getVisualBounds

        public Rectangular getVisualBounds()
        Description copied from interface: Box
        Returns the bounds of the box as they visually appear to the user.
        Specified by:
        getVisualBounds in interface Box
        Returns:
        the visual bounds
      • setVisualBounds

        public void setVisualBounds​(Rectangular visualBounds)
        Description copied from interface: Box
        Sets the visual bounds of the box.
        Specified by:
        setVisualBounds in interface Box
        Parameters:
        visualBounds - the new visual bounds.
      • 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
        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
      • getIntrinsicParent

        public Box getIntrinsicParent()
        Description copied from interface: Box
        Gets the parent box of this box as obtained from the renderer. The renturned value may be null when the box was not obtained by rendering (e.g. a box tree loaded from the storage).
        Specified by:
        getIntrinsicParent in interface Box
        Returns:
        the intrinsic parent box or null
      • setIntrinsicParent

        public void setIntrinsicParent​(Box intrinsicParent)
      • 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
      • setSourceNodeId

        public void setSourceNodeId​(String sourceNodeId)
      • 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
        Returns:
        the tag name or null for boxes that do not correspond to a DOM element.
      • setTagName

        public void setTagName​(String tagName)
      • 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
        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
        Returns:
        A map assigning values to the individual attribute names. An empty map is returned when no attributes are defined.
      • setAttribute

        public void setAttribute​(String name,
                                 String value)
      • removeAttribute

        public void removeAttribute​(String name)
      • getType

        public Box.Type getType()
        Description copied from interface: Box
        Resurns the type of the box.
        Specified by:
        getType in interface Box
        Returns:
        the box type
      • setType

        public void setType​(Box.Type type)
      • 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
        Returns:
        The display type of NULL if the box does not correspond to an element
      • setDisplayType

        public void setDisplayType​(Box.DisplayType displayType)
      • isVisuallySeparated

        public boolean isVisuallySeparated()
        Description copied from interface: Box
        Checks if the box is separated from other contents by some visual means: a visible border at any side, visible background different from its parent or a visible content.
        Specified by:
        isVisuallySeparated in interface Box
        Returns:
        true if the box is visually separated