net.sf.paperclips
Interface BorderPainter

All Known Implementing Classes:
AbstractBorderPainter

public interface BorderPainter

Interface for calculating and drawing borders in a BorderPrint.


Method Summary
 void dispose()
          Disposes the system resources allocated by this BorderPainter.
 int getBottom(boolean open)
          Returns the border inset, in pixels, from the bottom.
 int getHeight(boolean topOpen, boolean bottomOpen)
          Returns the sum of the top and bottom border insets.
 int getLeft()
          Returns the border inset, in pixels, from the left.
 int getMaxHeight()
          Returns the sum of the maximum top and bottom border insets.
 org.eclipse.swt.graphics.Point getOverlap()
          Returns the x and y distance that two of the same BorderPainters would overlap to create the appearance of a single border between the two.
 int getRight()
          Returns the border inset, in pixels, from the right.
 int getTop(boolean open)
          Returns the border inset, in pixels, from the top.
 int getWidth()
          Returns the sum of the left and right border insets.
 void paint(org.eclipse.swt.graphics.GC gc, int x, int y, int width, int height, boolean topOpen, boolean bottomOpen)
          Paints a border around the specified region.
 

Method Detail

getLeft

int getLeft()
Returns the border inset, in pixels, from the left.

Returns:
the border inset, in pixels, from the left.

getRight

int getRight()
Returns the border inset, in pixels, from the right.

Returns:
the border inset, in pixels, from the right.

getWidth

int getWidth()
Returns the sum of the left and right border insets.

Returns:
the sum of the left and right border insets.

getTop

int getTop(boolean open)
Returns the border inset, in pixels, from the top.

Parameters:
open - If true, the inset of an open border will be returned. If false, the inset of a closed border will be returned.
Returns:
the border inset, in pixels, from the top.

getBottom

int getBottom(boolean open)
Returns the border inset, in pixels, from the bottom.

Parameters:
open - If true, the inset of an open border will be returned. If false, the inset of a closed border will be returned.
Returns:
the border inset, in pixels, from the bottom.

getHeight

int getHeight(boolean topOpen,
              boolean bottomOpen)
Returns the sum of the top and bottom border insets.

Parameters:
topOpen - If true, the inset of an open border will be returned. If false, the inset of a closed border will be returned.
bottomOpen - If true, the inset of an open border will be returned. If false, the inset of a closed border will be returned.
Returns:
the sum of the top and bottom border insets.

getMaxHeight

int getMaxHeight()
Returns the sum of the maximum top and bottom border insets.

Returns:
the sum of the maximum top and bottom border insets.

getOverlap

org.eclipse.swt.graphics.Point getOverlap()
Returns the x and y distance that two of the same BorderPainters would overlap to create the appearance of a single border between the two. This method is used by GridPrint whenever the horizontal and/or vertical spacing fields are set to GridPrint.BORDER_OVERLAP.

Returns:
the distance that this border painter would overlap an adjacent one.

paint

void paint(org.eclipse.swt.graphics.GC gc,
           int x,
           int y,
           int width,
           int height,
           boolean topOpen,
           boolean bottomOpen)
Paints a border around the specified region. Depending on the type of border, the top and bottom of may be painted differently depending on the values of topOpen and bottomOpen.

Parameters:
gc - The graphics context to paint on.
x - The x coordinate of the top left corner of the border.
y - The y coordinate of the top left corner of the border.
width - The width of the border to paint
height - The height of the border to paint
topOpen - If true, the top border should be drawn "open," to indicate that this is the continuation of a border in a previous iteration. If false, the border should be drawn "closed" to indicate that this is the first iteration on the BorderPrint's target.
bottomOpen - If true, the bottom border should be drawn "open," to indicate that the BorderPrint's target was not consumed in this iteration. If false, the bottom border should be drawn "closed," to indicate that the BorderPrint's target completed during this iteration.

dispose

void dispose()
Disposes the system resources allocated by this BorderPainter. The dispose method is not a permanent disposal of a BorderPainter. It is intended to reclaim system resources, however future calls to paint(GC,int,int) may require that the resources be allocated again.