ice.storm.print
Class PageNumberPageDecoration

java.lang.Object
  extended byice.storm.print.AbstractPageDecoration
      extended byice.storm.print.PageNumberPageDecoration
All Implemented Interfaces:
PageDecoration

public class PageNumberPageDecoration
extends AbstractPageDecoration

The PageNumberPageDecoration paints "x of y" just outside of the pages margins to the specified vertical and horizontal alignment. Where x is the current page number and y is the total number of pages in the document. This class is a demonstration of how AbstractPageDecoration can be implemented and used.

Since:
6.0
Version:
%I%, %G%
Author:
Patrick Corless
See Also:
AbstractPageDecoration

Field Summary
 
Fields inherited from class ice.storm.print.AbstractPageDecoration
BOTTOM, CENTER, horizontalAlignment, LEFT, name, OTHER, RIGHT, TOP, verticalAlignment
 
Constructor Summary
PageNumberPageDecoration(String name, int verticalAlignment, int horizontalAlignment)
          Create a new PageNumberPageDecoration object.
 
Method Summary
 void paint(Graphics g, int currentPageIndex, int pageCount, StormPageFormat pageFormat)
          Paint the page decoration.
 
Methods inherited from class ice.storm.print.AbstractPageDecoration
getHorizontalAlignment, getName, getVerticalAlignment, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageNumberPageDecoration

public PageNumberPageDecoration(String name,
                                int verticalAlignment,
                                int horizontalAlignment)
Create a new PageNumberPageDecoration object.

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

paint

public void paint(Graphics g,
                  int currentPageIndex,
                  int pageCount,
                  StormPageFormat pageFormat)
Description copied from class: AbstractPageDecoration
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
Specified by:
paint in class AbstractPageDecoration
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 .