Class Discretionary

All Implemented Interfaces:
Dimensions

public class Discretionary extends NonDiscardableElement
Represents a discretionary line break, storing both the split and unsplit versions of the text.
  • Field Details

  • Constructor Details

    • Discretionary

      public Discretionary(HBox preBreak, HBox postBreak, HBox noBreak, int penalty)
  • Method Details

    • getPreBreak

      public HBox getPreBreak()
    • getPostBreak

      public HBox getPostBreak()
    • getNoBreak

      public HBox getNoBreak()
    • getPenalty

      public int getPenalty()
    • getWidth

      public long getWidth()
      Description copied from class: Element
      Return the width of the element.
      Specified by:
      getWidth in interface Dimensions
      Specified by:
      getWidth in class Element
    • getHeight

      public long getHeight()
      Description copied from class: Element
      Return the height (above the baseline) of the element.
      Specified by:
      getHeight in interface Dimensions
      Specified by:
      getHeight in class Element
    • getDepth

      public long getDepth()
      Description copied from class: Element
      Return the depth (below the baseline) of the element.
      Specified by:
      getDepth in interface Dimensions
      Specified by:
      getDepth in class Element
    • 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.
      Specified by:
      layOutHorizontally in class Element
      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
    • layOutVertically

      public long layOutVertically(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 vertical sequence.
      Specified by:
      layOutVertically in class Element
      Parameters:
      x - the left-most point of the element.
      y - the upper-left point of the element.
      contents - the stream to add the element to.
      Returns:
      how much to move down 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 Element
    • 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 Element
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object