Class StyledTextPrint

java.lang.Object
net.sf.paperclips.StyledTextPrint
All Implemented Interfaces:
Print

public class StyledTextPrint extends Object implements Print
A class for printing styled text. Text of varying size and style are aligned along the baseline.
Author:
Matthew Hall
  • Constructor Details

    • StyledTextPrint

      public StyledTextPrint()
      Constructs a new StyledTextPrint.
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • setStyle

      public StyledTextPrint setStyle(TextStyle style)
      Sets the text style that will be applied to text added through the append(String)
      Parameters:
      style - the new text style.
      Returns:
      this StyledTextPrint, for chaining method calls.
    • append

      public StyledTextPrint append(String text)
      Appends the given text to the end of the document, using the default style. This method is equivalent to calling append(text, getStyle()).
      Parameters:
      text - the text to append.
      Returns:
      this StyledTextPrint, for chaining method calls.
    • append

      public StyledTextPrint append(String text, TextStyle style)
      Appends the given text to the end of the document, using the given style.
      Parameters:
      text - the text to append.
      style - the text style.
      Returns:
      this StyledTextPrint, for chaining method calls.
    • newline

      public StyledTextPrint newline()
      Appends a line break to the document. If a line break produces a blank line, that line will take the height of the font in the default text style.
      Returns:
      this StyledTextPrint, for chaining method calls.
    • append

      public StyledTextPrint append(Print element)
      Appends the given element to the document.
      Parameters:
      element - the element to append.
      Returns:
      this StyledTextPrint, for chaining method calls.
    • iterator

      public PrintIterator iterator(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc)
      Description copied from interface: Print
      Returns a PrintIterator for laying out the contents of this Print. The iterator uses a snapshot of the print at the time this method is invoked, so subsequent changes to the Print will not affect the output of the iterator.
      Specified by:
      iterator in interface Print
      Parameters:
      device - the graphics device this Print will be drawn onto.
      gc - the graphics context to be used for calculating layout and drawing the Print's contents.
      Returns:
      a PrintIterator for laying out the contents of this Print.