org.jfree.layouting.renderer.model

Class RenderBox

Implemented Interfaces:
Cloneable
Known Direct Subclasses:
BlockRenderBox, InlineRenderBox, TableColumnGroupNode

public abstract class RenderBox
extends RenderNode

A render-box corresponds to elements in a DOM tree.

Each box has a size, paddings, margins and borders. Boxes may have one or more childs.

While all nodes may have a position or dimensions, boxes are special, as they can have borders, margins and paddings. Borders, paddings and margins can have percentages, the margins can additionally be 'auto'.

The StrictInset variables for these properties contain the resolved values, while the box-definition contain the unresolved values. The resolve values are not valid unless the object has been validated to least least 'LAYOUTING'.

Author:
Thomas Morgner

Field Summary

static boolean
LOG_PRUNE

Fields inherited from class org.jfree.layouting.renderer.model.RenderNode

HORIZONTAL_AXIS, VERTICAL_AXIS

Constructor Summary

RenderBox(BoxDefinition boxDefinition)

Method Summary

void
addChild(RenderNode child)
void
addChilds(RenderNode[] nodes)
void
addGeneratedChild(RenderNode child)
void
appyStyle(LayoutContext context, OutputProcessorMetaData metaData)
void
clear()
Removes all children.
Object
clone()
Clones this node.
void
close()
RenderNode
derive(boolean deepDerive)
Derive creates a disconnected node that shares all the properties of the original node.
RenderNode
deriveFrozen(boolean deepDerive)
Derive creates a disconnected node that shares all the properties of the original node.
RenderNode
findNodeById(Object instanceId)
void
freeze()
ExtendedBaselineInfo
getBaselineInfo()
Border
getBorder()
BoxDefinition
getBoxDefinition()
BoxLayoutProperties
getBoxLayoutProperties()
long
getContentAreaX1()
long
getContentAreaX2()
CSSValue
getDominantBaseline()
long
getEffectiveMarginBottom()
long
getEffectiveMarginTop()
RenderNode
getFirstChild()
RenderBox
getInsertationPoint()
RenderNode
getLastChild()
int
getLineCount()
ExtendedBaselineInfo
getNominalBaselineInfo()
int
getOrphans()
long
getOrphansSize()
PageContext
getPageContext()
StaticBoxLayoutProperties
getStaticBoxLayoutProperties()
RenderNode
getVisibleFirst()
RenderNode
getVisibleLast()
int
getWidows()
long
getWidowsSize()
RenderNode
hibernate()
Derive creates a disconnected node that shares all the properties of the original node.
protected void
insertAfter(RenderNode node, RenderNode target)
Inserts the given target after the specified node.
protected void
insertBefore(RenderNode node, RenderNode target)
Inserts the given target directly before the the specified node.
boolean
isAppendable()
boolean
isAvoidPagebreakInside()
boolean
isDiscardable()
boolean
isEmpty()
boolean
isOpen()
boolean
isPreserveSpace()
void
remove(RenderNode child)
void
replaceChild(RenderNode old, RenderNode replacement)
void
replaceChilds(RenderNode old, RenderNode[] replacement)
void
setBaselineInfo(ExtendedBaselineInfo baselineInfo)
void
setContentAreaX1(long contentAreaX1)
void
setContentAreaX2(long contentAreaX2)
protected void
setFirstChild(RenderNode firstChild)
protected void
setLastChild(RenderNode lastChild)
void
setLineCount(int lineCount)
void
setOrphansSize(long orphansSize)
void
setPageContext(PageContext pageContext)
void
setWidowsSize(long widowsSize)
RenderBox
split(int axis)
Performs a simple split.

Methods inherited from class org.jfree.layouting.renderer.model.RenderNode

appyStyle, clone, derive, deriveFrozen, findNodeById, freeze, getAlignmentAdjust, getAlignmentAdjustResolved, getAlignmentBaseline, getBaselineShift, getBaselineShiftResolved, getChangeTracker, getComputedLayoutProperties, getDimension, getEffectiveMarginBottom, getEffectiveMarginTop, getHeight, getInstanceId, getLayoutContext, getLogicalPage, getMajorAxis, getMaximumBoxWidth, getMinimumChunkWidth, getMinorAxis, getNamespace, getNext, getNodeLayoutProperties, getNormalFlow, getPageContext, getParent, getParentBlockContext, getPosition, getPrev, getStickyMarker, getTagName, getVerticalAlignment, getVisibleNext, getVisiblePrev, getWidth, getX, getY, hibernate, isDirectionLTR, isDirty, isDiscardable, isEmpty, isFrozen, isHibernated, isIcmMetricsFinished, isIgnorableForRendering, isOpen, normalizeAlignment, setComputedLayoutProperties, setDimension, setDirty, setHeight, setHibernated, setIcmMetricsFinished, setMajorAxis, setMaximumBoxWidth, setMinimumChunkWidth, setMinorAxis, setNext, setParent, setPosition, setPrev, setStickyMarker, setWidth, setX, setY, updateChangeTracker

Field Details

LOG_PRUNE

public static final boolean LOG_PRUNE
Field Value:
false

Constructor Details

RenderBox

public RenderBox(BoxDefinition boxDefinition)

Method Details

addChild

public void addChild(RenderNode child)

addChilds

public void addChilds(RenderNode[] nodes)

addGeneratedChild

public void addGeneratedChild(RenderNode child)

appyStyle

public void appyStyle(LayoutContext context,
                      OutputProcessorMetaData metaData)
Overrides:
appyStyle in interface RenderNode

clear

public void clear()
Removes all children.

clone

public Object clone()
Clones this node. Be aware that cloning can get you into deep trouble, as the relations this node has may no longer be valid.
Overrides:
clone in interface RenderNode
Returns:

close

public void close()

derive

public RenderNode derive(boolean deepDerive)
Derive creates a disconnected node that shares all the properties of the original node. The derived node will no longer have any parent, silbling, child or any other relationships with other nodes.
Overrides:
derive in interface RenderNode
Returns:

deriveFrozen

public RenderNode deriveFrozen(boolean deepDerive)
Derive creates a disconnected node that shares all the properties of the original node. The derived node will no longer have any parent, silbling, child or any other relationships with other nodes.
Overrides:
deriveFrozen in interface RenderNode
Returns:

findNodeById

public RenderNode findNodeById(Object instanceId)
Overrides:
findNodeById in interface RenderNode

freeze

public void freeze()
Overrides:
freeze in interface RenderNode

getBaselineInfo

public ExtendedBaselineInfo getBaselineInfo()

getBorder

public Border getBorder()

getBoxDefinition

public BoxDefinition getBoxDefinition()

getBoxLayoutProperties

public BoxLayoutProperties getBoxLayoutProperties()

getContentAreaX1

public long getContentAreaX1()

getContentAreaX2

public long getContentAreaX2()

getDominantBaseline

public CSSValue getDominantBaseline()

getEffectiveMarginBottom

public long getEffectiveMarginBottom()
Overrides:
getEffectiveMarginBottom in interface RenderNode

getEffectiveMarginTop

public long getEffectiveMarginTop()
Overrides:
getEffectiveMarginTop in interface RenderNode

getFirstChild

public RenderNode getFirstChild()

getInsertationPoint

public RenderBox getInsertationPoint()

getLastChild

public RenderNode getLastChild()

getLineCount

public int getLineCount()

getNominalBaselineInfo

public ExtendedBaselineInfo getNominalBaselineInfo()

getOrphans

public int getOrphans()

getOrphansSize

public long getOrphansSize()

getPageContext

public PageContext getPageContext()
Overrides:
getPageContext in interface RenderNode

getStaticBoxLayoutProperties

public StaticBoxLayoutProperties getStaticBoxLayoutProperties()

getVisibleFirst

public RenderNode getVisibleFirst()

getVisibleLast

public RenderNode getVisibleLast()

getWidows

public int getWidows()

getWidowsSize

public long getWidowsSize()

hibernate

public RenderNode hibernate()
Derive creates a disconnected node that shares all the properties of the original node. The derived node will no longer have any parent, silbling, child or any other relationships with other nodes.
Overrides:
hibernate in interface RenderNode
Returns:

insertAfter

protected void insertAfter(RenderNode node,
                           RenderNode target)
Inserts the given target after the specified node. If the node is null, the target is inserted as first node.
Parameters:
node -
target -

insertBefore

protected void insertBefore(RenderNode node,
                            RenderNode target)
Inserts the given target directly before the the specified node. If the node is null, the element is inserted at the last position.
Parameters:
node -
target -

isAppendable

public boolean isAppendable()

isAvoidPagebreakInside

public boolean isAvoidPagebreakInside()

isDiscardable

public boolean isDiscardable()
Overrides:
isDiscardable in interface RenderNode

isEmpty

public boolean isEmpty()
Overrides:
isEmpty in interface RenderNode

isOpen

public boolean isOpen()
Overrides:
isOpen in interface RenderNode

isPreserveSpace

public boolean isPreserveSpace()

remove

public void remove(RenderNode child)

replaceChild

public void replaceChild(RenderNode old,
                         RenderNode replacement)

replaceChilds

public void replaceChilds(RenderNode old,
                          RenderNode[] replacement)

setBaselineInfo

public void setBaselineInfo(ExtendedBaselineInfo baselineInfo)

setContentAreaX1

public void setContentAreaX1(long contentAreaX1)

setContentAreaX2

public void setContentAreaX2(long contentAreaX2)

setFirstChild

protected void setFirstChild(RenderNode firstChild)

setLastChild

protected void setLastChild(RenderNode lastChild)

setLineCount

public void setLineCount(int lineCount)

setOrphansSize

public void setOrphansSize(long orphansSize)

setPageContext

public void setPageContext(PageContext pageContext)

setWidowsSize

public void setWidowsSize(long widowsSize)

split

public RenderBox split(int axis)
Performs a simple split. This box will be altered to form the left/top side of the split, and a derived empty box will be returned, which makes up the right/bottom side.

A split will only happen on inline-boxes during the line-break-step. In the ordinary layouting, splitting is not necesary.

Parameters:
axis -
Returns: