All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sgi.sysadm.ui.TaskContext

java.lang.Object
   |
   +----com.sgi.sysadm.ui.UIContext
           |
           +----com.sgi.sysadm.ui.TaskContext

public class TaskContext
extends UIContext
TaskContext is a UIContext that provides additional services to Tasks, their subclasses, and components such as creating a Task specific ResourceStack, accessing TaskData, verifying TaskData, and maintaining the Task title.

TaskContext creates and maintains a ResourceStack to encourage sharing of properties across multiple Tasks and to allow Tasks to fall back on default properties defined by the client package or by the infrastructure. The creator of TaskContext, typically TaskLoader, must push the (optional) Package ResourceBundle and (required) Task ResourceBundle onto the TaskContext ResourceStack.

TaskContext supports access to TaskData and verification of TaskData. Task subclasses create TaskDataVerifiers and add them to the list of verifiers maintained by TaskContext so that the verifiers may be shared among the many classes that make up a Task. For example, if a Task has both a Form and Guide interface, they can share TaskDataVerifiers rather than each defining their own (duplicate) verifiers.

TaskData verification frequently requires that multiple asynchronous calls be made in sequence, one call for each piece of TaskData. For example, the Create PPP Connection Task might need to confirm with the server that the proposed User Name exists and then that the proposed Connection name does not exist. If any verification in the sequence fails, no further calls in the sequence are made and a notification of failure is sent to the caller. This sequential, asynchronous verification process is also known as chained verification.

TaskContext provides support for chaining by allowing clients to create an ordered list of TaskDataVerifiers by calls to TaskContext.appendTaskDataVerifier() or TaskContext.insertTaskDataVerifier(). Clients can then trigger individual TaskDataVerifiers by calling TaskContext.dataOK(), or they can trigger the entire chained verification by calling TaskContext.allDataOK().

See the How to Write a Task tutorial for details and examples on verifying TaskData.

See Also:
ResourceStack, TaskDataVerifier

Variable Index

 o ALL_DATA_VERIFIER
When the user presses the OK button, the Task will call TaskContext.allDataOK(TaskDataVerifiers.MUST_BE_SET).

Method Index

 o addTitleListener(TitleListener)
Add a listener to the list of those interested in changes to the Task title.
 o allDataOK(int, Object, ResultListener)
Verify that all TaskData is valid.
 o appendTaskDataVerifier(String, TaskDataVerifier)
Append a TaskDataVerifier onto the list of verifiers.
 o dataOK(String, int, Object, ResultListener)
Call a specific TaskDataVerifier that has been added via TaskContext.appendTaskDataVerifier() or TaskContext.insertTaskDataVerifier().
 o dataOK(String[], int, Object, ResultListener)
Invoke a sequence of TaskDataVerifiers that have been added via TaskContext.appendTaskDataVerifier() or TaskContext.insertTaskDataVerifier().
 o dataOK(Vector, int, Object, ResultListener)
Invoke a sequence of TaskDataVerifiers.
 o getServerName()
Get the name of the server associated with this TaskContext.
 o getTask()
Get the Task that is associated with this TaskContext.
 o getTaskControlPanel()
Get the TaskControlPanel associated with this TaskContext.
 o getTaskData()
Get the TaskData object created for the TaskContext.
 o getTitleString()
Get the string to be used as the Task title when the Form interface is displayed.
 o insertTaskDataVerifier(String, String, TaskDataVerifier)
Insert a TaskDataVerifier into the list of verifiers.
 o removeTaskDataVerifier(String)
Remove a TaskDataVerifier from the list of verifiers.
 o removeTitleListener(TitleListener)
Remove a listener from the list of those interested in changes to the Task title.
 o setTaskTitle(String)
Set the title of the Task.
 o setTitleString(String)
Set the string to be used as the Task title.

Variables

 o ALL_DATA_VERIFIER
 public static final String ALL_DATA_VERIFIER
When the user presses the OK button, the Task will call TaskContext.allDataOK(TaskDataVerifiers.MUST_BE_SET). If a verifier named TaskContext.ALL_DATA_VERIFIER has been added, that verifier will be called to determine if the TaskData is valid. Otherwise each TaskDataVerifier that has been added will be called in order.

Methods

 o getTask
 public Task getTask()
Get the Task that is associated with this TaskContext.

Returns:
the Task associated with this context, null if TaskContext().setTask() has not been called yet.
 o getTaskData
 public TaskData getTaskData()
Get the TaskData object created for the TaskContext. There will be no TaskData attributes until TaskContext.setTask() has been called.

Returns:
The TaskData object created for this TaskContext.
 o getTaskControlPanel
 public TaskControlPanel getTaskControlPanel()
Get the TaskControlPanel associated with this TaskContext.

Returns:
The TaskControlPanel associated with this context, null if TaskContext.setTask() has not been called yet.
 o getServerName
 public String getServerName()
Get the name of the server associated with this TaskContext. This is a convenience routine and returns the same value as found in the HostContext for this Task.

Returns:
Name of the server associate with this TaskContext.
See Also:
HostContext
 o setTitleString
 public void setTitleString(String titleString)
Set the string to be used as the Task title. This will be the exact title string when the Form interface is displayed. When the Guide interface is displayed, additional information about the current page number and total number of pages in the guide will be appended to the title. If this method is not called by the Task subclass, then the title will be formed using the property Task.TITLE_FORMAT, which includes the hostname and Task.shortName.

Parameters:
titleString - The string to be used as the Task title.
 o getTitleString
 public String getTitleString()
Get the string to be used as the Task title when the Form interface is displayed.

Returns:
The String to be used as the Form title.
 o addTitleListener
 public void addTitleListener(TitleListener listener)
Add a listener to the list of those interested in changes to the Task title. The listener will be notified immediately if the Task title has already been set.

Parameters:
listener - The TitleListener interested in changes to the Task title.
 o removeTitleListener
 public void removeTitleListener(TitleListener listener)
Remove a listener from the list of those interested in changes to the Task title.

Parameters:
listener - The TitleListener no longer interested in changes to the Task title.
 o setTaskTitle
 public void setTaskTitle(String taskTitle)
Set the title of the Task. Notifies all TaskTitleListeners.

Parameters:
taskTitle - Localized Task title.
 o appendTaskDataVerifier
 public void appendTaskDataVerifier(String verifierName,
                                    TaskDataVerifier verifier)
Append a TaskDataVerifier onto the list of verifiers.

Parameters:
verifierName - The name that will be used to refer to the added verifier, usually the name of the TaskData attribute being verified or TaskContext.ALL_DATA_VERIFIER.
verifier - The verifier to add.
 o insertTaskDataVerifier
 public void insertTaskDataVerifier(String previousName,
                                    String verifierName,
                                    TaskDataVerifier verifier)
Insert a TaskDataVerifier into the list of verifiers.

Parameters:
previousName - The name of the verifier after which the new verifier should be inserted. Set to null if you want the new verifier to be first on the list.
verifierName - The name that will be used to refer to the inserted verifier, usually the name of the TaskData attribute being verified or TaskContext.ALL_DATA_VERIFIER.
verifier - The verifier to insert.
 o removeTaskDataVerifier
 public void removeTaskDataVerifier(String verifierName)
Remove a TaskDataVerifier from the list of verifiers.

Parameters:
verifierName - The name of the verifier to remove.
 o dataOK
 public void dataOK(String verifierName,
                    int browseFlag,
                    Object context,
                    ResultListener listener)
Call a specific TaskDataVerifier that has been added via TaskContext.appendTaskDataVerifier() or TaskContext.insertTaskDataVerifier().

Parameters:
verifierName - The name of the verifier to call.
browseFlag - TaskDataVerifier.MAY_BE_EMPTY if null strings or zero values are valid, TaskDataVerifier.MUST_BE_SET if a valid value must be entered.
context - An object the verifier can use to behave differently in different contexts.
listener - A ResultListener to be notified when the verification succeeds or fails.
 o dataOK
 public void dataOK(String verifierList[],
                    int browseFlag,
                    Object context,
                    ResultListener listener)
Invoke a sequence of TaskDataVerifiers that have been added via TaskContext.appendTaskDataVerifier() or TaskContext.insertTaskDataVerifier(). The dataOK() method of each verifier will be called in turn. If a verifier fails, listener.failed() will be called and no additional verifiers will be invoked. If all of the verifiers succeed, then listener.succeeded() will be called.

Parameters:
verifierList - An non-null array of verifier names to call, in order. The names refer to verifiers that have been added via TaskContext.appendTaskDataVerifier() or TaskContext.insertTaskDataVerifier().
browseFlag - TaskDataVerifier.MAY_BE_EMPTY if null strings or zero values are valid, TaskDataVerifier.MUST_BE_SET if a valid value must be entered.
context - An object the verifiers can use to behave differently in different contexts.
listener - A ResultListener to be notified when the verification succeeds or fails.
 o dataOK
 public void dataOK(Vector verifierList,
                    int browseFlag,
                    Object context,
                    ResultListener listener)
Invoke a sequence of TaskDataVerifiers. The dataOK() method of each verifier will be called in turn. If a verifier fails, listener.failed() will be called and no additional verifiers will be invoked. If all of the verifiers succeed, then listener.succeeded() will be called.

Parameters:
verifierList - A non-null Vector of verifiers to call, in order.
browseFlag - TaskDataVerifier.MAY_BE_EMPTY if null strings or zero values are valid, TaskDataVerifier.MUST_BE_SET if a valid value must be entered.
context - An object the verifiers can use to behave differently in different contexts.
listener - A ResultListener to be notified when the verification succeeds or fails.
 o allDataOK
 public void allDataOK(int browseFlag,
                       Object context,
                       ResultListener listener)
Verify that all TaskData is valid. If a verifier named TaskContext.ALL_DATA_VERIFIER has been added, then that verifier will be used to verify TaskData. Otherwise all TaskDataVerifiers that have been added via TaskContext.appendTaskDataVerifier() or TaskContext.insertTaskDataVerifier() will be called, in order, to verify TaskData.

Parameters:
browseFlag - TaskDataVerifier.MAY_BE_EMPTY if null strings or zero values are valid, TaskDataVerifier.MUST_BE_SET if a valid value must be entered.
context - An object the verifiers can use to behave differently in different contexts.
listener - A ResultListener to be notified when the verification succeeds or fails.

All Packages  Class Hierarchy  This Package  Previous  Next  Index