Package net.sf.paperclips
Class CompositePiece
java.lang.Object
net.sf.paperclips.CompositePiece
- All Implemented Interfaces:
PrintPiece
A composite PrintPiece for displaying child PrintPieces. This class is
especially useful for Print implementations that perform layout of multiple
child Prints.
- Author:
- Matthew Hall
-
Constructor Summary
ConstructorsConstructorDescriptionCompositePiece(List entries) Constructs a composite PrintPiece with the given entries.CompositePiece(List entries, org.eclipse.swt.graphics.Point size) Constructs a composite PrintPiece with the given entries and minimum size.CompositePiece(CompositeEntry[] entries) Constructs a CompositePiece with the given entries.CompositePiece(CompositeEntry[] entries, org.eclipse.swt.graphics.Point size) Constructs a CompositePrintPiece with the given entries and explicit size. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Disposes the system resources allocated by this PrintPiece.org.eclipse.swt.graphics.PointgetSize()Returns the dimensions of this PrintPiece, in pixels.voidpaint(org.eclipse.swt.graphics.GC gc, int x, int y) Draws this PrintPiece on the given graphics device, at the given coordinates.
-
Constructor Details
-
CompositePiece
Constructs a CompositePiece with the given entries.- Parameters:
entries- an array of entries that make up this PrintPiece.
-
CompositePiece
Constructs a CompositePrintPiece with the given entries and explicit size. This constructor will increase the explicit size to completely contain any child entries which extend outside the given size.- Parameters:
entries- an array of entries that make up this PrintPiece.size-
-
CompositePiece
Constructs a composite PrintPiece with the given entries.- Parameters:
entries- an array of entries that make up this PrintPiece.
-
CompositePiece
Constructs a composite PrintPiece with the given entries and minimum size.- Parameters:
entries- a list of CompositeEntry objects describing the child PrintPieces.size- a hint indicating the minimum size that should be reported from getSize(). This constructor increase this size to fit any entries that extend outside the given size.
-
-
Method Details
-
getSize
public org.eclipse.swt.graphics.Point getSize()Description copied from interface:PrintPieceReturns the dimensions of this PrintPiece, in pixels.- Specified by:
getSizein interfacePrintPiece- Returns:
- the dimensions of this PrintPiece, in pixels.
-
paint
public void paint(org.eclipse.swt.graphics.GC gc, int x, int y) Description copied from interface:PrintPieceDraws this PrintPiece on the given graphics device, at the given coordinates.- Specified by:
paintin interfacePrintPiece- Parameters:
gc- a graphics context for the graphics device.x- the x coordinate where this PrintPiece will be drawn.y- the x coordinate where this PrintPiece will be drawn.
-
dispose
public void dispose()Description copied from interface:PrintPieceDisposes the system resources allocated by this PrintPiece. The dispose method is not a permanent disposal of a PrintPiece. It is intended to reclaim system resources, however future calls to paint(GC,int,int) may require that the resources be allocated again.- Specified by:
disposein interfacePrintPiece
-