public class BoxNode
extends org.fit.layout.impl.GenericTreeNode
implements org.fit.layout.model.Box
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
backgroundSeparated
Is the box separated by background
|
protected org.fit.layout.model.Rectangular |
bounds
The total bounds of the box node.
|
protected org.fit.cssbox.layout.Box |
box
The CSSBox box that forms this node
|
protected org.fit.layout.model.Rectangular |
content
The total content bounds of the node.
|
protected Color |
efficientBackground
Efficient background color
|
BoxNode |
nearestParent
Potential nearest parent node in the box tree
|
protected int |
order
Order in the box tree.
|
protected org.fit.layout.model.Page |
page
The page this box belongs to.
|
protected BoxTransform |
transform
The transformation that should be applied to the box
|
protected org.fit.layout.model.Rectangular |
visual
Visual bounds of the node.
|
| Constructor and Description |
|---|
BoxNode(org.fit.cssbox.layout.Box box,
org.fit.layout.model.Page page)
Creates a new node containing a box.
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyTransform(BoxTransform trans) |
void |
applyTransformRecursively(BoxTransform trans) |
void |
applyTransforms() |
boolean |
containsVisibleTextString()
Checks if the box text is visible (it does not contain spaces only).
|
boolean |
contentEncloses(BoxNode childNode)
Checks if another node is fully located inside the content bounds of this box.
|
boolean |
equals(Object obj) |
void |
expandToEnclose(BoxNode child)
Expands the box node in order to fully enclose another box
|
protected String |
getAncestorAttribute(Node node,
String elementName,
String attrName) |
String |
getAttribute(String name) |
Map<String,String> |
getAttributes() |
Color |
getBackgroundColor()
Returns the declared background color of the element or null when transparent.
|
int |
getBorderCount() |
org.fit.layout.model.Border |
getBorderStyle(org.fit.layout.model.Border.Side side) |
int |
getBottomBorder()
Obtains the bottom border of the box
|
org.fit.layout.model.Rectangular |
getBounds() |
org.fit.cssbox.layout.Box |
getBox() |
Color |
getColor() |
org.fit.layout.model.Rectangular |
getContentBounds() |
org.fit.layout.model.ContentObject |
getContentObject() |
org.fit.layout.model.Box.DisplayType |
getDisplayType() |
Node |
getDOMNode() |
Color |
getEfficientBackground() |
String |
getEfficientColor()
Get the effective text color.
|
protected String |
getElementAttribute(Node node,
String attrName) |
String |
getFontFamily() |
float |
getFontSize() |
float |
getFontStyle() |
float |
getFontWeight() |
int |
getHeight() |
BoxNode |
getChildBox(int index)
Returns a specified child box.
|
int |
getId() |
int |
getLeftBorder()
Obtains the left border of the box
|
float |
getLineThrough() |
int |
getOrder() |
org.fit.layout.model.Page |
getPage() |
org.fit.layout.model.Box |
getParentBox() |
int |
getRightBorder()
Obtains the right border of the box
|
int |
getSourceNodeId() |
Color |
getStartColor()
Obtains the text color of the first box in the area.
|
String |
getTagName() |
String |
getText() |
int |
getTopBorder()
Obtains the top border of the box
|
org.fit.layout.model.Box.Type |
getType() |
float |
getUnderline() |
org.fit.layout.model.Rectangular |
getVisualBounds()
Returns the bounds of the box as they visually appear to the user.
|
int |
getWidth() |
int |
getX1() |
int |
getX2() |
int |
getY1() |
int |
getY2() |
boolean |
hasBottomBorder() |
boolean |
hasLeftBorder() |
boolean |
hasRightBorder() |
boolean |
hasTopBorder() |
boolean |
isBackgroundSeparated() |
boolean |
isRootNode() |
boolean |
isVisible()
Checks whether the box is inside of the visible area and the text is visible and its color is different from the background
|
boolean |
isVisuallySeparated() |
void |
markChildNodes(Vector<BoxNode> list)
Takes a list of nodes and selects the nodes whose parent box is identical to this node's box.
|
void |
markNodesInside(Vector<BoxNode> list,
boolean full)
Takes a list of nodes and selects the nodes that are located directly inside
of this node's box.
|
void |
move(int xofs,
int yofs) |
void |
recomputeBounds()
Recomputes the total bounds of the whole subtree.
|
void |
recomputeVisualBounds()
Re-computes the visual bounds of the whole subtree.
|
void |
removeFromTree()
Removes the node from the tree.
|
void |
setBackgroundSeparated(boolean backgroundSeparated) |
void |
setEfficientBackground(Color bgcolor) |
void |
setOrder(int order) |
void |
takeChildren(Vector<BoxNode> list)
Goes through the parent's children, takes all the nodes that are inside of this node
and makes them the children of this node.
|
String |
toString() |
boolean |
visuallyEncloses(BoxNode childNode)
Checks if another node is located inside the visual bounds of this box.
|
boolean |
visuallyEncloses1(BoxNode childNode)
Checks if another node is fully located inside the content bounds of this box.
|
add, addUserAttribute, getDepth, getChildAt, getChildCount, getChildren, getIndex, getLeafCount, getNextSiblingNode, getParent, getPreviousSiblingNode, getRoot, getUserAttribute, insert, isLeaf, isRoot, remove, remove, removeAllChildrenprotected org.fit.cssbox.layout.Box box
protected org.fit.layout.model.Page page
protected int order
protected BoxTransform transform
protected org.fit.layout.model.Rectangular bounds
protected org.fit.layout.model.Rectangular content
protected org.fit.layout.model.Rectangular visual
protected boolean backgroundSeparated
protected Color efficientBackground
public BoxNode nearestParent
public BoxNode(org.fit.cssbox.layout.Box box,
org.fit.layout.model.Page page)
box - the contained boxpublic int getId()
getId in interface org.fit.layout.model.ContentRectpublic int getOrder()
public void setOrder(int order)
order - the display tree order to setpublic boolean isRootNode()
public boolean isBackgroundSeparated()
isBackgroundSeparated in interface org.fit.layout.model.ContentRectpublic void setBackgroundSeparated(boolean backgroundSeparated)
public Color getEfficientBackground()
public void setEfficientBackground(Color bgcolor)
bgcolor - the efficientBackground to setpublic boolean isVisuallySeparated()
true if the box is visually separated by a border or
a different background color.public org.fit.layout.model.Rectangular getVisualBounds()
getVisualBounds in interface org.fit.layout.model.Boxpublic void recomputeVisualBounds()
public void recomputeBounds()
public int getBorderCount()
getBorderCount in interface org.fit.layout.model.ContentRectpublic boolean hasTopBorder()
hasTopBorder in interface org.fit.layout.model.ContentRecttrue if the box has a top borderpublic int getTopBorder()
getTopBorder in interface org.fit.layout.model.ContentRectpublic boolean hasBottomBorder()
hasBottomBorder in interface org.fit.layout.model.ContentRecttrue if the box has a bottom borderpublic int getBottomBorder()
getBottomBorder in interface org.fit.layout.model.ContentRectpublic boolean hasLeftBorder()
hasLeftBorder in interface org.fit.layout.model.ContentRecttrue if the box has a left borderpublic int getLeftBorder()
getLeftBorder in interface org.fit.layout.model.ContentRectpublic boolean hasRightBorder()
hasRightBorder in interface org.fit.layout.model.ContentRecttrue if the box has a right borderpublic int getRightBorder()
getRightBorder in interface org.fit.layout.model.ContentRectpublic org.fit.layout.model.Border getBorderStyle(org.fit.layout.model.Border.Side side)
getBorderStyle in interface org.fit.layout.model.ContentRectpublic String getEfficientColor()
public Color getStartColor()
public boolean containsVisibleTextString()
public boolean isVisible()
isVisible in interface org.fit.layout.model.Boxtrue if the box is visiblepublic Color getBackgroundColor()
getBackgroundColor in interface org.fit.layout.model.ContentRectpublic void applyTransform(BoxTransform trans)
public void applyTransformRecursively(BoxTransform trans)
public void applyTransforms()
public org.fit.cssbox.layout.Box getBox()
public org.fit.layout.model.Box getParentBox()
getParentBox in interface org.fit.layout.model.Boxpublic BoxNode getChildBox(int index)
getChildBox in interface org.fit.layout.model.Boxindex - the child indexpublic org.fit.layout.model.Rectangular getBounds()
getBounds in interface org.fit.layout.model.BoxgetBounds in interface org.fit.layout.model.ContentRectpublic org.fit.layout.model.Rectangular getContentBounds()
getContentBounds in interface org.fit.layout.model.Boxpublic boolean visuallyEncloses(BoxNode childNode)
childNode - the node to checktrue if the child node is completely inside this node, false otherwisepublic boolean visuallyEncloses1(BoxNode childNode)
childNode - the node to checktrue if the child node is completely inside this node, false otherwisepublic boolean contentEncloses(BoxNode childNode)
childNode - the node to checktrue if the child node is completely inside this node, false otherwisepublic void expandToEnclose(BoxNode child)
public void markNodesInside(Vector<BoxNode> list, boolean full)
nearestParent of the selected boxes is set to this box.list - the list of nodes to testfull - when set to true, all the nodes within the box content bounds are considered.
Otherwise, only the boxes within the visual bounds are considered.public void markChildNodes(Vector<BoxNode> list)
nearestParent of the selected boxes is set to this box node.list - the list of nodes to testpublic void takeChildren(Vector<BoxNode> list)
public void removeFromTree()
public String getText()
getText in interface org.fit.layout.model.Boxpublic org.fit.layout.model.Page getPage()
getPage in interface org.fit.layout.model.ContentRectpublic float getUnderline()
getUnderline in interface org.fit.layout.model.ContentRectpublic float getLineThrough()
getLineThrough in interface org.fit.layout.model.ContentRectpublic float getFontSize()
getFontSize in interface org.fit.layout.model.ContentRectpublic float getFontStyle()
getFontStyle in interface org.fit.layout.model.ContentRectpublic float getFontWeight()
getFontWeight in interface org.fit.layout.model.ContentRectpublic int getX1()
getX1 in interface org.fit.layout.model.Rectpublic int getY1()
getY1 in interface org.fit.layout.model.Rectpublic int getX2()
getX2 in interface org.fit.layout.model.Rectpublic int getY2()
getY2 in interface org.fit.layout.model.Rectpublic int getWidth()
getWidth in interface org.fit.layout.model.Rectpublic int getHeight()
getHeight in interface org.fit.layout.model.Rectpublic void move(int xofs,
int yofs)
move in interface org.fit.layout.model.Rectpublic Color getColor()
getColor in interface org.fit.layout.model.Boxpublic String getFontFamily()
getFontFamily in interface org.fit.layout.model.Boxpublic org.fit.layout.model.ContentObject getContentObject()
getContentObject in interface org.fit.layout.model.Boxpublic org.fit.layout.model.Box.Type getType()
getType in interface org.fit.layout.model.Boxpublic Node getDOMNode()
public int getSourceNodeId()
getSourceNodeId in interface org.fit.layout.model.Boxpublic String getTagName()
getTagName in interface org.fit.layout.model.Boxpublic String getAttribute(String name)
getAttribute in interface org.fit.layout.model.Boxpublic Map<String,String> getAttributes()
getAttributes in interface org.fit.layout.model.Boxprotected String getAncestorAttribute(Node node, String elementName, String attrName)
public org.fit.layout.model.Box.DisplayType getDisplayType()
getDisplayType in interface org.fit.layout.model.BoxCopyright © 2018. All rights reserved.