|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openide.NotifyDescriptor org.openide.DialogDescriptor
A description of a standard dialog.
It may be built later using 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 inherited from class org.openide.NotifyDescriptor |
NotifyDescriptor.Confirmation, NotifyDescriptor.Exception, NotifyDescriptor.InputLine, NotifyDescriptor.Message |
Field Summary | |
static int |
BOTTOM_ALIGN
Alignment to put options in the bottom part. |
static int |
DEFAULT_ALIGN
Alignment to place options in the default manner. |
static String |
PROP_BUTTON_LISTENER
Name of property for the button listener. |
static String |
PROP_CLOSING_OPTIONS
Name of property for list of closing options. |
static String |
PROP_HELP_CTX
Name of property for the help context. |
static String |
PROP_LEAF
Name of property whether the dialg is leaf or can be the owner of other one dialog. |
static String |
PROP_MODAL
Name of property for modality of dialog. |
static String |
PROP_OPTIONS_ALIGN
Name of property for alignment of options. |
static int |
RIGHT_ALIGN
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_MESSAGE, PROP_MESSAGE_TYPE, PROP_OPTION_TYPE, PROP_OPTIONS, PROP_TITLE, PROP_VALID, PROP_VALUE, QUESTION_MESSAGE, WARNING_MESSAGE, YES_NO_CANCEL_OPTION, YES_NO_OPTION, YES_OPTION |
Constructor Summary | |
DialogDescriptor(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,
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 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,
int optionType,
Object initialValue,
int optionsAlign,
HelpCtx helpCtx,
ActionListener bl)
Create dialog descriptor. |
|
DialogDescriptor(Object innerPane,
String title,
boolean modal,
Object[] options,
Object initialValue,
int optionsAlign,
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,
HelpCtx helpCtx,
ActionListener bl,
boolean leaf)
Create dialog descriptor; possibility of specifying custom array of options and their alignment. |
Method Summary | |
ActionListener |
getButtonListener()
Get button listener which listens for the user's button presses. |
Object[] |
getClosingOptions()
Getter for list of closing options. |
HelpCtx |
getHelpCtx()
Get current help context asociated with this dialog descriptor. |
int |
getOptionsAlign()
Get current option alignment. |
boolean |
isLeaf()
Get leaf status. |
boolean |
isModal()
Get modal status. |
void |
setButtonListener(ActionListener l)
Set new button listener instance for this dialog descriptor. |
void |
setClosingOptions(Object[] arr)
Setter for list of options that close the dialog. |
void |
setHelpCtx(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, firePropertyChange, getAdditionalOptions, getDefaultValue, getMessage, getMessageType, getOptions, getOptionType, getTitle, getTitleForType, getValue, initialize, isValid, removePropertyChangeListener, setAdditionalOptions, setMessage, setMessageType, setOptions, setOptionType, setTitle, setValid, setValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String PROP_OPTIONS_ALIGN
public static final String PROP_MODAL
public static final String PROP_LEAF
public static final String PROP_HELP_CTX
public static final String PROP_BUTTON_LISTENER
public static final String PROP_CLOSING_OPTIONS
public static final int BOTTOM_ALIGN
public static final int RIGHT_ALIGN
public static final int DEFAULT_ALIGN
Constructor Detail |
public DialogDescriptor(Object innerPane, String title)
innerPane
- inner component of the dialog, or String messagetitle
- title of the dialogpublic DialogDescriptor(Object innerPane, String title, boolean isModal, ActionListener bl)
bl
is not null
, 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 using NotifyDescriptor.getValue()
.)
innerPane
- inner component of the dialog, or String messagetitle
- title of the dialogisModal
- modal statusbl
- listener for user's button pressespublic DialogDescriptor(Object innerPane, String title, boolean isModal, int optionType, Object initialValue, ActionListener bl)
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 optionspublic DialogDescriptor(Object innerPane, String title, boolean modal, Object[] options, Object initialValue, int optionsAlign, HelpCtx helpCtx, ActionListener bl)
ActionListener
or setClosingOptions
.
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 or null
for default close action on all options
(unless you specified the options yourself)setClosingOptions(java.lang.Object[])
public DialogDescriptor(Object innerPane, String title, boolean modal, Object[] options, Object initialValue, int optionsAlign, HelpCtx helpCtx, ActionListener bl, boolean leaf)
ActionListener
or setClosingOptions
.
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 or null
for default close action on all options
(unless you specified the options yourself)leaf
- property specifies whether the dialog can be owner of other dialogssetClosingOptions(java.lang.Object[])
public DialogDescriptor(Object innerPane, String title, boolean isModal, int optionType, Object initialValue, int optionsAlign, HelpCtx helpCtx, ActionListener bl)
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 or null
for default close action on all options
(unless you specified the options yourself)Method Detail |
public int getOptionsAlign()
setOptionsAlign(int)
public void setOptionsAlign(int optionsAlign)
optionsAlign
- new options alignment
IllegalArgumentException
- when unknown alignment is givenDEFAULT_ALIGN
public boolean isModal()
setModal(boolean)
public void setModal(boolean modal)
modal
- new modal statusisModal()
public boolean isLeaf()
setLeaf(boolean)
public void setLeaf(boolean leaf)
leaf
- new leaf statusisLeaf()
public void setClosingOptions(Object[] arr)
arr
- array of options that should close the dialog when pressed
if null then all options close the dialogpublic Object[] getClosingOptions()
public HelpCtx getHelpCtx()
getHelpCtx
in interface HelpCtx.Provider
setHelpCtx(org.openide.util.HelpCtx)
public void setHelpCtx(HelpCtx helpCtx)
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
nor HelpCtx.DEFAULT_HELP
. If the
descriptor is null
, this feature will be disabled
(you can still add your own help button manually if you wish,
of course). If DEFAULT_HELP
(the default), normally the button
will also be disabled, however if the inner pane is a component
and this component has an associated
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 to null
you must explicitly call this method; passing
null
in the constructor actually sets it to DEFAULT_HELP
.
helpCtx
- new help context, can be null
(no help)getHelpCtx()
public ActionListener getButtonListener()
setButtonListener(java.awt.event.ActionListener)
public void setButtonListener(ActionListener l)
l
- new button listener. It may be null
, in which case listening is cancelled.getButtonListener()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |