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
-
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 questionstatic 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 questionstatic 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 questionstatic 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 choicestatic 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 messagestatic Dialog
buildExceptionDialog(java.lang.Throwable exception)
Build a dialog box with an exceptionstatic Dialog
buildInformDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text)
Build a dialog box that inform the userstatic 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 choicestatic int
choice(java.lang.String title, java.lang.String text, int defaultSelection, ChoiceItem... items)
Create a dialog box with a choicestatic 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 choicevoid
close()
Close the dialog boxstatic void
error(java.lang.String title, java.lang.String errorMessage)
Create a dialog box that displays an error messagestatic void
error(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String errorMessage)
Create a dialog box that displays an error messageDialog.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 userstatic void
inform(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text)
Create a dialog box that inform the userstatic boolean
isConfirmed(java.lang.String title, java.lang.String text)
Create a dialog box that asks the user a confirmationstatic 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 confirmationstatic 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 shellstatic int
radioChoice(java.lang.String title, java.lang.String text, int defaultSelection, java.lang.String... values)
Create a dialog box with a radio choicestatic 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 choicevoid
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 boxstatic void
showException(java.lang.Throwable exception)
Display a dialog box with an exception
-
Field Details
-
buttonType
Dialog.OpalDialogType buttonType -
shell
final org.eclipse.swt.widgets.Shell shell
-
-
Constructor Details
-
Dialog
public Dialog()Constructor -
Dialog
public Dialog(boolean resizable)Constructor- Parameters:
resizable
- iftrue
, 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 shellresizable
- iftrue
, 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 boxtext
- text of the questiondefaultValue
- 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 boxtext
- text of the questiondefaultValue
- 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 boxtext
- text of the questiondefaultValue
- 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 boxerrorMessage
- 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 shelltitle
- title of the dialog boxerrorMessage
- 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 shelltitle
- title of the dialog boxerrorMessage
- 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 boxtext
- 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 shelltitle
- title of the dialog boxtext
- 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 shelltitle
- title of the dialog boxtext
- 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 boxtext
- 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 shelltitle
- title of the dialog boxtext
- 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 boxtext
- text to displaytimer
- 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 shelltitle
- title of the dialog boxtext
- text to displaytimer
- 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 shelltitle
- title of the dialog boxtext
- text to displaytimer
- 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 boxtext
- text to displaydefaultSelection
- index of the default selectionvalues
- 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 shelltitle
- title of the dialog boxtext
- text to displaydefaultSelection
- index of the default selectionvalues
- 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 shelltitle
- title of the dialog boxtext
- text to displaydefaultSelection
- index of the default selectionvalues
- 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
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 boxtext
- text to displaydefaultSelection
- index of the default selectionitems
- 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 shelltitle
- title of the dialog boxtext
- text to displaydefaultSelection
- index of the default selectionitems
- 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 shelltitle
- title of the dialog boxtext
- text to displaydefaultSelection
- index of the default selectionitems
- 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
- Returns:
- the buttonType
-
setButtonType
- Parameters:
buttonType
- the buttonType to set
-
getMessageArea
- Returns:
- the messageArea
-
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
- Returns:
- the center policy (Dialog centered on screen or centered in the center of the parent window)
-
setCenterPolicy
- Parameters:
centerPolicy
- center policy
-
setLastSize
void setLastSize(org.eclipse.swt.graphics.Point lastSize)
-