All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sgi.sysadm.ui.TaskLaunchComponent

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----javax.swing.JComponent
                           |
                           +----javax.swing.JPanel
                                   |
                                   +----com.sgi.sysadm.ui.RPanel
                                           |
                                           +----com.sgi.sysadm.ui.OneColumnPanel
                                                   |
                                                   +----com.sgi.sysadm.ui.TaskLaunchComponent

public class TaskLaunchComponent
extends OneColumnPanel
A component containing a Task link that the user can click to launch another Task. These components can be combined into a "metatask" or "taskset." A metatask is a set of Tasks that can be executed in a programmer-controlled way, such as in a particular order (ex., Task A must be completed before Tasks B and C become launchable, or Item Foo must exist before Task Bar becomes launchable). Metatasks can be implemented as just another extension of the Task class.

The TaskLaunchComponent appears visually as three lines of text. The first line, the "description" line, describes the Task to be launched as a human readable string. The text comes from the ResourceStack that is passed to the constructor. This line is a RichTextArea, so it can contain glossary links. The name of the RichTextArea that is created is <name>.description, where <name> is the TaskLaunchComponent's name that is passed to the constructor. To set the text that is displayed for the description, you would provide a resource with the name <name>.description.text. See the RichTextArea about other resources that effect the look of the RichTextArea.

The second line contains a Task Icon and a link to launch the Task. The icon and the name of the Task are determined automatically from the TaskLoader that is passed to the constructor.

The third line is the status of the Task. The TaskLaunchComponent automatically updates the status when the component is first shown, when the Task is launched, when the Task is canceled, and when the Task is completed. The strings that are displayed come from the ResourceStack passed to the constructor, and are described in NEVER_LAUNCHED, LAUNCHED, CANCELED, and COMPLETED. The status line can also be set programatically with setStatus. You can disable the automatic setting of the status field with the enableAutoStatus method. The status text is preceded by a string that says something like "Status: ". The exact text displayed is determined by the STATUS_PREFIX resource. The name of the RichTextComponent that is created is described by STATUS, and you can use that name to affect the way the the RichTextComponent appears (see RichTextComponent for more information).

When a user clicks on the Task link or icon, the TaskLaunchComponent automatically creates a new TaskFrame window for the Task and displays it. When the task completes, the Task's usual ResultView is not shown. Instead, a dialog with the text described in the SUCCESS resource is displayed. If SUCCESS is not defined, then a more general resource, TASK_COMPLETED_MESSAGE, is used.

There is a border inside the TaskLaunchComponent. Its size can be adjusted with the TOP, BOTTOM, LEFT, and RIGHT resources.

The TaskLaunchComponent looks different when it is enabled versus when it is disabled. When enabled, the Task link becomes active, and a special colored border is placed around the component. The border's size is controlled via the ENABLED_WIDTH resource, and the color comes from a UIDefault called "TaskLaunchComponent.highlight". See the documention for RApp on how to set UIDefaults.

See Also:
Task, RApp, RichTextComponent, RichTextArea

Variable Index

 o BOTTOM
The resource TaskLaunchComponent.margin.bottom gives the number of points to use for the bottom of the margin inside the component.
 o CANCELED
A resource TaskLaunchComponent.canceled is the string to display for the status if the Task has been canceled.
 o COMPLETED
A resource TaskLaunchComponent.completed is the string to display for the status if the Task has been successfully completed.
 o DESCRIPTION
The string <name>.description is used to name the RichTextArea used to display the description.
 o ENABLED_WIDTH
The resource TaskLaunchComponent.border.enabledWidth gives the width (in points) to use for the colored margin that highlights the component when it is enabled.
 o LAUNCHED
A resource TaskLaunchComponent.launched is the string to display for the status if the Task is currently launched.
 o LEFT
The resource TaskLaunchComponent.margin.left gives the number of points to use for the left of the margin inside the component.
 o NEVER_LAUNCHED
A resource TaskLaunchComponent.neverLaunched is the string to display for the status if the Task has not yet been launched.
 o RIGHT
The resource TaskLaunchComponent.margin.right gives the number of points to use for the right of the margin inside the component.
 o STATUS
The string <name>.status is used to name the RichTextComponent used to display the status.
 o STATUS_PREFIX
A resource TaskLaunchComponent.statusPrefix is the String to prepend to the status field.
 o SUCCESS
The resource <name>.success is message that will be displayed in the status line when the task sucessfully completes.
 o TASK_COMPLETED_MESSAGE
The resource TaskLaunchComponent.taskCompletedMessage is a String that is displayed in a dialog whenever a task successfully completes, if the SUCCESS resource is not found.
 o TOP
The resource TaskLaunchComponent.margin.top gives the number of points to use for the top of the border inside the component.

Constructor Index

 o TaskLaunchComponent(UIContext, TaskLoader, TaskData, String, ResourceStack)
Create a TaskLaunchComponent.

Method Index

 o addInTaskDataBinding(String, String)
Connects some parent's (ex., metatask) TaskData to the child's TaskData.
 o addOutTaskDataBinding(String, String)
Connects some child's TaskData to the parent's (ex., metatask) TaskData.
 o addTaskLaunchComponentListener(TaskLaunchComponentListener)
Adds a listener to the list of listeners that will be notified when this TaskLaunchComponent changes state.
 o enableAutoStatus(boolean)
Determines whether or not this component will automatically set the status.
 o getState()
Return the current state of the TaskLaunchComponent.
 o removeTaskLaunchComponentListener(TaskLaunchComponentListener)
Removes a listener from the list of listeners that will be notified when this TaskLaunchComponent changes state.
 o setDescription(String)
Sets the HTML that will be displayed for the description line.
 o setEnabled(boolean)
Sets this component to be enabled or disabled.
 o setStatus(String)
Sets the status field of the component programatically.

Variables

 o NEVER_LAUNCHED
 public static final String NEVER_LAUNCHED
A resource TaskLaunchComponent.neverLaunched is the string to display for the status if the Task has not yet been launched.

 o LAUNCHED
 public static final String LAUNCHED
A resource TaskLaunchComponent.launched is the string to display for the status if the Task is currently launched.

 o CANCELED
 public static final String CANCELED
A resource TaskLaunchComponent.canceled is the string to display for the status if the Task has been canceled.

 o COMPLETED
 public static final String COMPLETED
A resource TaskLaunchComponent.completed is the string to display for the status if the Task has been successfully completed.

 o STATUS_PREFIX
 public static final String STATUS_PREFIX
A resource TaskLaunchComponent.statusPrefix is the String to prepend to the status field.

 o TASK_COMPLETED_MESSAGE
 public static final String TASK_COMPLETED_MESSAGE
The resource TaskLaunchComponent.taskCompletedMessage is a String that is displayed in a dialog whenever a task successfully completes, if the SUCCESS resource is not found.

See Also:
SUCCESS
 o SUCCESS
 public static final String SUCCESS
The resource <name>.success is message that will be displayed in the status line when the task sucessfully completes. If this resource is not defined, then the TASK_COMPLETED_MESSAGE resource will be used instead.

See Also:
TASK_COMPLETED_MESSAGE
 o DESCRIPTION
 public static final String DESCRIPTION
The string <name>.description is used to name the RichTextArea used to display the description. This is not a resource key, but the name of the RichTextArea. You can use this name to set properties that control the RichTextArea, as described in RichTextArea.

See Also:
RichTextArea
 o STATUS
 public static final String STATUS
The string <name>.status is used to name the RichTextComponent used to display the status. This is not a resource key, but the name of the RichTextComponent. You can use this name to set properties that control the RichTextComponent, as described in RichTextComponent.

See Also:
RichTextComponent
 o TOP
 public static final String TOP
The resource TaskLaunchComponent.margin.top gives the number of points to use for the top of the border inside the component.

 o BOTTOM
 public static final String BOTTOM
The resource TaskLaunchComponent.margin.bottom gives the number of points to use for the bottom of the margin inside the component.

 o LEFT
 public static final String LEFT
The resource TaskLaunchComponent.margin.left gives the number of points to use for the left of the margin inside the component.

 o RIGHT
 public static final String RIGHT
The resource TaskLaunchComponent.margin.right gives the number of points to use for the right of the margin inside the component.

 o ENABLED_WIDTH
 public static final String ENABLED_WIDTH
The resource TaskLaunchComponent.border.enabledWidth gives the width (in points) to use for the colored margin that highlights the component when it is enabled.

Constructors

 o TaskLaunchComponent
 public TaskLaunchComponent(UIContext uic,
                            TaskLoader loader,
                            TaskData parentTD,
                            String name,
                            ResourceStack rs)
Create a TaskLaunchComponent.

Parameters:
uic - The UIContext. This component will call blockInput() on the UIContext while a task is launched, and will use the context to post error messages.
loader - The task loader of the task to launch.
parentTD - The TaskData of the parent Task (metatask). Will be used to move TaskData Attributes between the parent and child Tasks. Can be null if there is no parent Task, or if no TaskData Attributes will be moved between parent and child via the addInTaskDataBinding or addOutTaskDataBinding methods.
name - The name of this TaskLaunchComponent. Will be used
  • for naming the RichTextArea used for the description line (see DESCRIPTION)
  • for naming the RichTextComponent used for the status line (see STATUS)
  • for creating the property name to lookup when the task completed (see SUCCESS).
rs - The ResourceStack to use to look up resources.
See Also:
DESCRIPTION, STATUS, SUCCESS, addInTaskDataBinding, addOutTaskDataBinding

Methods

 o addInTaskDataBinding
 public void addInTaskDataBinding(String parent,
                                  String child)
Connects some parent's (ex., metatask) TaskData to the child's TaskData. The parent TaskData is defined by the parentTD that was passed to the constructor. The child's TaskData is the TaskData in the Task that this TaskLaunchComponent creates.When the user launches the Task, the TaskData specified by this call will be copied from the parent TaskData and placed in the child.

This method allows you to specify both the name the TaskData Attribute has in the parent, as well as what name the TaskData Attribute will have in the child. This is useful if you need to use a different name for the TaskData Attributes in the two TaskDatas. In many cases, though, both names will be the same.

This method can be called as many times as necessary.

Parameters:
parent - The name of the TaskData Attribute to copy from the parent.
child - The name to give the TaskData Attribute in the child.
 o addOutTaskDataBinding
 public void addOutTaskDataBinding(String child,
                                   String parent)
Connects some child's TaskData to the parent's (ex., metatask) TaskData. The parent TaskData is defined by the parentTD that was passed to the constructor. The child's TaskData is the TaskData in the Task that this TaskLaunchComponent creates. When the Task successfully completes, the TaskData specifed by this call will be copied from the child's TaskData and placed in the parent's TaskData.

This method allows you to specify both the name the TaskData Attribute has in the child, as well as what name the TaskData Attribute will have in the parent. This is useful if you need to use a different name for the TaskData Attributes in the two TaskDatas. In many cases, though, both names will be the same.

This method can be called as many times as necessary.

Parameters:
child - The name of the task data to copy from the child.
parent - The name to give the task data in the parent.
 o addTaskLaunchComponentListener
 public void addTaskLaunchComponentListener(TaskLaunchComponentListener listener)
Adds a listener to the list of listeners that will be notified when this TaskLaunchComponent changes state.

Parameters:
listener - The TaskLaunchComponentListener to add
 o removeTaskLaunchComponentListener
 public void removeTaskLaunchComponentListener(TaskLaunchComponentListener listener)
Removes a listener from the list of listeners that will be notified when this TaskLaunchComponent changes state.

Parameters:
listener - The TaskLaunchComponentListener to remove
 o setStatus
 public void setStatus(String status)
Sets the status field of the component programatically. The component automatically shows some status: "Not launched", "Launched", "Canceled", and "Finished" (in localized versions), unless that feature has been disabled via the enableAutoStatus method. If auto status is disabled, then the status String that is passed will be used until another call to setStatus. If auto status is enabled, then the status String that is passed will be used until the component changes status, when the TaskLaunchComponent will automatically set the status to the new value.

It is often desirable to set the status of the TaskLaunchComponent in response to being notified that the state of the component has changed (via a TaskLaunchComponentListener). If auto status is enabled, then the status field is set automatically before callbacks to TaskLaunchComponentListeners occur, so listeners can call setStatus without fear that the auto status will overwrite the status they just passed to setStatus.

Parameters:
status - The String to show in the status field.
 o setEnabled
 public void setEnabled(boolean enabled)
Sets this component to be enabled or disabled. If the component is disabled, then the Task can't be launched. If the component is enabled, then the Task can be launched, and a border is drawn around the component.

Parameters:
enabled - True to enable, false to disable.
Overrides:
setEnabled in class JComponent
 o getState
 public TaskLaunchComponentState getState()
Return the current state of the TaskLaunchComponent.

Returns:
a TaskLaunchComponentState object representing the current state.
 o enableAutoStatus
 public void enableAutoStatus(boolean enable)
Determines whether or not this component will automatically set the status. Defaults to true. If auto status is enabled, then the TaskLaunchComponent will set the status field to one of four values (descibed in NEVER_LAUNCHED, LAUNCHED, CANCELED, and COMPLETED). If disabled, the TaskLaunchComponent will not automatically set the state, and the setStatus method should be used to set the status.

Parameters:
enable - Pass true to automatically set status, false to not.
See Also:
NEVER_LAUNCHED, LAUNCHED, CANCELED, COMPLETED
 o setDescription
 public void setDescription(String description)
Sets the HTML that will be displayed for the description line. If this method is not called, the TaskLaunchComponent will use a default value that comes from the DESCRIPTION resource.

Parameters:
description - The HTML text to display as the "description"

All Packages  Class Hierarchy  This Package  Previous  Next  Index