You use the show
method of the PrintDialog
or
PreviewDialog
object when you want to let the bean manage the entire printing
process, including the user interface. This is appropriate under the following circumstances:
You want to allow your users to print one or all logical pages of a single view. The default user interface does not support printing multiple views in one print job.
Your users do not need to print a range of rows and columns. The default user interface can print a single logical page, a range of pages, or all pages. The default user interface does not support printing that starts with something other than the first row and column of the table or crosstab. (To do this kind of printing, see Using the printPage Method to Take Control of a Print Job.)
Create an appropriate view printer object, such as a TablePrinter
to print a
table, and pass it to the constructor for the PrintDialog
. The
PrintDialog
is in the oracle.dss.dataView.gui
package.
The system print dialog appears after the end user chooses OK in the presentation bean's print dialog. If the end user cancels the print operation instead, then the system print dialog does not appear.
After an end user chooses OK from the system print dialog, the view printer prints the view according to the options that the end user set in the print dialog for the bean.
PrintDialog.show
The following example shows the simplest way to print a graph. This example allows end users
to select printing options. This example assumes that you have a graph named
myGraph
.
//create an instance of the GraphPrinter GraphPrinter printer = new GraphPrinter(myGraph); //create a frame from which to display the print dialog Frame frame = oracle.bali.ewt.util.WindowUtils.parentFrame(myGraph); //create an instance of the print dialog PrintDialog dialog = new PrintDialog(frame, printer); //display the dialog, so that users can set options and initiate printing dialog.show(); //after the printing is completed or canceled, dispose of the dialog dialog.dispose(); dialog = null;