org.jfree.layouting.renderer.model
Class RenderBox

java.lang.Object
  extended by org.jfree.layouting.renderer.model.RenderNode
      extended by org.jfree.layouting.renderer.model.RenderBox
All Implemented Interfaces:
java.lang.Cloneable
Direct Known 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.
 java.lang.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(java.lang.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
getAlignmentAdjust, getAlignmentAdjustResolved, getAlignmentBaseline, getBaselineShift, getBaselineShiftResolved, getChangeTracker, getComputedLayoutProperties, getDimension, getHeight, getInstanceId, getLayoutContext, getLogicalPage, getMajorAxis, getMaximumBoxWidth, getMinimumChunkWidth, getMinorAxis, getNamespace, getNext, getNodeLayoutProperties, getNormalFlow, getParent, getParentBlockContext, getPosition, getPrev, getStickyMarker, getTagName, getVerticalAlignment, getVisibleNext, getVisiblePrev, getWidth, getX, getY, isDirectionLTR, isDirty, isFrozen, isHibernated, isIcmMetricsFinished, isIgnorableForRendering, normalizeAlignment, setComputedLayoutProperties, setDimension, setDirty, setHeight, setHibernated, setIcmMetricsFinished, setMajorAxis, setMaximumBoxWidth, setMinimumChunkWidth, setMinorAxis, setNext, setParent, setPosition, setPrev, setStickyMarker, setWidth, setX, setY, updateChangeTracker
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_PRUNE

public static final boolean LOG_PRUNE
See Also:
Constant Field Values
Constructor Detail

RenderBox

public RenderBox(BoxDefinition boxDefinition)
Method Detail

getStaticBoxLayoutProperties

public StaticBoxLayoutProperties getStaticBoxLayoutProperties()

appyStyle

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

getWidowsSize

public long getWidowsSize()

setWidowsSize

public void setWidowsSize(long widowsSize)

getOrphansSize

public long getOrphansSize()

setOrphansSize

public void setOrphansSize(long orphansSize)

getLineCount

public int getLineCount()

setLineCount

public void setLineCount(int lineCount)

getWidows

public int getWidows()

getOrphans

public int getOrphans()

isAvoidPagebreakInside

public boolean isAvoidPagebreakInside()

getBaselineInfo

public ExtendedBaselineInfo getBaselineInfo()

setBaselineInfo

public void setBaselineInfo(ExtendedBaselineInfo baselineInfo)

getNominalBaselineInfo

public ExtendedBaselineInfo getNominalBaselineInfo()

getDominantBaseline

public CSSValue getDominantBaseline()

isPreserveSpace

public boolean isPreserveSpace()

getBoxDefinition

public BoxDefinition getBoxDefinition()

getFirstChild

public RenderNode getFirstChild()

setFirstChild

protected void setFirstChild(RenderNode firstChild)

getLastChild

public RenderNode getLastChild()

setLastChild

protected void setLastChild(RenderNode lastChild)

addGeneratedChild

public void addGeneratedChild(RenderNode child)

addChild

public void addChild(RenderNode child)

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 -

replaceChild

public void replaceChild(RenderNode old,
                         RenderNode replacement)

replaceChilds

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

clone

public java.lang.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 class RenderNode
Returns:

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 class RenderNode
Returns:

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 class 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 class RenderNode
Returns:

addChilds

public void addChilds(RenderNode[] nodes)

findNodeById

public RenderNode findNodeById(java.lang.Object instanceId)
Overrides:
findNodeById in class RenderNode

isAppendable

public boolean isAppendable()

getInsertationPoint

public RenderBox getInsertationPoint()

getBorder

public Border getBorder()

clear

public void clear()
Removes all children.


getVisibleFirst

public RenderNode getVisibleFirst()

getVisibleLast

public RenderNode getVisibleLast()

isEmpty

public boolean isEmpty()
Overrides:
isEmpty in class RenderNode

isDiscardable

public boolean isDiscardable()
Overrides:
isDiscardable in class RenderNode

close

public void close()

remove

public void remove(RenderNode child)

isOpen

public boolean isOpen()
Overrides:
isOpen in class RenderNode

getPageContext

public PageContext getPageContext()
Overrides:
getPageContext in class RenderNode

setPageContext

public void setPageContext(PageContext pageContext)

freeze

public void freeze()
Overrides:
freeze in class RenderNode

getBoxLayoutProperties

public BoxLayoutProperties getBoxLayoutProperties()

getContentAreaX1

public long getContentAreaX1()

setContentAreaX1

public void setContentAreaX1(long contentAreaX1)

getContentAreaX2

public long getContentAreaX2()

setContentAreaX2

public void setContentAreaX2(long contentAreaX2)

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:

getEffectiveMarginTop

public long getEffectiveMarginTop()
Overrides:
getEffectiveMarginTop in class RenderNode

getEffectiveMarginBottom

public long getEffectiveMarginBottom()
Overrides:
getEffectiveMarginBottom in class RenderNode