Package cz.vutbr.fit.layout.cssbox.impl
Class BoxNode
- java.lang.Object
-
- cz.vutbr.fit.layout.impl.DefaultTreeNode<T>
-
- cz.vutbr.fit.layout.impl.DefaultTreeContentRect<Box>
-
- cz.vutbr.fit.layout.impl.DefaultBox
-
- cz.vutbr.fit.layout.cssbox.impl.BoxNode
-
- All Implemented Interfaces:
Box,ContentRect,GenericTreeNode<Box>,Rect
public class BoxNode extends DefaultBox
A node of a tree of visual blocks.- Author:
- burgetr
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface cz.vutbr.fit.layout.model.Box
Box.DisplayType, Box.Type
-
-
Field Summary
Fields Modifier and Type Field Description protected org.fit.cssbox.layout.BoxboxThe CSSBox box that forms this nodeprotected BoxTransformtransformThe transformation that should be applied to the box-
Fields inherited from interface cz.vutbr.fit.layout.model.ContentRect
ATTR_SAME_AS
-
-
Constructor Summary
Constructors Constructor Description BoxNode(org.fit.cssbox.layout.Box box, Page page, float zoom)Creates a new node containing a box with a transparent background.BoxNode(org.fit.cssbox.layout.Box box, Page page, Color bgColor, float zoom)Creates a new node containing a box with a computed background.
-
Method Summary
-
Methods inherited from class cz.vutbr.fit.layout.impl.DefaultBox
getColor, getContentBounds, getContentObject, getFontFamily, getHeight, getIntrinsicParent, getOrder, getOwnText, getPage, getPageIri, getText, getText, getType, getVisualBounds, getWidth, getX1, getX2, getY1, getY2, isVisible, isVisuallySeparated, move, removeAttribute, setAttribute, setColor, setContentBounds, setContentObject, setDisplayType, setFontFamily, setIntrinsicParent, setOrder, setOwnText, setPage, setPageIri, setSourceNodeId, setTagName, setType, setVisible, setVisualBounds
-
Methods inherited from class cz.vutbr.fit.layout.impl.DefaultTreeContentRect
addUserAttribute, getBackgroundColor, getBackgroundImagePng, getBorderCount, getBorderStyle, getBottomBorder, getBounds, getId, getLeftBorder, getLine, getRightBorder, getTextStyle, getTopBorder, getUserAttribute, hasBackground, hasBottomBorder, hashCode, hasLeftBorder, hasRightBorder, hasTopBorder, childrenChanged, isBackgroundSeparated, setBackgroundColor, setBackgroundImagePng, setBackgroundSeparated, setBorderStyle, setBounds, setId, setLine, setTextStyle
-
Methods inherited from class cz.vutbr.fit.layout.impl.DefaultTreeNode
appendChild, appendChildren, findNodesPostOrder, findNodesPreOrder, getDepth, getChildAt, getChildCount, getChildren, getIndex, getLeafCount, getNextSibling, getParent, getPreviousSibling, getRoot, insertChild, isLeaf, isRoot, removeAllChildren, removeChild, removeChild, setParent, setRoot
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface cz.vutbr.fit.layout.model.ContentRect
addUserAttribute, getBackgroundColor, getBackgroundImagePng, getBorderCount, getBorderStyle, getBottomBorder, getId, getLeftBorder, getLine, getRightBorder, getTextStyle, getTopBorder, getUserAttribute, hasBackground, hasBottomBorder, hasLeftBorder, hasRightBorder, hasTopBorder, isBackgroundSeparated, setBackgroundSeparated, setBounds, setLine
-
Methods inherited from interface cz.vutbr.fit.layout.model.GenericTreeNode
appendChild, appendChildren, findNodesPostOrder, findNodesPreOrder, getDepth, getChildAt, getChildCount, getChildren, getIndex, getLeafCount, getNextSibling, getParent, getPreviousSibling, getRoot, childrenChanged, insertChild, isLeaf, isRoot, removeAllChildren, removeChild, removeChild, setParent, setRoot
-
-
-
-
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, Page page, float zoom)Creates a new node containing a box with a transparent background.- Parameters:
box- the contained boxpage- containing pagezoom- zoom factor to apply
-
BoxNode
public BoxNode(org.fit.cssbox.layout.Box box, Page page, 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 boxpage- containing pagebgColor- computed backgound color to be used for the boxzoom- zoom factor to apply
-
-
Method Detail
-
toString
public String toString()
- Overrides:
toStringin classDefaultBox
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classDefaultTreeContentRect<Box>
-
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
-
recomputeTextStyle
protected void recomputeTextStyle()
- Overrides:
recomputeTextStylein classDefaultBox
-
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()
- Specified by:
getSourceNodeIdin interfaceBox- Overrides:
getSourceNodeIdin classDefaultBox
-
getTagName
public String getTagName()
- Specified by:
getTagNamein interfaceBox- Overrides:
getTagNamein classDefaultBox
-
getAttribute
public String getAttribute(String name)
- Specified by:
getAttributein interfaceBox- Overrides:
getAttributein classDefaultBox
-
getAttributes
public Map<String,String> getAttributes()
- Specified by:
getAttributesin interfaceBox- Overrides:
getAttributesin classDefaultBox
-
getAncestorAttribute
protected String getAncestorAttribute(Node node, String elementName, String attrName)
-
getDisplayType
public Box.DisplayType getDisplayType()
- Specified by:
getDisplayTypein interfaceBox- Overrides:
getDisplayTypein classDefaultBox
-
getSubstringBounds
public Rectangular getSubstringBounds(int startPos, int endPos)
- Specified by:
getSubstringBoundsin interfaceBox- Overrides:
getSubstringBoundsin classDefaultBox
-
-