Package com.itextpdf.layout.renderer
Class MulticolRenderer
java.lang.Object
com.itextpdf.layout.renderer.AbstractRenderer
com.itextpdf.layout.renderer.MulticolRenderer
- All Implemented Interfaces:
IPropertyContainer
,IRenderer
Represents a renderer for columns.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Interface which used for additional height calculationstatic class
static class
Represents result of one iteration of MulticolRenderer layouting It contains split renderers which were lauded on a given height and overflow renderer for which height should be increased, so it can be lauded. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate float
private int
private float
private float
private BlockRenderer
private Float
private boolean
private static final float
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
ConstructorsConstructorDescriptionMulticolRenderer
(MulticolContainer modelElement) Creates a DivRenderer from its corresponding layout object. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
applyWidth
(Rectangle parentBbox, float originalWidth) balanceContentAndLayoutColumns
(LayoutContext prelayoutContext, Rectangle actualBbox) private void
calculateColumnCountAndWidth
(float initialWidth) private LayoutArea
calculateContainerOccupiedArea
(LayoutContext layoutContext, boolean isFull) private void
protected AbstractRenderer
createOverflowRenderer
(IRenderer overflowedContentRenderer) Creates an overflow renderer.protected AbstractRenderer
createSplitRenderer
(List<IRenderer> children) Creates a split renderer.private Float
determineHeight
(Rectangle parentBBox) 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.private void
drawTaggedWhenNeeded
(DrawContext drawContext, Consumer<PdfCanvas> action) private BlockRenderer
Gets a new instance of this class to be used as a next renderer, after this renderer is used, ifIRenderer.layout(LayoutContext)
is called more than once.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.layoutColumnsAndReturnOverflowRenderer
(LayoutContext preLayoutContext, Rectangle actualBBox, float workingHeight) protected MulticolRenderer.MulticolLayoutResult
layoutInColumns
(LayoutContext layoutContext, Rectangle actualBBox) private void
recalculateHeightWidthAfterLayouting
(Rectangle parentBBox, boolean isFull) private float
safelyRetrieveFloatProperty
(int property) final void
setHeightCalculator
(MulticolRenderer.ColumnHeightCalculator heightCalculator) Sets the height calculator to be used by this renderer.private void
setOverflowForAllChildren
(IRenderer renderer) private float
updateOccupiedHeight
(float initialHeight, boolean isFull) Methods inherited from class com.itextpdf.layout.renderer.AbstractRenderer
addAllChildRenderers, addAllChildRenderers, addAllProperties, addChild, 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, 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
-
Field Details
-
ZERO_DELTA
private static final float ZERO_DELTA- See Also:
-
heightCalculator
-
elementRenderer
-
columnCount
private int columnCount -
columnWidth
private float columnWidth -
approximateHeight
private float approximateHeight -
heightFromProperties
-
columnGap
private float columnGap -
isFirstLayout
private boolean isFirstLayout
-
-
Constructor Details
-
MulticolRenderer
Creates a DivRenderer from its corresponding layout object.- Parameters:
modelElement
- theMulticolContainer
which this object should manage
-
-
Method Details
-
setHeightCalculator
Sets the height calculator to be used by this renderer.- Parameters:
heightCalculator
- the height calculator to be used by this renderer.
-
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
-
getNextRenderer
Gets a new instance of this class to be used as a next renderer, after this renderer is used, ifIRenderer.layout(LayoutContext)
is called more than once.- Returns:
- new renderer instance
-
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.
-
layoutInColumns
protected MulticolRenderer.MulticolLayoutResult layoutInColumns(LayoutContext layoutContext, Rectangle actualBBox) -
createSplitRenderer
Creates a split renderer.- Parameters:
children
- children of the split renderer- Returns:
- a new
AbstractRenderer
instance
-
createOverflowRenderer
Creates an overflow renderer.- Parameters:
overflowedContentRenderer
- an overflowed content renderer- Returns:
- a new
AbstractRenderer
instance
-
setOverflowForAllChildren
-
drawTaggedWhenNeeded
-
applyWidth
-
determineHeight
-
recalculateHeightWidthAfterLayouting
-
safelyRetrieveFloatProperty
private float safelyRetrieveFloatProperty(int property) -
balanceContentAndLayoutColumns
private MulticolRenderer.MulticolLayoutResult balanceContentAndLayoutColumns(LayoutContext prelayoutContext, Rectangle actualBbox) -
calculateColumnCountAndWidth
private void calculateColumnCountAndWidth(float initialWidth) -
clearOverFlowRendererIfNeeded
-
calculateContainerOccupiedArea
-
updateOccupiedHeight
private float updateOccupiedHeight(float initialHeight, boolean isFull) -
getElementsRenderer
-
layoutColumnsAndReturnOverflowRenderer
private MulticolRenderer.MulticolLayoutResult layoutColumnsAndReturnOverflowRenderer(LayoutContext preLayoutContext, Rectangle actualBBox, float workingHeight)
-