|
ReportCat 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectli.netcat.print.PrintManager
The PrintManager
adds the PageFormat
and the PrinterJob
to a Print
and controls the layouting,
i.e. it uses the Print
to create a PrintIterator
and consumes all Painter
s of the iterator.
The PrintManager
also has the capability for scaling (Graphics2D
required).
Field Summary |
Fields inherited from interface java.awt.print.Pageable |
UNKNOWN_NUMBER_OF_PAGES |
Fields inherited from interface java.awt.print.Printable |
NO_SUCH_PAGE, PAGE_EXISTS |
Constructor Summary | |
PrintManager()
Constructs a new PrintManager with no Print and a scale of 1.0. |
|
PrintManager(boolean createPrinterJob,
java.awt.print.PageFormat pageFormat)
Constructs a new PrintManager with no Print and a scale of 1.0. |
|
PrintManager(Print print)
Constructs a new PrintManager with the given Print and a scale of 1.0. |
Method Summary | |
void |
addPrintManagerListener(PrintManagerListener listener)
Adds a PrintManagerListener to the list of listerners. |
void |
ensureLayout(java.awt.Graphics g)
Call this method to ensure that the layout is done. |
int |
getImageableHeight()
Returns the current imageableHeight of the paper as an int . |
int |
getImageableWidth()
Returns the current imageableWidth of the paper as an int . |
int |
getImageableX()
Returns the current imageableX of the paper as an int . |
int |
getImageableY()
Returns the current imageableY of the paper as an int . |
int |
getNumberOfPages()
|
int |
getOrientation()
Returns the current orientation of the PageFormat . |
int |
getPageCount()
Returns the current number of pages or -1, if the layout is not jet done. |
java.awt.print.PageFormat |
getPageFormat()
Returns a copy of the PageFormat associated with this PrintManager .
|
java.awt.print.PageFormat |
getPageFormat(int page)
|
Painter |
getPainter(int page)
Returns the Painter that is able to paint the page with the given index. |
int |
getPaperHeight()
Returns the current height of the paper as an int . |
int |
getPaperWidth()
Returns the current width of the paper as an int . |
Print |
getPrint()
|
java.awt.print.Printable |
getPrintable(int page)
|
java.awt.print.PrinterJob |
getPrinterJob()
Returns the PrinterJob associated with this PrintManager . |
double |
getScaleValue()
Returns the scale value that is applyed by the PrintManager . |
void |
pageDialog(boolean separateThread)
Shows the page dialog to change the PageFormat . |
void |
print(boolean showDialog)
Prints the Print associated with the PrintManager . |
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat pageFormat,
int pageIndex)
|
void |
removePrintManagerListener(PrintManagerListener listener)
Removes a PrintManagerListener from the list of listeners. |
static void |
setErrorPainterTooManyPages(Painter painter)
Sets the painter that is used when the layout exceeds the maximum number of pages. |
static void |
setErrorPainterTooSmall(Painter painter)
Sets the painter that is used when the imageable area is too small. |
void |
setImageableArea(int imageableX,
int imageableY,
int imageableWidth,
int imageableHeight)
Sets the imageable area of the PageFormat . |
void |
setMaxNumberOfPages(int number)
Sets the maximum number of pages before the layout is aborted. |
void |
setOrientation(int orientation)
Sets the orientation of the PageFormat . |
void |
setPageFormat(java.awt.print.PageFormat pageFormat)
Sets the given PageFormat to the PrintManager . |
void |
setPrint(Print print)
Sets the Print associated with this PrintManager . |
void |
setScaleValue(double scaleValue)
Sets the scale value. |
void |
setValidateAgainstPrinterJob(boolean b)
Specify true if the page layout should be validated against the PrinterJob . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PrintManager()
PrintManager
with no Print
and a scale of 1.0.
public PrintManager(boolean createPrinterJob, java.awt.print.PageFormat pageFormat)
PrintManager
with no Print
and a scale of 1.0.
createPrinterJob
- Specify false, if you want to use the PrintManager as pure adapter class, i.e. it
will NOT allocate its own PrinterJob instance. Note that the methods pageDialog(boolean) and
print(boolean) will throw an IllegalStateException if the PrintManager has no PrinterJob instance.pageFormat
- The pageFormat that defines the size of one page. If set to null, the default page format of the
printer job will be used. If the flag createPrinterJob is set fo false, this parameter must not be null.public PrintManager(Print print)
PrintManager
with the given Print
and a scale of 1.0.
Method Detail |
public java.awt.print.PrinterJob getPrinterJob()
PrinterJob
associated with this PrintManager
.
PrinterJob
associated with this PrintManager
.public int getPaperWidth()
int
.
int
.public int getPaperHeight()
int
.
int
.public int getImageableX()
int
.
int
.public int getImageableY()
int
.
int
.public int getImageableWidth()
int
.
int
.public int getImageableHeight()
int
.
int
.public int getOrientation()
PageFormat
.
PageFormat
, one of the values LANDSCAPE
, PORTRAIT
or REVERSE_LANDSCAPE
.public void setOrientation(int orientation)
PageFormat
.
orientation
- The orientation of the PageFormat
, one of the values LANDSCAPE
, PORTRAIT
or REVERSE_LANDSCAPE
.public java.awt.print.PageFormat getPageFormat()
PageFormat
associated with this PrintManager
.
Modifications made to the returned instance take no effect.
PageFormat
associated with that PrintManager
.public void setPageFormat(java.awt.print.PageFormat pageFormat)
PageFormat
to the PrintManager
. This method creates uses copy of
the given parameter for further operations.
pageFormat
- The PageFormat
to be used for layouting.public void setImageableArea(int imageableX, int imageableY, int imageableWidth, int imageableHeight)
PageFormat
. This method is independent of the orientation.
imageableX
- The x offset of the page format.imageableY
- The y offset of the page format.imageableWidth
- The imageable width of the page format.imageableHeight
- The mageable height of the page format.public Print getPrint()
public void setPrint(Print print)
Print
associated with this PrintManager
.
print
- The Print
associated with this PrintManager
, might be null
.public void setMaxNumberOfPages(int number)
number
- The macimum number of pages before the layout is aborted.public int getPageCount()
ensureLayout(...)
to
make sure that the layout is made. This method returns Integer.MAX_VALUE
if an error occured during layouting.
public Painter getPainter(int page)
Painter
that is able to paint the page with the given index.
page
- The index of the page, starting at 0 as usual.public double getScaleValue()
PrintManager
.
PrintManager
.public void setScaleValue(double scaleValue)
scaleValue
- The scale value that is applyed by the PrintManager
.public void addPrintManagerListener(PrintManagerListener listener)
PrintManagerListener
to the list of listerners.
listener
- The listener to be added.public void removePrintManagerListener(PrintManagerListener listener)
PrintManagerListener
from the list of listeners.
listener
- The listener to be removed.public void pageDialog(boolean separateThread)
PageFormat
.
separateThread
- Creates a new thread to run the dialog so that the swing thread continues working.public void print(boolean showDialog) throws java.awt.print.PrinterException
Print
associated with the PrintManager
.
showDialog
- Specify true
to show the print dialog before printing.
java.awt.print.PrinterException
public void setValidateAgainstPrinterJob(boolean b)
true
if the page layout should be validated against the PrinterJob
.
b
- The flag.public void ensureLayout(java.awt.Graphics g)
g
- The relevant Graphics
object that is used for layouting.public static void setErrorPainterTooManyPages(Painter painter)
painter
- A painter showing the error, not null.public static void setErrorPainterTooSmall(Painter painter)
painter
- A painter showing the error, not null.public int print(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex)
print
in interface java.awt.print.Printable
public java.awt.print.Printable getPrintable(int page)
getPrintable
in interface java.awt.print.Pageable
public java.awt.print.PageFormat getPageFormat(int page)
getPageFormat
in interface java.awt.print.Pageable
public int getNumberOfPages()
getNumberOfPages
in interface java.awt.print.Pageable
|
ReportCat 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |