Class LinePrint

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

public class LinePrint extends Object implements Print
A Print for drawing horizontal and vertical lines.

LinePrints are either horizontally or vertically greedy, according to the orientation of the line. Greedy prints take up all the available space on the page.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a horizontal LinePrint.
    LinePrint(int orientation)
    Constructs a LinePrint with the given orientation and 1-point thickness.
    LinePrint(int orientation, double thickness)
    Constructs a LinePrint with the given orientation and thickness.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
    Returns the line orientation (one of SWT.HORIZONTAL or SWT.VERTICAL).
    org.eclipse.swt.graphics.RGB
    Returns the line color.
    double
    Returns the line thickness, in points.
    int
     
    iterator(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc)
    Returns a PrintIterator for laying out the contents of this Print.
    void
    setRGB(org.eclipse.swt.graphics.RGB foreground)
    Sets the line color to the argument.
    void
    setThickness(double thickness)
    Sets the line thickness, in points.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LinePrint

      public LinePrint()
      Constructs a horizontal LinePrint.
    • LinePrint

      public LinePrint(int orientation)
      Constructs a LinePrint with the given orientation and 1-point thickness.
      Parameters:
      orientation - one of SWT#HORIZONTAL or SWT#VERTICAL.
    • LinePrint

      public LinePrint(int orientation, double thickness)
      Constructs a LinePrint with the given orientation and thickness.
      Parameters:
      orientation - one of SWT#HORIZONTAL or SWT#VERTICAL.
      thickness - the line thickness, expressed in points.
  • Method Details

    • hashCode

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

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

      public int getOrientation()
      Returns the line orientation (one of SWT.HORIZONTAL or SWT.VERTICAL).
      Returns:
      the line orientation.
    • getThickness

      public double getThickness()
      Returns the line thickness, in points. 72 points = 1".
      Returns:
      the line thickness, in points.
    • setThickness

      public void setThickness(double thickness)
      Sets the line thickness, in points. 72 points = 1".
      Parameters:
      thickness - the line thickness, in points.
    • setRGB

      public void setRGB(org.eclipse.swt.graphics.RGB foreground)
      Sets the line color to the argument.
      Parameters:
      foreground - the new line color.
    • getRGB

      public org.eclipse.swt.graphics.RGB getRGB()
      Returns the line color.
      Returns:
      the line color.
    • 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.