ilog.views.print
Class IlvManagerPrintableDocument

java.lang.Object
  extended by ilog.views.util.print.IlvPrintableDocument
      extended by ilog.views.print.IlvManagerPrintableDocument
All Implemented Interfaces:
Pageable, Printable
Direct Known Subclasses:
IlvMapPrintableDocument

public class IlvManagerPrintableDocument
extends IlvPrintableDocument

A 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.

Since:
JViews 5.5

Field Summary
 
Fields inherited from class ilog.views.util.print.IlvPrintableDocument
ORDERED_BY_COLUMNS, ORDERED_BY_ROWS
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
 
Constructor Summary
IlvManagerPrintableDocument(String name, IlvManagerView view)
          Creates a ManagerDocument for the specified manager view.
IlvManagerPrintableDocument(String name, IlvManagerView view, PageFormat pageFormat)
          Creates a ManagerDocument for the specified manager view and page format.
 
Method Summary
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.
 
Methods inherited from class ilog.views.util.print.IlvPrintableDocument
addPage, addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getAuthor, getDate, getFooter, getHeader, getImageableBounds, getName, getNumberOfPages, getPage, getPageFormat, getPageFormat, getPageIndex, getPageOrder, getPrintable, getTemplatePage, invalidateFlowLayout, invalidatePages, isFlowLayoutValid, print, removeAll, removePage, removePropertyChangeListener, removePropertyChangeListener, setAuthor, setDate, setFooter, setHeader, setName, setPageFormat, setPageOrder, setPages, setTemplatePage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvManagerPrintableDocument

public IlvManagerPrintableDocument(String name,
                                   IlvManagerView view,
                                   PageFormat pageFormat)
Creates a ManagerDocument for the specified manager view and page format.

Parameters:
view - The manager view to print.
pageFormat - The page format.

IlvManagerPrintableDocument

public IlvManagerPrintableDocument(String name,
                                   IlvManagerView view)
Creates a ManagerDocument for the specified manager view. The default page format is a letter-sized page with one-inch margins.

Parameters:
view - The manager view to print.
Method Detail

getView

public IlvManagerView getView()
Returns the manager view used when creating the document.


isPrintingAllManagerBBox

public boolean isPrintingAllManagerBBox()
Returns true if the area to be printed is the total area of the manager.


getTotalManagerPrintableArea

public IlvRect getTotalManagerPrintableArea()
Returns the total area of the manager to be printed. The value returned is in manager coordinate system.

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.

See Also:
setAutomaticZoomLevel(boolean), getZoomTransformer()

getZoomTransformer

public IlvTransformer getZoomTransformer()
Returns the zoom transformer used when printing. This zoom transformer is only used when automatic zoom level is disabled.

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.

Since:
JViews 8.0
See Also:
setZoomTransformer(ilog.views.IlvTransformer), setZoomLevel(double), setAutomaticZoomLevel(boolean), setMaximumZoomLevel(double), setMinimumZoomLevel(double), setZoomLevelModificationEnabled(boolean)

setZoomTransformer

public void setZoomTransformer(IlvTransformer t)
Changes the zoom transformer used when printing. This zoom transformer is only used when automatic zoom level is disabled.

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.

Since:
JViews 8.0
See Also:
getZoomTransformer(), setZoomLevel(double), setAutomaticZoomLevel(boolean), setMaximumZoomLevel(double), setMinimumZoomLevel(double), setZoomLevelModificationEnabled(boolean)

getZoomLevel

public double getZoomLevel()
Returns the zoom level used when printing. The zoom level is the zoom factor of the zoom transformer.

See Also:
setZoomTransformer(ilog.views.IlvTransformer)

setZoomLevel

public void setZoomLevel(double zl)
Changes the zoom level used when printing. This sets the zoom transformer to a transformation that scales in x and y direction by the same amount.

See Also:
setZoomTransformer(ilog.views.IlvTransformer), setMaximumZoomLevel(double), setMinimumZoomLevel(double), setZoomLevelModificationEnabled(boolean)

isAutomaticZoomLevel

public boolean isAutomaticZoomLevel()
Returns true if the automatic zoom level calculation is enabled. It is enabled by default.

Since:
JViews 8.0
See Also:
setAutomaticZoomLevel(boolean), setZoomTransformer(ilog.views.IlvTransformer)

setAutomaticZoomLevel

public void setAutomaticZoomLevel(boolean enable)
Sets whether the automatic zoom level calculation is enabled. It is enabled by default.

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.

Since:
JViews 8.0
See Also:
isAutomaticZoomLevel(), setZoomTransformer(ilog.views.IlvTransformer)

setMaximumZoomLevel

public void setMaximumZoomLevel(double zl)
Sets the maximum zoom level that can be used for printing. This maximum value is controlled by the dialog box that allows you to change the zoom level used for printing.

Since:
JViews 8.0
See Also:
getMaximumZoomLevel(), setMinimumZoomLevel(double), setZoomLevel(double), setZoomLevelModificationEnabled(boolean)

getMaximumZoomLevel

public double getMaximumZoomLevel()
Returns the maximum zoom level that can be used for printing. This maximum value is controlled by the dialog box that allows you to change the zoom level used for printing.

Since:
JViews 8.0
See Also:
setMaximumZoomLevel(double), setMinimumZoomLevel(double), setZoomLevel(double), setZoomLevelModificationEnabled(boolean)

setMinimumZoomLevel

public void setMinimumZoomLevel(double zl)
Returns the maximum zoom level that can be used for printing. This maximum value is controlled by the dialog box that allows you to change the zoom level used for printing.

See Also:
getMinimumZoomLevel(), setMaximumZoomLevel(double), setZoomLevel(double), setZoomLevelModificationEnabled(boolean)

getMinimumZoomLevel

public double getMinimumZoomLevel()
Returns the minimum zoom level that can be used for printing. This minimum value is controlled by the dialog box that allows you to change the zoom level used for printing.

See Also:
setMinimumZoomLevel(double), setMaximumZoomLevel(double), setZoomLevel(double), setZoomLevelModificationEnabled(boolean)

setZoomLevelModificationEnabled

public void setZoomLevelModificationEnabled(boolean set)
Allows the user to change the zoom level used for printing in the setup dialog box. When set to true the setup dialog box allows the user to change the zoom level from the value specified by setMinimumZoomLevel(double) and setMaximumZoomLevel(double).

See Also:
isZoomLevelModificationEnabled(), setMaximumZoomLevel(double), setMinimumZoomLevel(double), setZoomLevel(double)

isZoomLevelModificationEnabled

public boolean isZoomLevelModificationEnabled()
Returns true if the zoom level used for printing can be changed from the dialog box.

See Also:
setZoomLevelModificationEnabled(boolean), setZoomLevel(double), setMaximumZoomLevel(double), setMinimumZoomLevel(double)

setPrintArea

public void setPrintArea(IlvRect area)
Changes the area of the manager that is printed.

Parameters:
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.
See Also:
getPrintArea()

getPrintArea

public IlvRect getPrintArea()
Returns the area of the manager that is printed. The area is returned in manager coordinate.

See Also:
setPrintArea(ilog.views.IlvRect)

getPrintArea

public IlvRect getPrintArea(int pageIndex)
Returns the area of the manager that is printed in the specified page. The area is returned in manager coordinate system.

Parameters:
pageIndex - The index of the page in the document.

setPageBreakPreviewVisible

public void setPageBreakPreviewVisible(boolean set)
Shows or hides the Page Break Preview on the view that corresponds to this document. Note that the Page Break Preview can only be displayed on the view if the print area has been specified to an area of the manager and not to the full area.

See Also:
createPageBreakPreview()

createPageBreakPreview

protected IlvManagerPageBreakPreview createPageBreakPreview()
Creates an IlvManagerPageBreakPreview for previewing the pages in the view that corresponds to this document.


createPrintableManagerArea

protected IlvPrintableManagerArea createPrintableManagerArea(IlvUnit.Rectangle pageArea,
                                                             IlvRect managerArea)
Creates a new 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()).

Parameters:
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.
Since:
JViews 7.5

prepareDocument

protected void prepareDocument()
This method is called before printing the document, before showing the 'print preview' dialog or opening the 'page setup' dialog. The method will recreate the pages of the document in case the area to print is the total area of the manager and this area has changed since the pages were last created.

Overrides:
prepareDocument in class IlvPrintableDocument

createPages

protected IlvPage[] createPages()
Creates the pages of this document. This method takes into account the number of rows and columns, the page order, the printed area, the header and footer and is called every time one of these parameters changes.

Overrides:
createPages in class IlvPrintableDocument

setColumnCount

public void setColumnCount(int columns)
Changes the number of columns used to print this document.

Overrides:
setColumnCount in class IlvPrintableDocument
Parameters:
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.
See Also:
setRowCount(int), getColumnCount()

getColumnCount

public int getColumnCount()
Returns the number of columns of pages in this document.

Overrides:
getColumnCount in class IlvPrintableDocument
Returns:
The number of columns, or -1 if this document does not represent pages organized in rows and columns. The default value is -1.
See Also:
setColumnCount(int)

setRowCount

public void setRowCount(int rows)
Changes the number of rows used to print this document.

Parameters:
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.
See Also:
setColumnCount(int), getRowCount()

getRowCount

public int getRowCount()
Returns the number of rows of pages in this document.

See Also:
setRowCount(int)

getFlow

public IlvFlow getFlow()
Overwrites the method to disable the usage of the flow in this type of document. The method always throws an IllegalArgumentException.

Overrides:
getFlow in class IlvPrintableDocument
See Also:
IlvPrintableDocument.isFlowLayoutValid(), IlvPrintableDocument.invalidateFlowLayout()


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.