Class MulticolRenderer

java.lang.Object
com.itextpdf.layout.renderer.AbstractRenderer
com.itextpdf.layout.renderer.MulticolRenderer
All Implemented Interfaces:
IPropertyContainer, IRenderer

public class MulticolRenderer extends AbstractRenderer
Represents a renderer for columns.
  • Field Details

    • ZERO_DELTA

      private static final float ZERO_DELTA
      See Also:
    • heightCalculator

      private MulticolRenderer.ColumnHeightCalculator heightCalculator
    • elementRenderer

      private BlockRenderer elementRenderer
    • columnCount

      private int columnCount
    • columnWidth

      private float columnWidth
    • approximateHeight

      private float approximateHeight
    • heightFromProperties

      private Float heightFromProperties
    • columnGap

      private float columnGap
    • isFirstLayout

      private boolean isFirstLayout
  • Constructor Details

    • MulticolRenderer

      public MulticolRenderer(MulticolContainer modelElement)
      Creates a DivRenderer from its corresponding layout object.
      Parameters:
      modelElement - the MulticolContainer which this object should manage
  • Method Details

    • setHeightCalculator

      public final void setHeightCalculator(MulticolRenderer.ColumnHeightCalculator heightCalculator)
      Sets the height calculator to be used by this renderer.
      Parameters:
      heightCalculator - the height calculator to be used by this renderer.
    • layout

      public 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. 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.
      Parameters:
      layoutContext - the description of layout area and any other additional information
      Returns:
      result of the layout process
    • getNextRenderer

      public IRenderer getNextRenderer()
      Gets a new instance of this class to be used as a next renderer, after this renderer is used, if IRenderer.layout(LayoutContext) is called more than once.
      Returns:
      new renderer instance
    • drawBorder

      public 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.
      Overrides:
      drawBorder in class AbstractRenderer
      Parameters:
      drawContext - the context (canvas, document, etc) of this drawing operation.
    • layoutInColumns

      protected MulticolRenderer.MulticolLayoutResult layoutInColumns(LayoutContext layoutContext, Rectangle actualBBox)
    • createSplitRenderer

      protected AbstractRenderer createSplitRenderer(List<IRenderer> children)
      Creates a split renderer.
      Parameters:
      children - children of the split renderer
      Returns:
      a new AbstractRenderer instance
    • createOverflowRenderer

      protected AbstractRenderer createOverflowRenderer(IRenderer overflowedContentRenderer)
      Creates an overflow renderer.
      Parameters:
      overflowedContentRenderer - an overflowed content renderer
      Returns:
      a new AbstractRenderer instance
    • setOverflowForAllChildren

      private void setOverflowForAllChildren(IRenderer renderer)
    • drawTaggedWhenNeeded

      private void drawTaggedWhenNeeded(DrawContext drawContext, Consumer<PdfCanvas> action)
    • applyWidth

      private void applyWidth(Rectangle parentBbox, float originalWidth)
    • determineHeight

      private Float determineHeight(Rectangle parentBBox)
    • recalculateHeightWidthAfterLayouting

      private void recalculateHeightWidthAfterLayouting(Rectangle parentBBox, boolean isFull)
    • safelyRetrieveFloatProperty

      private float safelyRetrieveFloatProperty(int property)
    • balanceContentAndLayoutColumns

      private MulticolRenderer.MulticolLayoutResult balanceContentAndLayoutColumns(LayoutContext prelayoutContext, Rectangle actualBbox)
    • calculateColumnCountAndWidth

      private void calculateColumnCountAndWidth(float initialWidth)
    • clearOverFlowRendererIfNeeded

      private void clearOverFlowRendererIfNeeded(MulticolRenderer.MulticolLayoutResult result)
    • calculateContainerOccupiedArea

      private LayoutArea calculateContainerOccupiedArea(LayoutContext layoutContext, boolean isFull)
    • updateOccupiedHeight

      private float updateOccupiedHeight(float initialHeight, boolean isFull)
    • getElementsRenderer

      private BlockRenderer getElementsRenderer()
    • layoutColumnsAndReturnOverflowRenderer

      private MulticolRenderer.MulticolLayoutResult layoutColumnsAndReturnOverflowRenderer(LayoutContext preLayoutContext, Rectangle actualBBox, float workingHeight)