com.ibm.ui.framework
Class TaskMessage

java.lang.Object
  extended by com.ibm.ui.framework.TaskMessage

public class TaskMessage
extends Object

Provides a way for applications to communicate information to the user.

A TaskMessage has an associated type which affects how the information is presented. The possible types are defined as integer constants.

Since:
5.2
Version:
1.0 12/8/00

Field Summary
Modifier and Type Field and Description
static int ERROR
          Used to specify an error message.
static int INFORMATION
          Used to specify an informational message.
static int PLAIN
          Used to specify a plain message.
static int QUESTION
          Used to specify a question message.
static int WARNING
          Used to specify a warning message.
 
Constructor Summary
Constructor and Description
TaskMessage(WindowManager parent, String message, int type)
          Constructs a TaskMessage object which presents information to the user.
TaskMessage(WindowManager parent, String message, int type, Object[] options, Object initial)
          Constructs a TaskMessage that presents information to the user.
TaskMessage(WindowManager parent, String message, String title, int type, Object[] options, Object initial)
          Constructs a TaskMessage that presents information to the user.
 
Method Summary
Modifier and Type Method and Description
 void dispose()
          Deactivates the task message and releases all associated resources.
 String getTitle()
          Gets the title of the dialog
 Object invoke()
          Renders the task message.
 boolean isRendered()
          Determines whether the task message is currently rendered.
 void setTitle(String title)
          Sets the title of the Dialog
 Vector splitString(String str, int lineLength)
          Splits a string of text into a vector of strings.
 Vector splitString(String str, int lineLength, FontMetrics fm)
          Splits a string of text into a vector of strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR

public static final int ERROR
Used to specify an error message.

See Also:
Constant Field Values

INFORMATION

public static final int INFORMATION
Used to specify an informational message.

See Also:
Constant Field Values

WARNING

public static final int WARNING
Used to specify a warning message.

See Also:
Constant Field Values

QUESTION

public static final int QUESTION
Used to specify a question message.

See Also:
Constant Field Values

PLAIN

public static final int PLAIN
Used to specify a plain message.

See Also:
Constant Field Values
Constructor Detail

TaskMessage

public TaskMessage(WindowManager parent,
                   String message,
                   int type)
Constructs a TaskMessage object which presents information to the user.

Parameters:
parent - The WindowManager that is the parent of this TaskMessage
message - The localized message text.
type - A TaskMessage constant indicating the message type.
Since:
5.2

TaskMessage

public TaskMessage(WindowManager parent,
                   String message,
                   int type,
                   Object[] options,
                   Object initial)
Constructs a TaskMessage that presents information to the user.

Parameters:
parent - The WindowManager that is the parent of this TaskMessage
message - The localized message text.
type - A TaskMessage constant indicating the message type.
options - An array of options. For example, {"Yes", "No", "Details"}.
initial - The initially selected option in the array supplied. Defaults to the first option.
Since:
5.2

TaskMessage

public TaskMessage(WindowManager parent,
                   String message,
                   String title,
                   int type,
                   Object[] options,
                   Object initial)
Constructs a TaskMessage that presents information to the user.

Parameters:
parent - The WindowManager that is the parent of this TaskMessage
message - The localized message text.
title - The title for the dialog.
type - A TaskMessage constant indicating the message type.
options - An array of options. For example, {"Yes", "No", "Details"}.
initial - The initially selected option in the array supplied. Defaults to the first option.
Since:
5.2
Method Detail

invoke

public Object invoke()
Renders the task message.

Returns:
the object the user selected.
Since:
5.2
See Also:
isRendered(), dispose()

isRendered

public boolean isRendered()
Determines whether the task message is currently rendered. isRendered returns false if invoke has never been called, if the user has dismissed the message, or if dispose has been called.

Returns:
true if the task message is rendered; false otherwise.
Since:
5.2
See Also:
invoke(), dispose()

dispose

public void dispose()
Deactivates the task message and releases all associated resources.

Since:
5.2
See Also:
invoke()

getTitle

public String getTitle()
Gets the title of the dialog

Returns:
the title of this message window
Since:
5.2
See Also:
setTitle(java.lang.String)

setTitle

public void setTitle(String title)
Sets the title of the Dialog

Parameters:
title - - the new title being given to the message dialog
Since:
5.2
See Also:
getTitle()

splitString

public Vector splitString(String str,
                          int lineLength)
Splits a string of text into a vector of strings. Uses the UI's default font to calculate the splits.

Parameters:
str - the string to be split
lineLength - optimal number of characters on a line
Returns:
vector containing each line of the split string
Since:
5.2

splitString

public Vector splitString(String str,
                          int lineLength,
                          FontMetrics fm)
Splits a string of text into a vector of strings.

Parameters:
str - the string to be split
lineLength - optimal number of characters on a line
fm - font metrics of the font used to calculate the splits
Returns:
vector containing each line of the split string
Since:
5.2