Class DialogDescriptor
- All Implemented Interfaces:
org.openide.util.HelpCtx.Provider
- Direct Known Subclasses:
WizardDescriptor
DialogDisplayer.createDialog(org.openide.DialogDescriptor)
or shown with DialogDisplayer.notify(org.openide.NotifyDescriptor)
.
It extends NotifyDescriptor
's capabilities by allowing specification of the
modal/nonmodal state of the dialog, button behavior and alignment, help, and
a listener on button presses.
Anyone who wants to display some kind of dialog with standard
behavior should use this class to describe it and
use createDialog(d)
to build it.
When the dialog is closed you may use NotifyDescriptor.getValue()
to determine which button
closed it.
The property message
(inherited from NotifyDescriptor
) is primarily used here
to specify the inner GUI component of the dialog, in contrast to NotifyDescriptor
which generally uses a String
message.
If you want to set one of the custom Options to be the default Option, it
is possible to call DialogDescriptor.setValue(the button you want to
have default...)
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openide.NotifyDescriptor
NotifyDescriptor.ComposedInput, NotifyDescriptor.Confirmation, NotifyDescriptor.Exception, NotifyDescriptor.InputLine, NotifyDescriptor.Message, NotifyDescriptor.PasswordLine, NotifyDescriptor.QuickPick
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
Alignment to place options in the default manner.static final String
Name of property for the button listener.static final String
Name of property for list of closing options.static final String
Name of property for the help context.static final String
Name of property whether the dialg is leaf or can be the owner of other one dialog.static final String
Name of property for modality of dialog.static final String
Name of property for alignment of options.static final int
Alignment to place options vertically in the right part.Fields inherited from class org.openide.NotifyDescriptor
CANCEL_OPTION, CLOSED_OPTION, DEFAULT_OPTION, ERROR_MESSAGE, INFORMATION_MESSAGE, NO_OPTION, OK_CANCEL_OPTION, OK_OPTION, PLAIN_MESSAGE, PROP_DETAIL, PROP_ERROR_NOTIFICATION, PROP_INFO_NOTIFICATION, PROP_MESSAGE, PROP_MESSAGE_TYPE, PROP_NO_DEFAULT_CLOSE, PROP_OPTION_TYPE, PROP_OPTIONS, PROP_TITLE, PROP_VALID, PROP_VALUE, PROP_WARNING_NOTIFICATION, QUESTION_MESSAGE, WARNING_MESSAGE, YES_NO_CANCEL_OPTION, YES_NO_OPTION, YES_OPTION
-
Constructor Summary
ConstructorsConstructorDescriptionDialogDescriptor
(Object innerPane, String title) Create modal dialog descriptor with given title and inner part, with OK/Cancel buttons with default alignment, no help available.DialogDescriptor
(Object innerPane, String title, boolean isModal, int optionType, Object initialValue, int optionsAlign, org.openide.util.HelpCtx helpCtx, ActionListener bl) Create dialog descriptor.DialogDescriptor
(Object innerPane, String title, boolean isModal, int optionType, Object initialValue, ActionListener bl) Create dialog descriptor with given title, inner part, modal status, option type and default option.DialogDescriptor
(Object innerPane, String title, boolean isModal, ActionListener bl) Create dialog descriptor with given title, inner part and modal status, with OK/Cancel buttons displayed with default alignment, no help available.DialogDescriptor
(Object innerPane, String title, boolean modal, Object[] options, Object initialValue, int optionsAlign, org.openide.util.HelpCtx helpCtx, ActionListener bl) Create dialog descriptor; possibility of specifying custom array of options and their alignment.DialogDescriptor
(Object innerPane, String title, boolean modal, Object[] options, Object initialValue, int optionsAlign, org.openide.util.HelpCtx helpCtx, ActionListener bl, boolean leaf) Create dialog descriptor; possibility of specifying custom array of options and their alignment. -
Method Summary
Modifier and TypeMethodDescriptionGet button listener which listens for the user's button presses.Object[]
Getter for list of closing options.org.openide.util.HelpCtx
Get current help context asociated with this dialog descriptor.int
Get current option alignment.boolean
isLeaf()
Get leaf status.boolean
isModal()
Get modal status.void
Set new button listener instance for this dialog descriptor.void
setClosingOptions
(Object[] arr) Setter for list of options that close the dialog.void
setHelpCtx
(org.openide.util.HelpCtx helpCtx) Set new help context for this dialog descriptor.void
setLeaf
(boolean leaf) Set new leaf status.void
setModal
(boolean modal) Set new modal status.void
setOptionsAlign
(int optionsAlign) Set new option alignment.Methods inherited from class org.openide.NotifyDescriptor
addPropertyChangeListener, createNotificationLineSupport, firePropertyChange, getAdditionalOptions, getDefaultValue, getMessage, getMessageType, getNotificationLineSupport, getOptions, getOptionType, getTitle, getTitleForType, getValue, initialize, isNoDefaultClose, isValid, removePropertyChangeListener, setAdditionalOptions, setMessage, setMessageType, setNoDefaultClose, setOptions, setOptionType, setTitle, setValid, setValue
-
Field Details
-
PROP_OPTIONS_ALIGN
-
PROP_MODAL
-
PROP_LEAF
Name of property whether the dialg is leaf or can be the owner of other one dialog.- See Also:
-
PROP_HELP_CTX
-
PROP_BUTTON_LISTENER
-
PROP_CLOSING_OPTIONS
Name of property for list of closing options.- See Also:
-
BOTTOM_ALIGN
public static final int BOTTOM_ALIGN- See Also:
-
RIGHT_ALIGN
public static final int RIGHT_ALIGNAlignment to place options vertically in the right part.- See Also:
-
DEFAULT_ALIGN
public static final int DEFAULT_ALIGNAlignment to place options in the default manner.- See Also:
-
-
Constructor Details
-
DialogDescriptor
Create modal dialog descriptor with given title and inner part, with OK/Cancel buttons with default alignment, no help available. All buttons will close the dialog and the getValue () will provide the pressed option.- Parameters:
innerPane
- inner component of the dialog, or String messagetitle
- title of the dialog
-
DialogDescriptor
Create dialog descriptor with given title, inner part and modal status, with OK/Cancel buttons displayed with default alignment, no help available. Ifbl
is notnull
, then it will receive notifications when the user presses the buttons. (If no listener is specified, it's still possible to retrieve the user-selected button usingNotifyDescriptor.getValue()
.)- Parameters:
innerPane
- inner component of the dialog, or String messagetitle
- title of the dialogisModal
- modal statusbl
- listener for user's button presses
-
DialogDescriptor
public DialogDescriptor(Object innerPane, String title, boolean isModal, int optionType, Object initialValue, ActionListener bl) Create dialog descriptor with given title, inner part, modal status, option type and default option. Options have default alignment, no help available. If the action listener is null, all option buttons will close the dialog and the getValue () will provide the pressed option.- Parameters:
innerPane
- inner component of the dialog, or String messagetitle
- title of the dialogisModal
- modal statusoptionType
- one of the standard options (OK_CANCEL_OPTION
, ...)initialValue
- default option (default button)bl
- listener for the user's button presses or null for default close action on all options
-
DialogDescriptor
public DialogDescriptor(Object innerPane, String title, boolean modal, Object[] options, Object initialValue, int optionsAlign, org.openide.util.HelpCtx helpCtx, ActionListener bl) Create dialog descriptor; possibility of specifying custom array of options and their alignment. If the action listener is null, all option buttons will close the dialog and the getValue () will provide the pressed option. When a custom option set is provided, if any of the standard options (OK_OPTION, CLOSE_OPTION or CANCEL_OPTION) are used, the dialog will close when a button for a standard option is pressed; otherwise for custom options, closing the dialog is left to theActionListener
orsetClosingOptions
.- Parameters:
innerPane
- inner component of the dialog, or String messagetitle
- title of the dialogmodal
- modal statusoptions
- array of custom options (null
means no options at all); may include strings (for button labels; such buttons then do nothing by default) or components (such as buttons, in which case you are responsible for listening to the buttons yourself)initialValue
- default option from custom option arrayoptionsAlign
- specifies where to place options in the dialoghelpCtx
- help context specifying help pagebl
- listener for the user's button presses ornull
for default close action on all options (unless you specified the options yourself)- See Also:
-
DialogDescriptor
public DialogDescriptor(Object innerPane, String title, boolean modal, Object[] options, Object initialValue, int optionsAlign, org.openide.util.HelpCtx helpCtx, ActionListener bl, boolean leaf) Create dialog descriptor; possibility of specifying custom array of options and their alignment. If the action listener is null, all option buttons will close the dialog and the getValue () will provide the pressed option. When a custom option set is provided, if any of the standard options (OK_OPTION, CLOSE_OPTION or CANCEL_OPTION) are used, the dialog will close when a button for a standard option is pressed; otherwise for custom options, closing the dialog is left to theActionListener
orsetClosingOptions
.- Parameters:
innerPane
- inner component of the dialog, or String messagetitle
- title of the dialogmodal
- modal statusoptions
- array of custom options (null
means no options at all); may include strings (for button labels; such buttons then do nothing by default) or components (such as buttons, in which case you are responsible for listening to the buttons yourself)initialValue
- default option from custom option arrayoptionsAlign
- specifies where to place options in the dialoghelpCtx
- help context specifying help pagebl
- listener for the user's button presses ornull
for default close action on all options (unless you specified the options yourself)leaf
- property specifies whether the dialog can be owner of other dialogs- Since:
- 5.5
- See Also:
-
DialogDescriptor
public DialogDescriptor(Object innerPane, String title, boolean isModal, int optionType, Object initialValue, int optionsAlign, org.openide.util.HelpCtx helpCtx, ActionListener bl) Create dialog descriptor. If the action listener is null, all option buttons will close the dialog and the getValue () will provide the pressed option.- Parameters:
innerPane
- inner component of the dialog, or String messagetitle
- title of the dialogisModal
- modal statusoptionType
- one of the standard options (OK_CANCEL_OPTION
, ...)initialValue
- default option (default button)optionsAlign
- specifies where to place options in the dialoghelpCtx
- help context specifying help pagebl
- listener for the user's button presses ornull
for default close action on all options (unless you specified the options yourself)
-
-
Method Details
-
getOptionsAlign
public int getOptionsAlign()Get current option alignment.- Returns:
- current option alignment
- See Also:
-
setOptionsAlign
public void setOptionsAlign(int optionsAlign) Set new option alignment. See aligment constants for possible values. Fires property change event if successful.- Parameters:
optionsAlign
- new options alignment- Throws:
IllegalArgumentException
- when unknown alignment is given- See Also:
-
isModal
public boolean isModal()Get modal status.- Returns:
- modal status
- See Also:
-
setModal
public void setModal(boolean modal) Set new modal status. Fires property change event if successful.- Parameters:
modal
- new modal status- See Also:
-
isLeaf
public boolean isLeaf()Get leaf status. If is leaf then cannot be the owner to other one dialog.- Returns:
- leaf status
- Since:
- 5.5
- See Also:
-
setLeaf
public void setLeaf(boolean leaf) Set new leaf status. Fires property change event if successful.- Parameters:
leaf
- new leaf status- Since:
- 5.5
- See Also:
-
setClosingOptions
Setter for list of options that close the dialog. Special values are:- null - all options will close the dialog
- empty array - no option will close the dialog
- Parameters:
arr
- array of options that should close the dialog when pressed if null then all options close the dialog
-
getClosingOptions
Getter for list of closing options.- Returns:
- array of options or null
-
getHelpCtx
public org.openide.util.HelpCtx getHelpCtx()Get current help context asociated with this dialog descriptor.- Specified by:
getHelpCtx
in interfaceorg.openide.util.HelpCtx.Provider
- Returns:
- current help context
- See Also:
-
setHelpCtx
public void setHelpCtx(org.openide.util.HelpCtx helpCtx) Set new help context for this dialog descriptor. Fires property change event if successful.The implementation should automatically display a help button among the secondary options, without your needing to specify it, if the help context on the descriptor is neither
null
norHelpCtx.DEFAULT_HELP
. If the descriptor isnull
, this feature will be disabled (you can still add your own help button manually if you wish, of course). IfDEFAULT_HELP
(the default), normally the button will also be disabled, however if the inner pane is a component and this component has anassociated
help ID, that will be used automatically. So most users should never need to manually add a help button: call this method with the correct context, or associate an ID with the displayed component. Note that to set it tonull
you must explicitly call this method; passingnull
in the constructor actually sets it toDEFAULT_HELP
.- Parameters:
helpCtx
- new help context, can benull
(no help)- See Also:
-
getButtonListener
Get button listener which listens for the user's button presses.- Returns:
- current button listener instance or null
- See Also:
-
setButtonListener
Set new button listener instance for this dialog descriptor. Fires property change event if successful.- Parameters:
l
- new button listener. It may benull
, in which case listening is cancelled.- See Also:
-