Class Leader

All Implemented Interfaces:
Dimensions, Flexible

public class Leader extends Glue
Like glue, but draws a pattern over and over (e.g., for table of contents).
  • Constructor Details

    • Leader

      public Leader(SizedFont font, String pattern, long stretch)
      Creates a leader which can be used like any other horizontal glue.
      Parameters:
      pattern - For table of contents you want something like " . "
      stretch - how much (infinite) stretchability. 1pt is good for this.
  • Method Details

    • fixed

      public Leader fixed(long newSize)
      Description copied from interface: Flexible
      Fix the element to the specified size.
      Specified by:
      fixed in interface Flexible
      Overrides:
      fixed in class Glue
    • layOutHorizontally

      public long layOutHorizontally(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) throws IOException
      Description copied from class: Element
      Add the element to the contents as part of a horizontal sequence.
      Overrides:
      layOutHorizontally in class Glue
      Parameters:
      x - the left-most point of the element.
      y - the baseline of the element.
      contents - the stream to add the element to.
      Returns:
      how much to move right afterward.
      Throws:
      IOException
    • println

      public void println(PrintStream stream, String indent)
      Description copied from class: Element
      Pretty prints the element to the PrintWriter with the given indent. The method must print its own newline.
      Overrides:
      println in class Glue
    • toTextString

      public String toTextString()
      Description copied from class: Element
      Return a text version of the element, ideally containing only the text of the element and its children.
      Overrides:
      toTextString in class Glue