Class FontDialog

  • All Implemented Interfaces:
    IChooseValueDialog<Font>, org.eclipse.jface.window.IShellProvider

    public final class FontDialog
    extends org.eclipse.jface.dialogs.TitleAreaDialog
    implements IChooseValueDialog<Font>
    Defines font selection dialog. It provides user with a list of predefined font styles. Each style defines:
    • Font family
    • Font size
    • Font typography: bold, italic, underlined, striken through
    User may override font style settings by specifying an alternate font family, font size, and typography. The dialog also has a preview area, where the sample text is displayed using currently chosen font specification.
    The class uses EMF Font as input/output media. It accepts an instance implementing the interface in constructor and returns such an instance in getValue() method.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  FontDialog.FontStyleLabelProvider
      The class displays a FontStyle object in a ListViewer.
      • 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.TitleAreaDialog

        DLG_IMG_TITLE_BANNER, DLG_IMG_TITLE_ERROR, INFO_MESSAGE, WARNING_MESSAGE
      • 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean close()  
      void create()  
      protected org.eclipse.swt.widgets.Control createContents​(org.eclipse.swt.widgets.Composite parent)  
      protected org.eclipse.swt.widgets.Control createDialogArea​(org.eclipse.swt.widgets.Composite parent)  
      protected org.eclipse.swt.graphics.Point getInitialSize()  
      Font getValue()
      Returns a Font object that defines a font that user chose in this dialog.
      protected void okPressed()  
      void setErrorMessage​(String newErrorMessage)  
      void setMessage​(String newMessage, int newType)  
      • Methods inherited from class org.eclipse.jface.dialogs.TitleAreaDialog

        getErrorMessage, getMessage, getTitleArea, getTitleImageLabel, setMessage, setTitle, setTitleAreaColor, setTitleImage
      • Methods inherited from class org.eclipse.jface.dialogs.TrayDialog

        closeTray, createButtonBar, createHelpControl, getLayout, getTray, 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, createButton, createButtonsForButtonBar, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getOKButton, initializeBounds, initializeDialogUnits, isResizable, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
      • Methods inherited from class org.eclipse.jface.window.Window

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

      • FontDialog

        public FontDialog​(org.eclipse.swt.widgets.Shell parentShell,
                          Font font,
                          Map<String,​Font> styleFonts,
                          Map<String,​Font> systemFonts,
                          Map<String,​Font> styleItemFonts,
                          boolean editable)
        Creates a new FontDialog class to choose font specification with.
        Parameters:
        parentShell - the parent window
        font - an object to instantiate value of each control on the dialog
        styleFonts - the all style fonts of current project, cannot be null
        systemFonts - the all system fonts of current project, cannot be null
        styleItemFonts - the all style item fonts of current project, cannot be null
        editable - the editable state, true if this dialog is editable, false otherwise
      • FontDialog

        public FontDialog​(org.eclipse.swt.widgets.Shell parentShell,
                          Font font,
                          Map<String,​Font> styleFonts,
                          Map<String,​Font> systemFonts,
                          Map<String,​Font> styleItemFonts,
                          boolean avoidStrikenThrough,
                          boolean editable)
        Creates a new FontDialog class to choose font specification with.
        Parameters:
        parentShell - the parent window
        font - an object to instantiate value of each control on the dialog
        styleFonts - the all style fonts of current project, cannot be null
        systemFonts - the all system fonts of current project, cannot be null
        styleItemFonts - the all style item fonts of current project, cannot be null
        avoidStrikenThrough - if true, disables StrikenThrough font flag setting
        editable - the editable state, true if this dialog is editable, false otherwise
    • Method Detail

      • close

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

        public void setErrorMessage​(String newErrorMessage)
        Overrides:
        setErrorMessage in class org.eclipse.jface.dialogs.TitleAreaDialog
      • setMessage

        public void setMessage​(String newMessage,
                               int newType)
        Overrides:
        setMessage in class org.eclipse.jface.dialogs.TitleAreaDialog
      • create

        public void create()
        Overrides:
        create in class org.eclipse.jface.dialogs.Dialog
      • createContents

        protected org.eclipse.swt.widgets.Control createContents​(org.eclipse.swt.widgets.Composite parent)
        Overrides:
        createContents in class org.eclipse.jface.dialogs.TitleAreaDialog
      • createDialogArea

        protected org.eclipse.swt.widgets.Control createDialogArea​(org.eclipse.swt.widgets.Composite parent)
        Overrides:
        createDialogArea in class org.eclipse.jface.dialogs.TitleAreaDialog
      • getInitialSize

        protected org.eclipse.swt.graphics.Point getInitialSize()
        Overrides:
        getInitialSize in class org.eclipse.jface.dialogs.TitleAreaDialog
      • okPressed

        protected void okPressed()
        Overrides:
        okPressed in class org.eclipse.jface.dialogs.Dialog