public class TableRenderer extends AbstractRenderer
renderer
object for a Table
object. It will delegate its drawing operations on to the CellRenderer
instances associated with the table cells
.
Modifier and Type | Field and Description |
---|---|
protected DivRenderer |
captionRenderer |
protected TableRenderer |
footerRenderer |
protected TableRenderer |
headerRenderer |
protected boolean |
isOriginalNonSplitRenderer
True for newly created renderer.
|
protected Table.RowRange |
rowRange |
protected List<CellRenderer[]> |
rows |
childRenderers, EPS, flushed, INF, isLastRendererForModelElement, modelElement, occupiedArea, OVERLAP_EPSILON, parent, positionedRenderers, properties
Constructor and Description |
---|
TableRenderer(Table modelElement)
Creates a TableRenderer from a Table .
|
TableRenderer(Table modelElement, Table.RowRange rowRange)
Creates a TableRenderer from a Table which will partially render the table.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(IRenderer renderer)
Adds a child to the current renderer
|
protected boolean |
allowLastYLineRecursiveExtraction() |
protected Rectangle |
applyBorderBox(Rectangle rect, Border[] borders, boolean reverse)
Applies the given border box (borders) on the given rectangle
|
Rectangle |
applyPaddings(Rectangle rect, boolean reverse)
Applies paddings of the renderer on the given rectangle
|
protected Rectangle |
applyPaddings(Rectangle rect, UnitValue[] paddings, boolean reverse)
Applies given paddings on the given rectangle
|
protected TableRenderer |
createOverflowRenderer(Table.RowRange rowRange) |
protected TableRenderer |
createSplitRenderer(Table.RowRange rowRange) |
void |
draw(DrawContext drawContext)
Flushes the renderer subtree contents, i.e.
|
void |
drawBackground(DrawContext drawContext)
Draws a background layer if it is defined by a key Property.BACKGROUND in either the layout element or this IRenderer itself.
|
protected void |
drawBackgrounds(DrawContext drawContext) |
void |
drawBorder(DrawContext drawContext)
Performs the drawing operation for the border of this renderer, if defined by any of the Property.BORDER values in either the layout element or this IRenderer itself.
|
protected void |
drawBorders(DrawContext drawContext) |
protected void |
drawCaption(DrawContext drawContext) |
void |
drawChildren(DrawContext drawContext)
Performs the drawing operation for all children of this renderer.
|
protected void |
extendLastRow(CellRenderer[] lastRow, Rectangle freeBox) |
protected Float |
getLastYLineRecursively()
Deprecated.
Will be removed in next major release (iText 7.2). The aim of this method overriding here is achieved by overriding
allowLastYLineRecursiveExtraction() method.
|
MinMaxWidth |
getMinMaxWidth()
Calculates min and max width values for current renderer.
|
IRenderer |
getNextRenderer()
Gets a new instance of this class to be used as a next renderer, after this renderer is used, if layout(LayoutContext) is called more than once.
|
LayoutResult |
layout(LayoutContext layoutContext)
This method simulates positioning of the renderer, including all of its children, and returns the LayoutResult , representing the layout result, including occupied area, status, i.e.
|
void |
move(float dxRight, float dyUp)
Moves the renderer subtree by the specified offset.
|
protected Float |
retrieveWidth(float parentBoxWidth)
Retrieves element's fixed content box width, if it's set.
|
protected TableRenderer[] |
split(int row) |
protected TableRenderer[] |
split(int row, boolean hasContent) |
protected TableRenderer[] |
split(int row, boolean hasContent, boolean cellWithBigRowspanAdded) |
addAllProperties, alignChildHorizontally, applyAbsolutePosition, applyAction, applyBorderBox, applyDestination, applyDestinationsAndAnnotation, applyLinkAnnotation, applyMargins, applyMargins, applyRelativePositioningTranslation, beginElementOpacityApplying, beginTransformationIfApplied, calculateAbsolutePdfBBox, calculateBBox, calculateShiftToPositionBBoxOfPointsAt, clipBackgroundArea, clipBackgroundArea, clipBorderArea, createXObject, deleteOwnProperty, deleteProperty, endElementOpacityApplying, endTransformationIfApplied, getBackgroundArea, getBorderAreaBBox, getBorderRadii, getBorders, getChildRenderers, getDefaultProperty, getFirstYLineRecursively, getInnerAreaBBox, getMargins, getModelElement, getOccupiedArea, getOccupiedAreaBBox, 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, rectangleToPointsList, retrieveHeight, retrieveMaxHeight, retrieveMaxWidth, retrieveMinHeight, retrieveMinWidth, retrieveUnitValue, retrieveUnitValue, setBorders, setMinMaxWidthBasedOnFixedWidth, setParent, setProperty, toString, transformPoints, updateHeight, updateHeightsOnSplit, updateMaxHeight, updateMinHeight, updateWidth
protected List<CellRenderer[]> rows
protected Table.RowRange rowRange
protected TableRenderer headerRenderer
protected TableRenderer footerRenderer
protected DivRenderer captionRenderer
protected boolean isOriginalNonSplitRenderer
public TableRenderer(Table modelElement, Table.RowRange rowRange)
Table
which will partially render the table.
modelElement
- the table to be rendered by this renderer
rowRange
- the table rows to be rendered
public void addChild(IRenderer renderer)
addChild
in interface IRenderer
addChild
in class AbstractRenderer
renderer
- a child to be added
protected Rectangle applyBorderBox(Rectangle rect, Border[] borders, boolean reverse)
AbstractRenderer
applyBorderBox
in class AbstractRenderer
rect
- a rectangle paddings will be applied on.
borders
- the borders
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.
border box
of the renderer
protected Rectangle applyPaddings(Rectangle rect, UnitValue[] paddings, boolean reverse)
AbstractRenderer
applyPaddings
in class AbstractRenderer
rect
- a rectangle paddings will be applied on.
paddings
- the paddings to be applied on the given rectangle
reverse
- indicates whether paddings will be applied inside (in case of false) or outside (in case of false) the rectangle.
border box
of the renderer
public Rectangle applyPaddings(Rectangle rect, boolean reverse)
AbstractRenderer
applyPaddings
in class AbstractRenderer
rect
- a rectangle paddings will be applied on.
reverse
- indicates whether paddings will be applied inside (in case of false) or outside (in case of false) the rectangle.
border box
of the renderer
AbstractRenderer.getPaddings()
public LayoutResult layout(LayoutContext layoutContext)
LayoutResult
, representing the layout result, including occupied area, status, i.e. if there was enough place to fit the renderer subtree, etc. LayoutResult
can be extended to return custom layout results for custom elements, e.g. TextRenderer
uses TextLayoutResult
as its result. This method can be called standalone to learn how much area the renderer subtree needs, or can be called before IRenderer.draw(DrawContext)
, to prepare the renderer to be flushed to the output stream.
layoutContext
- the description of layout area and any other additional information
public void draw(DrawContext drawContext)
PdfDocument
etc.
draw
in interface IRenderer
draw
in class AbstractRenderer
drawContext
- contains the PdfDocument
to which the renderer subtree if flushed, the PdfCanvas
on which the renderer subtree is drawn and other additional parameters needed to perform drawing
public void drawChildren(DrawContext drawContext)
children
of this renderer.
drawChildren
in class AbstractRenderer
drawContext
- the context (canvas, document, etc) of this drawing operation.
protected void drawBackgrounds(DrawContext drawContext)
protected void drawCaption(DrawContext drawContext)
public void drawBackground(DrawContext drawContext)
AbstractRenderer
Property.BACKGROUND
in either the layout element or this IRenderer
itself.
drawBackground
in class AbstractRenderer
drawContext
- the context (canvas, document, etc) of this drawing operation.
public IRenderer getNextRenderer()
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 TableRenderer
, one should override this method: otherwise the default method will be used and thus the default rather than the custom renderer will be created.
public void move(float dxRight, float dyUp)
move
in interface IRenderer
move
in class AbstractRenderer
dxRight
- the x-axis offset in points. Positive value will move the renderer subtree to the right.
dyUp
- the y-axis offset in points. Positive value will move the renderer subtree to the top.
protected TableRenderer[] split(int row)
protected TableRenderer[] split(int row, boolean hasContent)
protected TableRenderer[] split(int row, boolean hasContent, boolean cellWithBigRowspanAdded)
protected TableRenderer createSplitRenderer(Table.RowRange rowRange)
protected TableRenderer createOverflowRenderer(Table.RowRange rowRange)
protected Float retrieveWidth(float parentBoxWidth)
AbstractRenderer
Property.BOX_SIZING
, Property.MIN_WIDTH
, and Property.MAX_WIDTH
properties.
retrieveWidth
in class AbstractRenderer
parentBoxWidth
- width of the parent element content box. If element has relative width, it will be calculated relatively to this parameter.
AbstractRenderer.hasAbsoluteUnitValue(int)
public MinMaxWidth getMinMaxWidth()
AbstractRenderer
getMinMaxWidth
in class AbstractRenderer
MinMaxWidth
@Deprecated protected Float getLastYLineRecursively()
allowLastYLineRecursiveExtraction()
method.
getLastYLineRecursively
in class AbstractRenderer
protected boolean allowLastYLineRecursiveExtraction()
allowLastYLineRecursiveExtraction
in class AbstractRenderer
public void drawBorder(DrawContext drawContext)
AbstractRenderer
Property.BORDER
values in either the layout element or this IRenderer
itself.
drawBorder
in class AbstractRenderer
drawContext
- the context (canvas, document, etc) of this drawing operation.
protected void drawBorders(DrawContext drawContext)
protected void extendLastRow(CellRenderer[] lastRow, Rectangle freeBox)
Copyright © 1998–2023 iText Group NV. All rights reserved.