public class IlvPage extends Object implements Printable
IlvPage
defines a page that can be printed. It maintains a set of
IlvPrintableObject
objects. When a IlvPage
is being printed,
it calls the print()
method of the contained printable objects.
The IlvPage
class is designed to work with a IlvPrintableDocument
object: IlvPage
s are added to the IlvPrintableDocument
.
IlvPrintableObject
NO_SUCH_PAGE, PAGE_EXISTS
Constructor and Description |
---|
IlvPage()
Creates an empty page.
|
Modifier and Type | Method and Description |
---|---|
void |
addPrintableObject(IlvPrintableObject printable)
Adds a printable object to the page.
|
IlvPrintableDocument |
getDocument()
Returns the owner
IlvPrintableDocument . |
PageFormat |
getPageFormat()
Returns the page format of the printable page.
|
int |
getPageIndex()
Returns the page index of the page.
|
int |
getPrintableCount()
Returns the number of printable objects in the page.
|
IlvPrintableObject |
getPrintableObject(int index)
Gets the
IlvPrintableObject at the specified position. |
int |
print(Graphics graphics,
PageFormat format,
int pageIndex)
Implements the
java.awt.print.Printable.print method. |
protected void |
printObjects(Graphics graphics,
PageFormat format,
int pageIndex)
Prints the objects that have been added to this page.
|
protected void |
printTemplate(Graphics graphics,
PageFormat format,
int pageIndex)
Prints the template page of the document.
|
void |
removePrintableObject(IlvPrintableObject printable)
Removes the specified printable object from the page.
|
void |
setDocument(IlvPrintableDocument document)
Sets the owner
IlvPrintableDocument . |
public IlvPage()
public IlvPrintableDocument getDocument()
IlvPrintableDocument
.IlvPrintableDocument
.public void setDocument(IlvPrintableDocument document)
IlvPrintableDocument
.document
- The owner IlvPrintableDocument
.public PageFormat getPageFormat()
IlvPrintableDocument
.public int getPrintableCount()
public IlvPrintableObject getPrintableObject(int index)
IlvPrintableObject
at the specified position.index
- The index of the printable object.public int getPageIndex()
IlvPrintableDocument
.public void addPrintableObject(IlvPrintableObject printable)
printable
- The printable object to be added.public void removePrintableObject(IlvPrintableObject printable)
printable
- The printable object to be removed.public int print(Graphics graphics, PageFormat format, int pageIndex) throws PrinterException
java.awt.print.Printable.print
method. If the
IlvPrintableDocument
of this page has a template page, this method first
prints the template page. Then, it calls the print
method of the
contained IlvPrintableObject
.print
in interface Printable
graphics
- The output device, which must be a Graphics2D
object.format
- The format of the page.pageIndex
- The index of the page.PrinterException
protected void printTemplate(Graphics graphics, PageFormat format, int pageIndex) throws PrinterException
graphics
- The output device, which must be a Graphics2D
object.format
- The format of the page.pageIndex
- The index of the page.PrinterException
protected void printObjects(Graphics graphics, PageFormat format, int pageIndex) throws PrinterException
graphics
- The output device, which must be a Graphics2D
object.format
- The format of the page.pageIndex
- The index of the page.PrinterException
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.