org.eclipse.draw2d

## Class PrintFigureOperation

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

    public class PrintFigureOperation
    extends PrintOperation

Class responsible for printing Figures.

### Field Summary

Fields
`static 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.
`static int` `FIT_PAGE` A print mode that scales the printer graphics so that the entire printed image fits on one page.
`static 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.
`static int` `TILE` The default print mode.

### Constructor Summary

Constructors
`protected` `PrintFigureOperation(Printer p)` Constructor for PrintFigureOperation.
`` `PrintFigureOperation(Printer p, IFigure srcFigure)` Constructor for PrintFigureOperation.

### Method Summary

Methods
`protected int` `getPrintMode()` Returns the current print mode.
`protected IFigure` `getPrintSource()` Returns the printSource.
`protected void` `preparePrintSource()` This method contains all operations performed to sourceFigure prior to being printed.
`protected void` `printPages()` Prints the pages based on the current print mode.
`protected void` `restorePrintSource()` This method contains all operations performed to sourceFigure after being printed.
`void` `setPrintMode(int mode)` Sets the print mode.
`protected void` `setPrintSource(IFigure printSource)` Sets the printSource.
`protected void` `setupPrinterGraphicsFor(Graphics graphics, IFigure figure)` Sets up Graphics object for the given IFigure.

### Methods inherited from class org.eclipse.draw2d.PrintOperation

`cleanup, getFreshPrinterGraphics, getPrinter, getPrintRegion, run, setPrinter, setPrintMargin, setupGraphicsForPage`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### TILE

    public static final int TILE

The default print mode. Prints at 100% scale and tiles horizontally and/or vertically, if necessary.

See Also:
  Constant Field Values

#### 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:
  Constant Field Values

#### 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:
  Constant Field Values

#### 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:
  Constant Field Values

### Constructor Detail

#### 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:
  `PrintOperation.PrintOperation(Printer)`

#### PrintFigureOperation

    public PrintFigureOperation(Printer p,
                        IFigure srcFigure)

Constructor for PrintFigureOperation.

Parameters:
  `p` - Printer to print on
  `srcFigure` - Figure to print

### Method Detail

#### 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:
  `PrintOperation.preparePrintSource()`

#### printPages

    protected void printPages()

Prints the pages based on the current print mode.

Specified by:
  `printPages` in class `PrintOperation`
See Also:
  `PrintOperation.printPages()`

#### 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:
  `PrintOperation.restorePrintSource()`

#### 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