Class VerticalList

java.lang.Object
com.teamten.typeset.ElementList
com.teamten.typeset.VerticalList
All Implemented Interfaces:
ElementSink

public class VerticalList extends ElementList
Accumulates elements in a vertical list until the document is finished, at which point a list of pages (type VBox) is generated.
  • Constructor Details

    • VerticalList

      public VerticalList()
  • Method Details

    • addElement

      public void addElement(Element element)
      Override this so that we can insert glues between lines to create an even baseline skip.
      Specified by:
      addElement in interface ElementSink
      Overrides:
      addElement in class ElementList
    • getBaselineSkip

      public long getBaselineSkip()
      Get the distance between baselines.
    • getFirstHBoxHeight

      public long getFirstHBoxHeight()
      Get the height of the first HBox we saw.
    • getLastHBoxDepth

      public long getLastHBoxDepth()
      Get the depth of the most recent HBox we've seen.
    • skipNextLeadingAdjust

      public void skipNextLeadingAdjust()
      Skip the next vertical space inserted before an HBox to get the leading to work. This is useful before things like horizontal lines that don't need to be on any leading and the extra space would throw things off. It only skips once, resetting after the next element.
    • changeColumnLayout

      public void changeColumnLayout(@NotNull @NotNull ColumnLayout columnLayout)
      Specify that there should be a new column layout after the last-inserted element.
    • setBaselineSkip

      public long setBaselineSkip(long baselineSkip)
      Specify the distance between baselines. This is normally scaled by the font size, for example 120% of font size. Set this between paragraphs when the font size changes.
      Returns:
      the previous baseline skip.
    • makeOutputBox

      protected Page makeOutputBox(List<Element> elements, int counter, long shift)
      Description copied from class: ElementList
      Generate the Box that will be sent to the output.
      Specified by:
      makeOutputBox in class ElementList
      Parameters:
      elements - the elements of the box.
      counter - the number of the box, starting from 1. For horizontal lists this is the line number of the paragraph. For vertical lists this is the physical page number.
      shift - how much to shift the box in the final layout (up or to the right).
    • getElementSize

      protected long getElementSize(Element element)
      Description copied from class: ElementList
      Return the size (width for horizontal lists, height + depth for vertical lists) of the element.
      Specified by:
      getElementSize in class ElementList
    • getElementSublist

      protected List<Element> getElementSublist(ElementList.Breakpoint beginBreakpoint, ElementList.Breakpoint endBreakpoint)
      Return the list of elements on this page, from beginBreakpoint (inclusive) to endBreakpoint (exclusive). Combines elements of multiple columns into groups.
      Specified by:
      getElementSublist in class ElementList
    • getChunkExtraIncrement

      protected int getChunkExtraIncrement(Chunk chunk)
      Description copied from class: ElementList
      When generating breakpoints, if there are images and other things in a chunk, we must adjust the counter if those images will take up space (such as a space).
      Specified by:
      getChunkExtraIncrement in class ElementList
    • newPage

      public void newPage()
      Like ejectPage(), but only if the document is not empty.
    • oddPage

      public void oddPage()
      Like newPage(), but ensures that the next page is an odd page.
    • ejectPage

      public void ejectPage()
      Add infinite vertical glue and force a page break.