Class BlockFlowLayout

All Implemented Interfaces:
LayoutManager, FlowContext
Direct Known Subclasses:
PageFlowLayout

public class BlockFlowLayout extends FlowContainerLayout
The layout for BlockFlow figures.

WARNING: This class is not intended to be subclassed by clients.

Since:
2.1
  • Constructor Details

    • BlockFlowLayout

      public BlockFlowLayout(BlockFlow blockFlow)
      Creates a new BlockFlowLayout with the given BlockFlow.
      Parameters:
      blockFlow - the BlockFlow
  • Method Details

    • addCurrentLine

      protected void addCurrentLine()
      Align the line horizontally and then commit it.
    • addLine

      public void addLine(CompositeBox box)
      Description copied from interface: FlowContext
      Adds an entire line into the context. If there is a previous line, it is ended.
      Parameters:
      box - the line being added
      See Also:
    • blockContentsChanged

      public void blockContentsChanged()
      Marks the blocks contents as changed. This means that children will be invalidated during validation.
      Since:
      3.1
    • cleanup

      protected void cleanup()
      Description copied from class: FlowContainerLayout
      Flush anything pending and free all temporary data used during layout.
      Overrides:
      cleanup in class FlowContainerLayout
      See Also:
    • createNewLine

      protected void createNewLine()
      Description copied from class: FlowContainerLayout
      Used by getCurrentLine().
      Specified by:
      createNewLine in class FlowContainerLayout
      See Also:
    • endBlock

      protected void endBlock()
      Called by flush(), adds the BlockBox associated with this BlockFlowLayout to the current line and then ends the line.
    • endLine

      public void endLine()
      Description copied from interface: FlowContext
      The current line should be committed if it is occupied, and then set to null. Otherwise, do nothing.
      See Also:
    • flush

      protected void flush()
      Description copied from class: FlowContainerLayout
      Called after FlowContainerLayout.layoutChildren() when all children have been laid out. This method exists to flush the last line.
      Specified by:
      flush in class FlowContainerLayout
      See Also:
    • getBlockFlow

      protected final BlockFlow getBlockFlow()
      Returns the BlockFlow associated with this BlockFlowLayout
      Returns:
      the BlockFlow
    • getContinueOnSameLine

      public boolean getContinueOnSameLine()
      Description copied from interface: FlowContext
      This method is used to convey layout state to different FlowFigures. This state is cleared when a fragment is added to the current line and once the layout is complete.
      Returns:
      true if the next fragment should be placed on the current line
      See Also:
    • getWidthLookahead

      public void getWidthLookahead(FlowFigure child, int[] result)
      Description copied from interface: FlowContext
      This method looks ahead for line-breaks. When laying out, this method can be used to determine the next line-break across multiple figures.
      Parameters:
      child - the search will occur starting from the figure after the given child
      result - the width before the next line-break (if one's found; all the width, otherwise) will be added on to the first int in the given array
      See Also:
    • preLayout

      protected void preLayout()
      Description copied from class: FlowContainerLayout
      Called before layoutChildren() to setup any necessary state.
      Specified by:
      preLayout in class FlowContainerLayout
      See Also:
    • setContinueOnSameLine

      public void setContinueOnSameLine(boolean value)
      Description copied from interface: FlowContext
      This method is used to convey layout state to different FlowFigures. This state is cleared when a fragment is added and once the layout is complete.
      Parameters:
      value - true indicates that the first fragment of the next TextFlow should be laid out on the current line, and not a new one
      See Also:
    • setupBlock

      protected void setupBlock()
      sets up the single block that contains all of the lines.