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, page
UNKNOWN_NUMBER_OF_PAGES
BOTTOM, 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, setup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
releasePage
public 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)
Printable
printingStarting
in interface Printable
public PageFormat getPreferredFormat()
Printable
getPreferredFormat
in interface Printable
public String getDocumentName()
getDocumentName
in interface Printable
public void adjustPrinterProperties(PrinterProperties p)
adjustPrinterProperties
in interface Printable
protected 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)
Printable
validatePage
in interface Printable
protected final void setupForPage(PointGraphics pg)
CellPrinter
setupForPage
in class CellPrinter
public final boolean print(Handle handle, PointGraphics pg, PageFormat page, PointRect areaOnPage, int pageIndex)
Printable
public int countPages(PageFormat pf)
countPages
in interface Printable
public void printingComplete()
Printable
printingComplete
in interface Printable
public PointDrawable getPage(PageFormat pf, int pageIndex)
RandomPrintable
getPage
in interface RandomPrintable
pf
- the PageFormat to be used.pageIndex
- the index of the page - starting from zero.