Class RootRenderer

All Implemented Interfaces:
IPropertyContainer, IRenderer
Direct Known Subclasses:
CanvasRenderer, DocumentRenderer

public abstract class RootRenderer extends AbstractRenderer
  • Field Details

    • immediateFlush

      protected boolean immediateFlush
    • currentArea

      protected RootLayoutArea currentArea
    • waitingDrawingElements

      protected List<IRenderer> waitingDrawingElements
  • Constructor Details

    • RootRenderer

      public RootRenderer()
  • Method Details

    • addChild

      public void addChild (IRenderer renderer)
      Description copied from class: AbstractRenderer
      Adds a child to the current renderer
      Specified by:
      addChild in interface IRenderer
      addChild in class AbstractRenderer
      renderer - a child to be added
    • flush

      public void flush()
      Draws (flushes) the content.
      See Also:
    • close

      public void close()
      This method correctly closes the RootRenderer instance. There might be hanging elements, like in case of Property.KEEP_WITH_NEXT is set to true and when no consequent element has been added. This method addresses such situations.
    • 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.
      layoutContext - the description of layout area and any other additional information
      result of the layout process
    • getCurrentArea

      public LayoutArea getCurrentArea()
    • flushSingleRenderer

      protected abstract void flushSingleRenderer (IRenderer resultRenderer)
    • updateCurrentArea

      protected abstract LayoutArea updateCurrentArea (LayoutResult overflowResult)
    • shrinkCurrentAreaAndProcessRenderer

      protected void shrinkCurrentAreaAndProcessRenderer (IRenderer renderer, List<IRenderer> resultRenderers, LayoutResult result)
    • flushWaitingDrawingElements

      protected void flushWaitingDrawingElements()