public abstract class PrintableObject extends CellPrinter implements RandomPrintable
| Modifier and Type | Field and Description |
|---|---|
String |
documentName |
protected double |
drawDPI
This is 360 by default, but you can change it to any value you want.
|
protected static FontManager |
fontManager |
protected FontManager |
myFontManager |
protected Printer |
myPrinter |
PageFormat |
preferredFormat |
PrinterControl |
printerControl
A default PrinterControl Object that initially has no values
set.
|
dontFreeAfterPrint, pageUNKNOWN_NUMBER_OF_PAGESBOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, LEFT, NORTH, NORTHEAST, NORTHWEST, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, STRETCH, TAG_BACKGROUND_IMAGE, TAG_BORDER, TAG_FIXEDSIZE, TAG_INSETS, TAG_MAXIMUMSIZE, TAG_MINIMUMSIZE, TAG_PREFERREDSIZE, TAG_RECT, TAG_SPAN, TAG_TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WEST| Constructor and Description |
|---|
PrintableObject() |
| Modifier and Type | Method and Description |
|---|---|
void |
adjustPrinterProperties(PrinterProperties p)
Adjust the PrinterProperties as necessary.
|
int |
countPages(PageFormat pf)
By default this returns UNKNOWN_NUMBER_OF_PAGES.
|
String |
getDocumentName() |
PointDrawable |
getPage(PageFormat pf,
int pageIndex)
Get a PointDrawable for a particular page.
|
PageFormat |
getPreferredFormat()
Return the preferred format for printing, or null if there is no preferred format.
|
protected double |
getXdpiFor(int pageIndex) |
protected double |
getYdpiFor(int pageIndex) |
boolean |
print(Handle handle,
PointGraphics pg,
PageFormat page,
PointRect areaOnPage,
int pageIndex)
This is called for each page as the document is being printed.
|
void |
printingComplete()
This is called after printing is complete and indicates that the Printable object
can release resources associated with it.
|
void |
printingStarting(Printer printer)
This is called before printing starts and before countPages() is called.
|
protected void |
setupForPage(PointGraphics pg)
Setup the PrintCells within the CellPrinter.
|
protected abstract boolean |
setupForPage(PointGraphics pg,
PageFormat format,
int pageIndex) |
abstract boolean |
validatePage(PageFormat page,
int pageIndex)
This should return true if the page with the specified index should be printed.
|
addCell, addFullImageablePanel, addMarginedPanel, addMarginedPanel, addMarginedPanel, checkSetup, completeSetup, doPrint, doPrint, draw, free, getCurrentCell, getCurrentPage, isSetupFor, print, reset, setPageFormat, setupclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreleasePagepublic String documentName
public PageFormat preferredFormat
public PrinterControl printerControl
protected Printer myPrinter
protected FontManager myFontManager
protected static FontManager fontManager
protected double drawDPI
public void printingStarting(Printer printer)
PrintableprintingStarting in interface Printablepublic PageFormat getPreferredFormat()
PrintablegetPreferredFormat in interface Printablepublic String getDocumentName()
getDocumentName in interface Printablepublic void adjustPrinterProperties(PrinterProperties p)
adjustPrinterProperties in interface Printableprotected double getXdpiFor(int pageIndex)
protected double getYdpiFor(int pageIndex)
protected abstract boolean setupForPage(PointGraphics pg, PageFormat format, int pageIndex)
public abstract boolean validatePage(PageFormat page, int pageIndex)
PrintablevalidatePage in interface Printableprotected final void setupForPage(PointGraphics pg)
CellPrintersetupForPage in class CellPrinterpublic final boolean print(Handle handle, PointGraphics pg, PageFormat page, PointRect areaOnPage, int pageIndex)
Printablepublic int countPages(PageFormat pf)
countPages in interface Printablepublic void printingComplete()
PrintableprintingComplete in interface Printablepublic PointDrawable getPage(PageFormat pf, int pageIndex)
RandomPrintablegetPage in interface RandomPrintablepf - the PageFormat to be used.pageIndex - the index of the page - starting from zero.