net.sf.paperclips
Class BasicGridLookPainter

java.lang.Object
  extended by net.sf.paperclips.BasicGridLookPainter
All Implemented Interfaces:
GridLookPainter

public abstract class BasicGridLookPainter
extends java.lang.Object
implements GridLookPainter

A abstract GridLookPainter which simplifies implementation of custom GridLooks.

Subclasses must have the following methods implemented:


Field Summary
protected  org.eclipse.swt.graphics.Device device
          The printer device on which the look is being painted.
 
Constructor Summary
BasicGridLookPainter(org.eclipse.swt.graphics.Device device)
          Constructs a BasicGridLook painter.
 
Method Summary
 void paint(org.eclipse.swt.graphics.GC gc, int x, int y, int[] columns, int[] headerRows, int[][] headerColSpans, int firstRowIndex, boolean topOpen, int[] bodyRows, int[][] bodyColSpans, boolean bottomOpen, int[] footerRows, int[][] footerColSpans)
          Paints the grid look onto the GC.
protected abstract  void paintBodyCell(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, int row, int col, int colspan, boolean topOpen, boolean bottomOpen)
          Paint the decorations for the described body cell.
protected abstract  void paintFooterCell(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, int row, int col, int colspan)
          Paint the decorations for the described footer cell.
protected abstract  void paintHeaderCell(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, int row, int col, int colspan)
          Paint the decorations for the described header cell.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.paperclips.GridLookPainter
dispose, getMargins
 

Field Detail

device

protected final org.eclipse.swt.graphics.Device device
The printer device on which the look is being painted. This is the device that was passed as an argument to the constructor.

Constructor Detail

BasicGridLookPainter

public BasicGridLookPainter(org.eclipse.swt.graphics.Device device)
Constructs a BasicGridLook painter.

Parameters:
device - the printer device (may not be null). This argument will be saved in the protected device field.
Method Detail

paint

public void paint(org.eclipse.swt.graphics.GC gc,
                  int x,
                  int y,
                  int[] columns,
                  int[] headerRows,
                  int[][] headerColSpans,
                  int firstRowIndex,
                  boolean topOpen,
                  int[] bodyRows,
                  int[][] bodyColSpans,
                  boolean bottomOpen,
                  int[] footerRows,
                  int[][] footerColSpans)
Description copied from interface: GridLookPainter
Paints the grid look onto the GC.

Specified by:
paint in interface GridLookPainter
Parameters:
gc - the graphics context to paint on.
x - the x coordinate of the top-left of the grid.
y - the y coordinate of the top-left of the grid.
columns - the column widths. The left and right margins of each cell are included in the column widths.
headerRows - the header row heights.
headerColSpans - a two-dimensional array of cell spans in the header. Each element in the outer array is a header row. Each element of an inner array is a cell, where the element value indicates how many columns the cell spans.
firstRowIndex - the zero-based index of the first row displayed on the page.
topOpen - whether the top body row should be drawn with the top edge of the cell border "open." An open top border is a visual indication that the top row is being continued from the previous page.
bodyRows - the body row heights.
bodyColSpans - a two-dimensional array of cell spans in the body. Each element in the outer array is a body row. Each element of an inner array is a cell, where the element value indicates how many columns the cell spans.
bottomOpen - whether the bottom body row should be drawn with the bottom edge of the cell border "open." An open bottom border is a visual indication that the bottom row will be continued on the next page.
footerRows - the footer row heights.
footerColSpans - a two-dimensional array of cell spans in the footer. Each element in the outer array is a footer row. Each element of an inner array is a cell, where the element value indicates how many columns the cell spans.

paintHeaderCell

protected abstract void paintHeaderCell(org.eclipse.swt.graphics.GC gc,
                                        org.eclipse.swt.graphics.Rectangle bounds,
                                        int row,
                                        int col,
                                        int colspan)
Paint the decorations for the described header cell.

Parameters:
gc - the graphics context to use for painting.
bounds - the bounds of the cell, excluding margins.
row - the row offset of the cell within the header.
col - the column offset of the cell within the header.
colspan - the number of columns that this cell spans.

paintBodyCell

protected abstract void paintBodyCell(org.eclipse.swt.graphics.GC gc,
                                      org.eclipse.swt.graphics.Rectangle bounds,
                                      int row,
                                      int col,
                                      int colspan,
                                      boolean topOpen,
                                      boolean bottomOpen)
Paint the decorations for the described body cell.

Parameters:
gc - the graphics context to use for painting.
bounds - the bounds of the cell, excluding margins.
row - the row offset of the cell within the header.
col - the column offset of the cell within the header.
colspan - the number of columns that this cell spans.
topOpen - whether the cell should be drawn with the top edge of the cell border "open." An open top border is a visual cue that the cell is being continued from the previous page.
bottomOpen - whether the cell should be drawn with the bottom edge of the cell border "open." An open bottom border is a visual cue that the cell will be continued on the next page.

paintFooterCell

protected abstract void paintFooterCell(org.eclipse.swt.graphics.GC gc,
                                        org.eclipse.swt.graphics.Rectangle bounds,
                                        int row,
                                        int col,
                                        int colspan)
Paint the decorations for the described footer cell.

Parameters:
gc - the graphics context to use for painting.
bounds - the bounds of the cell, excluding margins.
row - the row offset of the cell within the header.
col - the column offset of the cell within the header.
colspan - the number of columns that this cell spans.