public class NotifyDescriptor extends Object
Simple example of usage:
NotifyDescriptor d = new NotifyDescriptor.Message("Hello...", NotifyDescriptor.INFORMATION_MESSAGE); DialogDisplayer.getDefault().notify(d);or to get a result:
NotifyDescriptor d = new NotifyDescriptor.Confirmation("Really do this?!", "Dialog Title", NotifyDescriptor.OK_CANCEL_OPTION); if (DialogDisplayer.getDefault().notify(d) == NotifyDescriptor.OK_OPTION) { // really do it... }
Modifier and Type | Class and Description |
---|---|
static class |
NotifyDescriptor.ComposedInput
Notification providing a composed input of multiple chained selection lists and/or input lines.
|
static class |
NotifyDescriptor.Confirmation
Provides a description of a possible action and requests confirmation from the user before proceeding.
|
static class |
NotifyDescriptor.Exception
Deprecated.
No longer used. Try
java.util.logging or Exceptions . |
static class |
NotifyDescriptor.InputLine
Notification providing for a line of text input.
|
static class |
NotifyDescriptor.Message
Provides information about the results of a command.
|
static class |
NotifyDescriptor.PasswordLine
Notification providing a password input.
|
static class |
NotifyDescriptor.QuickPick
Notification providing a selection list allowing multiple selections.
|
Modifier and Type | Field and Description |
---|---|
static Object |
CANCEL_OPTION
Return value if CANCEL is chosen.
|
static Object |
CLOSED_OPTION
Return value if user closes the window without pressing any button.
|
static int |
DEFAULT_OPTION
Option type used by default.
|
static int |
ERROR_MESSAGE
Message type for error messages.
|
static int |
INFORMATION_MESSAGE
Message type for information messages.
|
static Object |
NO_OPTION
Return value if NO is chosen.
|
static int |
OK_CANCEL_OPTION
Option type used for cancellable confirmations.
|
static Object |
OK_OPTION
Return value if OK is chosen.
|
static int |
PLAIN_MESSAGE
Plain message type using no icon.
|
static String |
PROP_DETAIL
Name of property for the detail message reported.
|
static String |
PROP_ERROR_NOTIFICATION
Name of property for the error message at the bottom of the wizard.
|
static String |
PROP_INFO_NOTIFICATION
Name of property for the error message at the bottom of the wizard.
|
static String |
PROP_MESSAGE
Name of property for the message to be displayed.
|
static String |
PROP_MESSAGE_TYPE
Name of property for the type of message to use.
|
static String |
PROP_NO_DEFAULT_CLOSE
Name of property for toggling the ESC key and title frame button closing.
|
static String |
PROP_OPTION_TYPE
Name of property for the style of options available.
|
static String |
PROP_OPTIONS
Name of property for the exact list of options.
|
static String |
PROP_TITLE
Name of property for the dialog title.
|
static String |
PROP_VALID
Name of property for the OK button validation.
|
static String |
PROP_VALUE
Name of property for the value the user selected.
|
static String |
PROP_WARNING_NOTIFICATION
Name of property for the error message at the bottom of the wizard.
|
static int |
QUESTION_MESSAGE
Message type for questions.
|
static int |
WARNING_MESSAGE
Message type for warning messages.
|
static int |
YES_NO_CANCEL_OPTION
Option type used for negatable and cancellable confirmations.
|
static int |
YES_NO_OPTION
Option type used for negatable confirmations.
|
static Object |
YES_OPTION
Return value if YES is chosen.
|
Constructor and Description |
---|
NotifyDescriptor(Object message,
String title,
int optionType,
int messageType,
Object[] options,
Object initialValue)
Creates a new notify descriptor with specified information to report.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a
PropertyChangeListener to the listener list. |
NotificationLineSupport |
createNotificationLineSupport()
Create
NotificationLineSupport if you want to notify users
using info/warning/error messages in designed line at the bottom
of your dialog. |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Fire a
PropertyChangeEvent to each listener. |
Object[] |
getAdditionalOptions()
Get the explicit additional choices the user can make.
|
Object |
getDefaultValue()
Get the default value of descriptor.
|
Object |
getMessage()
Get the message object.
|
int |
getMessageType()
Get the message type.
|
NotificationLineSupport |
getNotificationLineSupport()
Returns NotificationLineSupport if it was created or
null if doesn't. |
Object[] |
getOptions()
Get the explicit choices the user can make.
|
int |
getOptionType()
Get the type of options that are to be displayed.
|
String |
getTitle()
Get the title string for this report description.
|
protected static String |
getTitleForType(int messageType)
Get the title to use for the indicated type.
|
Object |
getValue()
Get the value the user has selected.
|
protected void |
initialize()
Method that is called before a value is returned from any of
getter methods in this object.
|
boolean |
isNoDefaultClose() |
boolean |
isValid()
Return true if OK button is valid (enabled), otherwise return false.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a
PropertyChangeListener from the listener list. |
void |
setAdditionalOptions(Object[] newOptions)
Define an explicit description of the set of additional user-selectable options.
|
void |
setMessage(Object newMessage)
Define a descriptive message to be reported.
|
void |
setMessageType(int newType)
Define the style of the message.
|
void |
setNoDefaultClose(boolean noDefaultClose)
Disable or enabled the closing of dialog window using ESC and the close button
in dialog's title bar.
|
void |
setOptions(Object[] newOptions)
Define an explicit description of the set of user-selectable options.
|
void |
setOptionType(int newType)
Define the set of options.
|
void |
setTitle(String newTitle)
Set the title string for this report description.
|
void |
setValid(boolean newValid)
Set validity of OK button.
|
void |
setValue(Object newValue)
Set the value the user has chosen and fires appropriate property change.
|
public static final String PROP_MESSAGE
public static final String PROP_MESSAGE_TYPE
public static final String PROP_OPTION_TYPE
public static final String PROP_OPTIONS
public static final String PROP_VALUE
public static final String PROP_TITLE
public static final String PROP_DETAIL
public static final String PROP_VALID
public static final String PROP_NO_DEFAULT_CLOSE
public static final String PROP_ERROR_NOTIFICATION
NotifyDescriptor.createNotificationLineSupport()
public static final String PROP_WARNING_NOTIFICATION
NotifyDescriptor.createNotificationLineSupport()
public static final String PROP_INFO_NOTIFICATION
NotifyDescriptor.createNotificationLineSupport()
public static final Object YES_OPTION
public static final Object NO_OPTION
public static final Object CANCEL_OPTION
public static final Object OK_OPTION
public static final Object CLOSED_OPTION
public static final int DEFAULT_OPTION
public static final int YES_NO_OPTION
public static final int YES_NO_CANCEL_OPTION
public static final int OK_CANCEL_OPTION
public static final int ERROR_MESSAGE
public static final int INFORMATION_MESSAGE
public static final int WARNING_MESSAGE
public static final int QUESTION_MESSAGE
public static final int PLAIN_MESSAGE
public NotifyDescriptor(Object message, String title, int optionType, int messageType, Object[] options, Object initialValue)
optionType
is NotifyDescriptor.YES_NO_OPTION
or NotifyDescriptor.YES_NO_CANCEL_OPTION
and the options
parameter is null
, then the options are
supplied by the look and feel.
The messageType
parameter is primarily used to supply a
default icon from the look and feel.message
- the object to displaytitle
- the title string for the dialogoptionType
- indicates which options are availablemessageType
- indicates what type of message should be displayedoptions
- an array of objects indicating the possible choicesinitialValue
- the object that represents the default valueNotifyDescriptor.getMessage()
,
NotifyDescriptor.getMessageType()
,
NotifyDescriptor.getOptions()
,
NotifyDescriptor.getOptionType()
,
NotifyDescriptor.getValue()
protected void initialize()
public final boolean isValid()
NotifyDescriptor.setValid(boolean)
public final void setValid(boolean newValid)
newValid
- validity status of OK buttonNotifyDescriptor.isValid()
public void setMessage(Object newMessage)
String
. However, the type
of this parameter is actually Object
. Its interpretation depends on
its type:
Object[]
Component
Component
is displayed in the dialog.
Icon
Icon
is wrapped in a JLabel
and displayed in the dialog.
string representation
of the object.
newMessage
- the Object
to reportNotifyDescriptor.getMessage()
public Object getMessage()
Object
that is to be reportedNotifyDescriptor.setMessage(java.lang.Object)
public void setMessageType(int newType)
newType
- the kind of messageNotifyDescriptor.getMessageType()
public int getMessageType()
NotifyDescriptor.setMessageType(int)
public void setOptionType(int newType)
newType
- the options the look and feel is to displayNotifyDescriptor.getOptionType()
,
NotifyDescriptor.setOptions(java.lang.Object[])
public int getOptionType()
NotifyDescriptor.setOptionType(int)
public void setOptions(Object[] newOptions)
String
s. But the parameter type is an array of Object
s. Its
interpretation depends on its type:
newOptions
- an array of user-selectable optionsNotifyDescriptor.getOptions()
public Object[] getOptions()
Object
s that give the user's choicesNotifyDescriptor.setOptions(java.lang.Object[])
public void setAdditionalOptions(Object[] newOptions)
The usual value for the options parameter is an array of
String
s. But the parameter type is an array of Object
s. Its
interpretation depends on its type:
newOptions
- an array of user-selectable optionsNotifyDescriptor.getOptions()
public Object[] getAdditionalOptions()
Object
s that give the user's choicesNotifyDescriptor.setOptions(java.lang.Object[])
public void setValue(Object newValue)
newValue
- the chosen valueNotifyDescriptor.getValue()
public Object getValue()
Object
indicating the option selected by the userNotifyDescriptor.setValue(java.lang.Object)
public Object getDefaultValue()
Object
that represents the default valuepublic void setTitle(String newTitle)
newTitle
- the title of this descriptionNotifyDescriptor.getTitle()
public String getTitle()
NotifyDescriptor.setTitle(java.lang.String)
public final NotificationLineSupport createNotificationLineSupport()
NotificationLineSupport
if you want to notify users
using info/warning/error messages in designed line at the bottom
of your dialog. These message will be labelled with appropriate icons.
DialogDisplayer.createDialog(org.openide.DialogDescriptor)
public final NotificationLineSupport getNotificationLineSupport()
null
if doesn't.
WizardDescriptor
which has such capability longer.NotifyDescriptor.createNotificationLineSupport()
public void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
to the listener list.listener
- the PropertyChangeListener
to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
from the listener list.listener
- the PropertyChangeListener
to be removedprotected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
PropertyChangeEvent
to each listener.propertyName
- the programmatic name of the property that was changedoldValue
- the old value of the propertynewValue
- the new value of the propertypublic void setNoDefaultClose(boolean noDefaultClose)
noDefaultClose
- True to disabled ESC closing and to disable the close
button in dialog's title bar.WindowConstants.DO_NOTHING_ON_CLOSE
public boolean isNoDefaultClose()
protected static String getTitleForType(int messageType)
messageType
- the type of message