com.tensegrity.gui.swt.print
Class GraphPrinter

java.lang.Object
  extended bycom.tensegrity.gui.swt.print.GraphPrinter

public class GraphPrinter
extends java.lang.Object

The GraphPrinter class is the counterpart to the Swing GraphPrintable class. It provides method to print a VisualGraphView to a Display or to render it to an image.

Version:
$Id: GraphPrinter.java,v 1.19 2005/11/08 10:58:39 ArndHouben Exp $
Author:
Arnd Houben

Field Summary
 boolean inhibitLT2RBFlip
          Inhibit x flipping.
 boolean inhibitYFlip
          Inhibit y flipping.
 
Constructor Summary
GraphPrinter(VisualGraphView vgView, double viewScale, int rows, int cols)
          Constructs a new GraphPrinter instance for the given VisualGraphView.
 
Method Summary
 boolean drawCutBorder()
          Returns the draw cut border flag
 void drawCutBorder(boolean b)
          Sets the draw cut border flag
 boolean drawMargins()
          Returns the draw margin flag
 void drawMargins(boolean b)
          Sets the draw margin flag
static double getMaximumHeightDouble(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc, FormatItem[] items, BasePageFormat cpf)
          The method getMaximumHeightDouble returns the maximum height required for the list of FormatItems.
 void printTo(org.eclipse.swt.graphics.Device swtDevice, org.eclipse.swt.graphics.GC gc, BasePageFormat bpf, int row, int col, int pageIndex)
          Prints the page of the graph specified by row and col to the given device by using the given graphic context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inhibitLT2RBFlip

public boolean inhibitLT2RBFlip
Inhibit x flipping.


inhibitYFlip

public boolean inhibitYFlip
Inhibit y flipping.

Constructor Detail

GraphPrinter

public GraphPrinter(VisualGraphView vgView,
                    double viewScale,
                    int rows,
                    int cols)
Constructs a new GraphPrinter instance for the given VisualGraphView.

Parameters:
vgView - the view to print
viewScale - the view scale used to render
rows - defines in how many rows this view is devided
cols - defines in how many columns this view is devided
Method Detail

drawMargins

public final void drawMargins(boolean b)
Sets the draw margin flag

Parameters:
b - the new value for the draw margin flag

drawMargins

public final boolean drawMargins()
Returns the draw margin flag

Returns:
true if a margin should be drawn, false otherwise

drawCutBorder

public final void drawCutBorder(boolean b)
Sets the draw cut border flag

Parameters:
b - the new value for the draw cut border flag

drawCutBorder

public final boolean drawCutBorder()
Returns the draw cut border flag

Returns:
true if a cut border should be drawn, false otherwise

printTo

public final void printTo(org.eclipse.swt.graphics.Device swtDevice,
                          org.eclipse.swt.graphics.GC gc,
                          BasePageFormat bpf,
                          int row,
                          int col,
                          int pageIndex)
Prints the page of the graph specified by row and col to the given device by using the given graphic context.

Parameters:
swtDevice - a swt device to draw on (could be a printer too)
gc - the graphic context used for drawing
bpf - the page format
row - the row index of the view part which should be drawn
col - the columm index of the view part which should be drawn
pageIndex - the page index

getMaximumHeightDouble

public static double getMaximumHeightDouble(org.eclipse.swt.graphics.Device device,
                                            org.eclipse.swt.graphics.GC gc,
                                            FormatItem[] items,
                                            BasePageFormat cpf)
The method getMaximumHeightDouble returns the maximum height required for the list of FormatItems. This method determines the expected string bounds for each items text element and returns the maximum resulting height.

Parameters:
device - the device which renders the font
gc - graphics context to use to determine expected bounds
items - list of items to check.
cpf - PageFormat responsible for the scaled font.
Returns:
the height in pixel.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.