|
org.openide.dialogs 6.5.31 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openide.NotifyDescriptor
public class NotifyDescriptor
This class provides a description of a user notification to be displayed.
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... }
Nested Class Summary | |
---|---|
static class |
NotifyDescriptor.Confirmation
Provides a description of a possible action and requests confirmation from the user before proceeding. |
static class |
NotifyDescriptor.Exception
Deprecated. Better to use ErrorManager.notify(int, java.lang.Throwable) |
static class |
NotifyDescriptor.InputLine
Notification providing for a line of text input. |
static class |
NotifyDescriptor.Message
Provides information about the results of a command. |
Field Summary | |
---|---|
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_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_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 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 Summary | |
---|---|
NotifyDescriptor(Object message,
String title,
int optionType,
int messageType,
Object[] options,
Object initialValue)
Creates a new notify descriptor with specified information to report. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. |
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. |
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 |
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 |
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. |
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_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 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
Constructor Detail |
---|
public NotifyDescriptor(Object message, String title, int optionType, int messageType, Object[] options, Object initialValue)
optionType
is YES_NO_OPTION
or 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 valuegetMessage()
,
getMessageType()
,
getOptions()
,
getOptionType()
,
getValue()
Method Detail |
---|
protected void initialize()
public final boolean isValid()
setValid(boolean)
public final void setValid(boolean newValid)
newValid
- validity status of OK buttonisValid()
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 reportgetMessage()
public Object getMessage()
Object
that is to be reportedsetMessage(java.lang.Object)
public void setMessageType(int newType)
newType
- the kind of messagegetMessageType()
public int getMessageType()
setMessageType(int)
public void setOptionType(int newType)
newType
- the options the look and feel is to displaygetOptionType()
,
setOptions(java.lang.Object[])
public int getOptionType()
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:
Component
Icon
JButton
is created with this icon as its label.
Object
is converted
to a string and the result is used to
label a JButton
.
newOptions
- an array of user-selectable optionsgetOptions()
public Object[] getOptions()
Object
s that give the user's choicessetOptions(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:
Component
Icon
JButton
is created with this icon as its label.
Object
is converted
to a string and the result is used to
label a JButton
.
newOptions
- an array of user-selectable optionsgetOptions()
public Object[] getAdditionalOptions()
Object
s that give the user's choicessetOptions(java.lang.Object[])
public void setValue(Object newValue)
newValue
- the chosen valuegetValue()
public Object getValue()
Object
indicating the option selected by the usersetValue(java.lang.Object)
public Object getDefaultValue()
Object
that represents the default valuepublic void setTitle(String newTitle)
newTitle
- the title of this descriptiongetTitle()
public String getTitle()
setTitle(java.lang.String)
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 propertyprotected static String getTitleForType(int messageType)
messageType
- the type of message
|
org.openide.dialogs 6.5.31 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |