ice.storm.print
Class AbstractPageDecoration

java.lang.Object
  extended byice.storm.print.AbstractPageDecoration
All Implemented Interfaces:
PageDecoration
Direct Known Subclasses:
PageNumberPageDecoration, StringPageDecoration

public abstract class AbstractPageDecoration
extends Object
implements PageDecoration

An implementation of the PageDecoration interface to serve as a basis for implementing various kinds of page decorations. This class introduces a basic naming system for the placement of page decorations on the page and an associated name, which is used by the PageSetupDialog. The placement positions are only references and must be implemented in the paint method.

Since:
6.0
Version:
%I%, %G%
Author:
Patrick Corless

Field Summary
static int BOTTOM
          Box-orientation constant used to specify the bottom of a box.
static int CENTER
          The central position in an area.
protected  int horizontalAlignment
           
static int LEFT
          Box-orientation constant used to specify the left side of a box.
protected  String name
           
static int OTHER
          Constant used to specify a non box-orientation.
static int RIGHT
          Box-orientation constant used to specify the right side of a box.
static int TOP
          ox-orientation constant used to specify the top of a box.
protected  int verticalAlignment
           
 
Constructor Summary
AbstractPageDecoration(String name, int verticalAlignment, int horizontalAlignment)
          Constructs a new AbstractPageDecoration instance.
 
Method Summary
 int getHorizontalAlignment()
          Get the horizontal alignment associated with the page decoration.
 String getName()
          Get the descriptive name of the page decorations.
 int getVerticalAlignment()
          Get the vertical alignment associated with the page decoration.
abstract  void paint(Graphics g, int currentPageIndex, int pageCount, StormPageFormat pageFormat)
          Paint the page decoration.
 void setName(String name)
          Set the descriptive name of the page decoration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CENTER

public static int CENTER
The central position in an area.


LEFT

public static int LEFT
Box-orientation constant used to specify the left side of a box.


RIGHT

public static int RIGHT
Box-orientation constant used to specify the right side of a box.


TOP

public static int TOP
ox-orientation constant used to specify the top of a box.


BOTTOM

public static int BOTTOM
Box-orientation constant used to specify the bottom of a box.


OTHER

public static int OTHER
Constant used to specify a non box-orientation.


verticalAlignment

protected int verticalAlignment

horizontalAlignment

protected int horizontalAlignment

name

protected String name
Constructor Detail

AbstractPageDecoration

public AbstractPageDecoration(String name,
                              int verticalAlignment,
                              int horizontalAlignment)
Constructs a new AbstractPageDecoration instance.

Parameters:
name - Descriptive name of decoration being created
verticalAlignment - vertical alignment constant, LEFT, RIGHT or CENTER
horizontalAlignment - horizontal alignment constant, TOP OR BOTTOM
Method Detail

setName

public void setName(String name)
Set the descriptive name of the page decoration. This name is used by the PageSetup dialog for the placement of page decorations.

Parameters:
name - desciptive name fo the page decoration

getName

public String getName()
Get the descriptive name of the page decorations.

Returns:
descriptive name of the page decoration

getHorizontalAlignment

public int getHorizontalAlignment()
Get the horizontal alignment associated with the page decoration.

Returns:
value which represents the horizontal alignment

getVerticalAlignment

public int getVerticalAlignment()
Get the vertical alignment associated with the page decoration.

Returns:
value which represents the vertical alignment

paint

public abstract void paint(Graphics g,
                           int currentPageIndex,
                           int pageCount,
                           StormPageFormat pageFormat)
Paint the page decoration. This method is invoked by the StormPrinter when one of the print methods are called.

Specified by:
paint in interface PageDecoration
Parameters:
g - graphics context in which the decoration will be painted to.
currentPageIndex - page number of the page being printed. This is useful as some page decoration that should only be printed on specific page or need to paint page numbers.
pageCount - the total number of pages being printed in the print job
pageFormat - the StormPageFormat associated with the StormPrinter. The pageFormat is essential for retrieving the page dimensions and coordinates for painting the decoration .