Oracle™ Business Intelligence Beans Java API Reference
Release 10
g (9.0.4)
Part number B12159_01


oracle.dss.dataView
Class ViewPrinter

java.lang.Object
  |
  +--oracle.dss.dataView.ViewPrinter
All Implemented Interfaces:
java.awt.print.Printable
Direct Known Subclasses:
GraphPrinter, GridViewPrinter

public abstract class ViewPrinter
extends java.lang.Object
implements java.awt.print.Printable

Base class for printing or previewing data-aware controls. If you use the PrinterDialog class in oracle.dss.dataView.gui, then you do not need to call any of the methods in this class. Instead, you need only to create an instance of the appropriate subclass of this class and pass it in the PrinterDialog constructor. The ViewPrinter takes responsibility for the print job. It takes ownership of the entire page that is printed, and it manages pagination and other printing tasks.

If you create your own UI, then you call methods of a ViewPrinter subclass.

There are three different methods for printing:

See Also:
print(boolean), renderPage(java.awt.Graphics), GraphPrinter.printPage(Graphics), CrosstabPrinter.printPage(java.awt.Graphics), CrosstabPrinter.printPage(Graphics, DataSubsetRecord), TablePrinter.printPage(Graphics), TablePrinter.printPage(Graphics, DataSubsetRecord), PrintDialog

Field Summary
static int ADJUST_FOR_HEADERS_AND_FOOTERS
          Margin adjustment: When headers or footers do not fit in the specified margin, the margins are enlarged so that the headers or footers fit.
static int ALL_LOGICAL_PAGES
          Range type: Print all the logical pages in the view.
static int CURRENT_LOGICAL_PAGE
          Range type: Print only the current logical page of the view.
static int FOOTER_CENTER
          The center footer.
static int FOOTER_LEFT
          The left footer.
static int FOOTER_RIGHT
          The right footer.
static int HEADER_CENTER
          The center header.
static int HEADER_LEFT
          The left header.
static int HEADER_RIGHT
          The right header.
static int HEADERS_AND_FOOTERS_ALL
          All headers and footers.
static int HEADERS_AND_FOOTERS_NONE
          No headers or footers.
static int IGNORE_HEADERS_AND_FOOTERS
          Margin adjustment: When headers or footers do not fit in the specified margin, they are printed over the view in the printable area.
static int OCCLUDE_HEADERS_AND_FOOTERS
          Margin adjustment: When headers or footers do not fit in the specified margin, the margins are unchanged.
static int ORIGINAL_SIZE
          Print scale type: Print the view at its current size.
static int SCALE_TO_FIT_FULL_PAGE
          Print scale type: Print the graph so that it fills the entire physical page.
static int SCALE_TO_FIT_PAGE
          Print scale type: Print the graph so that it fills the physical page, keeping its on-screen proportions.
static int SCALE_TO_FIT_PAGES
          Print scale type: Scale the view to fit on the specified numbers of pages.
static int SCALE_TO_ZOOM_FACTOR
          Print scale type: Scale the view according to the PrintZoomFactor property of this ViewPrinter.
static int SELECTED_LOGICAL_PAGES
          Range type: Print selected logical pages in the view.

 

Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS

 

Constructor Summary
ViewPrinter(Dataview dv)
          Constructor.

 

Method Summary
abstract  void endPrint()
          Sets the view back to its original state.
 int getBottomMargin()
          Retrieves the height of the bottom margin of printed physical pages.
 CustomHeaderAndFooterCallback getCustomHeaderAndFooterCallback()
          Retrieves the callback that this ViewPrinter uses for displaying custom headers and footers.
 Dataview getDataview()
          Retrieves the Dataview that this ViewPrinter prints.
 int getFitToNumPagesTall()
          Retrieves the number of physical pages on which a printed view is required to fit vertically.
 int getFitToNumPagesWide()
          Retrieves the number of physical pages on which a printed view is required to fit horizontally.
 int getFooterMargin()
          Retrieves the height of the footer margin.
 HeaderAndFooterPainter getFooterPainter()
          Deprecated. As of 1.6.0.9, replaced by getHeaderAndFooterPainter(int)
 HeaderAndFooterPainter getHeaderAndFooterPainter(int headerOrFooterID)
          Retrieves a header or footer painter.
 int getHeaderMargin()
          Retrieves the height of the header margin.
 HeaderAndFooterPainter getHeaderPainter()
          Deprecated. As of 1.6.0.9, replaced by getHeaderAndFooterPainter(int)
 int getHeadersAndFootersUsingCallback()
          Retrieves the headers and footers that use a custom callback.
 int getLeftMargin()
          Retrieves the left margin of printed physical pages.
 int[] getLogicalPage()
          Retrieves the logical page to be printed, when you use the printPage method to print.
 int getMarginAdjustment()
          Retrieves the setting for how the margin responds when a header or footer does not fit.
 java.awt.print.PageFormat getPageFormat()
          Retrieves the PageFormat object that specifies the paper size for this ViewPrinter.
 java.awt.PrintJob getPrintJob()
          Retrieves the PrintJob object for this ViewPrinter.
 int getPrintScaleType()
          Retrieves information about how the DataView is scaled for printing.
 int getPrintZoomFactor()
          Retrieves the zoom factor for printing.
 int getRangeType()
          Retrieves information about how much of the view will be printed.
 int getRightMargin()
          Retrieves the width of the right margin of printed physical pages.
abstract  int getScaleFontSize()
          Retrieves the text components to resize when a graph is scaled to a different size for printing.
 java.util.Vector getSelectedHPos()
          Retrieves the hierarchical addresses of the logical pages to print, when RangeType is set to SELECTED_LOGICAL_PAGES.
 int getSequentialPageNumber()
          Retrieves the current physical page number that this ViewPrinter has printed.
 TokenSubstitution getTokenSubstitution()
          Retrieves the handler for token substitution in this ViewPrinter.
 int getTopMargin()
          Retrieves the height of the top margin of printed physical pages.
 java.awt.Dimension getViewDimension()
          Retrieves the space allowed for printing a view, when you assume responsibility for a print job.
abstract  boolean goToFirstPage()
          Deprecated. As of 1.6.0.9, replaced by prepareFirstPage(Graphics)
abstract  boolean goToNextPage()
          Deprecated. As of 1.6.0.9, replaced by prepareNextPage(Graphics)
abstract  boolean goToPrevPage()
          Deprecated. As of 1.6.0.9, replaced by preparePrevPage(Graphics)
abstract  boolean hasNextPage()
          Indicates whether the view has a physical page after the current physical page.
abstract  boolean hasPrevPage()
          Indicates whether the view has a physical page before the current physical page.
abstract  boolean isFirstPhysicalPage()
          Indicates whether the current physical page is the first physical page in the current logical page.
 boolean isGridlinesVisible()
          Indicates whether gridlines appear in a printed GridView.
abstract  boolean isLastPhysicalPage()
          Indicates whether the current physical page is the last physical page in the current logical page.
 boolean isPrintByColumns()
          Indicates whether physical pages are printed by rows (left-to-right then top-to-bottom) or by columns(top-to-bottom then left-to-right).
abstract  boolean isRepeatHeaders()
          Indicates whether column and row headers are displayed on every physical page, when a table or crosstab is printed on multiple physical pages.
abstract  boolean prepareFirstPage(java.awt.Graphics g)
          Prepares the first physical page in the view for printing and makes it the current page to print.
abstract  boolean prepareNextPage(java.awt.Graphics g)
          Prepares the next physical page for printing and makes it the current page to print.
abstract  boolean preparePrevPage(java.awt.Graphics g)
          Prepares the previous physical page for printing and makes it the current page to print.
 boolean print(boolean endPrintJob)
          Prints a Dataview, onto multiple physical pages if necessary.
 int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex)
          Prints a physical page of this Dataview to a Graphics.
 boolean renderPage(java.awt.Graphics g)
          Renders a physical page of a view to a Graphics object.
 void setBottomMargin(int mrgn)
          Specifies the height of the bottom margin of printed physical pages.
 void setCustomHeaderAndFooterCallback(CustomHeaderAndFooterCallback callback)
          Registers a custom callback with this ViewPrinter.
 void setFitToNumPagesTall(int num)
          Specifies the number of physical pages on which to fit a printed view vertically.
 void setFitToNumPagesWide(int num)
          Specifies the number of physical pages on which to fit a printed view horizontally.
 void setFooterMargin(int mrgn)
          Specifies the height of the footer margin.
 void setGridlinesVisible(boolean visible)
          Specifies whether gridlines appear in a printed GridView.
 void setHeaderMargin(int mrgn)
          Specifies the height of the header margin.
 void setHeadersAndFootersUsingCallback(int mask)
          Specifies the headers and footers to which a custom callback applies.
 void setLeftMargin(int mrgn)
          Specifies the width of left margin of printed physical pages.
 boolean setLogicalPage(int[] hPos)
          Specifies the logical page to print, when you use the printPage method to print.
 void setMarginAdjustment(int adjustment)
          Specifies how the margin behaves when a header or footer does not fit in the margin.
 void setPageFormat(java.awt.print.PageFormat pf)
          Specifies the PageFormat object that specifies paper size for this ViewPrinter.
 void setPrintByColumns(boolean byColumns)
          Specifies whether physical pages are printed by columns (left-to-right then top-to-bottom) or by rows(top-to-bottom then left-to-right).
 void setPrintJob(java.awt.PrintJob job)
          Specifies the PrintJob to use for printing.
 void setPrintScaleType(int type)
          Specifies how to scale the DataView for printing.
 void setPrintZoomFactor(int zoom)
          Specifies the zoom factor for printing.
 void setRangeType(int type)
          Specifies whether to print the current logical page or all logical pages.
abstract  void setRepeatHeaders(boolean repeat)
          Specifies whether to display the column and row headers on every physical page, when a table or crosstab is printed on multiple physical pages.
 void setRightMargin(int mrgn)
          Specifies the width of the right margin of printed physical pages.
abstract  void setScaleFontSize(int mask)
          Specifies text components to resize when a graph is scaled to a different size for printing.
 void setSelectedHPos(java.util.Vector printHPos)
          Specifies logical pages to print, when the RangeType is SELECTED_LOGICAL_PAGES.
 void setSequentialPageNumber(int pageNum)
          Specifies the starting page number for this ViewPrinter.
 void setTokenSubstitution(TokenSubstitution token)
          Specifies a handler for token substitution in this ViewPrinter.
 void setTopMargin(int mrgn)
          Specifies the height of the top margin of printed physical pages.
 void setViewDimension(java.awt.Dimension dim)
          Specifies the space allowed for printing a view.
 boolean showPrintJob()
          Displays the standard Print dialog box.
abstract  boolean startPrint()
          Puts the view in a state for printing.
abstract  boolean startPrint(boolean bPreviewMode)
          Puts the view in a state for printing.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

CURRENT_LOGICAL_PAGE

public static final int CURRENT_LOGICAL_PAGE
Range type: Print only the current logical page of the view.

ALL_LOGICAL_PAGES

public static final int ALL_LOGICAL_PAGES
Range type: Print all the logical pages in the view.

SELECTED_LOGICAL_PAGES

public static final int SELECTED_LOGICAL_PAGES
Range type: Print selected logical pages in the view. To specify the range to print, call the setSelectedHPos method.
See Also:
setSelectedHPos(java.util.Vector)

ORIGINAL_SIZE

public static final int ORIGINAL_SIZE
Print scale type: Print the view at its current size. When you set PrintScaleType to this value, the view is printed at its current size, as determined by its ZoomFactor property.

SCALE_TO_ZOOM_FACTOR

public static final int SCALE_TO_ZOOM_FACTOR
Print scale type: Scale the view according to the PrintZoomFactor property of this ViewPrinter. When you set PrintScaleType to this value, you must also call setPrintZoomFactor to specify the scale for printing.
See Also:
setPrintScaleType(int), setPrintZoomFactor(int)

SCALE_TO_FIT_PAGES

public static final int SCALE_TO_FIT_PAGES
Print scale type: Scale the view to fit on the specified numbers of pages. When you set PrintScaleType to this value, you must also call setFitToNumPagesTall and setFitToNumPagesWide to specify the number of pages on which you want the view to fit.

This value does not work in a GraphPrinter. If you use it, the graph will be printed at its original size.

See Also:
setPrintScaleType(int), setFitToNumPagesTall(int), setFitToNumPagesWide(int)

SCALE_TO_FIT_FULL_PAGE

public static final int SCALE_TO_FIT_FULL_PAGE
Print scale type: Print the graph so that it fills the entire physical page. The graph might not have the same proportions that it has on screen.

SCALE_TO_FIT_PAGE

public static final int SCALE_TO_FIT_PAGE
Print scale type: Print the graph so that it fills the physical page, keeping its on-screen proportions.

HEADER_LEFT

public static final int HEADER_LEFT
The left header.

HEADER_CENTER

public static final int HEADER_CENTER
The center header.

HEADER_RIGHT

public static final int HEADER_RIGHT
The right header.

FOOTER_LEFT

public static final int FOOTER_LEFT
The left footer.

FOOTER_CENTER

public static final int FOOTER_CENTER
The center footer.

FOOTER_RIGHT

public static final int FOOTER_RIGHT
The right footer.

HEADERS_AND_FOOTERS_ALL

public static final int HEADERS_AND_FOOTERS_ALL
All headers and footers.
See Also:
setHeadersAndFootersUsingCallback(int)

HEADERS_AND_FOOTERS_NONE

public static final int HEADERS_AND_FOOTERS_NONE
No headers or footers.
See Also:
setHeadersAndFootersUsingCallback(int)

IGNORE_HEADERS_AND_FOOTERS

public static final int IGNORE_HEADERS_AND_FOOTERS
Margin adjustment: When headers or footers do not fit in the specified margin, they are printed over the view in the printable area.

ADJUST_FOR_HEADERS_AND_FOOTERS

public static final int ADJUST_FOR_HEADERS_AND_FOOTERS
Margin adjustment: When headers or footers do not fit in the specified margin, the margins are enlarged so that the headers or footers fit. The printable area becomes smaller.

OCCLUDE_HEADERS_AND_FOOTERS

public static final int OCCLUDE_HEADERS_AND_FOOTERS
Margin adjustment: When headers or footers do not fit in the specified margin, the margins are unchanged. The part of the header or footer that does not fit in the margin is not visible. It is occluded by the view in the printable area.
Constructor Detail

ViewPrinter

public ViewPrinter(Dataview dv)
Constructor.
Parameters:
dv - The Dataview that this ViewPrinter prints.
Method Detail

print

public boolean print(boolean endPrintJob)
Prints a Dataview, onto multiple physical pages if necessary. The call to this method belongs between calls to startPrint and endPrint.
Parameters:
endPrintJob - true to end the print job with this method, false not to end the print job. Pass false only when you plan to print another object, after this Dataview, using the same print job.
Returns:
true if the view is successfully printed, false if the data in the view is not available to this ViewPrinter.
See Also:
startPrint(), endPrint()

setLeftMargin

public void setLeftMargin(int mrgn)
Specifies the width of left margin of printed physical pages. When the entire page is available for printing a view, then the margin should be at least 18 pixels wide, to prevent the view from being cropped around the edges by the printer device. Remember that large margins reduce the printing area for the view. This method does not impose limits on the margin size. By default, the margin is 72 pixels.

This method has no effect when you use the printPage method to print.

Parameters:
mrgn - The width of the left margin, pixels.

getLeftMargin

public int getLeftMargin()
Retrieves the left margin of printed physical pages. By default, the margin is 72 pixels.
Returns:
The width of the left margin, in pixels.

setRightMargin

public void setRightMargin(int mrgn)
Specifies the width of the right margin of printed physical pages. When the entire page is available for printing a view, then the margin should be at least 18 pixels wide, to prevent the view from being cropped around the edges by the printer device. Remember that large margins reduce the printing area for the view. This method does not impose limits on the margin size. By default, the margin is 72 pixels.

This method has no effect when you use the printPage method to print.

Parameters:
mrgn - The width of the right margin, in pixels.

getRightMargin

public int getRightMargin()
Retrieves the width of the right margin of printed physical pages. By default, the margin is 72 pixels.
Returns:
The width of the right margin, in pixels.

setTopMargin

public void setTopMargin(int mrgn)
Specifies the height of the top margin of printed physical pages. When the entire page is available for printing a view, then the margin should be at least 18 pixels high, to prevent the view from being cropped around the edges by the printer device. Remember that large margins reduce the printing area for the view. This method does not impose limits on the margin size. By default, the margin is 72 pixels.

This method has no effect when you use the printPage method to print.

Parameters:
mrgn - The height of the top margin, in pixels.

getTopMargin

public int getTopMargin()
Retrieves the height of the top margin of printed physical pages. By default, the margin is 72 pixels.
Returns:
The height of the top margin, in pixels.

setBottomMargin

public void setBottomMargin(int mrgn)
Specifies the height of the bottom margin of printed physical pages. When the entire page is available for printing a view, then the margin should be at least 18 pixels high, to prevent the view from being cropped around the edges by the printer device. Remember that large margins reduce the printing area for the view. This method does not impose limits on the margin size. By default, the margin is 72 pixels.

This method has no effect when you use the printPage method to print.

Parameters:
mrgn - The height of the bottom margin, in pixels.

getBottomMargin

public int getBottomMargin()
Retrieves the height of the bottom margin of printed physical pages. By default, the margin is 72 pixels.
Returns:
The height of the bottom margin, in pixels.

setHeaderMargin

public void setHeaderMargin(int mrgn)
Specifies the height of the header margin. When the entire page is available for printing a view, then the margin should be at least 18 pixels high, to prevent the view from being cropped around the edges by the printer device. This method does not impose limits on the margin size. By default, the margin is 18 pixels.

This method has no effect when you use the printPage method to print.

Parameters:
mrgn - The height of the header margin, in pixels.

getHeaderMargin

public int getHeaderMargin()
Retrieves the height of the header margin. By default, the margin is 18 pixels.
Returns:
The height of the header margin, in pixels.

setFooterMargin

public void setFooterMargin(int mrgn)
Specifies the height of the footer margin. When the entire page is available for printing a view, then the margin should be at least 18 pixels high, to prevent the view from being cropped around the edges by the printer device. This method does not impose limits on the margin size. By default, the margin is 18 pixels.

This method has no effect when you use the printPage method to print.

Parameters:
mrgn - The height of the footer margin, in pixels.

getFooterMargin

public int getFooterMargin()
Retrieves the height of the footer margin. By default, the margin is 18 pixels.
Returns:
The height of the footer margin, in pixels.

setPrintZoomFactor

public void setPrintZoomFactor(int zoom)
Specifies the zoom factor for printing. The print zoom factor is the amount by which the DataView is enlarged or reduced for printing. The value of the PrintZoomFactor property takes effect only when the PrintScaleType property is set to SCALE_TO_ZOOM_FACTOR.

By default, the view is printed at full size (100 percent).

Parameters:
zoom - The percentage at which to print the view. This methods logs an error if the value is less than 10.
See Also:
setPrintScaleType(int)

getPrintZoomFactor

public int getPrintZoomFactor()
Retrieves the zoom factor for printing. The print zoom factor is the amount by which the DataView is enlarged or reduced for printing. The value of the PrintZoomFactor property takes effect only when the PrintScaleType property is set to SCALE_TO_ZOOM_FACTOR.

By default, the view is printed at full size (100 percent).

Returns:
The percentage at which the view will be printed.
See Also:
setPrintScaleType(int)

setPrintScaleType

public void setPrintScaleType(int type)
Specifies how to scale the DataView for printing. By default, the view is printed at its original size.
Parameters:
type - A constant that indicates how to scale the DataView for printing. Most constants begin with SCALE_TO_. The constants are defined in this class and in the GraphPrinter subclass.
See Also:
ORIGINAL_SIZE, SCALE_TO_FIT_PAGES, SCALE_TO_ZOOM_FACTOR, SCALE_TO_FIT_PAGE, SCALE_TO_FIT_FULL_PAGE

getPrintScaleType

public int getPrintScaleType()
Retrieves information about how the DataView is scaled for printing.
Returns:
A constant that indicates how the DataView is scaled for printing. Most constants begin with SCALE_TO_. The constants are defined in this class and in the GraphPrinter subclass.
See Also:
ORIGINAL_SIZE, SCALE_TO_FIT_PAGES, SCALE_TO_ZOOM_FACTOR, SCALE_TO_FIT_PAGE, SCALE_TO_FIT_FULL_PAGE

setFitToNumPagesTall

public void setFitToNumPagesTall(int num)
Specifies the number of physical pages on which to fit a printed view vertically. This method does nothing in a GraphPrinter.

For example, suppose that you have a crosstab that has four columns and 40 rows. Suppose that this crosstab would normally print on two sheets of paper, the first 30 rows on page 1 and the remainder on page 2. You could set FitToNumPagesTall to 1 in order to reduce the printed size of the crosstab so that all 40 rows are printed on one sheet of paper.

The view is scaled to fit the number of pages that you specify only when the PrintScaleType property is set to SCALE_TO_FIT_PAGES.

Parameters:
num - The number of pages on which the view should fit vertically.
See Also:
setPrintScaleType(int)

getFitToNumPagesTall

public int getFitToNumPagesTall()
Retrieves the number of physical pages on which a printed view is required to fit vertically. The view is scaled to fit the returned number of pages only when the PrintScaleType property is set to SCALE_TO_FIT_PAGES.
Returns:
The number of pages on which the view is required to fit vertically.
See Also:
setPrintScaleType(int)

setFitToNumPagesWide

public void setFitToNumPagesWide(int num)
Specifies the number of physical pages on which to fit a printed view horizontally. This method does nothing in a GraphPrinter.

For example, suppose you have a crosstab that has 20 columns and 10 rows. Suppose that this crosstab would normally print on two sheets of paper, the first 12 columns on page 1 and the remainder on page 2. You could set FitToNumPagesWide to 1 in order to reduce the printed size of the crosstab so that all 20 columns are printed on one sheet of paper. The view is scaled to fit the number of pages that you specify only when the PrintScaleType property is set to SCALE_TO_FIT_PAGES.

Parameters:
num - The number of pages on which the view should fit horizontally.
See Also:
setPrintScaleType(int)

getFitToNumPagesWide

public int getFitToNumPagesWide()
Retrieves the number of physical pages on which a printed view is required to fit horizontally. The view is scaled to fit the returned number of pages only when the PrintScaleType property is set to SCALE_TO_FIT_PAGES.
Returns:
The number of pages on which the view is required to fit horizontally.
See Also:
setPrintScaleType(int)

setGridlinesVisible

public void setGridlinesVisible(boolean visible)
Specifies whether gridlines appear in a printed GridView. This method does nothing in a GraphPrinter.
Parameters:
visible - true to make gridlines appear in a printed GridView. false to hide gridlines.

isGridlinesVisible

public boolean isGridlinesVisible()
Indicates whether gridlines appear in a printed GridView.
Returns:
true if gridlines appear in the GridView when it is printed, false if they do not appear.

setLogicalPage

public boolean setLogicalPage(int[] hPos)
Specifies the logical page to print, when you use the printPage method to print. Call this method after you call the startPrint method for each view that you print.
Parameters:
hPos - The hPos array that identifies the logical page to print.
Returns:
true if the logical page has been set, false if the data in the view is not available to this ViewPrinter.
See Also:
GraphPrinter.printPage(Graphics), CrosstabPrinter.printPage(java.awt.Graphics), CrosstabPrinter.printPage(Graphics, DataSubsetRecord), TablePrinter.printPage(Graphics), TablePrinter.printPage(Graphics, DataSubsetRecord), PrintDialog, DataAccess.getFirstHPos(int), DataAccess.getNextHPos(int, int[])

getLogicalPage

public int[] getLogicalPage()
Retrieves the logical page to be printed, when you use the printPage method to print.
Returns:
The hPos array that identifies the logical page.
See Also:
GraphPrinter.printPage(Graphics), CrosstabPrinter.printPage(java.awt.Graphics), CrosstabPrinter.printPage(Graphics, DataSubsetRecord), TablePrinter.printPage(Graphics), TablePrinter.printPage(Graphics, DataSubsetRecord), PrintDialog, DataAccess.getNextHPos(int, int[])

setSelectedHPos

public void setSelectedHPos(java.util.Vector printHPos)
Specifies logical pages to print, when the RangeType is SELECTED_LOGICAL_PAGES. Each logical page to print is specified as an HPos.
Parameters:
printHPos - A Vector that contains an HPos for each logical page that you want to print.
See Also:
SELECTED_LOGICAL_PAGES, setRangeType(int), DataAccess.getMemberHPos(int, int, int)

getSelectedHPos

public java.util.Vector getSelectedHPos()
Retrieves the hierarchical addresses of the logical pages to print, when RangeType is set to SELECTED_LOGICAL_PAGES.
Returns:
A Vector that contains an HPos for each logical page to print.
See Also:
SELECTED_LOGICAL_PAGES, setRangeType(int), DataAccess.getMemberHPos(int, int, int)

setRangeType

public void setRangeType(int type)
Specifies whether to print the current logical page or all logical pages.

This method works only when you use the print method or the renderPage method to print. To set the page to print when you use the printPage method to print, call setLogicalPage.

Parameters:
type - A constant that identifies how much of the view to print.
See Also:
ALL_LOGICAL_PAGES, CURRENT_LOGICAL_PAGE, SELECTED_LOGICAL_PAGES, setLogicalPage(int[])

getRangeType

public int getRangeType()
Retrieves information about how much of the view will be printed.
Returns:
A constant that identifies whether the current logical page or all logical pages will be printed.
See Also:
ALL_LOGICAL_PAGES, CURRENT_LOGICAL_PAGE, SELECTED_LOGICAL_PAGES

getFooterPainter

public HeaderAndFooterPainter getFooterPainter()
Deprecated. As of 1.6.0.9, replaced by getHeaderAndFooterPainter(int)
There are now three different HeaderAndFooterPainter objects for footers. To retrieve a footer, pass FOOTER_LEFT, FOOTER_CENTER, or FOOTER_RIGHT to getHeaderAndFooterPainter.

getHeaderPainter

public HeaderAndFooterPainter getHeaderPainter()
Deprecated. As of 1.6.0.9, replaced by getHeaderAndFooterPainter(int)
There are now three different HeaderAndFooterPainter objects for headers. To retrieve a header, pass HEADER_LEFT, HEADER_CENTER, or HEADER_RIGHT to getHeaderAndFooterPainter.

getHeaderAndFooterPainter

public HeaderAndFooterPainter getHeaderAndFooterPainter(int headerOrFooterID)
Retrieves a header or footer painter. You set properties on the header or footer painter to specify what appears in the header or footer. There are three headers and three footers.
Parameters:
headerOrFooterID - A constant that specifies which header or footer painter you want.
Returns:
The painter for the specified header or footer.
See Also:
HEADER_LEFT, HEADER_CENTER, HEADER_RIGHT, FOOTER_LEFT, FOOTER_CENTER, FOOTER_RIGHT

setCustomHeaderAndFooterCallback

public void setCustomHeaderAndFooterCallback(CustomHeaderAndFooterCallback callback)
Registers a custom callback with this ViewPrinter. Use this method when you have implemented a CustomHeaderAndFooterCallback, to be able to print different headers and footers on different physical pages of a print job. To specify which headers and footers the callback should be used for, call setHeadersAndFootersUsingCallback.
Parameters:
callback - The callback that this ViewPrinter should use for custom headers and footers.
See Also:
setHeadersAndFootersUsingCallback(int)

getCustomHeaderAndFooterCallback

public CustomHeaderAndFooterCallback getCustomHeaderAndFooterCallback()
Retrieves the callback that this ViewPrinter uses for displaying custom headers and footers.
Returns:
The callback that this ViewPrinter uses to print custom headers and footers. If no custom callback has been registered with this ViewPrinter, then this method returns null.

setHeadersAndFootersUsingCallback

public void setHeadersAndFootersUsingCallback(int mask)
Specifies the headers and footers to which a custom callback applies. Use this method, when you implement a CustomHeaderAndFooterCallback, to specify which headers, footers, or both will use the custom callback.
Parameters:
mask - A constant that identifies the header or footer that uses a custom callback. You can combine the constants by using the OR operator (|).
See Also:
HEADER_LEFT, HEADER_CENTER, HEADER_RIGHT, FOOTER_LEFT, FOOTER_CENTER, FOOTER_RIGHT, HEADERS_AND_FOOTERS_ALL, HEADERS_AND_FOOTERS_NONE, setCustomHeaderAndFooterCallback(oracle.dss.dataView.CustomHeaderAndFooterCallback)

getHeadersAndFootersUsingCallback

public int getHeadersAndFootersUsingCallback()
Retrieves the headers and footers that use a custom callback.
Returns:
A constant that identifies the header or footer that uses a custom callback, or a bitmask that identifies multiple headers and footers.
See Also:
HEADER_LEFT, HEADER_CENTER, HEADER_RIGHT, FOOTER_LEFT, FOOTER_CENTER, FOOTER_RIGHT, setCustomHeaderAndFooterCallback(oracle.dss.dataView.CustomHeaderAndFooterCallback)

setMarginAdjustment

public void setMarginAdjustment(int adjustment)
Specifies how the margin behaves when a header or footer does not fit in the margin. By default, the margin ignores the size of the headers and footers, so if a header or footer is too big for a margin, it prints over the printable area of the view.
Parameters:
adjustment - A constant that represents how you want the margin to react to headers and footers that do not fit in the margin.
See Also:
ADJUST_FOR_HEADERS_AND_FOOTERS, IGNORE_HEADERS_AND_FOOTERS, OCCLUDE_HEADERS_AND_FOOTERS

getMarginAdjustment

public int getMarginAdjustment()
Retrieves the setting for how the margin responds when a header or footer does not fit.
Returns:
A constant that indicates how the margin responds when a header or footer does not fit.
See Also:
ADJUST_FOR_HEADERS_AND_FOOTERS, IGNORE_HEADERS_AND_FOOTERS, OCCLUDE_HEADERS_AND_FOOTERS

setViewDimension

public void setViewDimension(java.awt.Dimension dim)
Specifies the space allowed for printing a view.

When you call print to print a view, you do not need to call this method. The ViewPrinter gets the size of the paper from the print job.

When you call renderPage to print, then margins are taken out of the Dimension that you pass in this method. If you want to print on a full sheet of paper, then set the size of the paper in the Dimension.

If you call printPage, then the full Dimension is used to print the view. You should account for margins when you specify the Dimension.

Parameters:
dim - The Dimension that specifies the size of the area that is alloted on the page, for the view.
See Also:
print(boolean), renderPage(java.awt.Graphics), CrosstabPrinter.printPage(java.awt.Graphics), GraphPrinter.printPage(Graphics), CrosstabPrinter.printPage(Graphics, DataSubsetRecord), TablePrinter.printPage(Graphics), TablePrinter.printPage(Graphics, DataSubsetRecord)

getViewDimension

public java.awt.Dimension getViewDimension()
Retrieves the space allowed for printing a view, when you assume responsibility for a print job.
Returns:
The Dimension that specifies the area for the view.

setPrintByColumns

public void setPrintByColumns(boolean byColumns)
Specifies whether physical pages are printed by columns (left-to-right then top-to-bottom) or by rows(top-to-bottom then left-to-right).

For example, suppose that you have a table that has 30 rows and 20 columns, and that 15 rows and 10 columns can fit on a printed sheet of paper. When PrintByColumns is true (the default), then the pages are printed as follows:

When PrintByColumns is false, then the pages are printed as follows:

This method does nothing in a GraphPrinter.

Parameters:
byRows - true if physical pages are printed by columns, false if physical pages are printed by rows.

isPrintByColumns

public boolean isPrintByColumns()
Indicates whether physical pages are printed by rows (left-to-right then top-to-bottom) or by columns(top-to-bottom then left-to-right). This method does nothing in a GraphPrinter.
Returns:
true if physical pages are printed by columns, false if physical pages are printed by rows.

getPrintJob

public java.awt.PrintJob getPrintJob()
Retrieves the PrintJob object for this ViewPrinter.
Returns:
The PrintJob object.

getDataview

public Dataview getDataview()
Retrieves the Dataview that this ViewPrinter prints.
Returns:
The Dataview that this ViewPrinter prints.

showPrintJob

public boolean showPrintJob()
Displays the standard Print dialog box. The standard Print dialog box is java.awt.Toolkit.DefaultToolkit. The user can specify the page dimensions in the standard Print dialog box and can accept or cancel the print job.
Returns:
true if the user presses the OK button in the Print dialog box, false if the user presses the Cancel button.

setPrintJob

public void setPrintJob(java.awt.PrintJob job)
Specifies the PrintJob to use for printing.
Parameters:
job - The PrintJob object to use.

renderPage

public boolean renderPage(java.awt.Graphics g)
Renders a physical page of a view to a Graphics object. Use this method when you want to print to an area less than the full page, or when you want to print more of a view than just one logical page, but not all pages.

For example, you would call this method if you had a linked crosstab and graph, and you wanted to print all the physical pages of one logical page of the crosstab, and then the same logical page of a graph, and then the next logical page of a crosstab, and then that logical page of a graph, and so on.

You should also call this method if you want to print a view and any other object on the same piece of paper.

You also call this method if you provide your own user interface for print preview.

Before you call this method, you must call prepareFirstPage, which performs initialization for printing.

Parameters:
g - The Graphics object onto which to render the page of the view.
Returns:
true if the page is successfully rendered, false if the data in the view is not available to this ViewPrinter.
See Also:
prepareFirstPage(java.awt.Graphics), hasNextPage(), prepareNextPage(java.awt.Graphics), hasPrevPage(), preparePrevPage(java.awt.Graphics), isFirstPhysicalPage(), isLastPhysicalPage()

isFirstPhysicalPage

public abstract boolean isFirstPhysicalPage()
Indicates whether the current physical page is the first physical page in the current logical page. Use this method when you use the renderPage method.
Returns:
true if the current physical page is the first physical page in the current logical page, false if the current physical page is not the first in the logical page.
See Also:
renderPage(java.awt.Graphics)

isLastPhysicalPage

public abstract boolean isLastPhysicalPage()
Indicates whether the current physical page is the last physical page in the current logical page. Use this method when you use the renderPage method.
Returns:
true if the current physical page is the last physical page in the current logical page, false if the current physical page is not the last in the logical page.
See Also:
renderPage(java.awt.Graphics)

setSequentialPageNumber

public void setSequentialPageNumber(int pageNum)
Specifies the starting page number for this ViewPrinter. This ViewPrinter increments or decrements this page number whenever the ViewPrinter moves to the next page or to the previous page.

You normally call this method when you print multiple views, and you print the same logical page of each view before moving to the next logical page. After you print the first logical page of the first view, you call getSequentialPageNumber method of the ViewPrinter for that view to get the current physical page number. You then pass the return value to the setSequentialPageNumber method of the second ViewPrinter.

Parameters:
pageNum - The page number of the physical page.
See Also:
getSequentialPageNumber()

getSequentialPageNumber

public int getSequentialPageNumber()
Retrieves the current physical page number that this ViewPrinter has printed.
Returns:
The current physical page number.
See Also:
setSequentialPageNumber(int)

print

public int print(java.awt.Graphics graphics,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
          throws java.awt.print.PrinterException
Prints a physical page of this Dataview to a Graphics. The java.awt.print.PrinterJob class calls this method. Application developers should not need call this method.
Specified by:
print in interface java.awt.print.Printable
Parameters:
graphics - The context into which the page is drawn.
pageFormat - The size and orientation of the page that is drawn.
pageIndex - The zero-based index of the page to be drawn.
Returns:
java.awt.print.Printable.PAGE_EXISTS if the page is rendered successfully, java.awt.print.Printable.NO_SUCH_PAGE if pageIndex specifies a nonexistent page.

startPrint

public abstract boolean startPrint()
Puts the view in a state for printing. This method saves the original state of the view, then it applies printing properties to the view. It displays the offscreen image (which has the snapshot of the view) on the screen, so that any modifications done to the view during printing will not be seen.

Calling this method is equivalent to calling startPrint(false). It is appropriate for printing or previewing graphs, or printing tables and crosstabs. To preview a table or crosstab, call startPrint(true).

Calls to the print method belong between calls to startPrint and endPrint.

Returns:
true if the print job starts successfully, false if the data in the view is not available to this ViewPrinter.
See Also:
endPrint(), print(boolean), renderPage(java.awt.Graphics), startPrint(boolean), CrosstabPrinter.printPage(java.awt.Graphics), GraphPrinter.printPage(Graphics), CrosstabPrinter.printPage(Graphics, DataSubsetRecord), TablePrinter.printPage(Graphics), TablePrinter.printPage(Graphics, DataSubsetRecord)

startPrint

public abstract boolean startPrint(boolean bPreviewMode)
Puts the view in a state for printing. This method saves the original state of the view, then it applies printing properties to the view. It displays the offscreen image (which has the snapshot of the view) on the screen, so that any modifications done to the view during printing will not be seen.

Use this method, with the renderPage method, when you preview a table or crosstab. Passing true in the bPreviewMode parameter allows this ViewPrinter to cache information to improve performance.

Calls to the print method belong between calls to startPrint and endPrint.

Parameters:
bPreviewMode - true if you are previewing the print job, false if you are actually sending the print job to a printer.
Returns:
true if the print job starts successfully, false if the data in the view is not available to this ViewPrinter.
See Also:
endPrint(), print(boolean), renderPage(java.awt.Graphics), GraphPrinter.printPage(Graphics), CrosstabPrinter.printPage(java.awt.Graphics), CrosstabPrinter.printPage(Graphics, DataSubsetRecord), TablePrinter.printPage(Graphics), TablePrinter.printPage(Graphics, DataSubsetRecord)

endPrint

public abstract void endPrint()
Sets the view back to its original state. This method removes the offscreen image that the startPrint method displays, and restores the active display of the view.

Calls to the print method belong between calls to startPrint and endPrint.

See Also:
startPrint(), print(boolean), renderPage(java.awt.Graphics), CrosstabPrinter.printPage(java.awt.Graphics), GraphPrinter.printPage(Graphics), CrosstabPrinter.printPage(Graphics, DataSubsetRecord), TablePrinter.printPage(Graphics), TablePrinter.printPage(Graphics, DataSubsetRecord)

setRepeatHeaders

public abstract void setRepeatHeaders(boolean repeat)
Specifies whether to display the column and row headers on every physical page, when a table or crosstab is printed on multiple physical pages. A logical page of a graph always prints to a single physical page, so this method has no effect in a graph.

When RepeatHeaders is true, then the title, subtitle, footnote, and paging component are also repeated on each page.

When RepeatHeaders is false, then the title, subtitle, and paging component appear only on the first page. The footnote appears only on the last page. The column headers appear only on pages that display the first column, and the row headers appear only on pages that display the first row.

Parameters:
repeat - true to repeat row and column headers and titles, false to prevent repeating.

isRepeatHeaders

public abstract boolean isRepeatHeaders()
Indicates whether column and row headers are displayed on every physical page, when a table or crosstab is printed on multiple physical pages. A logical page of a graph always prints to a single physical page, so this method always returns false in a GraphPrinter.

When RepeatHeaders is true, then the title, subtitle, footnote, and paging component are also repeated on each page.

When RepeatHeaders is false, then the title, subtitle, and paging component appear only on the first page. The footnote appears only on the last page. The column headers appear only on pages that display the first column, and the row headers appear only on pages that display the first row.

Parameters:
repeat - true if row and column headers and titles appear on each page, false if they do not.

goToFirstPage

public abstract boolean goToFirstPage()
Deprecated. As of 1.6.0.9, replaced by prepareFirstPage(Graphics)
The prepareFirstPage method respects the MarginAdjustment property.
See Also:
setMarginAdjustment(int)

goToNextPage

public abstract boolean goToNextPage()
Deprecated. As of 1.6.0.9, replaced by prepareNextPage(Graphics)
The prepareNextPage method respects the MarginAdjustment property.
See Also:
setMarginAdjustment(int)

goToPrevPage

public abstract boolean goToPrevPage()
Deprecated. As of 1.6.0.9, replaced by preparePrevPage(Graphics)
The preparePrevPage method respects the MarginAdjustment property.
See Also:
setMarginAdjustment(int)

prepareFirstPage

public abstract boolean prepareFirstPage(java.awt.Graphics g)
Prepares the first physical page in the view for printing and makes it the current page to print. Call this method before you call renderPage to print. Call this method before you call any of the other methods for changing pages. Call this method, even if you only print one physical page. This method performs initialization for printing.
Parameters:
g - The Graphics object to which to print the page.
Returns:
true if the call is successful, false if the first physical page has no data.
See Also:
renderPage(java.awt.Graphics), hasNextPage(), prepareNextPage(java.awt.Graphics)

prepareNextPage

public abstract boolean prepareNextPage(java.awt.Graphics g)
Prepares the next physical page for printing and makes it the current page to print. Use this method when you use renderPage to print. Unless you are certain that there is a next page, you should call hasNextPage before you call this method. Also, before calling this method, call prepareFirstPage.
Parameters:
g - The Graphics object to which to print the page.
Returns:
true if the call is successful, false if the next physical page has no data.
See Also:
renderPage(java.awt.Graphics), prepareFirstPage(java.awt.Graphics), hasNextPage()

setScaleFontSize

public abstract void setScaleFontSize(int mask)
Specifies text components to resize when a graph is scaled to a different size for printing.
Parameters:
mask - A constant that represents the set of components to scale with the graph. The constants are listed in the See Also section.
See Also:
Graph.TEXT_COMPONENTS_ALL, Graph.TEXT_COMPONENTS_NONE

getScaleFontSize

public abstract int getScaleFontSize()
Retrieves the text components to resize when a graph is scaled to a different size for printing.
Returns:
A constant that represents which text components should be resized when the Graph is scaled to a different size for printing. The constants are listed in the See Also section.
See Also:
Graph.TEXT_COMPONENTS_ALL, Graph.TEXT_COMPONENTS_NONE

preparePrevPage

public abstract boolean preparePrevPage(java.awt.Graphics g)
Prepares the previous physical page for printing and makes it the current page to print. Use this method when you use renderPage to print. Unless you are certain that there is a previous page, you should call hasPrevPage before you call this method. Also, before calling this method, call prepareFirstPage.
Parameters:
g - The Graphics object to which to print the page.
Returns:
true if the call is successful, false if the previous physical page has no data.
See Also:
renderPage(java.awt.Graphics), prepareFirstPage(java.awt.Graphics), hasPrevPage()

hasNextPage

public abstract boolean hasNextPage()
Indicates whether the view has a physical page after the current physical page. Use this method when you use renderPage to print. Call this method before you call prepareNextPage.
Returns:
true if the view has another physical page after the current page, false if the current physical page is the last physical page.
See Also:
renderPage(java.awt.Graphics), prepareNextPage(java.awt.Graphics)

hasPrevPage

public abstract boolean hasPrevPage()
Indicates whether the view has a physical page before the current physical page. Use this method when you use renderPage to print. Call this method before you call preparePrevPage.
Returns:
true if the view has another physical page before the current page, false if the current physical page is the first physical page.
See Also:
renderPage(java.awt.Graphics), preparePrevPage(java.awt.Graphics)

setTokenSubstitution

public void setTokenSubstitution(TokenSubstitution token)
Specifies a handler for token substitution in this ViewPrinter. Token substitution handlers make it possible for users to insert tokens (such as a token for the current dimension member) in the headers and footers of this ViewPrinter. This method sets the TokenSubstitution on this ViewPrinter and on all six of headers and footers that this ViewPrinter maintains. By default, the TokenSubstitution on this ViewPrinter and on each header and footer is null. You can also set a TokenSubstitution on each individual header and footer separately.
Parameters:
token - The token substitution handler for this ViewPrinter.

setPageFormat

public void setPageFormat(java.awt.print.PageFormat pf)
Specifies the PageFormat object that specifies paper size for this ViewPrinter. The PageSetupDialog calls this method to set the PageFormat object that it modifies, to set the paper size on the print job.
Parameters:
pf - The PageFormat object that specifies the paper size.

getPageFormat

public java.awt.print.PageFormat getPageFormat()
Retrieves the PageFormat object that specifies the paper size for this ViewPrinter. The PageSetupDialog calls this method to retrieve the PageFormat in its initialization. If you use the PageSetupDialog but not the PrintDialog, then you should call this method to set the PageFormat on the PageSetupDialog.
Returns:
The PageFormat object that specifies the paper size for this ViewPrinter.

getTokenSubstitution

public TokenSubstitution getTokenSubstitution()
Retrieves the handler for token substitution in this ViewPrinter. Token substitution handlers make it possible for users to insert tokens (such as a token for the current dimension member) in the headers and footers of this ViewPrinter. You can also set a TokenSubstitution on each individual header and footer separately. This method gets the TokenSubstitution that is set on this ViewPrinter, which may be overridden in one or more headers or footers. By default, the TokenSubstitution on this ViewPrinter and on each header and footer is null.
Returns:
The token substitution handler for this ViewPrinter.

Oracle™ Business Intelligence Beans Java API Reference
Release 10
g (9.0.4)
Part number B12159_01


Copyright © 2003, Oracle. All Rights Reserved.