Package com.itextpdf.layout.renderer
Class RootRenderer
java.lang.Object
com.itextpdf.layout.renderer.AbstractRenderer
com.itextpdf.layout.renderer.RootRenderer
- All Implemented Interfaces:
IPropertyContainer
,IRenderer
- Direct Known Subclasses:
CanvasRenderer
,DocumentRenderer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RootLayoutArea
private boolean
protected boolean
private LayoutArea
private IRenderer
private LayoutResult
private MarginsCollapseHandler
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 -
Method Summary
Modifier and TypeMethodDescriptionprivate void
void
Adds a child to the current rendererprivate void
void
close()
This method correctly closes theRootRenderer
instance.void
flush()
Draws (flushes) the content.protected abstract void
flushSingleRenderer
(IRenderer resultRenderer) protected void
(package private) void
flushWaitingDrawingElements
(boolean force) layout
(LayoutContext layoutContext) This method simulates positioning of the renderer, including all of its children, and returns theLayoutResult
, representing the layout result, including occupied area, status, i.e.(package private) final void
linkRenderToDocument
(IRenderer renderer, PdfDocument pdfDocument) private void
processRenderer
(IRenderer renderer, List<IRenderer> resultRenderers) private void
processWaitingKeepWithNextElement
(IRenderer renderer) protected void
shrinkCurrentAreaAndProcessRenderer
(IRenderer renderer, List<IRenderer> resultRenderers, LayoutResult result) private boolean
tryDisableKeepTogether
(LayoutResult result, boolean rendererIsFloat, RootRendererAreaStateHandler rootRendererStateHandler) private void
updateCurrentAndInitialArea
(LayoutResult overflowResult) protected abstract LayoutArea
updateCurrentArea
(LayoutResult overflowResult) private boolean
updateForcedPlacement
(IRenderer currentRenderer, IRenderer overflowRenderer) Methods inherited from class com.itextpdf.layout.renderer.AbstractRenderer
addAllChildRenderers, addAllChildRenderers, addAllProperties, addChildRenderer, alignChildHorizontally, allowLastYLineRecursiveExtraction, applyAbsolutePosition, applyAbsolutePositionIfNeeded, applyAction, applyBorderBox, applyBorderBox, applyDestination, applyDestinationsAndAnnotation, applyLinkAnnotation, applyMargins, applyMargins, applyMarginsBordersPaddings, applyPaddings, applyPaddings, applyRelativePositioningTranslation, beginElementOpacityApplying, beginTransformationIfApplied, calculateAbsolutePdfBBox, calculateAdditionalWidth, calculateBBox, calculatePaddingBorderHeight, calculatePaddingBorderWidth, calculateShiftToPositionBBoxOfPointsAt, clipBackgroundArea, clipBackgroundArea, clipBorderArea, createFontCharacteristics, createXObject, deleteOwnProperty, deleteProperty, draw, drawBackground, drawBorder, drawChildren, drawPositionedChildren, endElementOpacityApplying, endTransformationIfApplied, getAspectRatio, getBackgroundArea, getBorderAreaBBox, getBorderRadii, getBorders, getBorders, getChildRenderers, getDefaultProperty, getFirstYLineRecursively, getInnerAreaBBox, getLastYLineRecursively, getMargins, getMinMaxWidth, getModelElement, getOccupiedArea, getOccupiedAreaBBox, 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, retrieveUnitValue, retrieveUnitValue, retrieveWidth, returnBackOwnProperty, setBorders, setChildRenderer, setChildRenderers, setMinMaxWidthBasedOnFixedWidth, setParent, setProperty, setThisAsParent, shrinkOccupiedAreaForAbsolutePosition, toString, transformPoints, updateHeight, updateHeightsOnSplit, updateHeightsOnSplit, updateMaxHeight, updateMinHeight, updateWidth
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.itextpdf.layout.renderer.IRenderer
getNextRenderer
-
Field Details
-
immediateFlush
protected boolean immediateFlush -
currentArea
-
waitingDrawingElements
-
floatRendererAreas
-
keepWithNextHangingRenderer
-
keepWithNextHangingRendererLayoutResult
-
marginsCollapseHandler
-
initialCurrentArea
-
waitingNextPageRenderers
-
floatOverflowedCompletely
private boolean floatOverflowedCompletely
-
-
Constructor Details
-
RootRenderer
public RootRenderer()
-
-
Method Details
-
addChild
Description copied from class:AbstractRenderer
Adds a child to the current renderer- Specified by:
addChild
in interfaceIRenderer
- Overrides:
addChild
in classAbstractRenderer
- Parameters:
renderer
- a child to be added
-
flush
public void flush()Draws (flushes) the content.- See Also:
-
close
public void close()This method correctly closes theRootRenderer
instance. There might be hanging elements, like in case ofProperty.KEEP_WITH_NEXT
is set to true and when no consequent element has been added. This method addresses such situations. -
layout
This method simulates positioning of the renderer, including all of its children, and returns theLayoutResult
, 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
usesTextLayoutResult
as its result. This method can be called standalone to learn how much area the renderer subtree needs, or can be called beforeIRenderer.draw(DrawContext)
, to prepare the renderer to be flushed to the output stream.- Parameters:
layoutContext
- the description of layout area and any other additional information- Returns:
- result of the layout process
-
getCurrentArea
-
flushSingleRenderer
-
updateCurrentArea
-
shrinkCurrentAreaAndProcessRenderer
protected void shrinkCurrentAreaAndProcessRenderer(IRenderer renderer, List<IRenderer> resultRenderers, LayoutResult result) -
flushWaitingDrawingElements
protected void flushWaitingDrawingElements() -
flushWaitingDrawingElements
void flushWaitingDrawingElements(boolean force) -
linkRenderToDocument
-
processRenderer
-
processWaitingKeepWithNextElement
-
updateCurrentAndInitialArea
-
addAllWaitingNextPageRenderers
private void addAllWaitingNextPageRenderers() -
addWaitingNextPageRenderers
private void addWaitingNextPageRenderers() -
updateForcedPlacement
-
tryDisableKeepTogether
private boolean tryDisableKeepTogether(LayoutResult result, boolean rendererIsFloat, RootRendererAreaStateHandler rootRendererStateHandler)
-