Class PreviewDialog

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants, StatusListener

public class PreviewDialog extends JFrame implements StatusListener
AWT Viewer main window. Surrounds a PreviewPanel with a bunch of pretty buttons and controls.
See Also:
  • Field Details

    • translator

      protected Translator translator
      The Translator for localization
    • renderer

      protected AWTRenderer renderer
      The AWT renderer
    • foUserAgent

      protected FOUserAgent foUserAgent
      The FOUserAgent associated with this window
    • configuredTargetResolution

      protected float configuredTargetResolution
      The originally configured target resolution
    • renderable

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

    • 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.
    • PreviewDialog

      public PreviewDialog(FOUserAgent foUserAgent)
      Creates a new PreviewDialog that uses the given renderer.
      Parameters:
      foUserAgent - the user agent
  • 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
      asMainWindow - true if the window shall act as the main application window.
      Returns:
      the newly initialized preview dialog
    • notifyRendererStopped

      public void notifyRendererStopped()
      Called when the renderer has stopped.
      Specified by:
      notifyRendererStopped in interface StatusListener
    • 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.
    • goToNextPage

      public void goToNextPage()
      Shows the next page.
    • goToFirstPage

      public void goToFirstPage()
      Shows the first page.
    • goToLastPage

      public void goToLastPage()
      Shows the last page.
    • setScale

      public void setScale(double scaleFactor)
      Scales page image.
      Parameters:
      scaleFactor - the scale factor
    • setScaleToFitWindow

      public void setScaleToFitWindow()
      Sets the scaling so the contents fit into the window.
    • setScaleToFitWidth

      public void setScaleToFitWidth()
      Sets the scaling so the contents are spread over the whole width available.
    • startPrinterJob

      public void startPrinterJob(boolean showDialog)
      Prints the document.
      Parameters:
      showDialog - true if show dialog
    • setStatus

      public void setStatus(String message)
      Sets message to be shown in the status bar in a thread safe way.
      Parameters:
      message - the message
    • 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
    • reportException

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