jgnash.ui.checks
Class PrintableCheckLayout

java.lang.Object
  extended by jgnash.ui.checks.PrintableCheckLayout
All Implemented Interfaces:
java.awt.print.Printable

 class PrintableCheckLayout
extends java.lang.Object
implements java.awt.print.Printable

Check layout object

Version:
$Id$
Author:
Craig Cavanaugh

Field Summary
private  CheckLayout checkLayout
           
private  java.awt.Font font
           
private  java.awt.font.FontRenderContext frc
           
private  java.awt.print.PrinterJob job
           
private  java.awt.print.PageFormat pageFormat
           
private static float space
           
private  boolean testPrint
           
private  java.awt.Font testPrintFont
           
private  Transaction[] transations
           
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
protected PrintableCheckLayout(CheckLayout layout)
           
 
Method Summary
private  void drawAmount(java.awt.Graphics2D g2, CheckObject object, float offset, java.math.BigDecimal amount)
           
private  void drawAmountText(java.awt.Graphics2D g2, CheckObject object, float offset, java.math.BigDecimal amount)
           
private  void drawCheck(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D bounds, java.math.BigDecimal amount, java.util.Date date, java.lang.String memo, java.lang.String payee)
           
private  void drawDate(java.awt.Graphics2D g2, CheckObject object, float offset, java.util.Date date)
           
private  void drawMemo(java.awt.Graphics2D g2, CheckObject object, float offset, java.lang.String memo)
           
private  void drawPayee(java.awt.Graphics2D g2, CheckObject object, float offset, java.lang.String payee)
           
private  void drawSheet(java.awt.Graphics2D g2, java.awt.print.PageFormat format, Transaction[] list)
          Paint a sheet on checks on the graphics device given an array of transactions.
 double getCheckHeight()
           
 CheckLayout getCheckLayout()
           
 CheckObject[] getCheckObjects()
           
 int getNumChecks()
           
 java.awt.print.PageFormat getPageFormat()
           
private  java.awt.print.PrinterJob getPrinterJob()
           
protected  java.awt.print.PageFormat pageSetup()
           
protected  void print()
          This will print the sheet checks (Transactions)
 int print(java.awt.Graphics graphics, java.awt.print.PageFormat pf, int pageIndex)
          Prints the page at the specified index into the specified Graphics context in the specified format.
protected  void print(Transaction[] t)
          This will print the sheet checks (Transactions)
 void setCheckHeight(double height)
           
 void setCheckLayout(CheckLayout layout)
           
 void setNumChecks(int count)
           
 void setTestPrint(boolean testPrint)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

checkLayout

private CheckLayout checkLayout

transations

private Transaction[] transations

pageFormat

private java.awt.print.PageFormat pageFormat

testPrint

private boolean testPrint

font

private java.awt.Font font

testPrintFont

private java.awt.Font testPrintFont

frc

private java.awt.font.FontRenderContext frc

job

private java.awt.print.PrinterJob job

space

private static float space
Constructor Detail

PrintableCheckLayout

protected PrintableCheckLayout(CheckLayout layout)
Method Detail

setCheckLayout

public void setCheckLayout(CheckLayout layout)

getCheckLayout

public CheckLayout getCheckLayout()

getPrinterJob

private java.awt.print.PrinterJob getPrinterJob()

pageSetup

protected java.awt.print.PageFormat pageSetup()

print

protected void print()
This will print the sheet checks (Transactions)


print

protected void print(Transaction[] t)
This will print the sheet checks (Transactions)

Parameters:
t - transactions to print

getCheckObjects

public CheckObject[] getCheckObjects()

setCheckHeight

public void setCheckHeight(double height)

getCheckHeight

public double getCheckHeight()

setNumChecks

public void setNumChecks(int count)

getNumChecks

public int getNumChecks()

getPageFormat

public java.awt.print.PageFormat getPageFormat()

setTestPrint

public void setTestPrint(boolean testPrint)

drawCheck

private void drawCheck(java.awt.Graphics2D g2,
                       java.awt.geom.Rectangle2D bounds,
                       java.math.BigDecimal amount,
                       java.util.Date date,
                       java.lang.String memo,
                       java.lang.String payee)

drawSheet

private void drawSheet(java.awt.Graphics2D g2,
                       java.awt.print.PageFormat format,
                       Transaction[] list)
Paint a sheet on checks on the graphics device given an array of transactions. If the array is null, it is assumed that a test print is being requested, otherwise, only non null transactions will be printed. The array must equal getNumChecks. Check position will not be assumed.

Parameters:
g2 - graphics context to draw on
format - page format to use
list - array of transactions

drawDate

private void drawDate(java.awt.Graphics2D g2,
                      CheckObject object,
                      float offset,
                      java.util.Date date)

drawMemo

private void drawMemo(java.awt.Graphics2D g2,
                      CheckObject object,
                      float offset,
                      java.lang.String memo)

drawAmount

private void drawAmount(java.awt.Graphics2D g2,
                        CheckObject object,
                        float offset,
                        java.math.BigDecimal amount)

drawAmountText

private void drawAmountText(java.awt.Graphics2D g2,
                            CheckObject object,
                            float offset,
                            java.math.BigDecimal amount)

drawPayee

private void drawPayee(java.awt.Graphics2D g2,
                       CheckObject object,
                       float offset,
                       java.lang.String payee)

print

public int print(java.awt.Graphics graphics,
                 java.awt.print.PageFormat pf,
                 int pageIndex)
Prints the page at the specified index into the specified Graphics context in the specified format. A PrinterJob calls the Printable interface to request that a page be rendered into the context specified by graphics. The format of the page to be drawn is specified by pageFormat. The zero based index of the requested page is specified by pageIndex. If the requested page does not exist then this method returns NO_SUCH_PAGE; otherwise PAGE_EXISTS is returned. The Graphics class or subclass implements the PrinterGraphics interface to provide additional information. If the Printable object aborts the print job then it throws a PrinterException.

Specified by:
print in interface java.awt.print.Printable
Parameters:
graphics - the context into which the page is drawn
pf - the size and orientation of the page being drawn
pageIndex - the zero based index of the page to be drawn
Returns:
PAGE_EXISTS if the page is rendered successfully or NO_SUCH_PAGE if pageIndex specifies a non-existent page. *