Package com.itextpdf.layout.renderer
Class CellRenderer
java.lang.Object
com.itextpdf.layout.renderer.AbstractRenderer
com.itextpdf.layout.renderer.BlockRenderer
com.itextpdf.layout.renderer.CellRenderer
- All Implemented Interfaces:
-
IPropertyContainer
,IRenderer
Represents a renderer for the
Cell
layout element.
-
Field Summary
Fields inherited from class com.itextpdf.layout.renderer.AbstractRenderer
childRenderers, EPS, flushed, INF, isLastRendererForModelElement, modelElement, occupiedArea, OVERLAP_EPSILON, parent, positionedRenderers, properties
-
Constructor Summary
ConstructorDescriptionCellRenderer
(Cell modelElement) Creates a CellRenderer from its corresponding layout object. -
Method Summary
Modifier and TypeMethodDescriptionprotected Rectangle
applyBorderBox
(Rectangle rect, Border[] borders, boolean reverse) Applies the given border box (borders) on the given rectangleprotected Rectangle
applyMargins
(Rectangle rect, UnitValue[] margins, boolean reverse) Applies given margins on the given rectangleprotected Rectangle
applySpacings
(Rectangle rect, boolean reverse) Applies spacings on the given rectangle.protected Rectangle
applySpacings
(Rectangle rect, float[] spacings, boolean reverse) Applies given spacings on the given rectangle.protected AbstractRenderer
createOverflowRenderer
(int layoutResult) Creates an overflow renderer.protected AbstractRenderer
createSplitRenderer
(int layoutResult) Creates a split renderer.void
drawBackground
(DrawContext drawContext) Draws a background layer if it is defined by a keyProperty.BACKGROUND
in either the layout element or thisIRenderer
itself.void
drawBorder
(DrawContext drawContext) Performs the drawing operation for the border of this renderer, if defined by any of theProperty.BORDER
values in either the layout element or thisIRenderer
itself.Gets the model element associated with this renderer.Gets a new instance of this class to be used as a next renderer, after this renderer is used, ifBlockRenderer.layout(LayoutContext)
is called more than once.protected Float
retrieveWidth
(float parentBoxWidth) Retrieves element's fixed content box width, if it's set.Methods inherited from class com.itextpdf.layout.renderer.BlockRenderer
applyRotationLayout, applyVerticalAlignment, beginRotationIfApplied, createRotationTransformInsideOccupiedArea, draw, endRotationIfApplied, getMinMaxWidth, getOccupiedAreaBBox, getResolvedFont, layout
Methods inherited from class com.itextpdf.layout.renderer.AbstractRenderer
addAllProperties, addChild, alignChildHorizontally, allowLastYLineRecursiveExtraction, applyAbsolutePosition, applyAction, applyBorderBox, applyDestination, applyDestinationsAndAnnotation, applyLinkAnnotation, applyMargins, applyPaddings, applyPaddings, applyRelativePositioningTranslation, beginElementOpacityApplying, beginTransformationIfApplied, calculateAbsolutePdfBBox, calculateBBox, calculateShiftToPositionBBoxOfPointsAt, clipBackgroundArea, clipBackgroundArea, clipBorderArea, createXObject, deleteOwnProperty, deleteProperty, drawChildren, endElementOpacityApplying, endTransformationIfApplied, getBackgroundArea, getBorderAreaBBox, getBorderRadii, getBorders, getChildRenderers, getDefaultProperty, getFirstYLineRecursively, getInnerAreaBBox, getLastYLineRecursively, getMargins, getOccupiedArea, getOwnProperties, getOwnProperty, getPaddings, getParent, getProperty, getProperty, getPropertyAsBoolean, getPropertyAsColor, getPropertyAsFloat, getPropertyAsFloat, getPropertyAsFont, getPropertyAsInteger, getPropertyAsTransparentColor, getPropertyAsUnitValue, hasAbsoluteUnitValue, hasOwnOrModelProperty, hasOwnProperty, hasProperty, hasRelativeUnitValue, initElementAreas, isAbsolutePosition, isBorderBoxSizing, isFirstOnRootArea, isFixedLayout, isFlushed, isKeepTogether, isNotFittingHeight, isNotFittingLayoutArea, isNotFittingWidth, isOverflowFit, isOverflowProperty, isOverflowProperty, isOverflowProperty, isPositioned, isRelativePosition, isStaticLayout, move, rectangleToPointsList, retrieveHeight, retrieveMaxHeight, retrieveMaxWidth, retrieveMinHeight, retrieveMinWidth, retrieveUnitValue, retrieveUnitValue, setBorders, setMinMaxWidthBasedOnFixedWidth, setParent, setProperty, toString, transformPoints, updateHeight, updateHeightsOnSplit, updateMaxHeight, updateMinHeight, updateWidth
-
Constructor Details
-
CellRenderer
Creates a CellRenderer from its corresponding layout object.- Parameters:
-
modelElement
- theCell
which this object should manage
-
-
Method Details
-
getModelElement
Gets the model element associated with this renderer.- Specified by:
-
getModelElement
in interfaceIRenderer
- Overrides:
-
getModelElement
in classAbstractRenderer
- Returns:
-
the model element, as a
container of properties
-
retrieveWidth
Description copied from class:AbstractRenderer
Retrieves element's fixed content box width, if it's set. Takes into accountProperty.BOX_SIZING
,Property.MIN_WIDTH
, andProperty.MAX_WIDTH
properties.- Overrides:
-
retrieveWidth
in classAbstractRenderer
- Parameters:
-
parentBoxWidth
- width of the parent element content box. If element has relative width, it will be calculated relatively to this parameter. - Returns:
- element's fixed content box width or null if it's not set.
- See Also:
-
createSplitRenderer
Creates a split renderer.- Overrides:
-
createSplitRenderer
in classBlockRenderer
- Parameters:
-
layoutResult
- the result of content layouting - Returns:
-
a new
AbstractRenderer
instance
-
createOverflowRenderer
Creates an overflow renderer.- Overrides:
-
createOverflowRenderer
in classBlockRenderer
- Parameters:
-
layoutResult
- the result of content layouting - Returns:
-
a new
AbstractRenderer
instance
-
drawBackground
Description copied from class:AbstractRenderer
Draws a background layer if it is defined by a keyProperty.BACKGROUND
in either the layout element or thisIRenderer
itself.- Overrides:
-
drawBackground
in classAbstractRenderer
- Parameters:
-
drawContext
- the context (canvas, document, etc) of this drawing operation.
-
drawBorder
Performs the drawing operation for the border of this renderer, if defined by any of theProperty.BORDER
values in either the layout element or thisIRenderer
itself.- Overrides:
-
drawBorder
in classAbstractRenderer
- Parameters:
-
drawContext
- the context (canvas, document, etc) of this drawing operation.
-
applyBorderBox
Description copied from class:AbstractRenderer
Applies the given border box (borders) on the given rectangle- Overrides:
-
applyBorderBox
in classAbstractRenderer
- Parameters:
-
rect
- a rectangle paddings will be applied on. -
borders
- theborders
to be applied on the given rectangle -
reverse
- indicates whether the border box will be applied inside (in case of false) or outside (in case of false) the rectangle. - Returns:
-
a
border box
of the renderer
-
applyMargins
Description copied from class:AbstractRenderer
Applies given margins on the given rectangle- Overrides:
-
applyMargins
in classAbstractRenderer
- Parameters:
-
rect
- a rectangle margins will be applied on. -
margins
- the margins to be applied on the given rectangle -
reverse
- indicates whether margins will be applied inside (in case of false) or outside (in case of true) the rectangle. - Returns:
-
a
border box
of the renderer
-
applySpacings
Applies spacings on the given rectangle.- Parameters:
-
rect
- a rectangle spacings will be applied on -
reverse
- indicates whether spacings will be applied inside (in case of false) or outside (in case of true) the rectangle. - Returns:
-
a
border box
of the renderer
-
applySpacings
Applies given spacings on the given rectangle.- Parameters:
-
rect
- a rectangle spacings will be applied on -
spacings
- the spacings to be applied on the given rectangle -
reverse
- indicates whether spacings will be applied inside (in case of false) or outside (in case of true) the rectangle. - Returns:
-
a
border box
of the renderer
-
getNextRenderer
Gets a new instance of this class to be used as a next renderer, after this renderer is used, ifBlockRenderer.layout(LayoutContext)
is called more than once.If a renderer overflows to the next area, iText uses this method to create a renderer for the overflow part. So if one wants to extend
CellRenderer
, one should override this method: otherwise the default method will be used and thus the default rather than the custom renderer will be created.- Returns:
- new renderer instance
-