Class Dialog
- java.lang.Object
-
- org.eclipse.nebula.widgets.opal.dialog.Dialog
-
public class Dialog extends java.lang.ObjectInstances 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 classDialog.CenterOptionstatic classDialog.OpalDialogTypeTypes of opal dialog
-
Field Summary
Fields Modifier and Type Field Description (package private) Dialog.OpalDialogTypebuttonTypeprivate Dialog.CenterOptioncenterPolicyprivate FooterAreafooterAreaprivate org.eclipse.swt.graphics.PointlastSizeprivate MessageAreamessageAreaprivate intminimumHeightprivate intminimumWidth(package private) org.eclipse.swt.widgets.Shellshellprivate java.lang.Stringtitle
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringask(java.lang.String title, java.lang.String text, java.lang.String defaultValue)Create a dialog box that asks a questionstatic java.lang.Stringask(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 DialogbuildAskDialog(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 DialogbuildChoiceDialog(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 DialogbuildConfirmDialog(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 DialogbuildErrorDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String errorMessage)Build a dialog box that displays an error messagestatic DialogbuildExceptionDialog(java.lang.Throwable exception)Build a dialog box with an exceptionstatic DialogbuildInformDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text)Build a dialog box that inform the userstatic DialogbuildRadioChoiceDialog(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 choiceprivate voidcenter()static intchoice(java.lang.String title, java.lang.String text, int defaultSelection, ChoiceItem... items)Create a dialog box with a choicestatic intchoice(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text, int defaultSelection, ChoiceItem... items)Create a dialog box with a choicevoidclose()Close the dialog boxstatic voiderror(java.lang.String title, java.lang.String errorMessage)Create a dialog box that displays an error messagestatic voiderror(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String errorMessage)Create a dialog box that displays an error messageDialog.OpalDialogTypegetButtonType()Dialog.CenterOptiongetCenterPolicy()booleangetCheckboxValue()FooterAreagetFooterArea()MessageAreagetMessageArea()intgetMinimumHeight()intgetMinimumWidth()intgetSelectedButton()org.eclipse.swt.widgets.ShellgetShell()java.lang.StringgetTitle()static voidinform(java.lang.String title, java.lang.String text)Create a dialog box that inform the userstatic voidinform(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text)Create a dialog box that inform the userstatic booleanisConfirmed(java.lang.String title, java.lang.String text)Create a dialog box that asks the user a confirmationstatic booleanisConfirmed(java.lang.String title, java.lang.String text, int timer)Create a dialog box that asks the user a confirmation.static booleanisConfirmed(org.eclipse.swt.widgets.Shell shell, java.lang.String title, java.lang.String text)Create a dialog box that asks the user a confirmationstatic booleanisConfirmed(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) voidpack()Compute the size of the shellstatic intradioChoice(java.lang.String title, java.lang.String text, int defaultSelection, java.lang.String... values)Create a dialog box with a radio choicestatic intradioChoice(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 choicevoidsetButtonType(Dialog.OpalDialogType buttonType)voidsetCenterPolicy(Dialog.CenterOption centerPolicy)(package private) voidsetLastSize(org.eclipse.swt.graphics.Point lastSize)voidsetMinimumHeight(int minimumHeight)voidsetMinimumWidth(int minimumWidth)voidsetTitle(java.lang.String title)intshow()Show the dialog boxstatic voidshowException(java.lang.Throwable exception)Display a dialog box with an exception
-
-
-
Field Detail
-
centerPolicy
private Dialog.CenterOption centerPolicy
-
title
private java.lang.String title
-
buttonType
Dialog.OpalDialogType buttonType
-
messageArea
private final MessageArea messageArea
-
footerArea
private final FooterArea footerArea
-
shell
final org.eclipse.swt.widgets.Shell shell
-
minimumWidth
private int minimumWidth
-
minimumHeight
private int minimumHeight
-
lastSize
private org.eclipse.swt.graphics.Point lastSize
-
-
Constructor Detail
-
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 Detail
-
show
public int show()
Show the dialog box- Returns:
- the index of the selected button
-
center
private void center()
-
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:
trueif the user confirmed,falseotherwise
-
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:
trueif the user confirmed,falseotherwise
-
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:
trueif the user confirmed,falseotherwise
-
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:
trueif the user confirmed,falseotherwise
-
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
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 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
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)
-
-