Class SidewaysPrint

  • All Implemented Interfaces:
    Print

    public final class SidewaysPrint
    extends java.lang.Object
    implements Print
    A decorator print that rotates it's target by increments of 90 degrees.

    Note: On Windows, this class depends on a bugfix available as of Eclipse build 3.2, release candidate 3 (2006-04-28). Prior to this release, using SidewaysPrint triggers the bug, causing the document to scale very large on paper. This bug only manifests itself on paper, not with on-screen viewing.

    SidewaysPrint, unlike RotatePrint, is neither horizontally nor vertically greedy. Greedy prints take up all the available space on the page.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int angle  
      private Print target  
    • Constructor Summary

      Constructors 
      Constructor Description
      SidewaysPrint​(Print target)
      Constructs a SidewaysPrint that rotates it's target 90 degrees counter-clockwise.
      SidewaysPrint​(Print target, int angle)
      Constructs a SidewaysPrint.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static int checkAngle​(int angle)  
      boolean equals​(java.lang.Object obj)  
      int getAngle()
      Returns the angle by which the target will be rotated (one of 0, 90, 180, or 270).
      Print getTarget()
      Returns the print to be rotated.
      int hashCode()  
      PrintIterator iterator​(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc)
      Returns a PrintIterator for laying out the contents of this Print.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • target

        private final Print target
      • angle

        private final int angle
    • Constructor Detail

      • SidewaysPrint

        public SidewaysPrint​(Print target)
        Constructs a SidewaysPrint that rotates it's target 90 degrees counter-clockwise.
        Parameters:
        target - the print to rotate.
      • SidewaysPrint

        public SidewaysPrint​(Print target,
                             int angle)
        Constructs a SidewaysPrint.
        Parameters:
        target - the print to rotate.
        angle - the angle by which the target will be rotated, expressed in degrees counter-clockwise. Positive values rotate counter-clockwise, and negative values rotate clockwise. Must be a multiple of 90.
    • Method Detail

      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • checkAngle

        private static int checkAngle​(int angle)
      • getTarget

        public Print getTarget()
        Returns the print to be rotated.
        Returns:
        the print to be rotated.
      • getAngle

        public int getAngle()
        Returns the angle by which the target will be rotated (one of 0, 90, 180, or 270).
        Returns:
        the angle by which the target will be rotated.
      • 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.