net.sf.paperclips
Class CompositePiece

java.lang.Object
  extended by net.sf.paperclips.CompositePiece
All Implemented Interfaces:
PrintPiece

public class CompositePiece
extends java.lang.Object
implements PrintPiece

A composite PrintPiece for displaying child PrintPieces. This class is especially useful for Print implementations that perform layout of multiple child Prints.


Constructor Summary
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.
CompositePiece(java.util.List entries)
          Constructs a composite PrintPiece with the given entries.
CompositePiece(java.util.List entries, org.eclipse.swt.graphics.Point size)
          Constructs a composite PrintPiece with the given entries and minimum size.
 
Method Summary
 void dispose()
          Disposes the system resources allocated by this PrintPiece.
 org.eclipse.swt.graphics.Point getSize()
          Returns the dimensions of this PrintPiece, in pixels.
 void paint(org.eclipse.swt.graphics.GC gc, int x, int y)
          Draws this PrintPiece on the given graphics device, at the given coordinates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositePiece

public CompositePiece(CompositeEntry[] entries)
Constructs a CompositePiece with the given entries.

Parameters:
entries - an array of entries that make up this PrintPiece.

CompositePiece

public CompositePiece(CompositeEntry[] entries,
                      org.eclipse.swt.graphics.Point size)
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

public CompositePiece(java.util.List entries)
Constructs a composite PrintPiece with the given entries.

Parameters:
entries - an array of entries that make up this PrintPiece.

CompositePiece

public CompositePiece(java.util.List entries,
                      org.eclipse.swt.graphics.Point size)
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 Detail

getSize

public org.eclipse.swt.graphics.Point getSize()
Description copied from interface: PrintPiece
Returns the dimensions of this PrintPiece, in pixels.

Specified by:
getSize in interface PrintPiece
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: PrintPiece
Draws this PrintPiece on the given graphics device, at the given coordinates.

Specified by:
paint in interface PrintPiece
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: PrintPiece
Disposes 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:
dispose in interface PrintPiece