ice.storm.print
Class AbstractStormPrinter

java.lang.Object
  extended byice.storm.print.AbstractStormPrinter
All Implemented Interfaces:
StormPrinter

public abstract class AbstractStormPrinter
extends Object
implements StormPrinter

Defines common behaviors for pilot printers.

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

Field Summary
protected  int currentPageIndex
           
protected  int numberOfPages
          Number of pages that can be printed.
protected  StormPageFormat pageFormat
          StormPageFormat - store page formating information for print.
 
Constructor Summary
AbstractStormPrinter()
          Default Constructor: A new StormPageFormat object is associated with the printer with values defined in the StormPageFormat default constructor.
AbstractStormPrinter(StormPageFormat pageFormat)
          Default Constructor: A StormPageFormat is passed into the constructor.
 
Method Summary
abstract  void dispose()
          Dispose of this printer
abstract  Dimension getDimension()
          Gets the dimension of the pilots layout in points.
abstract  int getPageCount()
          Instance variable numberOfPages should be maintained by this mehtod.
 int getPageIndex()
          Return the current page index.
 StormPageFormat getStormPageFormat()
          Gets the StormPageFormat representing the page format properties.
abstract  int getZoom()
          Gets the zoom factor of the pilots viewport.
 boolean layoutNextPage()
          Layout the next page.
abstract  void print(Graphics g)
          Print the full Graphics rendering of the pilot view with out pagination.
 void printPage(Graphics g)
          Print the currently laid out page to the Graphics context g.
abstract  void printPage(Graphics g, int pageIndex)
          Print the specified pageIndex.
 void setPageIndex(int pageIndex)
          Set the current page index to pageIndex.
 void setPageSize(int width, int height)
          Sets the paper size.
 void setStormPageFormat(StormPageFormat stormPageFormat)
          The Page layout will only be recalculated if the stormPageFormat differs from the previous value.
abstract  void setZoom(int zoom)
          Set the zoom factor of the pilots viewport.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pageFormat

protected StormPageFormat pageFormat
StormPageFormat - store page formating information for print.


numberOfPages

protected int numberOfPages
Number of pages that can be printed.


currentPageIndex

protected int currentPageIndex
Constructor Detail

AbstractStormPrinter

public AbstractStormPrinter()
Default Constructor: A new StormPageFormat object is associated with the printer with values defined in the StormPageFormat default constructor. The current number of pages is not calculated.


AbstractStormPrinter

public AbstractStormPrinter(StormPageFormat pageFormat)
Default Constructor: A StormPageFormat is passed into the constructor. The current number of pages is not calculated.

Method Detail

setStormPageFormat

public void setStormPageFormat(StormPageFormat stormPageFormat)
                        throws IllegalArgumentException
The Page layout will only be recalculated if the stormPageFormat differs from the previous value.

Specified by:
setStormPageFormat in interface StormPrinter
Parameters:
stormPageFormat - the StormPageFormat object to be assigned to the printer
Throws:
IllegalArgumentException - a null stormPageFormat instance was passed as a parameter

getZoom

public abstract int getZoom()
Description copied from interface: StormPrinter
Gets the zoom factor of the pilots viewport.

Specified by:
getZoom in interface StormPrinter
Returns:
value of the current zoom factor
See Also:
StormPrinter.setZoom(int)

getStormPageFormat

public StormPageFormat getStormPageFormat()
Description copied from interface: StormPrinter
Gets the StormPageFormat representing the page format properties.

Specified by:
getStormPageFormat in interface StormPrinter
Returns:
StormPageFormat object

getPageCount

public abstract int getPageCount()
Instance variable numberOfPages should be maintained by this mehtod.

Specified by:
getPageCount in interface StormPrinter
Returns:
total number of pages for print layout

dispose

public abstract void dispose()
Description copied from interface: StormPrinter
Dispose of this printer

Specified by:
dispose in interface StormPrinter

printPage

public void printPage(Graphics g)
Description copied from interface: StormPrinter
Print the currently laid out page to the Graphics context g.

Specified by:
printPage in interface StormPrinter
Parameters:
g - the current page will be printed to the g.

printPage

public abstract void printPage(Graphics g,
                               int pageIndex)
Print the specified pageIndex.

Specified by:
printPage in interface StormPrinter
Parameters:
g - the context into which the page is drawn
pageIndex - the zero based index of the page to be drawn

print

public abstract void print(Graphics g)
Description copied from interface: StormPrinter
Print the full Graphics rendering of the pilot view with out pagination.

Specified by:
print in interface StormPrinter
Parameters:
g - Graphics object to print pageIndex to

getDimension

public abstract Dimension getDimension()
Description copied from interface: StormPrinter
Gets the dimension of the pilots layout in points. The dimension is independent of the paper width and height set in the StormPageFormat.

Specified by:
getDimension in interface StormPrinter
Returns:
Dimension an Dimension object represents the actual width and height of the content laid out by the pilot.

layoutNextPage

public boolean layoutNextPage()
Description copied from interface: StormPrinter
Layout the next page. Returns true if this page exists, false otherwise. The page Index is not incremented past the total number of pages.

Specified by:
layoutNextPage in interface StormPrinter

setPageSize

public void setPageSize(int width,
                        int height)
Description copied from interface: StormPrinter
Sets the paper size.

Specified by:
setPageSize in interface StormPrinter
Parameters:
width - width of page measured in points
height - height of page measured in points

setPageIndex

public void setPageIndex(int pageIndex)
Description copied from interface: StormPrinter
Set the current page index to pageIndex. If the pageIndex is less than zero, the index is set to the first page index. If the pageIndex is greater than getPageCount() then the last page index is set as the currentPage.

Specified by:
setPageIndex in interface StormPrinter
Parameters:
pageIndex - the zero based index of the current index page
See Also:
StormPrinter.getPageIndex()

getPageIndex

public int getPageIndex()
Description copied from interface: StormPrinter
Return the current page index.

Specified by:
getPageIndex in interface StormPrinter
Returns:
pageIndex the zero based index of the current index page
See Also:
StormPrinter.setPageIndex(int)

setZoom

public abstract void setZoom(int zoom)
Description copied from interface: StormPrinter
Set the zoom factor of the pilots viewport. The total number of pages is recalculate after the zoom has been set. Negative zoom values are converted to positive values.

Specified by:
setZoom in interface StormPrinter
Parameters:
zoom - value of new zoom factor
See Also:
StormPrinter.getZoom()