Class ChoosePictureDialog

  • All Implemented Interfaces:
    org.eclipse.jface.window.IShellProvider

    public class ChoosePictureDialog
    extends org.eclipse.jface.dialogs.Dialog
    This is a modal dialog window to display current contents of CommonPicture or MdPicture. It has "Select" button to set new contents of the picture from a file on file-system. It also has "Clear" button to clear contents of the picture object. The changes apply the domain model object only if "OK" button is pressed at the end.

    View model delivered in ChoosePictureDialog must contain current value in its picture field. On pressing "OK" the same field contains the new contents; it is null if contents was cleared.

    Additionally, file extension field is set if contents was changed.

    • 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
      ChoosePictureDialog​(org.eclipse.swt.widgets.Shell shell, byte[] content, String extension, Point transparentPoint)
      Creates new dialog.
      ChoosePictureDialog​(org.eclipse.swt.widgets.Shell shell, byte[] content, String extension, Point transparentPoint, boolean editable)
      Creates new dialog.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void buttonPressed​(int buttonId)  
      void create()  
      protected void createButtonsForButtonBar​(org.eclipse.swt.widgets.Composite parent)
      Adds "Select from file", "Clear", "Set transparent background" and "Clear transparency" buttons to the button bar at the bottom.
      protected org.eclipse.swt.widgets.Control createDialogArea​(org.eclipse.swt.widgets.Composite parent)
      Sets title and description, prepares the form, creates image preview
      byte[] getContent()
      Returns picture content.
      String getFileExtension()
      Returns picture file extension.
      protected org.eclipse.swt.graphics.Point getInitialSize()  
      Point getTransparentPoint()
      Returns transparent point.
      • Methods inherited from class org.eclipse.jface.dialogs.Dialog

        applyDialogFont, cancelPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, createButton, createButtonBar, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getOKButton, initializeBounds, initializeDialogUnits, isResizable, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
      • Methods inherited from class org.eclipse.jface.window.Window

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

      • ChoosePictureDialog

        public ChoosePictureDialog​(org.eclipse.swt.widgets.Shell shell,
                                   byte[] content,
                                   String extension,
                                   Point transparentPoint)
        Creates new dialog.
        Parameters:
        shell - parent Shell, can be null
        content - the picture content, cannot be null
        extension - the file extension, cannot be null
        transparentPoint - the transparent point, can be null
      • ChoosePictureDialog

        public ChoosePictureDialog​(org.eclipse.swt.widgets.Shell shell,
                                   byte[] content,
                                   String extension,
                                   Point transparentPoint,
                                   boolean editable)
        Creates new dialog.
        Parameters:
        shell - parent Shell, can be null
        content - the picture content, cannot be null
        extension - the file extension, cannot be null
        transparentPoint - the transparent point, can be null
        editable - is editable dialog or not
    • Method Detail

      • create

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

        public byte[] getContent()
        Returns picture content.
        Returns:
        the picture content
      • getFileExtension

        public String getFileExtension()
        Returns picture file extension.
        Returns:
        the picture file extension
      • getTransparentPoint

        public Point getTransparentPoint()
        Returns transparent point.
        Returns:
        the transparent point
      • createDialogArea

        protected org.eclipse.swt.widgets.Control createDialogArea​(org.eclipse.swt.widgets.Composite parent)
        Sets title and description, prepares the form, creates image preview
        Overrides:
        createDialogArea in class org.eclipse.jface.dialogs.Dialog
      • getInitialSize

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

        protected void createButtonsForButtonBar​(org.eclipse.swt.widgets.Composite parent)
        Adds "Select from file", "Clear", "Set transparent background" and "Clear transparency" buttons to the button bar at the bottom.
        Overrides:
        createButtonsForButtonBar in class org.eclipse.jface.dialogs.Dialog
      • buttonPressed

        protected void buttonPressed​(int buttonId)
        Overrides:
        buttonPressed in class org.eclipse.jface.dialogs.Dialog