public abstract class Box extends Object implements Styleable, DisplayListItem
| Modifier and Type | Class and Description |
|---|---|
static class |
Box.ChildIteratorOfType<T> |
| Modifier and Type | Field and Description |
|---|---|
protected Element |
_element |
static int |
CHILDREN_FLUX |
static int |
DONE |
static int |
DUMP_LAYOUT |
static int |
DUMP_RENDER |
static int |
FLUX |
protected static String |
LINE_SEPARATOR |
static int |
NOTHING |
| Modifier | Constructor and Description |
|---|---|
protected |
Box() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAllChildren(List<Box> children) |
void |
addChild(Box child) |
void |
addChildForLayout(LayoutContext c,
Box child) |
void |
analyzePageBreaks(LayoutContext c,
ContentLimitContainer container) |
List<Box> |
ancestors()
Get all ancestors, up until the root box.
|
List<Box> |
ancestorsWhile(Predicate<Box> predicate)
Creates a list of ancestors by walking up the chain of parent,
grandparent, etc.
|
abstract void |
calcCanvasLocation() |
void |
calcChildLocations() |
protected void |
calcChildPaintingInfo(CssContext c,
PaintingInfo result,
boolean useCache) |
PaintingInfo |
calcPaintingInfo(CssContext c,
boolean useCache) |
void |
collectLayoutText(LayoutContext c,
StringBuilder builder)
Similar to
collectText(RenderingContext, StringBuilder) but
dynamic functions such as counter(pages) are not calculated. |
void |
collectText(RenderingContext c,
StringBuilder buffer) |
void |
connectChildrenToCurrentLayer(LayoutContext c) |
boolean |
crossesPageBreak(LayoutContext c)
Whether this box would cross a page break.
|
void |
detach(LayoutContext c) |
abstract String |
dump(LayoutContext c,
String indent,
int which) |
protected void |
dumpBoxes(LayoutContext c,
String indent,
List<Box> boxes,
int which,
StringBuilder result) |
protected void |
exportPageBoxText(RenderingContext c,
Writer writer,
int yPos) |
void |
exportText(RenderingContext c,
Writer writer) |
Box |
find(CssContext cssCtx,
int absX,
int absY,
boolean findAnonymous) |
Box |
findAncestor(Predicate<Box> predicate)
Walks up the ancestor tree to the root testing ancestors agains
the predicate.
|
void |
findColumnBreakOpportunities(FlowingColumnContainerBox.ColumnBreakStore store)
Recursive method to find column break opportunities.
|
void |
forcePageBreakAfter(LayoutContext c,
IdentValue pageBreakValue)
Forces a page break after this box.
|
int |
forcePageBreakBefore(LayoutContext c,
IdentValue pageBreakValue,
boolean pendingPageName) |
int |
forcePageBreakBefore(LayoutContext c,
IdentValue pageBreakValue,
boolean pendingPageName,
int absY) |
Area |
getAbsoluteClipBox(CssContext c)
Returns the absolute (ie transformed if needed) clip area for this box.
|
int |
getAbsX() |
int |
getAbsY() |
Object |
getAccessibilityObject() |
BorderPropertySet |
getBorder(CssContext cssCtx) |
Rectangle |
getBorderBox(CssContext c)
Only to be called after layout, due to double use of getHeight().
|
int |
getBorderBoxHeight(CssContext c) |
int |
getBorderBoxWidth(CssContext c) |
Rectangle |
getBorderEdge(int left,
int top,
CssContext cssCtx) |
int |
getBorderSides() |
BoxDimensions |
getBoxDimensions() |
Box |
getChild(int i) |
int |
getChildCount() |
Iterator<Box> |
getChildIterator() |
<T> Iterator<T> |
getChildIteratorOfType(Class<T> type)
Returns an iterator of boxes cast to type.
|
List<Box> |
getChildren() |
Rectangle |
getChildrenClipEdge(CssContext c) |
Rectangle |
getClipBox(RenderingContext c,
Layer layer)
Gets the combined clip of this box relative to the containing layer.
|
Box |
getContainingBlock() |
protected int |
getContainingBlockWidth() |
Layer |
getContainingLayer() |
Rectangle |
getContentAreaEdge(int left,
int top,
CssContext cssCtx) |
int |
getContentWidth() |
Box |
getDocumentParent() |
FSColor |
getEffBackgroundColor(RenderingContext c) |
int |
getEffectiveWidth() |
Element |
getElement() |
List<Box> |
getElementBoxes(Element elem) |
int |
getHeight()
Uh oh! This refers to content height during layout but total height after layout!
|
protected int |
getIndex()
The zero based index of this child amongst its fellow children of its parent.
|
Layer |
getLayer() |
int |
getLeftMBP() |
RectPropertySet |
getMargin(CssContext cssContext) |
int |
getMarginBorderPadding(CssContext cssCtx,
int which) |
Rectangle |
getMarginEdge(CssContext cssCtx,
int tx,
int ty) |
Rectangle |
getMarginEdge(int left,
int top,
CssContext cssCtx,
int tx,
int ty) |
protected Box |
getNext(Box child) |
Box |
getNextSibling() |
RectPropertySet |
getPadding(CssContext cssCtx) |
Rectangle |
getPaddingEdge(int left,
int top,
CssContext cssCtx) |
protected int |
getPaddingWidth(CssContext cssCtx) |
Rectangle |
getPaintingBorderEdge(CssContext cssCtx) |
Rectangle |
getPaintingClipEdge(CssContext cssCtx) |
PaintingInfo |
getPaintingInfo() |
Rectangle |
getPaintingPaddingEdge(CssContext cssCtx) |
Box |
getParent() |
Rectangle |
getParentClipBox(RenderingContext c,
Layer layer)
Gets the layer relative clip for the parent box.
|
protected Box |
getPrevious(Box child) |
Box |
getPreviousSibling() |
String |
getPseudoElementOrClass() |
Dimension |
getRelativeOffset() |
int |
getRightMBP() |
int |
getState() |
CalculatedStyle |
getStyle() |
protected RectPropertySet |
getStyleMargin(CssContext cssContext) |
protected RectPropertySet |
getStyleMargin(CssContext cssContext,
boolean useCache) |
int |
getTx() |
int |
getTy() |
int |
getWidth() |
int |
getX() |
int |
getY() |
boolean |
hasNonTextContent(CssContext c) |
boolean |
hasRootElementBackground(RenderingContext c)
If the html or body box have a background return true.
|
void |
initContainingLayer(LayoutContext c) |
boolean |
isAnonymous() |
boolean |
isBody() |
static boolean |
isBody(Box child) |
boolean |
isContainedInMarginBox() |
boolean |
isFirstChild()
Is this box the first child of its parent?
|
boolean |
isInDocumentFlow() |
protected boolean |
isInitialContainingBlock() |
protected boolean |
isInlineBlock() |
protected boolean |
isMarginAreaRoot() |
boolean |
isRoot() |
boolean |
isStyled() |
boolean |
isTerminalColumnBreak()
Is this box unbreakable in regards to column break opportunities?
|
protected void |
moveIfGreater(Dimension result,
Dimension test) |
void |
paintBackground(RenderingContext c) |
void |
paintBorder(RenderingContext c) |
void |
paintRootElementBackground(RenderingContext c) |
Dimension |
positionRelative(CssContext cssCtx) |
void |
removeAllChildren() |
boolean |
removeChild(Box target)
Removes a child box if it is indeed a child and adjusts
the index of subsequent children.
|
boolean |
removeChild(int index)
Removes child by index and adjusts the index of subsequent children.
|
void |
reset(LayoutContext c)
Responsible for resetting the state of the box before a repeat
call to
BlockBox.layout(LayoutContext) or other layout methods. |
protected void |
resetChildren(LayoutContext c) |
void |
resetChildren(LayoutContext c,
int start,
int end) |
protected void |
resetTopMargin(CssContext cssContext) |
Box |
rootBox()
Returns the highest ancestor box.
|
void |
setAbsX(int absX) |
void |
setAbsY(int absY) |
void |
setAccessiblityObject(Object object) |
void |
setAnonymous(boolean anonymous) |
protected void |
setBorderBoxHeight(CssContext c,
int h) |
void |
setBorderBoxWidth(CssContext c,
int borderBoxWidth) |
void |
setBoxDimensions(BoxDimensions dimensions) |
void |
setContainingBlock(Box containingBlock) |
void |
setContainingLayer(Layer containingLayer) |
void |
setContentWidth(int contentWidth) |
void |
setElement(Element element) |
void |
setHeight(int height)
Uh oh! This refers to content height during layout but total height after layout!
|
protected void |
setIndex(int index)
See
getIndex()
Must make sure this is correct when removing children/rearranging children. |
void |
setLayer(Layer layer) |
void |
setLeftMBP(int leftMBP) |
void |
setMarginBottom(CssContext cssContext,
int marginBottom) |
void |
setMarginLeft(CssContext cssContext,
int marginLeft) |
void |
setMarginRight(CssContext cssContext,
int marginRight) |
void |
setMarginTop(CssContext cssContext,
int marginTop) |
void |
setParent(Box box) |
void |
setPseudoElementOrClass(String pseudoElementOrClass) |
void |
setRelativeOffset(Dimension relativeOffset) |
void |
setRightMBP(int rightMBP) |
void |
setState(int state) |
void |
setStyle(CalculatedStyle style) |
void |
setTx(int tx) |
void |
setTy(int ty) |
void |
setX(int x) |
void |
setY(int y) |
static String |
stateToString(int state) |
String |
toString() |
protected static final String LINE_SEPARATOR
protected Element _element
public static final int NOTHING
public static final int FLUX
public static final int CHILDREN_FLUX
public static final int DONE
public static final int DUMP_RENDER
public static final int DUMP_LAYOUT
public Rectangle getClipBox(RenderingContext c, Layer layer)
getChildrenClipEdge(CssContext) - gets the local clip for a single box.
+ getParentClipBox(RenderingContext, Layer) - gets the layer relative clip for the parent box.
+ getAbsoluteClipBox(CssContext) - gets the absolute clip box in document coordinatespublic Rectangle getParentClipBox(RenderingContext c, Layer layer)
getClipBox(RenderingContext, Layer)public Area getAbsoluteClipBox(CssContext c)
public abstract String dump(LayoutContext c, String indent, int which)
protected void dumpBoxes(LayoutContext c, String indent, List<Box> boxes, int which, StringBuilder result)
public int getWidth()
public void addChildForLayout(LayoutContext c, Box child)
public void addChild(Box child)
public void removeAllChildren()
public boolean removeChild(Box target)
public Box getPreviousSibling()
public Box getNextSibling()
public boolean removeChild(int index)
removeChild(Box)public void setParent(Box box)
public Box getParent()
public Box getDocumentParent()
public int getChildCount()
public Box getChild(int i)
public <T> Iterator<T> getChildIteratorOfType(Class<T> type)
public int getState()
public void setState(int state)
public static String stateToString(int state)
public final CalculatedStyle getStyle()
public void setStyle(CalculatedStyle style)
public Box getContainingBlock()
public void setContainingBlock(Box containingBlock)
public Rectangle getMarginEdge(int left, int top, CssContext cssCtx, int tx, int ty)
public Rectangle getMarginEdge(CssContext cssCtx, int tx, int ty)
public Rectangle getPaintingBorderEdge(CssContext cssCtx)
public Rectangle getPaintingPaddingEdge(CssContext cssCtx)
public Rectangle getPaintingClipEdge(CssContext cssCtx)
public Rectangle getChildrenClipEdge(CssContext c)
public Rectangle getBorderEdge(int left, int top, CssContext cssCtx)
public Rectangle getPaddingEdge(int left, int top, CssContext cssCtx)
protected int getPaddingWidth(CssContext cssCtx)
public Rectangle getContentAreaEdge(int left, int top, CssContext cssCtx)
public Layer getLayer()
public void setLayer(Layer layer)
public Dimension positionRelative(CssContext cssCtx)
protected boolean isInlineBlock()
public void setAbsY(int absY)
public int getAbsY()
public void setAbsX(int absX)
public int getAbsX()
public boolean isStyled()
public int getBorderSides()
public void paintBorder(RenderingContext c)
public void paintBackground(RenderingContext c)
public boolean hasNonTextContent(CssContext c)
public void setAccessiblityObject(Object object)
public Object getAccessibilityObject()
public void paintRootElementBackground(RenderingContext c)
public boolean hasRootElementBackground(RenderingContext c)
public Layer getContainingLayer()
public void setContainingLayer(Layer containingLayer)
public void initContainingLayer(LayoutContext c)
public void connectChildrenToCurrentLayer(LayoutContext c)
public void reset(LayoutContext c)
BlockBox.layout(LayoutContext) or other layout methods.
public void detach(LayoutContext c)
public void resetChildren(LayoutContext c, int start, int end)
protected void resetChildren(LayoutContext c)
public abstract void calcCanvasLocation()
public void calcChildLocations()
public int forcePageBreakBefore(LayoutContext c, IdentValue pageBreakValue, boolean pendingPageName)
public int forcePageBreakBefore(LayoutContext c, IdentValue pageBreakValue, boolean pendingPageName, int absY)
public void forcePageBreakAfter(LayoutContext c, IdentValue pageBreakValue)
public boolean crossesPageBreak(LayoutContext c)
Layer.crossesPageBreak(LayoutContext, int, int) for extra info.public Dimension getRelativeOffset()
public void setRelativeOffset(Dimension relativeOffset)
public Box find(CssContext cssCtx, int absX, int absY, boolean findAnonymous)
public boolean isRoot()
public boolean isBody()
public static boolean isBody(Box child)
public Element getElement()
getElement in interface Styleablepublic void setElement(Element element)
setElement in interface Styleablepublic void setMarginTop(CssContext cssContext, int marginTop)
public void setMarginBottom(CssContext cssContext, int marginBottom)
public void setMarginLeft(CssContext cssContext, int marginLeft)
public void setMarginRight(CssContext cssContext, int marginRight)
public RectPropertySet getMargin(CssContext cssContext)
protected RectPropertySet getStyleMargin(CssContext cssContext)
protected RectPropertySet getStyleMargin(CssContext cssContext, boolean useCache)
public RectPropertySet getPadding(CssContext cssCtx)
public BorderPropertySet getBorder(CssContext cssCtx)
protected int getContainingBlockWidth()
protected void resetTopMargin(CssContext cssContext)
public PaintingInfo calcPaintingInfo(CssContext c, boolean useCache)
protected void calcChildPaintingInfo(CssContext c, PaintingInfo result, boolean useCache)
public int getMarginBorderPadding(CssContext cssCtx, int which)
protected int getIndex()
protected void setIndex(int index)
getIndex()
Must make sure this is correct when removing children/rearranging children.public String getPseudoElementOrClass()
getPseudoElementOrClass in interface Styleablepublic void setPseudoElementOrClass(String pseudoElementOrClass)
public void setX(int x)
public int getX()
public void setY(int y)
public int getY()
public void setTy(int ty)
public int getTy()
public void setTx(int tx)
public int getTx()
public void setRightMBP(int rightMBP)
public int getRightMBP()
public void setLeftMBP(int leftMBP)
public int getLeftMBP()
public void setHeight(int height)
public int getHeight()
protected void setBorderBoxHeight(CssContext c, int h)
public int getBorderBoxHeight(CssContext c)
public Rectangle getBorderBox(CssContext c)
public void setContentWidth(int contentWidth)
public int getContentWidth()
public int getBorderBoxWidth(CssContext c)
public void setBorderBoxWidth(CssContext c, int borderBoxWidth)
public PaintingInfo getPaintingInfo()
public boolean isAnonymous()
public void setAnonymous(boolean anonymous)
public BoxDimensions getBoxDimensions()
public void setBoxDimensions(BoxDimensions dimensions)
public void collectText(RenderingContext c, StringBuilder buffer)
public void collectLayoutText(LayoutContext c, StringBuilder builder)
collectText(RenderingContext, StringBuilder) but
dynamic functions such as counter(pages) are not calculated.public void exportText(RenderingContext c, Writer writer) throws IOException
IOExceptionprotected void exportPageBoxText(RenderingContext c, Writer writer, int yPos) throws IOException
IOExceptionpublic boolean isInDocumentFlow()
public void analyzePageBreaks(LayoutContext c, ContentLimitContainer container)
public FSColor getEffBackgroundColor(RenderingContext c)
protected boolean isMarginAreaRoot()
public boolean isContainedInMarginBox()
public int getEffectiveWidth()
protected boolean isInitialContainingBlock()
public boolean isFirstChild()
public boolean isTerminalColumnBreak()
public List<Box> ancestorsWhile(Predicate<Box> predicate)
public Box findAncestor(Predicate<Box> predicate)
public Box rootBox()
public void findColumnBreakOpportunities(FlowingColumnContainerBox.ColumnBreakStore store)
store - - use to report break opportunities.Copyright © 2004–2025. All rights reserved.