There is a separate printer class for each presentation bean. Just as the Graph
class and a GridView
class both extend the Dataview
class, the
GraphPrinter
class and the GridViewPrinter
class both extend the
ViewPrinter
. Likewise, as the Table
and Crosstab
classes
extend the GridView
, the TablePrinter
and CrosstabPrinter
extend the GridViewPrinter
. You use the printer class for the presentation bean that
you want to print. For example, to print a table, you use the TablePrinter
object.
The following figure depicts the relationships that are described in this topic.
The view printer classes support the 2 kinds of Java printing, AWT
(java.awt.Toolkit
class) and 2D printing (in the java.awt.print
package). All the print dialog boxes are based on 2D printing.
In addition to the view printer classes, BI Beans provides a graphical user interface for
printing. This support includes the following classes, all of which are in the
oracle.dss.dataView.gui
package.
Class |
Description |
---|---|
|
Dialog for printing a view or a page of a view |
|
A preview of a printed view |
|
Dialog for page options, such as headers and footers |
BI Beans has different levels of printing support:
The easiest thing to do is to create a PrintDialog
and then
use the show
method of the
PrintDialog
.
You do not have to call methods on any view printers. The dialog sets all options, based on
input from the user. The Print Options dialog box has a Page Setup button and
a Preview button; however, PageSetupDialog
and
PreviewDialog
can also be shown independently. For example, you could display the
Page Setup dialog box or the Print Preview dialog box from a File menu.
If you are using AWT printing and do not want to use the BI Beans user interface for printing,
you can create your own user interface and
use the print(boolean)
method of the ViewPrinter
class. The view printer implements the
Printable
interface. You set properties of the ViewPrinter
and then
print the view. You must also call the startPrint
and endPrint
methods of the ViewPrinter
.
When you need more control over printing, you
use the renderPage
method
of a ViewPrinter
class. This method gives you more control over the area in
which the view is printed, though the ViewPrinter
still manages pagination,
margins, and headers and footers. Use the renderPage
method when you want to
print a view and another object on the same physical page, or when you want to print two views
in the same print job, or when you want to print a logical page of one view and then a logical
page of another view. When you call renderPage
, you should also call
startPrint
, prepareFirstPage
, hasNextPage
,
prepareNextPage
, hasPrevPage
, preparePrevPage
, and
endPrint
.
For full control of a print job or printer job, you
call the printPage
method of a ViewPrinter
class. With printPage
, you print to a
Graphics
object. Using printPage
gives you total control of the page
layout, including margins, headers and footers, and the rows and columns that appear in the
printing area. Use this method when you want to print less than a logical page of a crosstab
or table, or when you want full control of the margins, headers, and footers. Methods related
to printPage
include startPrint
, endPrint
,
setLogicalPage
, and calcPageBounds
. When you use
printPage
to print a crosstab or table, you also use a
DataSubsetRecord
to manage the rows and columns that appear in each
Graphics
object.
All printing support requires the oracle.dss.dataView.ViewPrinter
class.
To print a table, import the oracle.dss.table.TablePrinter
class.
To print a graph, import the oracle.dss.table.GraphPrinter
class.
To print a crosstab, import the oracle.dss.table.CrosstabPrinter
class.
To use the user-interface classes that are provided for Java-client applications, import the
oracle.dss.dataView.gui
package, or the following classes and interface from that
package:
PrintDialog
PreviewDialog
PageSetupDialog
PrintDialogsProvider
PreviewDialogProvider
To print without using the BI Beans user-interface classes, import the
java.awt.Toolkit
class (for a print job) or the java.awt.print
package (for a printer job), and import the oracle.bali.ewt.util.WindowUtils
class, or some other class from which you can get a Frame
object.
To have fine control of row and column printing in tables and crosstabs, import the
oracle.dss.dataView.DataSubsetRecord
class.