public class IlvManagerPrintableDocument extends IlvPrintableDocument
Document
subclass for printing the content
of an IlvManager
. This class allows you to specify
an area of the IlvManager
that must be printed.
This area can be printed in several pages. The pages are
specified either by defining the number of rows or the
number of columns. This object will automatically create the
appropriate number of pages according to the area, the number
of rows and columns and the page format. If both the number
of rows and columns are specified, then the object will take
into account only the value that results in the
minimum number of pages. To print the area in one page, you
may set the number of rows and the number of columns to 1.ORDERED_BY_COLUMNS, ORDERED_BY_ROWS
NO_SUCH_PAGE, PAGE_EXISTS
UNKNOWN_NUMBER_OF_PAGES
Constructor and Description |
---|
IlvManagerPrintableDocument(String name,
IlvManagerView view)
Deprecated.
Since JViews 8.8, please use a constructor which allows the
page format to depend on the printer or - if no printer is
available - on the current locale.
|
IlvManagerPrintableDocument(String name,
IlvManagerView view,
int orientation)
Creates a
ManagerDocument for the specified
manager view and orientation. |
IlvManagerPrintableDocument(String name,
IlvManagerView view,
int orientation,
Paper paperFormat)
Creates a
ManagerDocument for the specified
manager view and page format, given as an orientation and a paper format. |
IlvManagerPrintableDocument(String name,
IlvManagerView view,
PageFormat pageFormat)
Creates a
ManagerDocument for the specified
manager view and page format. |
Modifier and Type | Method and Description |
---|---|
protected IlvManagerPageBreakPreview |
createPageBreakPreview()
Creates an
IlvManagerPageBreakPreview for
previewing the pages in the view that corresponds to this
document. |
protected IlvPage[] |
createPages()
Creates the pages of this document.
|
protected IlvPrintableManagerArea |
createPrintableManagerArea(IlvUnit.Rectangle pageArea,
IlvRect managerArea)
Creates a new
IlvPrintableManagerArea . |
int |
getColumnCount()
Returns the number of columns of pages in this document.
|
IlvFlow |
getFlow()
Overwrites the method to disable the usage of the flow
in this type of document.
|
double |
getMaximumZoomLevel()
Returns the maximum zoom level that can be used for printing.
|
double |
getMinimumZoomLevel()
Returns the minimum zoom level that can be used for printing.
|
IlvRect |
getPrintArea()
Returns the area of the manager that is printed.
|
IlvRect |
getPrintArea(int pageIndex)
Returns the area of the manager that is printed in the
specified page.
|
int |
getRowCount()
Returns the number of rows of pages in this document.
|
IlvRect |
getTotalManagerPrintableArea()
Returns the total area of the manager to be printed.
|
IlvManagerView |
getView()
Returns the manager view used when creating the document.
|
double |
getZoomLevel()
Returns the zoom level used when printing.
|
IlvTransformer |
getZoomTransformer()
Returns the zoom transformer used when printing.
|
boolean |
isAutomaticZoomLevel()
Returns
true if the automatic zoom level calculation is
enabled. |
boolean |
isPrintingAllManagerBBox()
Returns
true if the area to be printed
is the total area of the manager. |
boolean |
isZoomLevelModificationEnabled()
Returns
true if the zoom level used for printing
can be changed from the dialog box. |
protected void |
prepareDocument()
This method is called before
printing the document, before showing the 'print preview' dialog or
opening the 'page setup' dialog.
|
void |
setAutomaticZoomLevel(boolean enable)
Sets whether the automatic zoom level calculation is
enabled.
|
void |
setColumnCount(int columns)
Changes the number of columns used to print this document.
|
void |
setMaximumZoomLevel(double zl)
Sets the maximum zoom level that can be used for printing.
|
void |
setMinimumZoomLevel(double zl)
Returns the maximum zoom level that can be used for printing.
|
void |
setPageBreakPreviewVisible(boolean set)
Shows or hides the Page Break Preview on the view that
corresponds to this document.
|
void |
setPrintArea(IlvRect area)
Changes the area of the manager that is printed.
|
void |
setRowCount(int rows)
Changes the number of rows used to print this document.
|
void |
setZoomLevel(double zl)
Changes the zoom level used when printing.
|
void |
setZoomLevelModificationEnabled(boolean set)
Allows the user to change the zoom level used
for printing in the setup dialog box.
|
void |
setZoomTransformer(IlvTransformer t)
Changes the zoom transformer used when printing.
|
addPage, addPropertyChangeListener, addPropertyChangeListener, enablePrintStyle, firePropertyChange, getAuthor, getDate, getFooter, getHeader, getImageableBounds, getName, getNumberOfPages, getOrientation, getPage, getPageFormat, getPageFormat, getPageIndex, getPageOrder, getPaperFormat, getPrintable, getSides, getTemplatePage, invalidateFlowLayout, invalidatePages, isFlowLayoutValid, maybeInvalidatePages, print, removeAll, removePage, removePropertyChangeListener, removePropertyChangeListener, setAuthor, setDate, setFooter, setHeader, setName, setOrientation, setPageFormat, setPageOrder, setPages, setPaperFormat, setSides, setTemplatePage
public IlvManagerPrintableDocument(String name, IlvManagerView view, PageFormat pageFormat)
ManagerDocument
for the specified
manager view and page format.view
- The manager view to print.pageFormat
- The page format. Because a fixed
page format is not apppropriate for all printers and
all locales, it is recommended that this argument be
constructed from
IlvPrintingController.getDefaultPageFormat()
or
IlvPrintingController.getDefaultPaperFormat()
.public IlvManagerPrintableDocument(String name, IlvManagerView view, int orientation, Paper paperFormat)
ManagerDocument
for the specified
manager view and page format, given as an orientation and a paper format.view
- The manager view to print.orientation
- One of PageFormat.PORTRAIT
,
PageFormat.LANDSCAPE
,
PageFormat.REVERSE_LANDSCAPE
.paperFormat
- A paper format object, or null
if the paper
format shall be provided by the
IlvPrintingController
, depending on the default
printer or - if no printer is available - depending on
the current locale. Because a fixed page format is not
apppropriate for all printers and all locales, it is
recommended that this argument be null
or
constructed from
IlvPrintingController.getDefaultPaperFormat()
.public IlvManagerPrintableDocument(String name, IlvManagerView view, int orientation)
ManagerDocument
for the specified
manager view and orientation. The paper format shall be provided by the
IlvPrintingController
, depending on the default printer or
- if no printer is available - depending on the current locale.view
- The manager view to print.orientation
- One of PageFormat.PORTRAIT
,
PageFormat.LANDSCAPE
,
PageFormat.REVERSE_LANDSCAPE
.@Deprecated public IlvManagerPrintableDocument(String name, IlvManagerView view)
ManagerDocument
for the specified manager view with
portrait orientation and a page format that is a US Letter sized page with
one-inch margins.view
- The manager view to print.public IlvManagerView getView()
public boolean isAutomaticZoomLevel()
true
if the automatic zoom level calculation is
enabled. It is enabled by default.setAutomaticZoomLevel(boolean)
,
setZoomTransformer(ilog.views.IlvTransformer)
public void setAutomaticZoomLevel(boolean enable)
In the printout, the print area of the manager must be transformed to fit
to the page area. However, the content of an IlvManager
may
change when displayed at different zoom level (for example when it
contains nonzoomable objects). In order to adjust the printing, it
is possible to set the zoom transformer (see setZoomTransformer(ilog.views.IlvTransformer)
),
which however has only an effect if the automatic zoom level calculation
is disabled. If it is enabled, an internal zoom transformer is calculated
automatically and the explicitly set zoom transformer is ignored.
isAutomaticZoomLevel()
,
setZoomTransformer(ilog.views.IlvTransformer)
public double getMaximumZoomLevel()
setMaximumZoomLevel(double)
,
setMinimumZoomLevel(double)
,
setZoomLevel(double)
,
setZoomLevelModificationEnabled(boolean)
public void setMaximumZoomLevel(double zl)
getMaximumZoomLevel()
,
setMinimumZoomLevel(double)
,
setZoomLevel(double)
,
setZoomLevelModificationEnabled(boolean)
public double getMinimumZoomLevel()
public void setMinimumZoomLevel(double zl)
public IlvTransformer getZoomTransformer()
In the printout, the print area of the manager must be transformed to fit
to the page area. However, the content of an IlvManager
may
change when displayed at different zoom level (for example when it
contains nonzoomable objects).
The zoom transformer is used to specify the zoom level when
printing. Still, the print area is transformed to fit to the page area,
but the zoom transformer decides for instance how much of this
transformation contributes to the nonzoomable objects.
If the method returns null
, the zoom transformer
of the input view is used instead. In this case, the proportions between
zoomable and nonzoomable objects are in the printout exactly as in the
view.
public void setZoomTransformer(IlvTransformer t)
In the printout, the print area of the manager must be transformed to fit
to the page area. However, the content of an IlvManager
may
change when displayed at different zoom level (for example when it
contains nonzoomable objects).
The zoom transformer is used to specify the zoom level when
printing. Still, the print area is transformed to fit to the page area,
but the zoom transformer decides for instance how much of this
transformation contributes to the nonzoomable objects.
If the input zoom transformer is null
, the zoom transformer
of the input view is used instead. In this case, the proportions between
zoomable and nonzoomable objects are in the printout exactly as in the
view.
Changing the zoom transformer may affect the result of the printing but will not affect the number of pages or the area on a page that is printed.
public double getZoomLevel()
public void setZoomLevel(double zl)
public boolean isZoomLevelModificationEnabled()
true
if the zoom level used for printing
can be changed from the dialog box.public void setZoomLevelModificationEnabled(boolean set)
true
the setup dialog box allows the user to change the zoom level from the
value specified by setMinimumZoomLevel(double)
and setMaximumZoomLevel(double)
.public boolean isPrintingAllManagerBBox()
true
if the area to be printed
is the total area of the manager.public IlvRect getTotalManagerPrintableArea()
Invisible layers and layers for which
IlvManagerView.isContributingToViewBBox(int)
returns
false
are not taken into account when calculating the area.
If the automatic zoom level calculation is enabled, the returned value may only be an approximation. In particular if the manager contains nonzoomable objects, it is recommended to disable the automatic zoom level calculation and to set the zoom transformer instead, so that the returned value is precise with respect to the given zoom transformer.
public IlvRect getPrintArea()
setPrintArea(ilog.views.IlvRect)
public void setPrintArea(IlvRect area)
area
- The new area in manager coordinate system. When area
is null
, then the area to print will be the full area
of the manager.getPrintArea()
public int getColumnCount()
getColumnCount
in class IlvPrintableDocument
setColumnCount(int)
public void setColumnCount(int columns)
setColumnCount
in class IlvPrintableDocument
columns
- The number of columns, or 0 to indicate that
the number of column is not specified and should be computed
using the number of rows.setRowCount(int)
,
getColumnCount()
public int getRowCount()
setRowCount(int)
public void setRowCount(int rows)
rows
- The number of rows, or 0 to indicate that
the number of rows is not specified and should be computed
using the number of columns.setColumnCount(int)
,
getRowCount()
public void setPageBreakPreviewVisible(boolean set)
createPageBreakPreview()
protected IlvManagerPageBreakPreview createPageBreakPreview()
IlvManagerPageBreakPreview
for
previewing the pages in the view that corresponds to this
document.public IlvFlow getFlow()
IllegalArgumentException
.getFlow
in class IlvPrintableDocument
IlvPrintableDocument.isFlowLayoutValid()
,
IlvPrintableDocument.invalidateFlowLayout()
protected void prepareDocument()
prepareDocument
in class IlvPrintableDocument
protected IlvPage[] createPages()
createPages
in class IlvPrintableDocument
protected IlvPrintableManagerArea createPrintableManagerArea(IlvUnit.Rectangle pageArea, IlvRect managerArea)
IlvPrintableManagerArea
.
This method acts as factory method. It is called whenever a new
printable manager area is needed for the current view (see
getView()
) and the current zoom level (see getZoomLevel()
).
pageArea
- The area in the page where the manager must be printed.managerArea
- The area of the manager to be printed in manager's
coordinate system.public IlvRect getPrintArea(int pageIndex)
pageIndex
- The index of the page in the document.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.