|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--erkka.Vista
A simple Pageable class that can split a large drawing canvas over multiple pages. The pages in a canvas are laid out on pages going left to right and then top to bottom.
Nested Class Summary | |
static class |
Vista.TranslatedPrintable
This inner class's sole responsibility is to translate the coordinate system before invoking a canvas's painter. |
Field Summary |
Fields inherited from interface java.awt.print.Pageable |
UNKNOWN_NUMBER_OF_PAGES |
Constructor Summary | |
protected |
Vista()
Create a vista over a canvas whose width and height are zero and whose Printable and PageFormat are null. |
|
Vista(float width,
float height,
java.awt.print.Printable painter,
java.awt.print.PageFormat format)
Create a java.awt.Pageable that will print a canvas over as many pages as are needed. |
Method Summary | |
int |
getNumberOfPages()
Returns the number of pages over which the canvas will be drawn. |
protected java.awt.print.PageFormat |
getPageFormat()
|
java.awt.print.PageFormat |
getPageFormat(int pageIndex)
Returns the PageFormat of the page specified by pageIndex. |
java.awt.print.Printable |
getPrintable(int pageIndex)
Returns the Printable instance responsible for
rendering the page specified by pageIndex .
|
protected void |
setPageFormat(java.awt.print.PageFormat pageFormat)
Set the page format for the pages over which the canvas will be drawn. |
protected void |
setPrintable(java.awt.print.Printable painter)
Set the object responsible for drawing the canvas. |
protected void |
setSize(float width,
float height)
Set the size of the canvas to be drawn. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Vista(float width, float height, java.awt.print.Printable painter, java.awt.print.PageFormat format)
width
- The width, in 1/72nds of an inch,
of the vist's canvas.height
- The height, in 1/72nds of an inch,
of the vista's canvas.painter
- The object that will drawn the contents
of the canvas.format
- The description of the pages on to which
the canvas will be drawn.protected Vista()
Method Detail |
protected void setPrintable(java.awt.print.Printable painter)
protected void setPageFormat(java.awt.print.PageFormat pageFormat)
protected void setSize(float width, float height)
width
- The width, in 1/72nds of an inch, of
the vist's canvas.height
- The height, in 1/72nds of an inch, of
the vista's canvas.public int getNumberOfPages()
getNumberOfPages
in interface java.awt.print.Pageable
protected java.awt.print.PageFormat getPageFormat()
public java.awt.print.PageFormat getPageFormat(int pageIndex) throws java.lang.IndexOutOfBoundsException
getPageFormat
in interface java.awt.print.Pageable
pageIndex
- the zero based index of the page whose
PageFormat is being requested
java.lang.IndexOutOfBoundsException
- the Pageable does not contain the requested
page.public java.awt.print.Printable getPrintable(int pageIndex) throws java.lang.IndexOutOfBoundsException
Printable
instance responsible for
rendering the page specified by pageIndex
.
In a Vista, all of the pages are drawn with the same
Printable. This method however creates
a Printable which calls the canvas's
Printable. This new Printable
is responsible for translating the coordinate system
so that the desired part of the canvas hits the page.
The Vista's pages cover the canvas by going left to
right and then top to bottom. In order to change this
behavior, override this method.
getPrintable
in interface java.awt.print.Pageable
pageIndex
- the zero based index of the page whose
Printable is being requested
java.lang.IndexOutOfBoundsException
- the Pageable does not contain the requested
page.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |