org.apache.fop.render.awt.viewer

Class PreviewDialog

Implemented Interfaces:
StatusListener

public class PreviewDialog
extends JFrame
implements StatusListener

AWT Viewer main window. Surrounds a PreviewPanel with a bunch of pretty buttons and controls.

Field Summary

protected FOUserAgent
foUserAgent
The FOUserAgent associated with this window
protected Renderable
renderable
Renderable instance that can be used to reload and re-render a document after modifications.
protected AWTRenderer
renderer
The AWT renderer
protected Translator
translator
The Translator for localization

Constructor Summary

PreviewDialog(FOUserAgent foUserAgent)
Creates a new PreviewDialog that uses the given renderer.
PreviewDialog(FOUserAgent foUserAgent, Renderable renderable)
Creates a new PreviewDialog that uses the given renderer.

Method Summary

static PreviewDialog
createPreviewDialog(FOUserAgent foUserAgent, Renderable renderable, boolean asMainWindow)
Creates and initialize the AWT Viewer main window.
void
goToFirstPage()
Shows the first page.
void
goToLastPage()
Shows the last page.
void
goToNextPage()
Shows the next page.
void
goToPage(int number)
Changes the current visible page
void
goToPreviousPage()
Shows the previous page.
void
notifyPageRendered()
Updates the message to be shown in the info bar in a thread safe way.
void
notifyRendererStopped()
void
reportException(Exception e)
Opens standard Swing error dialog box and reports given exception details.
void
setScale(double scaleFactor)
Scales page image
void
setScaleToFitWidth()
void
setScaleToFitWindow()
void
setStatus(String message)
Sets message to be shown in the status bar in a thread safe way.
void
startPrinterJob(boolean showDialog)
Prints the document

Field Details

foUserAgent

protected FOUserAgent foUserAgent
The FOUserAgent associated with this window

renderable

protected Renderable renderable
Renderable instance that can be used to reload and re-render a document after modifications.

renderer

protected AWTRenderer renderer
The AWT renderer

translator

protected Translator translator
The Translator for localization

Constructor Details

PreviewDialog

public PreviewDialog(FOUserAgent foUserAgent)
Creates a new PreviewDialog that uses the given renderer.
Parameters:
foUserAgent - the user agent

PreviewDialog

public PreviewDialog(FOUserAgent foUserAgent,
                     Renderable renderable)
Creates a new PreviewDialog that uses the given renderer.
Parameters:
foUserAgent - the user agent
renderable - the Renderable instance that is used to reload/re-render a document after modifications.

Method Details

createPreviewDialog

public static PreviewDialog createPreviewDialog(FOUserAgent foUserAgent,
                                                Renderable renderable,
                                                boolean asMainWindow)
Creates and initialize the AWT Viewer main window.
Parameters:
foUserAgent - the FO user agent
renderable - the target for the rendering
Returns:
the newly initialized preview dialog

goToFirstPage

public void goToFirstPage()
Shows the first page.

goToLastPage

public void goToLastPage()
Shows the last page.

goToNextPage

public void goToNextPage()
Shows the next page.

goToPage

public void goToPage(int number)
Changes the current visible page
Parameters:
number - the page number to go to

goToPreviousPage

public void goToPreviousPage()
Shows the previous page.

notifyPageRendered

public void notifyPageRendered()
Updates the message to be shown in the info bar in a thread safe way.
Specified by:
notifyPageRendered in interface StatusListener

notifyRendererStopped

public void notifyRendererStopped()
Specified by:
notifyRendererStopped in interface StatusListener

reportException

public void reportException(Exception e)
Opens standard Swing error dialog box and reports given exception details.
Parameters:
e - the Exception

setScale

public void setScale(double scaleFactor)
Scales page image

setScaleToFitWidth

public void setScaleToFitWidth()

setScaleToFitWindow

public void setScaleToFitWindow()

setStatus

public void setStatus(String message)
Sets message to be shown in the status bar in a thread safe way.
Parameters:
message - the message

startPrinterJob

public void startPrinterJob(boolean showDialog)
Prints the document

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.