Class MulticolRenderer

    • Field Detail

      • columnCount

        private int columnCount
      • columnWidth

        private float columnWidth
      • approximateHeight

        private float approximateHeight
      • heightFromProperties

        private java.lang.Float heightFromProperties
      • columnGap

        private float columnGap
      • containerWidth

        private float containerWidth
      • isFirstLayout

        private boolean isFirstLayout
    • Constructor Detail

      • MulticolRenderer

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

      • 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.
      • 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,
                                          java.util.function.Consumer<PdfCanvas> action)
      • applyWidth

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

        private java.lang.Float determineHeight​(Rectangle parentBBox)
      • calculateColumnCountAndWidth

        private void calculateColumnCountAndWidth​(float initialWidth)
      • calculateContainerOccupiedArea

        private LayoutArea calculateContainerOccupiedArea​(LayoutContext layoutContext,
                                                          boolean isFull)
      • getElementsRenderer

        private BlockRenderer getElementsRenderer()