|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object | +--CoffeeTable.Grid.GridPrinterBase
GridPrinterBase is a helper class that provides Report printing capabilities
for the GridPanel. This class figures out the required number of pages
to fit all the Grid data and prints it in a report format. The default
implementation uses the Grid's drawing methods to print the report.
This class is sub-classed by the GridPrinter class (for JDK 1.1 style printing)
and the GridPrintable class (for JDK 1.2 style printing). You don't use this
class directly but rather it's sub-classes GridPrinter or GridPrintable
depending on your Java VM.
| Field Summary | |
static int |
CENTER
Align the printed area at the center of each page. |
static int |
CENTER_LEFT
Align the printed area at the vertical center of each page. |
protected boolean |
fAutoResizeColumns
|
protected java.lang.Boolean |
fAutoResizeRows
|
protected java.util.Vector |
fColRatios
|
protected java.awt.Point |
fEndCell
|
protected int |
fEndPage
|
protected int |
fFooterHeight
|
protected GridPanelInterface |
fGrid
|
protected CoffeeTable.Grid.RunVector |
fGridHeights
|
protected java.util.Vector |
fGridWidths
|
protected int |
fHeaderHeight
|
protected java.awt.Rectangle |
fPageArea
|
protected java.awt.Dimension |
fPages
|
protected java.awt.Dimension |
fPageSize
|
protected int |
fPrintAlignment
|
protected java.awt.Rectangle |
fPrintArea
|
protected boolean |
fPrintBorder
|
protected java.lang.Boolean |
fPrintColHeaders
|
protected java.lang.Boolean |
fPrintColLines
|
protected java.lang.Boolean |
fPrintRowHeaders
|
protected java.lang.Boolean |
fPrintRowLines
|
protected int |
fScreenRes
|
protected java.awt.Point |
fStartCell
|
protected int |
fStartPage
|
protected java.lang.String |
fTitle
|
static int |
TOP_CENTER
Align the printed area at the horizontal center of each page. |
static int |
TOP_LEFT
Align the printed area at the top-left corner of each page. |
| Constructor Summary | |
GridPrinterBase(java.lang.String title)
Constructs a new empty GridPrinterBase Object. |
|
GridPrinterBase(java.lang.String title,
GridPanelInterface grid)
Constructs a new empty GridPrinterBase Object for the specified Grid. |
|
| Method Summary | |
protected int |
calcColRange(int fromCol)
|
protected void |
calcColWidths()
|
protected void |
calcPageAreas()
|
protected void |
calcPages()
|
protected int |
calcRowHeight(int row)
|
protected void |
calcRowHeights()
|
protected int |
calcRowRange(int fromRow)
|
void |
drawCell(java.awt.Graphics pg,
java.awt.Point cell,
java.awt.Rectangle cellRect)
Print the cell. |
void |
drawHeaderCol(java.awt.Graphics pg,
int col,
java.awt.Rectangle aRect)
Print the header for a column. |
void |
drawHeaderRow(java.awt.Graphics pg,
int row,
java.awt.Rectangle aRect)
Print the header for a row. |
void |
drawIntersection(java.awt.Graphics pg,
java.awt.Rectangle aRect)
Print the area in the intersection between the row and column headers. |
int |
getColWidth(int col)
Return the width for a column. |
protected int |
getColWidths(int startCol,
int numCols)
|
GridPanelInterface |
getGrid()
Returns the Grid associated with this GridPrinter object. |
int |
getNumPages()
Return the total number of pages to be printed. |
java.awt.Rectangle |
getPageArea()
Returns the printable area for the grid on a page after calculating it based on the printable area of the page, taking the page header and footer dimensions into consideration. |
int |
getPageFooterHeight()
Returns the page footer height |
int |
getPageHeaderHeight()
Returns the page header height |
java.awt.Rectangle |
getPrintableArea()
Returns the printable area of a page. |
int |
getPrintAlignment()
Returns the current print alignment. |
boolean |
getPrintBorder()
Check if printing a border around a page boundary is enabled. |
boolean |
getPrintColHeaders()
Check if printing column headers is enabled. |
boolean |
getPrintColLines()
Check if printing column lines is specified. |
boolean |
getPrintRowHeaders()
Check if printing row headers is enabled. |
boolean |
getPrintRowLines()
Check if printing row lines is specified. |
int |
getRowHeight(int row)
Return the height for a row. |
protected int |
getRowHeights(int startRow,
int numRows)
|
java.lang.String |
getTitle()
Return the title for this report. |
boolean |
isAutoResizeColumns()
Check if automatically resizing columns to fit in a page is enabled. |
boolean |
isAutoResizeRows()
Check if the feature to automatically resize rows is enabled. |
void |
printFooter(java.awt.Graphics pg,
int page,
java.awt.Rectangle footerRect)
Prints the page footer. |
void |
printHeader(java.awt.Graphics pg,
int page,
java.awt.Rectangle headerRect)
Prints the page header. |
void |
printPage(java.awt.Graphics pg,
int page,
int fromRow,
int toRow,
int fromCol,
int toCol,
java.awt.Rectangle pageRect)
Prints the Grid data. |
void |
setAutoResizeColumns(boolean autoResizeColumns)
Set the flag to automatically resize all columns proportionally to fit on a page. |
void |
setAutoResizeRows(boolean autoResizeRows)
Set the flag to automatically resize row heights based on the cell text and column width if WORD_WRAP is enabled for any of the cells. |
void |
setColWidths(int[] colWidths)
Set the column widths for this report. |
void |
setGrid(GridPanelInterface grid)
Set the Grid to be printed. |
void |
setPageFooterHeight(int footerHeight)
Set the height for the page footer. |
void |
setPageHeaderHeight(int headerHeight)
Set the height for the page header. |
void |
setPageRange(int startPage,
int endPage)
Set the range of pages to be printed. |
void |
setPrintableArea(java.awt.Rectangle printableArea)
Set the printable area of the page. |
void |
setPrintAlignment(int printAlignment)
Set the print alignment. |
void |
setPrintBorder(boolean printBorder)
Set the flag to enable or disable the printing of a border around the page boundary. |
void |
setPrintColHeaders(boolean printColHeaders)
Set the flag to enable or disable the printing of column headers. |
void |
setPrintColLines(boolean printColLines)
Set the flag to enable or disable the printing of column lines. |
void |
setPrintRowHeaders(boolean printRowHeaders)
Set the flag to enable or disable the printing of row headers. |
void |
setPrintRowLines(boolean printRowLines)
Set the flag to enable or disable the printing of row lines. |
void |
setTitle(java.lang.String title)
Set the title for this report. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static int TOP_LEFT
public static int CENTER
public static int TOP_CENTER
public static int CENTER_LEFT
protected java.awt.Dimension fPageSize
protected int fScreenRes
protected GridPanelInterface fGrid
protected java.awt.Rectangle fPrintArea
protected java.awt.Rectangle fPageArea
protected int fStartPage
protected int fEndPage
protected java.awt.Dimension fPages
protected boolean fPrintBorder
protected java.lang.Boolean fPrintColHeaders
protected java.lang.Boolean fPrintRowHeaders
protected java.lang.Boolean fPrintRowLines
protected java.lang.Boolean fPrintColLines
protected int fHeaderHeight
protected int fFooterHeight
protected java.lang.String fTitle
protected java.awt.Point fStartCell
protected java.awt.Point fEndCell
protected int fPrintAlignment
protected boolean fAutoResizeColumns
protected java.lang.Boolean fAutoResizeRows
protected java.util.Vector fGridWidths
protected CoffeeTable.Grid.RunVector fGridHeights
protected java.util.Vector fColRatios
| Constructor Detail |
public GridPrinterBase(java.lang.String title)
title - a String specifying the report titlepublic GridPrinterBase(java.lang.String title, GridPanelInterface grid)
title - a String specifying the report titlegrid - the Grid being printed| Method Detail |
public void setGrid(GridPanelInterface grid)
grid - a reference to the GridPanel that is to be printed.public GridPanelInterface getGrid()
public void setPrintBorder(boolean printBorder)
printBorder - a boolean value to enable or disable printing a borderpublic boolean getPrintBorder()
public void setTitle(java.lang.String title)
title - a String specifying the titlepublic java.lang.String getTitle()
public void setAutoResizeColumns(boolean autoResizeColumns)
autoResizeColumns - a boolean value to specify whether or not to automatically resize
columns to fit in a pagepublic boolean isAutoResizeColumns()
public void setAutoResizeRows(boolean autoResizeRows)
autoResizeRows - a boolean value to specify whether or not to automatically resize rows based on textpublic boolean isAutoResizeRows()
public void setPrintColHeaders(boolean printColHeaders)
printColHeaders - a boolean value to enable or disable printing column headerspublic boolean getPrintColHeaders()
public void setPrintRowHeaders(boolean printRowHeaders)
printRowHeaders - a boolean value to enable or disable printing row headerspublic boolean getPrintRowHeaders()
public void setPrintColLines(boolean printColLines)
printColLines - a boolean value to enable or disable printing column linespublic boolean getPrintColLines()
public void setPrintRowLines(boolean printRowLines)
printRowLines - a boolean value to enable or disable printing row linespublic boolean getPrintRowLines()
public void setPrintAlignment(int printAlignment)
printAlignment - the page alignment (TOP_LEFT or CENTER)public int getPrintAlignment()
public void setPageHeaderHeight(int headerHeight)
headerHeight - page header heightprintHeader(java.awt.Graphics, int, java.awt.Rectangle)public int getPageHeaderHeight()
public void setPageFooterHeight(int footerHeight)
footerHeight - page footer heightprintFooter(java.awt.Graphics, int, java.awt.Rectangle)public int getPageFooterHeight()
public void setPageRange(int startPage, int endPage)
startPage - the first page to be printedendPage - the last page to be printedpublic int getNumPages()
public java.awt.Rectangle getPrintableArea()
public void setPrintableArea(java.awt.Rectangle printableArea)
printableArea - a Rectangle specifying the printable area of a pagepublic void setColWidths(int[] colWidths)
colWidths - a array of ints specifying the column widths printed reportpublic java.awt.Rectangle getPageArea()
public int getColWidth(int col)
col - the columnpublic int getRowHeight(int row)
row - the rowprotected int getColWidths(int startCol, int numCols)
protected int getRowHeights(int startRow, int numRows)
protected void calcPageAreas()
protected void calcPages()
protected final int calcRowHeight(int row)
protected void calcColWidths()
protected void calcRowHeights()
protected int calcColRange(int fromCol)
protected int calcRowRange(int fromRow)
public void printHeader(java.awt.Graphics pg, int page, java.awt.Rectangle headerRect)
pg - the PrintGraphics objectpage - the current page being printedheaderRect - the area for the headerpublic void printFooter(java.awt.Graphics pg, int page, java.awt.Rectangle footerRect)
pg - the PrintGraphics objectpage - the current page being printedfooterRect - the area for the footerpublic void printPage(java.awt.Graphics pg, int page, int fromRow, int toRow, int fromCol, int toCol, java.awt.Rectangle pageRect)
pg - the PrintGraphics objectpage - the current page being printedfromRow - the first row printed on this pagetoRow - the last row printed on this pagefromCol - the first column printed on this pagetoCol - the last column printed on this pagepageRect - the area for the pagepublic void drawIntersection(java.awt.Graphics pg, java.awt.Rectangle aRect)
pg - the graphics context to use for printingaRect - the Rectangle for the intersection areaGridPanelInterface.drawIntersection(java.awt.Graphics, java.awt.Rectangle)public void drawHeaderCol(java.awt.Graphics pg, int col, java.awt.Rectangle aRect)
pg - the graphics context to use for printingcol - the column whose header is being printedaRect - the Rectangle for the column header areaGridPanelInterface.drawHeaderCol(java.awt.Graphics, int, java.awt.Rectangle)public void drawHeaderRow(java.awt.Graphics pg, int row, java.awt.Rectangle aRect)
pg - the graphics context to use for printingrow - the row whose header is being printedaRect - the Rectangle for the row header areaGridPanelInterface.drawHeaderRow(java.awt.Graphics, int, java.awt.Rectangle)public void drawCell(java.awt.Graphics pg, java.awt.Point cell, java.awt.Rectangle cellRect)
pg - the graphics context to use for printingcell - the cell being printedcellRect - the Rectangle for the cell areaGridPanelInterface.drawCell(java.awt.Graphics, java.awt.Point, java.awt.Rectangle, boolean)
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||