Class Dialog

java.lang.Object
org.eclipse.nebula.widgets.opal.dialog.Dialog

public class Dialog
extends java.lang.Object
Instances of this class are dialog box This component was inspired by the Oxbow Project (http://code.google.com/p/oxbow/) by Eugene Ryzhikov
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  Dialog.CenterOption  
    static class  Dialog.OpalDialogType
    Types of opal dialog
  • Field Summary

    Fields 
    Modifier and Type Field Description
    (package private) Dialog.OpalDialogType buttonType  
    (package private) org.eclipse.swt.widgets.Shell shell  
  • Constructor Summary

    Constructors 
    Constructor Description
    Dialog()
    Constructor
    Dialog​(boolean resizable)
    Constructor
    Dialog​(org.eclipse.swt.widgets.Shell parent)
    Constructor
    Dialog​(org.eclipse.swt.widgets.Shell parent, boolean resizable)
    Constructor
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String ask​(java.lang.String title, java.lang.String text, java.lang.String defaultValue)
    Create a dialog box that asks a question
    static java.lang.String ask​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, java.lang.String defaultValue)
    Create a dialog box that asks a question
    static Dialog buildAskDialog​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, java.lang.String defaultValue)
    Build a dialog box that asks a question
    static Dialog buildChoiceDialog​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int defaultSelection, ChoiceItem... items)
    Build a dialog box with a choice
    static Dialog buildConfirmDialog​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int timer)
    Build a dialog box that asks the user a confirmation.
    static Dialog buildErrorDialog​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String errorMessage)
    Build a dialog box that displays an error message
    static Dialog buildExceptionDialog​(java.lang.Throwable exception)
    Build a dialog box with an exception
    static Dialog buildInformDialog​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text)
    Build a dialog box that inform the user
    static Dialog buildRadioChoiceDialog​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int defaultSelection, java.lang.String... values)
    Build a dialog box with a radio choice
    static int choice​(java.lang.String title, java.lang.String text, int defaultSelection, ChoiceItem... items)
    Create a dialog box with a choice
    static int choice​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int defaultSelection, ChoiceItem... items)
    Create a dialog box with a choice
    void close()
    Close the dialog box
    static void error​(java.lang.String title, java.lang.String errorMessage)
    Create a dialog box that displays an error message
    static void error​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String errorMessage)
    Create a dialog box that displays an error message
    Dialog.OpalDialogType getButtonType()  
    Dialog.CenterOption getCenterPolicy()  
    boolean getCheckboxValue()  
    FooterArea getFooterArea()  
    MessageArea getMessageArea()  
    int getMinimumHeight()  
    int getMinimumWidth()  
    int getSelectedButton()  
    org.eclipse.swt.widgets.Shell getShell()  
    java.lang.String getTitle()  
    static void inform​(java.lang.String title, java.lang.String text)
    Create a dialog box that inform the user
    static void inform​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text)
    Create a dialog box that inform the user
    static boolean isConfirmed​(java.lang.String title, java.lang.String text)
    Create a dialog box that asks the user a confirmation
    static boolean isConfirmed​(java.lang.String title, java.lang.String text, int timer)
    Create a dialog box that asks the user a confirmation.
    static boolean isConfirmed​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text)
    Create a dialog box that asks the user a confirmation
    static boolean isConfirmed​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int timer)
    Create a dialog box that asks the user a confirmation.
    (package private) void pack()
    Compute the size of the shell
    static int radioChoice​(java.lang.String title, java.lang.String text, int defaultSelection, java.lang.String... values)
    Create a dialog box with a radio choice
    static int radioChoice​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int defaultSelection, java.lang.String... values)
    Create a dialog box with a radio choice
    void setButtonType​(Dialog.OpalDialogType buttonType)  
    void setCenterPolicy​(Dialog.CenterOption centerPolicy)  
    (package private) void setLastSize​(org.eclipse.swt.graphics.Point lastSize)  
    void setMinimumHeight​(int minimumHeight)  
    void setMinimumWidth​(int minimumWidth)  
    void setTitle​(java.lang.String title)  
    int show()
    Show the dialog box
    static void showException​(java.lang.Throwable exception)
    Display a dialog box with an exception

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • Dialog

      public Dialog()
      Constructor
    • Dialog

      public Dialog​(boolean resizable)
      Constructor
      Parameters:
      resizable - if true, the window is resizable
    • Dialog

      public Dialog​(org.eclipse.swt.widgets.Shell parent)
      Constructor
      Parameters:
      parent - parent shell
    • Dialog

      public Dialog​(org.eclipse.swt.widgets.Shell parent, boolean resizable)
      Constructor
      Parameters:
      parent - parent shell
      resizable - if true, the window is resizable
  • Method Details

    • show

      public int show()
      Show the dialog box
      Returns:
      the index of the selected button
    • close

      public void close()
      Close the dialog box
    • pack

      void pack()
      Compute the size of the shell
    • ask

      public static java.lang.String ask​(java.lang.String title, java.lang.String text, java.lang.String defaultValue)
      Create a dialog box that asks a question
      Parameters:
      title - title of the dialog box
      text - text of the question
      defaultValue - default value of the input
      Returns:
      the value typed by the user
    • ask

      public static java.lang.String ask​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, java.lang.String defaultValue)
      Create a dialog box that asks a question
      Parameters:
      title - title of the dialog box
      text - text of the question
      defaultValue - default value of the input
      Returns:
      the value typed by the user
    • buildAskDialog

      public static Dialog buildAskDialog​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, java.lang.String defaultValue)
      Build a dialog box that asks a question
      Parameters:
      title - title of the dialog box
      text - text of the question
      defaultValue - default value of the input
      Returns:
      dialog
    • error

      public static void error​(java.lang.String title, java.lang.String errorMessage)
      Create a dialog box that displays an error message
      Parameters:
      title - title of the dialog box
      errorMessage - Error message
    • error

      public static void error​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String errorMessage)
      Create a dialog box that displays an error message
      Parameters:
      shell - parent shell
      title - title of the dialog box
      errorMessage - Error message
    • buildErrorDialog

      public static Dialog buildErrorDialog​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String errorMessage)
      Build a dialog box that displays an error message
      Parameters:
      shell - parent shell
      title - title of the dialog box
      errorMessage - Error message
      Returns:
      dialog
    • inform

      public static void inform​(java.lang.String title, java.lang.String text)
      Create a dialog box that inform the user
      Parameters:
      title - title of the dialog box
      text - text to display
    • inform

      public static void inform​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text)
      Create a dialog box that inform the user
      Parameters:
      shell - parent shell
      title - title of the dialog box
      text - text to display
    • buildInformDialog

      public static Dialog buildInformDialog​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text)
      Build a dialog box that inform the user
      Parameters:
      shell - parent shell
      title - title of the dialog box
      text - text to display
      Returns:
      dialog
    • isConfirmed

      public static boolean isConfirmed​(java.lang.String title, java.lang.String text)
      Create a dialog box that asks the user a confirmation
      Parameters:
      title - title of the dialog box
      text - text to display
      Returns:
      true if the user confirmed, false otherwise
    • isConfirmed

      public static boolean isConfirmed​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text)
      Create a dialog box that asks the user a confirmation
      Parameters:
      shell - parent shell
      title - title of the dialog box
      text - text to display
      Returns:
      true if the user confirmed, false otherwise
    • isConfirmed

      public static boolean isConfirmed​(java.lang.String title, java.lang.String text, int timer)
      Create a dialog box that asks the user a confirmation. The button "yes" is not enabled before timer seconds
      Parameters:
      title - title of the dialog box
      text - text to display
      timer - number of seconds before enabling the yes button
      Returns:
      true if the user confirmed, false otherwise
    • isConfirmed

      public static boolean isConfirmed​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int timer)
      Create a dialog box that asks the user a confirmation. The button "yes" is not enabled before timer seconds
      Parameters:
      shell - parent shell
      title - title of the dialog box
      text - text to display
      timer - number of seconds before enabling the yes button
      Returns:
      true if the user confirmed, false otherwise
    • buildConfirmDialog

      public static Dialog buildConfirmDialog​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int timer)
      Build a dialog box that asks the user a confirmation. The button "yes" is not enabled before timer seconds
      Parameters:
      shell - parent shell
      title - title of the dialog box
      text - text to display
      timer - number of seconds before enabling the yes button
      Returns:
      dialog
    • radioChoice

      public static int radioChoice​(java.lang.String title, java.lang.String text, int defaultSelection, java.lang.String... values)
      Create a dialog box with a radio choice
      Parameters:
      title - title of the dialog box
      text - text to display
      defaultSelection - index of the default selection
      values - values to display
      Returns:
      the index of the selection
    • radioChoice

      public static int radioChoice​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int defaultSelection, java.lang.String... values)
      Create a dialog box with a radio choice
      Parameters:
      shell - parent shell
      title - title of the dialog box
      text - text to display
      defaultSelection - index of the default selection
      values - values to display
      Returns:
      the index of the selection
    • buildRadioChoiceDialog

      public static Dialog buildRadioChoiceDialog​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int defaultSelection, java.lang.String... values)
      Build a dialog box with a radio choice
      Parameters:
      shell - parent shell
      title - title of the dialog box
      text - text to display
      defaultSelection - index of the default selection
      values - values to display
      Returns:
      dialog
    • showException

      public static void showException​(java.lang.Throwable exception)
      Display a dialog box with an exception
      Parameters:
      exception - exception to display
    • buildExceptionDialog

      public static Dialog buildExceptionDialog​(java.lang.Throwable exception)
      Build a dialog box with an exception
      Parameters:
      exception - exception to display
      Returns:
      dialog
    • choice

      public static int choice​(java.lang.String title, java.lang.String text, int defaultSelection, ChoiceItem... items)
      Create a dialog box with a choice
      Parameters:
      title - title of the dialog box
      text - text to display
      defaultSelection - index of the default selection
      items - items to display
      Returns:
      the index of the selected value
    • choice

      public static int choice​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int defaultSelection, ChoiceItem... items)
      Create a dialog box with a choice
      Parameters:
      shell - parent shell
      title - title of the dialog box
      text - text to display
      defaultSelection - index of the default selection
      items - items to display
      Returns:
      the index of the selected value
    • buildChoiceDialog

      public static Dialog buildChoiceDialog​(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int defaultSelection, ChoiceItem... items)
      Build a dialog box with a choice
      Parameters:
      shell - parent shell
      title - title of the dialog box
      text - text to display
      defaultSelection - index of the default selection
      items - items to display
      Returns:
      dialog
    • getTitle

      public java.lang.String getTitle()
      Returns:
      the title
    • setTitle

      public void setTitle​(java.lang.String title)
      Parameters:
      title - the title to set
    • getButtonType

      public Dialog.OpalDialogType getButtonType()
      Returns:
      the buttonType
    • setButtonType

      public void setButtonType​(Dialog.OpalDialogType buttonType)
      Parameters:
      buttonType - the buttonType to set
    • getMessageArea

      public MessageArea getMessageArea()
      Returns:
      the messageArea
    • getFooterArea

      public FooterArea getFooterArea()
      Returns:
      the footerArea
    • getShell

      public org.eclipse.swt.widgets.Shell getShell()
      Returns:
      the shell
    • getSelectedButton

      public int getSelectedButton()
      Returns:
      the index of the selected button
    • getCheckboxValue

      public boolean getCheckboxValue()
      Returns:
      the selection state of the checkbox
    • getMinimumWidth

      public int getMinimumWidth()
      Returns:
      the minimum width of the dialog box
    • setMinimumWidth

      public void setMinimumWidth​(int minimumWidth)
      Parameters:
      minimumWidth - the minimum width of the dialog box to set
    • getMinimumHeight

      public int getMinimumHeight()
      Returns:
      the minimum height of the dialog box
    • setMinimumHeight

      public void setMinimumHeight​(int minimumHeight)
      Parameters:
      minimumHeight - the minimum height of the dialog box to set
    • getCenterPolicy

      public Dialog.CenterOption getCenterPolicy()
      Returns:
      the center policy (Dialog centered on screen or centered in the center of the parent window)
    • setCenterPolicy

      public void setCenterPolicy​(Dialog.CenterOption centerPolicy)
      Parameters:
      centerPolicy - center policy
    • setLastSize

      void setLastSize​(org.eclipse.swt.graphics.Point lastSize)