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
The implementation is inspired by
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, ELLIPSISFields inherited from class org.eclipse.jface.window.Window
CANCEL, OK, resizeHasOccurred -
Constructor Summary
ConstructorsConstructorDescriptionKlighdPrintDialog(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 TypeMethodDescriptionbooleanclose()protected voidconfigureShell(org.eclipse.swt.widgets.Shell newShell) protected voidcreateActionsBlockArea(org.eclipse.swt.widgets.Composite parent, boolean previewInitiallyOpen) Creates the actions block area.protected voidcreateAlignmentBlockArea(org.eclipse.swt.widgets.Composite parent) Creates the copies block area.protected org.eclipse.swt.widgets.ButtoncreateButton(org.eclipse.swt.widgets.Composite parent, int id, String label, boolean defaultButton) protected voidcreateCopiesBlockArea(org.eclipse.swt.widgets.Composite parent) Creates the copies block area.protected org.eclipse.swt.widgets.ControlcreateDialogArea(org.eclipse.swt.widgets.Composite parent) protected voidcreateExtensibleBlockArea(org.eclipse.swt.widgets.Composite parent) Creates the extensible block area.protected voidcreateOrientationBlockArea(org.eclipse.swt.widgets.Composite parent) Creates the orientation block area.protected voidcreatePrinterBlockArea(org.eclipse.swt.widgets.Composite parent) Creates the printer block area.protected voidcreateRangeBlockArea(org.eclipse.swt.widgets.Composite parent) Creates the range block area.protected voidcreateScalingBlockArea(org.eclipse.swt.widgets.Composite parent) Creates the scaling block area.protected org.eclipse.swt.printing.PrintDialogConvenience factory method providing the native printer selection dialog.getTray()protected voidfinal intopen()
Specialization first checks whether a valid printer configuration can be loaded from the saved configuration (preferences).voidOpens the print preview by injecting a correspondingPrintPreviewTray.Methods inherited from class org.eclipse.jface.dialogs.TrayDialog
closeTray, createButtonBar, createHelpControl, getLayout, handleShellCloseEvent, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailableMethods 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, shortenTextMethods 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
-
Constructor Details
-
KlighdPrintDialog
Creates a new KLighD print dialog based on the given options.- Parameters:
parentShell- the object that returns the current parent shelloptions- the options to configure the print job- See Also:
-
KlighdPrintDialog
Creates a new KLighD print dialog based on the given options.- Parameters:
shell- the parent shell, ornullto create a top-level shelloptions- 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 (nullis returned byPrintDialog.open()) the background instance of this dialog is closed and theIDialogConstants.CANCEL_IDis returned.
If the user properly selects a printer the returned printer data are applied tooptionssuper.open()is (again) called in blocking mode. The implementation ofsuper.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:
openin classorg.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:
configureShellin classorg.eclipse.jface.window.Window
-
createDialogArea
protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent) - Overrides:
createDialogAreain classorg.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:
createButtonin classorg.eclipse.jface.dialogs.Dialog
-
getTray
- Overrides:
getTrayin classorg.eclipse.jface.dialogs.TrayDialog
-
initializeBounds
protected void initializeBounds()- Overrides:
initializeBoundsin classorg.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 compositepreviewInitiallyOpen- determines the text of the preview button; must betrueif preview is initially visible,falseotherwise
-
openPreview
public void openPreview()Opens the print preview by injecting a correspondingPrintPreviewTray. -
close
public boolean close()- Overrides:
closein classorg.eclipse.jface.dialogs.Dialog
-