Package com.im.commons.ui
Class Dialogs
- java.lang.Object
-
- com.im.commons.ui.Dialogs
-
public final class Dialogs extends java.lang.ObjectProvides utility methods for showing dialogs of various types.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDialogs.ValidatingPaneDialog contents which is validated.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.ObjectdisplayOkCancel(java.lang.Object innerPane, java.lang.String title)Displays a plain OK/Cancel dialog with the defaultNotifyDescriptor.OK_OPTIONbutton and no help context.static java.lang.ObjectdisplayOkCancel(java.lang.Object innerPane, java.lang.String title, int messageType)Displays OK/Cancel dialog with the defaultNotifyDescriptor.OK_OPTIONbutton and no help context.static java.lang.ObjectdisplayOkCancel(java.lang.Object innerPane, java.lang.String title, int messageType, org.openide.util.HelpCtx helpCtx)Displays OK/Cancel dialog with the defaultNotifyDescriptor.OK_OPTIONbutton.static java.lang.ObjectdisplayOkCancel(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.ObjectdisplayOkCancel(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.ObjectdisplaySaveDontSaveCancel(Dialogs.ValidatingPane innerPane, java.lang.String title)Displays validating dialog with options "Save", "Don't Save" and "Cancel".static voidsetMinimumSize(javax.swing.JComponent comp, java.awt.Dimension size)Sets minimum dialog size to panel displayed usingDialogsstatic voidshowError(java.lang.String message)Show error dialog with the given message using NetBeans Dialogs API.static voidshowInfo(java.lang.String message)Show information dialog with the given message using NetBeans Dialogs API.static voidshowMessage(java.lang.String message, int messageType)Show dialog with the given message using NetBeans Dialogs API.static voidshowMessage(java.lang.String message, int messageType, java.lang.String title)Show dialog with the given message using NetBeans Dialogs API.static voidshowWarning(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 fromNotifyDescriptorAPI, 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 fromNotifyDescriptorAPI, 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 ofDialogDescriptorcalls.- Parameters:
innerPane- contents of dialogtitle- title of dialogokOption- the OK buttonmessageType- the type of the dialog, seeNotifyDescriptorconstantshelpCtx- help context for the dialog, can benullfor no help- Returns:
- Either
okOptionorNotifyDescriptor.CANCEL_OPTIONdepending 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 ofDialogDescriptorcalls.- Parameters:
innerPane- contents of dialogtitle- title of dialogokOption- the OK buttonmessageType- the type of the dialog, seeNotifyDescriptorconstantshelpCtx- help context for the dialog, can benullfor 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 samedimensionKeydialog will be shown with the remembered bounds and new bounds will be remembered again. Bounds are remembered across JVM sessions.- Returns:
- Either
okOptionorNotifyDescriptor.CANCEL_OPTIONdepending 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_OPTIONbutton.- Parameters:
innerPane- contents of dialogtitle- title of dialogmessageType- the type of the dialog, seeNotifyDescriptorconstantshelpCtx- help context for the dialog, can benullfor no help- Returns:
- Either
NotifyDescriptor.OK_OPTIONorNotifyDescriptor.CANCEL_OPTIONdepending 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_OPTIONbutton and no help context.- Parameters:
innerPane- contents of dialogtitle- title of dialogmessageType- the type of the dialog, seeNotifyDescriptorconstants- Returns:
- Either
NotifyDescriptor.OK_OPTIONorNotifyDescriptor.CANCEL_OPTIONdepending 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_OPTIONbutton and no help context.- Parameters:
innerPane- contents of dialogtitle- title of dialog- Returns:
- Either
NotifyDescriptor.OK_OPTIONorNotifyDescriptor.CANCEL_OPTIONdepending 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_OPTIONorNotifyDescriptor.CANCEL_OPTIONif 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-
-
-