|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.rave.designtime.Result
A Result object represents the logical result of an operation. The SUCCESS and FAILURE Result objects are useful when returning an otherwise empty result with no user messages. null Results should never be returned, but if one is, it will be treated as Result.SUCCESS with no messages.
Some Result objects may contain user messages, returned by the 'getMessages()' method. These messages will be displayed to the user in one of three ways:
| Status Bar | The Status Bar displays very low-importance messages. Any ResultMessage objects of type ResultMessage.TYPE_INFORMATION will be displayed here, as long as there are no result options returned from the 'getResultOptions()' method. |
| Message Window | The Message Window displays more important messages than the status bar, as they are persisted until the user clears the message window. Any ResultMessage objects of type ResultMessage.TYPE_WARNING will be displayed here, as long as there are no result options returned from the 'getResultOptions()' method. |
| Message Dialog | A pop-up modal Message Dialog displays the most important messages, as the user must stop work to 'handle' the dialog. Any ResultMessage objects of type ResultMessage.TYPE_CRITICAL will be displayed in an modal dialog. If there are any result options returned from the 'getResultOptions()' method, they will be displayed as buttons in the dialog, otherwise a default 'OK' button will be displayed. If a Result contains messages that are less than TYPE_CRITICAL, but result options are included - the messages will be 'upgraded' and displayed in the model dialog, as if they were TYPE_CRITICAL. |
The three most important methods of this class are: 'isSuccess()', 'getMessages()', and 'getMessageOptions()'. These are called by the IDE to investigate the details of a Result object.
| Field Summary | |
protected java.lang.String |
dialogTitle
Protected storage for the 'resultDialogTitle' property |
static Result |
FAILURE
Common instance of a failed result object |
protected java.lang.String |
helpKey
Protected storage for the 'dialogHelpKey' property |
protected java.util.ArrayList |
messages
Protected storage for the message list (ResultMessage[]) |
protected java.util.ArrayList |
options
Protected storage for the result option list (DisplayAction[]) |
protected boolean |
success
Protected storage for the 'success' property |
static Result |
SUCCESS
Common instance of a successful result object |
| Constructor Summary | |
Result(boolean success)
Constructs a Result object with the specified success status |
|
Result(boolean success,
ResultMessage message)
Constructs a Result object with the specified success status and message |
|
Result(boolean success,
ResultMessage[] messages)
Constructs a Result object with the specified success status and messages |
|
Result(boolean success,
ResultMessage[] messages,
DisplayAction[] options)
Constructs a Result object with the specified success status, messages, and options |
|
| Method Summary | |
void |
addMessage(ResultMessage message)
Adds a ResultMessage to this Result to be displayed to the user |
void |
addMessages(ResultMessage[] messages)
Adds an array of ResultMessage to this Result to be displayed to the user |
void |
addResultOption(DisplayAction option)
Adds a DisplayAction to this Result to be displayed to the user as an option button in a dialog |
void |
addResultOptions(DisplayAction[] options)
Adds a set of DisplayAction(s) to this Result to be displayed to the user as option buttons in a dialog |
java.lang.String |
getDialogHelpKey()
Returns the 'dialogHelpKey' property. |
java.lang.String |
getDialogTitle()
Returns the 'dialogTitle' property. |
int |
getMessageCount()
Returns the count of ResultMessage(s) in this Result |
ResultMessage[] |
getMessages()
Returns an (optional) set of ResultMessage objects from the completed operation. |
int |
getResultOptionCount()
Returns the count of DisplayAction(s) in this Result which will be displayed to the user as option buttons in a dialog |
DisplayAction[] |
getResultOptions()
Returns an (optional) set of DisplayAction objects representing options in a dialog box for the user. |
boolean |
isSuccess()
Returns true if the operation represented by this Result object was successful |
void |
removeMessage(ResultMessage message)
Removes a ResultMessage from the set to display to the user |
void |
removeMessages(ResultMessage[] messages)
Removes an array of ResultMessage(s) from the set to display to the user |
void |
removeResultOption(DisplayAction option)
Removes a DisplayAction (option button in a dialog) from this Result |
void |
removeResultOptions(DisplayAction[] options)
Removes an array of DisplayAction(s) (option buttons in a dialog) from this Result |
void |
setDialogHelpKey(java.lang.String helpKey)
Sets the 'dialogHelpKey' property. |
void |
setDialogTitle(java.lang.String dialogTitle)
Sets the 'dialogTitle' property. |
void |
setSuccess(boolean success)
Sets the success state of this Result |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String dialogTitle
public static final Result FAILURE
protected java.lang.String helpKey
protected java.util.ArrayList messages
protected java.util.ArrayList options
protected boolean success
public static final Result SUCCESS
| Constructor Detail |
public Result(boolean success)
success - true if successful, false if not
public Result(boolean success,
ResultMessage message)
success - true if successful, false if notmessage - A ResultMessage to display to the user
public Result(boolean success,
ResultMessage[] messages)
success - true if successful, false if notmessages - A set of ResultMessage(s) to display to the user
public Result(boolean success,
ResultMessage[] messages,
DisplayAction[] options)
success - true if successful, false if notmessages - A set of ResultMessage(s) to display to the useroptions - A set of DisplayAction(s) to present to the user as option buttons| Method Detail |
public void addMessage(ResultMessage message)
message - The ResultMessage to addpublic void addMessages(ResultMessage[] messages)
messages - The array of ResultMessage(s) to addpublic void addResultOption(DisplayAction option)
option - The DisplayAction to add as an option buttonpublic void addResultOptions(DisplayAction[] options)
options - The DisplayAction(s) to add as option buttonspublic java.lang.String getDialogHelpKey()
public java.lang.String getDialogTitle()
public int getMessageCount()
public ResultMessage[] getMessages()
public int getResultOptionCount()
public DisplayAction[] getResultOptions()
public boolean isSuccess()
public void removeMessage(ResultMessage message)
message - the ResultMessage to remove from the setpublic void removeMessages(ResultMessage[] messages)
messages - the ResultMessage(s) to remove from the setpublic void removeResultOption(DisplayAction option)
option - The DisplayAction (option button) to removepublic void removeResultOptions(DisplayAction[] options)
options - The DisplayAction(s) (option buttons) to removepublic void setDialogHelpKey(java.lang.String helpKey)
public void setDialogTitle(java.lang.String dialogTitle)
dialogTitle - The desired title for the result dialogpublic void setSuccess(boolean success)
success - the success state of this Result
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||