Package com.im.commons.ui
Class Dialogs
- java.lang.Object
-
- com.im.commons.ui.Dialogs
-
public final class Dialogs extends java.lang.Object
Provides utility methods for showing dialogs of various types.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Dialogs.ValidatingPane
Dialog contents which is validated.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
displayOkCancel(java.lang.Object innerPane, java.lang.String title)
Displays a plain OK/Cancel dialog with the defaultNotifyDescriptor.OK_OPTION
button and no help context.static java.lang.Object
displayOkCancel(java.lang.Object innerPane, java.lang.String title, int messageType)
Displays OK/Cancel dialog with the defaultNotifyDescriptor.OK_OPTION
button and no help context.static java.lang.Object
displayOkCancel(java.lang.Object innerPane, java.lang.String title, int messageType, org.openide.util.HelpCtx helpCtx)
Displays OK/Cancel dialog with the defaultNotifyDescriptor.OK_OPTION
button.static java.lang.Object
displayOkCancel(java.lang.Object innerPane, java.lang.String title, java.lang.Object okOption, int messageType, org.openide.util.HelpCtx helpCtx)
Displays OK/Cancel dialog.static java.lang.Object
displayOkCancel(java.lang.Object innerPane, java.lang.String title, java.lang.Object okOption, int messageType, org.openide.util.HelpCtx helpCtx, java.lang.String dimensionKey)
Displays OK/Cancel dialog.static java.lang.Object
displaySaveDontSaveCancel(Dialogs.ValidatingPane innerPane, java.lang.String title)
Displays validating dialog with options "Save", "Don't Save" and "Cancel".static void
setMinimumSize(javax.swing.JComponent comp, java.awt.Dimension size)
Sets minimum dialog size to panel displayed usingDialogs
static void
showError(java.lang.String message)
Show error dialog with the given message using NetBeans Dialogs API.static void
showInfo(java.lang.String message)
Show information dialog with the given message using NetBeans Dialogs API.static void
showMessage(java.lang.String message, int messageType)
Show dialog with the given message using NetBeans Dialogs API.static void
showMessage(java.lang.String message, int messageType, java.lang.String title)
Show dialog with the given message using NetBeans Dialogs API.static void
showWarning(java.lang.String message)
Show warning dialog with the given message using NetBeans Dialogs API.
-
-
-
Method Detail
-
showMessage
public static void showMessage(java.lang.String message, int messageType)
Show dialog with the given message using NetBeans Dialogs API. Second parameter decides what type of dialog will be shown. Use constants fromNotifyDescriptor
API, likeNotifyDescriptor.INFORMATION_MESSAGE
.- Parameters:
message
- message to be shownmessageType
- type of the message - informational, waring, error, etc.
-
showMessage
public static void showMessage(java.lang.String message, int messageType, java.lang.String title)
Show dialog with the given message using NetBeans Dialogs API. Second parameter decides what type of dialog will be shown. Use constants fromNotifyDescriptor
API, likeNotifyDescriptor.INFORMATION_MESSAGE
.- Parameters:
message
- message to be shownmessageType
- type of the message - informational, waring, error, etc.title
- title of the dialog- Since:
- 22.6.0
-
showInfo
public static void showInfo(java.lang.String message)
Show information dialog with the given message using NetBeans Dialogs API.- Parameters:
message
- message to be shown
-
showError
public static void showError(java.lang.String message)
Show error dialog with the given message using NetBeans Dialogs API.- Parameters:
message
- message to be shown
-
showWarning
public static void showWarning(java.lang.String message)
Show warning dialog with the given message using NetBeans Dialogs API.- Parameters:
message
- message to be shown- Since:
- 22.6.0
-
displayOkCancel
public static java.lang.Object displayOkCancel(java.lang.Object innerPane, java.lang.String title, java.lang.Object okOption, int messageType, org.openide.util.HelpCtx helpCtx)
Displays OK/Cancel dialog. The supplied parameters control the dialog's contents, title, OK or approve button, etc. This method is a simplified version ofDialogDescriptor
calls.- Parameters:
innerPane
- contents of dialogtitle
- title of dialogokOption
- the OK buttonmessageType
- the type of the dialog, seeNotifyDescriptor
constantshelpCtx
- help context for the dialog, can benull
for no help- Returns:
- Either
okOption
orNotifyDescriptor.CANCEL_OPTION
depending on what button a user hits. - Since:
- 6.1
-
displayOkCancel
public static java.lang.Object displayOkCancel(java.lang.Object innerPane, java.lang.String title, java.lang.Object okOption, int messageType, org.openide.util.HelpCtx helpCtx, java.lang.String dimensionKey)
Displays OK/Cancel dialog. The supplied parameters control the dialog's contents, title, OK or approve button, etc. This method is a simplified version ofDialogDescriptor
calls.- Parameters:
innerPane
- contents of dialogtitle
- title of dialogokOption
- the OK buttonmessageType
- the type of the dialog, seeNotifyDescriptor
constantshelpCtx
- help context for the dialog, can benull
for no helpdimensionKey
- used for remembering bounds of shown dialog. When this method is called for the first time the size of a dialog at the point it was closed is remembered. Upon next invocation of this method with the samedimensionKey
dialog will be shown with the remembered bounds and new bounds will be remembered again. Bounds are remembered across JVM sessions.- Returns:
- Either
okOption
orNotifyDescriptor.CANCEL_OPTION
depending on what button a user hits. - Since:
- 6.2
-
displayOkCancel
public static java.lang.Object displayOkCancel(java.lang.Object innerPane, java.lang.String title, int messageType, org.openide.util.HelpCtx helpCtx)
Displays OK/Cancel dialog with the defaultNotifyDescriptor.OK_OPTION
button.- Parameters:
innerPane
- contents of dialogtitle
- title of dialogmessageType
- the type of the dialog, seeNotifyDescriptor
constantshelpCtx
- help context for the dialog, can benull
for no help- Returns:
- Either
NotifyDescriptor.OK_OPTION
orNotifyDescriptor.CANCEL_OPTION
depending on what button a user hits.
-
displayOkCancel
public static java.lang.Object displayOkCancel(java.lang.Object innerPane, java.lang.String title, int messageType)
Displays OK/Cancel dialog with the defaultNotifyDescriptor.OK_OPTION
button and no help context.- Parameters:
innerPane
- contents of dialogtitle
- title of dialogmessageType
- the type of the dialog, seeNotifyDescriptor
constants- Returns:
- Either
NotifyDescriptor.OK_OPTION
orNotifyDescriptor.CANCEL_OPTION
depending on what button a user hits.
-
displayOkCancel
public static java.lang.Object displayOkCancel(java.lang.Object innerPane, java.lang.String title)
Displays a plain OK/Cancel dialog with the defaultNotifyDescriptor.OK_OPTION
button and no help context.- Parameters:
innerPane
- contents of dialogtitle
- title of dialog- Returns:
- Either
NotifyDescriptor.OK_OPTION
orNotifyDescriptor.CANCEL_OPTION
depending on what button a user hits.
-
displaySaveDontSaveCancel
public static java.lang.Object displaySaveDontSaveCancel(Dialogs.ValidatingPane innerPane, java.lang.String title)
Displays validating dialog with options "Save", "Don't Save" and "Cancel".- Parameters:
innerPane
- contents of dialogtitle
- title of dialog- Returns:
NotifyDescriptor.YES_OPTION
,NotifyDescriptor.NO_OPTION
orNotifyDescriptor.CANCEL_OPTION
if user chooses Save, Don't Save or Cancel respectively.
-
setMinimumSize
public static void setMinimumSize(javax.swing.JComponent comp, java.awt.Dimension size)
Sets minimum dialog size to panel displayed usingDialogs
- Parameters:
comp
-size
-
-
-