ilog.views.util.print
Class IlvPrintingController

java.lang.Object
  extended by ilog.views.util.print.IlvPrintingController
Direct Known Subclasses:
IlvManagerPrintingController

public class IlvPrintingController
extends Object

The IlvPrintingController is the root object of the print framework. It is designed to manage various printing tasks. It is the root from which you can perform different print actions. You can invoke different dialog boxes to change various printing parameters.

It is designed to manage the following objects:

The IlvPrintingController has two methods, printDialog() and print(), which you can use to change the printer settings and to print the associated IlvPrintableDocument.

Since:
JViews 5.5
See Also:
IlvPrintableDocument, IlvPrintPreviewDialog, print(boolean)

Constructor Summary
IlvPrintingController(IlvPrintableDocument document)
          Creates a IlvPrintingController for the specified IlvPrintableDocument.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener propertyChangeListener)
          Adds a listener to listen to the modification of all properties
 void addPropertyChangeListener(String propertyName, PropertyChangeListener propertyChangeListener)
          Adds a listener to listen to the modification of the specified property.
protected  Window createPrintPreviewWindow(Window owner)
          Creates the IlvPrintPreviewDialog for previewing the associated IlvPrintableDocument.
protected  IlvDocumentSetupDialog createSetupDialog(Window owner, boolean printButton, boolean printPreviewButton)
          Creates the dialog box used to edit the parameters of a document.
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          Fires a 'PropertyChangeEvent' event for the specified property.
 ComponentOrientation getComponentOrientation()
          Returns the language-sensitive orientation of the dialogs managed by this controller.
 IlvPrintableDocument getDocument()
          Returns the IlvPrintableDocument to be printed.
 int getPreviewMode()
          Returns the mode of the IlvPrintPreviewPanel created by createPrintPreviewWindow(java.awt.Window).
 PrinterJob getPrinterJob()
          Gets the PrinterJob if it is already created.
 void pageDialog()
          This function shows a page format dialog box that allows users to change the page format of the associated IlvPrintableDocument.
 void print(boolean showPrintDialog)
          Prints the document.
 boolean printDialog()
          Opens a dialog box for changes the setting of the associated PrinterJob.
 void printPreview(Window owner)
          Opens a Print Preview dialog box.
 void removePropertyChangeListener(PropertyChangeListener propertyChangeListener)
          Removes a listener so that it no longer listens to the modification of the properties.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener propertyChangeListener)
          Removes a listener so that it no longer listens to the modification of the specified property.
 void setComponentOrientation(ComponentOrientation o)
          Sets the language-sensitive orientation of the dialogs managed by this controller.
 void setDocument(IlvPrintableDocument document)
          Changes the IlvPrintableDocument to be printed.
 void setLookAndFeel(UIManager.LookAndFeelInfo laf)
          Updates the look & feel of the dialogs managed by this controller.
 void setPreviewMode(int mode)
          Changes the mode of the IlvPrintPreviewPanel created by createPrintPreviewWindow(java.awt.Window).
 void setupDialog(Window owner, boolean printButton, boolean previewButton)
          Opens the dialog box used to edit the parameters of a document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvPrintingController

public IlvPrintingController(IlvPrintableDocument document)
Creates a IlvPrintingController for the specified IlvPrintableDocument.

Parameters:
document - The IlvPrintableDocument that defines the contents to be printed.
Method Detail

getDocument

public IlvPrintableDocument getDocument()
Returns the IlvPrintableDocument to be printed.

Returns:
The IlvPrintableDocument that defines the contents to be printed.

setDocument

public void setDocument(IlvPrintableDocument document)
Changes the IlvPrintableDocument to be printed. This method refreshes the preview of the document if it is visible.

Parameters:
document - The document that defines the contents to be printed.

printPreview

public void printPreview(Window owner)
Opens a Print Preview dialog box.

See Also:
setPreviewMode(int), createPrintPreviewWindow(java.awt.Window)

getPreviewMode

public int getPreviewMode()
Returns the mode of the IlvPrintPreviewPanel created by createPrintPreviewWindow(java.awt.Window). The mode can be one of IlvPrintPreviewPanel.SINGLE_PAGE_MODE or IlvPrintPreviewPanel.CONTINUOUS_MODE. The default mode is IlvPrintPreviewPanel.SINGLE_PAGE_MODE.

See Also:
printPreview(java.awt.Window)

setPreviewMode

public void setPreviewMode(int mode)
Changes the mode of the IlvPrintPreviewPanel created by createPrintPreviewWindow(java.awt.Window). The mode can be one of IlvPrintPreviewPanel.SINGLE_PAGE_MODE or IlvPrintPreviewPanel.CONTINUOUS_MODE. The method must be called before the printPreview(java.awt.Window) method is called.

See Also:
printPreview(java.awt.Window)

createPrintPreviewWindow

protected Window createPrintPreviewWindow(Window owner)
Creates the IlvPrintPreviewDialog for previewing the associated IlvPrintableDocument. This method can be overridden by subclasses if you want to customize the preview dialog. The preview mode is defined by the method setPreviewMode(int).

Returns:
The new IlvPrintPreviewDialog object.

getPrinterJob

public PrinterJob getPrinterJob()
Gets the PrinterJob if it is already created. Otherwise, a PrinterJob will be created. This PrinterJob is used to change the printer settings and to print the IlvPrintableDocument.

Returns:
The PrinterJob used to print the contents.
See Also:
print(boolean)

printDialog

public boolean printDialog()
Opens a dialog box for changes the setting of the associated PrinterJob. Call print() to print the associated IlvPrintableDocument.

Returns:
true is the dialog was validated or falseSee Also:
print(boolean), getPrinterJob()

createSetupDialog

protected IlvDocumentSetupDialog createSetupDialog(Window owner,
                                                   boolean printButton,
                                                   boolean printPreviewButton)
Creates the dialog box used to edit the parameters of a document.

Parameters:
owner - The owner of the dialog.
printButton - Indicates if a button must be added to the dialog to print the content of the document.
printPreviewButton - Indicates if a button must be added to the dialog to open the 'Print Preview' dialog.

setupDialog

public void setupDialog(Window owner,
                        boolean printButton,
                        boolean previewButton)
Opens the dialog box used to edit the parameters of a document.

Parameters:
owner - The owner of the dialog.
printButton - Indicates if a button must be added to the dialog to print the content of the document.
previewButton - Indicates if a button must be added to the dialog to open the 'Print Preview' dialog.

pageDialog

public void pageDialog()
This function shows a page format dialog box that allows users to change the page format of the associated IlvPrintableDocument. This function uses the associated PrinterJob and invokes its pageDialog method to open the page dialog. Note that you should better use the setupDialog(java.awt.Window, boolean, boolean) method that opens a dialog that allows to change the page format and the header and footer.


print

public void print(boolean showPrintDialog)
           throws PrinterException
Prints the document. This function invokes the print method of the associated PrinterJob.

Parameters:
showPrintDialog - When True the dialog that allows to choose a printer and set printer parameters will be shown before printing.
Throws:
PrinterException - an error in the print system caused the job to be aborted.
See Also:
getPrinterJob()

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  Object oldValue,
                                  Object newValue)
Fires a 'PropertyChangeEvent' event for the specified property.

Parameters:
propertyName - The name of the property.
oldValue - The old value of the property.
newValue - The new value of the property.

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener propertyChangeListener)
Adds a listener to listen to the modification of the specified property.

Parameters:
propertyName - The name of the property.
propertyChangeListener - The listener.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener)
Adds a listener to listen to the modification of all properties

Parameters:
propertyChangeListener - The listener.

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener propertyChangeListener)
Removes a listener so that it no longer listens to the modification of the specified property.

Parameters:
propertyName - The name of the property.
propertyChangeListener - The listener.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener propertyChangeListener)
Removes a listener so that it no longer listens to the modification of the properties.

Parameters:
propertyChangeListener - The listener.

setLookAndFeel

public void setLookAndFeel(UIManager.LookAndFeelInfo laf)
Updates the look & feel of the dialogs managed by this controller.

Parameters:
laf - The look & feel.

getComponentOrientation

public ComponentOrientation getComponentOrientation()
Returns the language-sensitive orientation of the dialogs managed by this controller.

Since:
JViews 6.0

setComponentOrientation

public void setComponentOrientation(ComponentOrientation o)
Sets the language-sensitive orientation of the dialogs managed by this controller.

Since:
JViews 6.0


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