Class KlighdPrintDialog

java.lang.Object
org.eclipse.jface.window.Window
org.eclipse.jface.dialogs.Dialog
org.eclipse.jface.dialogs.TrayDialog
de.cau.cs.kieler.klighd.ui.printing.dialog.KlighdPrintDialog
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider

public class KlighdPrintDialog extends org.eclipse.jface.dialogs.TrayDialog
A dialog that offers platform independent printing options and print preview in a separate tray.

To add own GUI elements, you may override any of the create*BlockArea(Composite) methods to change or omit the corresponding controls. Or you may override the createDialogArea(Composite) method and call the needed create*BlockArea(Composite) methods.

The implementation is inspired by org.eclipse.gmf.runtime.diagram.ui.printing.render.dialogs.JPSPrintDialog JPSPrintDialog of the GMF project.
Author:
Christian Damus (cdamus), James Bruck (jbruck), csp
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.eclipse.jface.window.Window

    org.eclipse.jface.window.Window.IExceptionHandler
  • Field Summary

    Fields inherited from class org.eclipse.jface.dialogs.Dialog

    blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, dialogArea, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS

    Fields inherited from class org.eclipse.jface.window.Window

    CANCEL, OK, resizeHasOccurred
  • Constructor Summary

    Constructors
    Constructor
    Description
    KlighdPrintDialog(org.eclipse.jface.window.IShellProvider parentShell, PrintOptions options)
    Creates a new KLighD print dialog based on the given options.
    KlighdPrintDialog(org.eclipse.swt.widgets.Shell shell, PrintOptions options)
    Creates a new KLighD print dialog based on the given options.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    protected void
    configureShell(org.eclipse.swt.widgets.Shell newShell)
    protected void
    createActionsBlockArea(org.eclipse.swt.widgets.Composite parent, boolean previewInitiallyOpen)
    Creates the actions block area.
    protected void
    createAlignmentBlockArea(org.eclipse.swt.widgets.Composite parent)
    Creates the copies block area.
    protected org.eclipse.swt.widgets.Button
    createButton(org.eclipse.swt.widgets.Composite parent, int id, String label, boolean defaultButton)
    protected void
    createCopiesBlockArea(org.eclipse.swt.widgets.Composite parent)
    Creates the copies block area.
    protected org.eclipse.swt.widgets.Control
    createDialogArea(org.eclipse.swt.widgets.Composite parent)
    protected void
    createExtensibleBlockArea(org.eclipse.swt.widgets.Composite parent)
    Creates the extensible block area.
    protected void
    createOrientationBlockArea(org.eclipse.swt.widgets.Composite parent)
    Creates the orientation block area.
    protected void
    createPrinterBlockArea(org.eclipse.swt.widgets.Composite parent)
    Creates the printer block area.
    protected void
    createRangeBlockArea(org.eclipse.swt.widgets.Composite parent)
    Creates the range block area.
    protected void
    createScalingBlockArea(org.eclipse.swt.widgets.Composite parent)
    Creates the scaling block area.
    protected org.eclipse.swt.printing.PrintDialog
    Convenience factory method providing the native printer selection dialog.
    protected void
    final int


    Specialization first checks whether a valid printer configuration can be loaded from the saved configuration (preferences).
    void
    Opens the print preview by injecting a corresponding PrintPreviewTray.

    Methods inherited from class org.eclipse.jface.dialogs.TrayDialog

    closeTray, createButtonBar, createHelpControl, getLayout, handleShellCloseEvent, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable

    Methods inherited from class org.eclipse.jface.dialogs.Dialog

    applyDialogFont, buttonPressed, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButtonsForButtonBar, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeDialogUnits, isResizable, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText

    Methods inherited from class org.eclipse.jface.window.Window

    canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KlighdPrintDialog

      public KlighdPrintDialog(org.eclipse.jface.window.IShellProvider parentShell, PrintOptions options)
      Creates a new KLighD print dialog based on the given options.
      Parameters:
      parentShell - the object that returns the current parent shell
      options - the options to configure the print job
      See Also:
    • KlighdPrintDialog

      public KlighdPrintDialog(org.eclipse.swt.widgets.Shell shell, PrintOptions options)
      Creates a new KLighD print dialog based on the given options.
      Parameters:
      shell - the parent shell, or null to create a top-level shell
      options - the options to configure the print job
      See Also:
  • Method Details

    • open

      public final int open()


      Specialization first checks whether a valid printer configuration can be loaded from the saved configuration (preferences). If so this dialog is opened in blocking mode. Otherwise this dialog is opened (in background) without blocking and the native printer selection dialog is opened on top (in blocking mode).
      If the user cancels the printer selections (null is returned by PrintDialog.open()) the background instance of this dialog is closed and the IDialogConstants.CANCEL_ID is returned.
      If the user properly selects a printer the returned printer data are applied to options super.open() is (again) called in blocking mode. The implementation of super.open() checks whether the dialog is already visible on the screen and, hence, skips the creation in this case but starts rather immediately the blocking event listening loop.
      Overrides:
      open in class org.eclipse.jface.window.Window
    • getNativePrintDialog

      protected org.eclipse.swt.printing.PrintDialog getNativePrintDialog()
      Convenience factory method providing the native printer selection dialog.
      Returns:
      the native PrintDialog
    • configureShell

      protected void configureShell(org.eclipse.swt.widgets.Shell newShell)
      Overrides:
      configureShell in class org.eclipse.jface.window.Window
    • createDialogArea

      protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
      Overrides:
      createDialogArea in class org.eclipse.jface.dialogs.Dialog
    • createButton

      protected org.eclipse.swt.widgets.Button createButton(org.eclipse.swt.widgets.Composite parent, int id, String label, boolean defaultButton)
      Overrides:
      createButton in class org.eclipse.jface.dialogs.Dialog
    • getTray

      public PrintPreviewTray getTray()
      Overrides:
      getTray in class org.eclipse.jface.dialogs.TrayDialog
    • initializeBounds

      protected void initializeBounds()
      Overrides:
      initializeBounds in class org.eclipse.jface.dialogs.Dialog
    • createPrinterBlockArea

      protected void createPrinterBlockArea(org.eclipse.swt.widgets.Composite parent)
      Creates the printer block area.
      Parameters:
      parent - the parent composite
    • createScalingBlockArea

      protected void createScalingBlockArea(org.eclipse.swt.widgets.Composite parent)
      Creates the scaling block area.
      Parameters:
      parent - the parent composite
    • createOrientationBlockArea

      protected void createOrientationBlockArea(org.eclipse.swt.widgets.Composite parent)
      Creates the orientation block area.
      Parameters:
      parent - the parent composite
    • createAlignmentBlockArea

      protected void createAlignmentBlockArea(org.eclipse.swt.widgets.Composite parent)
      Creates the copies block area.
      Parameters:
      parent - the parent composite
    • createRangeBlockArea

      protected void createRangeBlockArea(org.eclipse.swt.widgets.Composite parent)
      Creates the range block area.
      Parameters:
      parent - the parent composite
    • createCopiesBlockArea

      protected void createCopiesBlockArea(org.eclipse.swt.widgets.Composite parent)
      Creates the copies block area.
      Parameters:
      parent - the parent composite
    • createExtensibleBlockArea

      protected void createExtensibleBlockArea(org.eclipse.swt.widgets.Composite parent)
      Creates the extensible block area.
      Parameters:
      parent - the parent composite
    • createActionsBlockArea

      protected void createActionsBlockArea(org.eclipse.swt.widgets.Composite parent, boolean previewInitiallyOpen)
      Creates the actions block area.
      Parameters:
      parent - the parent composite
      previewInitiallyOpen - determines the text of the preview button; must be true if preview is initially visible, false otherwise
    • openPreview

      public void openPreview()
      Opens the print preview by injecting a corresponding PrintPreviewTray.
    • close

      public boolean close()
      Overrides:
      close in class org.eclipse.jface.dialogs.Dialog