Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.dialogs 6.5.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openide
Class DialogDescriptor

    java.lang.Object
      org.openide.NotifyDescriptor
          org.openide.DialogDescriptor

All Implemented Interfaces:
  HelpCtx.Provider

Direct Known Subclasses:
  WizardDescriptor

    public class DialogDescriptor

extends NotifyDescriptor
implements HelpCtx.Provider

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/interfaces inherited from class org.openide.NotifyDescriptor
`NotifyDescriptor.Confirmation, NotifyDescriptor.Exception, NotifyDescriptor.InputLine, NotifyDescriptor.Message`

Field Summary
`static int` | `BOTTOM_ALIGN`
`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

### PROP_OPTIONS_ALIGN

    public static final String PROP_OPTIONS_ALIGN

  Name of property for alignment of options.

  See Also:
    Constant Field Values

### PROP_MODAL

    public static final String PROP_MODAL

  Name of property for modality of dialog.

  See Also:
    Constant Field Values

### PROP_LEAF

    public static final String PROP_LEAF

  Name of property whether the dialg is leaf or can be the owner of other one dialog.

  See Also:
    Constant Field Values

### PROP_HELP_CTX

    public static final String PROP_HELP_CTX

  Name of property for the help context.

  See Also:
    Constant Field Values

### PROP_BUTTON_LISTENER

    public static final String PROP_BUTTON_LISTENER

  Name of property for the button listener.

  See Also:
    Constant Field Values

### PROP_CLOSING_OPTIONS

    public static final String PROP_CLOSING_OPTIONS

  Name of property for list of closing options.

  See Also:
    Constant Field Values

### BOTTOM_ALIGN

    public static final int BOTTOM_ALIGN

See Also:
  Constant Field Values

### RIGHT_ALIGN

    public static final int RIGHT_ALIGN

  Alignment to place options vertically in the right part.

  See Also:
    Constant Field Values

### DEFAULT_ALIGN

    public static final int DEFAULT_ALIGN

  Alignment to place options in the default manner.

  See Also:
    Constant Field Values

Constructor Detail

### DialogDescriptor

    public 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. All buttons will close the dialog and the getValue () will provide the pressed option.

  Parameters:
    `innerPane` - inner component of the dialog, or String message
    `title` - title of the dialog

### DialogDescriptor

    public 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. If `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()`.)

  Parameters:
    `innerPane` - inner component of the dialog, or String message
    `title` - title of the dialog
    `isModal` - modal status
    `bl` - 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 message
    `title` - title of the dialog
    `isModal` - modal status
    `optionType` - 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,
                            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 the `ActionListener` or `setClosingOptions`.

  Parameters:
    `innerPane` - inner component of the dialog, or String message
    `title` - title of the dialog
    `modal` - modal status
    `options` - 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 array
    `optionsAlign` - specifies where to place options in the dialog
    `helpCtx` - help context specifying help page
    `bl` - listener for the user's button presses or `null` for default close action on all options (unless you specified the options yourself)
  See Also:
    `setClosingOptions(java.lang.Object[])`

### DialogDescriptor

    public 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. 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 the `ActionListener` or `setClosingOptions`.

  Parameters:
    `innerPane` - inner component of the dialog, or String message
    `title` - title of the dialog
    `modal` - modal status
    `options` - 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 array
    `optionsAlign` - specifies where to place options in the dialog
    `helpCtx` - help context specifying help page
    `bl` - 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 dialogs
  Since:
    5.5
  See Also:
    `setClosingOptions(java.lang.Object[])`

### DialogDescriptor

    public DialogDescriptor(Object innerPane,
                            String title,
                            boolean isModal,
                            int optionType,
                            Object initialValue,
                            int optionsAlign,
                            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 message
    `title` - title of the dialog
    `isModal` - modal status
    `optionType` - one of the standard options (`OK_CANCEL_OPTION`, ...)
    `initialValue` - default option (default button)
    `optionsAlign` - specifies where to place options in the dialog
    `helpCtx` - help context specifying help page
    `bl` - listener for the user's button presses or `null` for default close action on all options (unless you specified the options yourself)

Method Detail

### getOptionsAlign

    public int getOptionsAlign()

  Get current option alignment.

  Returns:
    current option alignment
  See Also:
    `setOptionsAlign(int)`

### 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:
    `DEFAULT_ALIGN`

### isModal

    public boolean isModal()

  Get modal status.

  Returns:
    modal status
  See Also:
    `setModal(boolean)`

### setModal

    public void setModal(boolean modal)

  Set new modal status. Fires property change event if successful.

  Parameters:
    `modal` - new modal status
  See Also:
    `isModal()`

### 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(boolean)`

### 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:
    `isLeaf()`

### setClosingOptions

    public void setClosingOptions(Object[] arr)

  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

    public Object[] getClosingOptions()

  Getter for list of closing options.

  Returns:
    array of options or null

### getHelpCtx

    public HelpCtx getHelpCtx()

  Get current help context asociated with this dialog descriptor.

  Specified by:
    `getHelpCtx` in interface `HelpCtx.Provider`
  Returns:
    current help context
  See Also:
    `setHelpCtx(org.openide.util.HelpCtx)`

### setHelpCtx

    public void setHelpCtx(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` 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`.

  Parameters:
    `helpCtx` - new help context, can be `null` (no help)
  See Also:
    `getHelpCtx()`

### getButtonListener

    public ActionListener getButtonListener()

  Get button listener which listens for the user's button presses.

  Returns:
    current button listener instance or null
  See Also:
    `setButtonListener(java.awt.event.ActionListener)`

### setButtonListener

    public void setButtonListener(ActionListener l)

  Set new button listener instance for this dialog descriptor. Fires property change event if successful.

  Parameters:
    `l` - new button listener. It may be `null`, in which case listening is cancelled.
  See Also:
    `getButtonListener()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.dialogs 6.5.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Built on December 7 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.