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
public class CellRenderer extends BlockRenderer
Represents a renderer for theCelllayout element.
-
-
Field Summary
-
Fields inherited from class com.itextpdf.layout.renderer.AbstractRenderer
BOTTOM_SIDE, childRenderers, EPS, flushed, INF, isLastRendererForModelElement, LEFT_SIDE, modelElement, occupiedArea, OVERLAP_EPSILON, parent, positionedRenderers, properties, RIGHT_SIDE, TOP_SIDE
-
-
Constructor Summary
Constructors Constructor Description CellRenderer(Cell modelElement)Creates a CellRenderer from its corresponding layout object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RectangleapplyBorderBox(Rectangle rect, Border[] borders, boolean reverse)Applies the given border box (borders) on the given rectangleprotected RectangleapplyMargins(Rectangle rect, UnitValue[] margins, boolean reverse)Applies given margins on the given rectangleprotected RectangleapplySpacings(Rectangle rect, boolean reverse)Applies spacings on the given rectangle.protected RectangleapplySpacings(Rectangle rect, float[] spacings, boolean reverse)Applies given spacings on the given rectangle.protected AbstractRenderercreateOverflowRenderer(int layoutResult)Creates an overflow renderer.protected AbstractRenderercreateSplitRenderer(int layoutResult)Creates a split renderer.voiddrawBackground(DrawContext drawContext)Draws a background layer if it is defined by a keyProperty.BACKGROUNDin either the layout element or thisIRendereritself.voiddrawBorder(DrawContext drawContext)Performs the drawing operation for the border of this renderer, if defined by theProperty.BORDER_TOP,Property.BORDER_RIGHT,Property.BORDER_BOTTOMandProperty.BORDER_LEFTvalues in either the layout element or thisIRendereritself.IPropertyContainergetModelElement()Gets the model element associated with this renderer.IRenderergetNextRenderer()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 java.lang.FloatretrieveWidth(float parentBoxWidth)Retrieves element's fixed content box width, if it's set.-
Methods inherited from class com.itextpdf.layout.renderer.BlockRenderer
applyMaxHeight, applyMinHeight, applyRotationLayout, applyVerticalAlignment, applyWidth, beginRotationIfApplied, correctFixedLayout, createRotationTransformInsideOccupiedArea, createSplitAndOverflowRenderers, decreaseLayoutBoxAfterChildPlacement, draw, endRotationIfApplied, fixOccupiedAreaIfOverflowedX, fixOccupiedAreaIfOverflowedY, getMinMaxWidth, getMinMaxWidth, getOccupiedAreaBBox, getResolvedFont, handleForcedPlacement, layout, processNotFullChildResult, recalculateLayoutBoxBeforeChildLayout, recalculateOccupiedAreaAfterChildLayout, startChildMarginsHandling, stopLayoutingChildrenIfChildResultNotFull
-
Methods inherited from class com.itextpdf.layout.renderer.AbstractRenderer
addAllChildRenderers, addAllChildRenderers, addAllProperties, addChild, addChildRenderer, alignChildHorizontally, allowLastYLineRecursiveExtraction, applyAbsolutePosition, applyAbsolutePositionIfNeeded, applyAction, applyBorderBox, applyDestination, applyDestinationsAndAnnotation, applyLinkAnnotation, applyMargins, applyMarginsBordersPaddings, applyPaddings, applyPaddings, applyRelativePositioningTranslation, beginElementOpacityApplying, beginTransformationIfApplied, calculateAbsolutePdfBBox, calculateAdditionalWidth, calculateBBox, calculatePaddingBorderHeight, calculatePaddingBorderWidth, calculateShiftToPositionBBoxOfPointsAt, clipBackgroundArea, clipBackgroundArea, clipBorderArea, createFontCharacteristics, createXObject, deleteOwnProperty, deleteProperty, drawChildren, drawPositionedChildren, endElementOpacityApplying, endTransformationIfApplied, getAspectRatio, getBackgroundArea, getBorderAreaBBox, getBorderRadii, getBorders, getBorders, getChildRenderers, getDefaultProperty, getFirstYLineRecursively, getInnerAreaBBox, getLastYLineRecursively, getMargins, getOccupiedArea, getOwnProperties, getOwnProperty, getPaddings, getParent, getPdfDocument, getProperty, getProperty, getPropertyAsBoolean, getPropertyAsColor, getPropertyAsFloat, getPropertyAsFloat, getPropertyAsFloat, getPropertyAsFont, getPropertyAsInteger, getPropertyAsTransparentColor, getPropertyAsUnitValue, getPropertyAsUnitValue, getRootRenderer, hasAbsoluteUnitValue, hasAspectRatio, hasOwnOrModelProperty, hasOwnProperty, hasProperty, hasRelativeUnitValue, initElementAreas, isAbsolutePosition, isBorderBoxSizing, isFirstOnRootArea, isFirstOnRootArea, isFixedLayout, isFlushed, isKeepTogether, isKeepTogether, isNotFittingHeight, isNotFittingLayoutArea, isNotFittingWidth, isOverflowFit, isOverflowProperty, isOverflowProperty, isOverflowProperty, isPositioned, isRelativePosition, isStaticLayout, logWarningIfGetNextRendererNotOverridden, move, noAbsolutePositionInfo, preparePositionedRendererAndAreaForLayout, processWaitingDrawing, rectangleToPointsList, removeAllChildRenderers, removeChildRenderer, replaceOwnProperty, resolveFirstPdfFont, resolveFirstPdfFont, retrieveHeight, retrieveMaxHeight, retrieveMaxWidth, retrieveMinHeight, retrieveMinWidth, retrieveResolvedDeclaredHeight, retrieveUnitValue, retrieveUnitValue, returnBackOwnProperty, setBorders, setChildRenderer, setChildRenderers, setMinMaxWidthBasedOnFixedWidth, setParent, setProperty, setThisAsParent, shrinkOccupiedAreaForAbsolutePosition, toString, transformPoints, updateHeight, updateHeightsOnSplit, updateHeightsOnSplit, updateMaxHeight, updateMinHeight, updateWidth
-
-
-
-
Method Detail
-
getModelElement
public IPropertyContainer getModelElement()
Gets the model element associated with this renderer.- Specified by:
getModelElementin interfaceIRenderer- Overrides:
getModelElementin classAbstractRenderer- Returns:
- the model element, as a
container of properties
-
retrieveWidth
protected java.lang.Float retrieveWidth(float parentBoxWidth)
Description copied from class:AbstractRendererRetrieves element's fixed content box width, if it's set. Takes into accountProperty.BOX_SIZING,Property.MIN_WIDTH, andProperty.MAX_WIDTHproperties.- Overrides:
retrieveWidthin 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:
AbstractRenderer.hasAbsoluteUnitValue(int)
-
createSplitRenderer
protected AbstractRenderer createSplitRenderer(int layoutResult)
Creates a split renderer.- Overrides:
createSplitRendererin classBlockRenderer- Parameters:
layoutResult- the result of content layouting- Returns:
- a new
AbstractRendererinstance
-
createOverflowRenderer
protected AbstractRenderer createOverflowRenderer(int layoutResult)
Creates an overflow renderer.- Overrides:
createOverflowRendererin classBlockRenderer- Parameters:
layoutResult- the result of content layouting- Returns:
- a new
AbstractRendererinstance
-
drawBackground
public void drawBackground(DrawContext drawContext)
Description copied from class:AbstractRendererDraws a background layer if it is defined by a keyProperty.BACKGROUNDin either the layout element or thisIRendereritself.- Overrides:
drawBackgroundin classAbstractRenderer- Parameters:
drawContext- the context (canvas, document, etc) of this drawing operation.
-
drawBorder
public void drawBorder(DrawContext drawContext)
Performs the drawing operation for the border of this renderer, if defined by theProperty.BORDER_TOP,Property.BORDER_RIGHT,Property.BORDER_BOTTOMandProperty.BORDER_LEFTvalues in either the layout element or thisIRendereritself.- Overrides:
drawBorderin classAbstractRenderer- Parameters:
drawContext- the context (canvas, document, etc.) of this drawing operation
-
applyBorderBox
protected Rectangle applyBorderBox(Rectangle rect, Border[] borders, boolean reverse)
Description copied from class:AbstractRendererApplies the given border box (borders) on the given rectangle- Overrides:
applyBorderBoxin classAbstractRenderer- Parameters:
rect- a rectangle paddings will be applied on.borders- thebordersto be applied on the given rectanglereverse- indicates whether the border box will be applied inside (in case of false) or outside (in case of false) the rectangle.- Returns:
- a
border boxof the renderer
-
applyMargins
protected Rectangle applyMargins(Rectangle rect, UnitValue[] margins, boolean reverse)
Description copied from class:AbstractRendererApplies given margins on the given rectangle- Overrides:
applyMarginsin classAbstractRenderer- Parameters:
rect- a rectangle margins will be applied on.margins- the margins to be applied on the given rectanglereverse- indicates whether margins will be applied inside (in case of false) or outside (in case of true) the rectangle.- Returns:
- a
border boxof the renderer
-
applySpacings
protected Rectangle applySpacings(Rectangle rect, boolean reverse)
Applies spacings on the given rectangle.- Parameters:
rect- a rectangle spacings will be applied onreverse- indicates whether spacings will be applied inside (in case of false) or outside (in case of true) the rectangle.- Returns:
- a
border boxof the renderer
-
applySpacings
protected Rectangle applySpacings(Rectangle rect, float[] spacings, boolean reverse)
Applies given spacings on the given rectangle.- Parameters:
rect- a rectangle spacings will be applied onspacings- the spacings to be applied on the given rectanglereverse- indicates whether spacings will be applied inside (in case of false) or outside (in case of true) the rectangle.- Returns:
- a
border boxof the renderer
-
getNextRenderer
public IRenderer 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
-
-