Class PrintFigureOperation

java.lang.Object
org.eclipse.draw2d.PrintOperation
org.eclipse.draw2d.PrintFigureOperation

public class PrintFigureOperation extends PrintOperation
Class responsible for printing Figures.
  • Field Details

    • TILE

      public static final int TILE
      The default print mode. Prints at 100% scale and tiles horizontally and/or vertically, if necessary.
      See Also:
    • FIT_PAGE

      public static final int FIT_PAGE
      A print mode that scales the printer graphics so that the entire printed image fits on one page.
      See Also:
    • FIT_WIDTH

      public static final int FIT_WIDTH
      A print mode that scales the printer graphics so that the width of the printed image fits on one page and tiles vertically, if necessary.
      See Also:
    • FIT_HEIGHT

      public static final int FIT_HEIGHT
      A print mode that scales the printer graphics so that the height of the printed image fits on one page and tiles horizontally, if necessary.
      See Also:
  • Constructor Details

    • PrintFigureOperation

      protected PrintFigureOperation(Printer p)
      Constructor for PrintFigureOperation.

      Note: Descendants must call setPrintSource(IFigure) to set the IFigure that is to be printed.

      See Also:
    • PrintFigureOperation

      public PrintFigureOperation(Printer p, IFigure srcFigure)
      Constructor for PrintFigureOperation.
      Parameters:
      p - Printer to print on
      srcFigure - Figure to print
  • Method Details

    • getPrintMode

      protected int getPrintMode()
      Returns the current print mode. The print mode is one of: FIT_HEIGHT, FIT_PAGE, or FIT_WIDTH.
      Returns:
      the print mode
    • getPrintSource

      protected IFigure getPrintSource()
      Returns the printSource.
      Returns:
      IFigure The source IFigure
    • preparePrintSource

      protected void preparePrintSource()
      Description copied from class: PrintOperation
      This method contains all operations performed to sourceFigure prior to being printed.
      Overrides:
      preparePrintSource in class PrintOperation
      See Also:
    • printPages

      protected void printPages()
      Prints the pages based on the current print mode.
      Specified by:
      printPages in class PrintOperation
      See Also:
    • restorePrintSource

      protected void restorePrintSource()
      Description copied from class: PrintOperation
      This method contains all operations performed to sourceFigure after being printed.
      Overrides:
      restorePrintSource in class PrintOperation
      See Also:
    • setPrintMode

      public void setPrintMode(int mode)
      Sets the print mode. Possible values are TILE, FIT_HEIGHT, FIT_WIDTH and FIT_PAGE.
      Parameters:
      mode - the print mode
    • setPrintSource

      protected void setPrintSource(IFigure printSource)
      Sets the printSource.
      Parameters:
      printSource - The printSource to set
    • setupPrinterGraphicsFor

      protected void setupPrinterGraphicsFor(Graphics graphics, IFigure figure)
      Sets up Graphics object for the given IFigure.
      Parameters:
      graphics - The Graphics to setup
      figure - The IFigure used to setup graphics