|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.clients.util.TaskDelegate
Class TaskDelegate
is a utility which supports launching create,
update, view and delete tasks associated with a particular business object.
The TaskDelegate
class is intended to be subclassed to provide
TaskDelegates
for various business objects. By having subclasses
of this class follow a naming convention, a user of the task delegates can
launch the tasks associated with a particular business object without knowing
the specific type of the business object.
For example, the WindchillExplorerFrame
uses the
TaskDelegate
to launch the create, view and update tasks of objects
that live in a folder.
The TaskDelegateFactory
is used in conjunction with this class to
generate an instance of a TaskDelegate
on which the various
tasks can be launched:
public class MyDisplay extends Frame { ... public void handleViewEvent( Event evt ) { Object obj_to_view = evt.getSource(); TaskDelegate delegate = TaskDelegateFactory.instantiateTaskDelegate( obj_to_view ); if( delegate != null ) { delegate.setParentApplet( getParentApplet() ); delegate.setParentFrame( this ); delegate.setObject( obj_to_view ); try { delegate.launchViewTask(); } catch (TaskDelegateException tde) { // Handle Exception } } ... }
Supported API: true
Extendable: false
Field Summary | |
static String |
ACTION_KEY
|
static String |
OBJ_PROPS_ACTION
|
protected Object |
object
|
protected WTReference |
objReference
|
static String |
OID_KEY
|
protected Applet |
parentApplet
|
protected Folder |
parentFolder
|
protected Frame |
parentFrame
|
private static String |
RESOURCES
|
static String |
URL_TEMPLATE_ACTION
|
static String |
URLPROCESSOR_CLASS
|
Constructor Summary | |
TaskDelegate()
|
Method Summary | |
protected boolean |
confirmAction(String message)
Launches a dialog prompting the user to confirm an action. |
protected void |
deleteObject()
|
void |
displayPropertiesPage()
Displays the HTML object properties page for the context object. |
Object |
getObject()
Returns the Object which is used as the target of the view,
update, and delete tasks. |
Applet |
getParentApplet()
Returns the parent Applet . |
Folder |
getParentFolder()
Returns the parent Folder of this delegate. |
Frame |
getParentFrame()
Returns the parent Frame of this delegate. |
void |
launchCreateTask()
Method launchCreateTask is invoked to launch the task to create
a particular business object. |
void |
launchDeleteTask()
Method launchDeleteTask is invoked to launch the task to delete
a particular business object. |
void |
launchSaveAsTask()
Method launchSaveAsTask is invoked to launch the task to create
a particular business object from an existing one. |
void |
launchUpdateTask()
Method launchUpdateTask is invoked to launch the task to update
a particular business object. |
void |
launchViewDistributionListTask()
Method launchViewDistributionListTask is invoked to launch the task to view
a particular business object. |
void |
launchViewTask()
Method launchViewTask is invoked to launch the task to view
a particular business object. |
void |
setObject(Object obj)
Sets the object to be used as the target of the view, update, and delete tasks. |
void |
setObjectReference(WTReference reference)
Sets the WTReference which corresponds to the object to be used as the target of the view, update and delete tasks. |
void |
setParentApplet(Applet applet)
Sets the parent Applet of this delegate. |
void |
setParentFolder(Folder folder)
Sets the parent Folder . |
void |
setParentFrame(Frame frame)
Sets the parent Frame of this delegate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Applet parentApplet
protected Frame parentFrame
protected Folder parentFolder
protected Object object
protected WTReference objReference
private static final String RESOURCES
public static String OID_KEY
public static String ACTION_KEY
public static String OBJ_PROPS_ACTION
public static String URLPROCESSOR_CLASS
public static String URL_TEMPLATE_ACTION
Constructor Detail |
public TaskDelegate()
Method Detail |
public void setParentApplet(Applet applet)
Applet
of this delegate. The applet instance
is often used by client applications to retrieve the appropriate
WTContext
for that client.
applet
- the Applet
to set as the parent
Applet
getParentApplet()
,
WTContext
public Applet getParentApplet()
Applet
.
Applet
of this delegatesetParentApplet(java.applet.Applet)
public void setParentFrame(Frame frame)
Frame
of this delegate. The parent frame
is provided to support tasks which involve launching dialogs. The
parent frame can be used to parent those dialogs.
frame
- the parent Frame
of this delegategetParentFrame()
public Frame getParentFrame()
Frame
of this delegate. If no
parent frame has been explicitly set, this method attempts to
retrieve a Frame
from the parent Applet
if that has been set.
Frame
of this delegatesetParentApplet(java.applet.Applet)
,
setParentFrame(java.awt.Frame)
public void setParentFolder(Folder folder)
Folder
. Setting the parent folder is
useful when the business object associated with this delegate is
Foldered
. For example, by invoking
setParentFolder
, the Folder
in which to
create a new Foldered
object can be initialized:
Folder folder = getSelectedFolder(); if( folder != null ) { delegate.setParentFolder( folder ); } try { delegate.launchCreateTask(); } catch (TaskDelegateException tde ) { ... }
folder
- the Folder
to be set as the parent foldergetParentFolder()
,
Folder
public Folder getParentFolder()
Folder
of this delegate.
Folder
of this delegatesetParentFolder(wt.folder.Folder)
,
Folder
public void setObject(Object obj)
obj
- the Object
which is used in launching the view,
update, and delete tasksgetObject()
,
launchViewTask()
,
launchUpdateTask()
,
launchDeleteTask()
public Object getObject()
Object
which is used as the target of the view,
update, and delete tasks. If the object associated with this task has
not been explicitly set, but has been set by an object reference, this
method will retrieve the object from the object reference and return that
object.
Object
which is used in launching the view,
update, and delete tasksgetObject()
,
launchViewTask()
,
launchUpdateTask()
,
launchDeleteTask()
,
WTReference
public void setObjectReference(WTReference reference)
reference
- the WTReference which is a reference to the objectWTReference
public void launchCreateTask() throws TaskDelegateException
launchCreateTask
is invoked to launch the task to create
a particular business object. Subclasses of this TaskDelegate
class should implement the create task to support creating instances of the
business object they represent. Since this TaskDelegate
class
is intented to be subclassed, this method provides no implementation. It
method should be implemented to throw an exception when invoked, but simply
does nothing.
TaskDelegateException
- if an error occurs launching a create taskpublic void launchSaveAsTask() throws TaskDelegateException
launchSaveAsTask
is invoked to launch the task to create
a particular business object from an existing one. Subclasses of this
TaskDelegate
class should implement the saveas task to support
creating instances of the business object they represent. Since this
TaskDelegate
class is intented to be subclassed, this method
provides no implementation. It method should be implemented to throw an
exception when invoked, but simply does nothing.
TaskDelegateException
- if an error occurs launching a create taskpublic void launchViewTask() throws ObjectNoLongerExistsException, NotAuthorizedException, TaskDelegateException, WTException
launchViewTask
is invoked to launch the task to view
a particular business object. Subclasses of this TaskDelegate
class should implement the view task to support viewing instances of the
business object they represent. The particular object to be viewed is
specified via setObject
. This method currently only contains
the code to refresh the object to be viewed.
ObjectNoLongerExistsException
- if the object no longer exists in the
database
NotAuthorizedException
- if the current user does not have
permission to view the object
TaskDelegateException
- if an error occurs launching a view
task
WTException
- if an error occurs preparing the object
for viewingsetObject(java.lang.Object)
public void launchUpdateTask() throws ModificationNotAllowedException, ObjectNoLongerExistsException, NotAuthorizedException, TaskDelegateException, WTException
launchUpdateTask
is invoked to launch the task to update
a particular business object. Subclasses of this TaskDelegate
class should implement the update task to support updating instances of the
business object they represent. The particular business object to be updated
is specified via setObject
. The implementation of this method
prepares the given object for modification. Subclasses of this delegate
class can invoke super.launchUpdateTask()
in their implementations
of this method to prepare the given object for modification.
ModificationNotAllowedException
- if the current user has permission to
view but not modify the object
ObjectNoLongerExistsException
- if the object no longer exists in the
database
NotAuthorizedException
- if the current user does not have
permission to modify nor view the object
TaskDelegateException
- if an error occurs launching a update
task
WTException
- if an error occurs preparing the object
for modificationpublic void launchDeleteTask() throws TaskDelegateException, WTException
launchDeleteTask
is invoked to launch the task to delete
a particular business object. Subclasses of this TaskDelegate
class should implement the delete task to support deleting instances of the
business object they represent. The particular object to be deleted is
specified via setObject
. This method will delete the object
and then dispatch a RefreshEvent
which broadcasts to
RefreshListeners
that the object was deleted.
TaskDelegateException
- if an error occurs deleting the object
WTException
RefreshEvent
,
RefreshListener
public void launchViewDistributionListTask() throws ObjectNoLongerExistsException, NotAuthorizedException, TaskDelegateException, WTException
launchViewDistributionListTask
is invoked to launch the task to view
a particular business object. Subclasses of this TaskDelegate
class should implement the view task to support viewing instances of the
business object they represent. The particular object to be viewed is
specified via setObject
. This method currently only contains
the code to refresh the object to be viewed.
ObjectNoLongerExistsException
- if the object no longer exists in the
database
NotAuthorizedException
- if the current user does not have
permission to view the object
TaskDelegateException
- if an error occurs launching a view
task
WTException
- if an error occurs preparing the object
for viewingsetObject(java.lang.Object)
protected boolean confirmAction(String message) throws TaskDelegateException
message
- the String
message asking the user
to confirm some action
TaskDelegateException
- thrown if no Frame is found to support the dialogprotected void deleteObject() throws WTException
WTException
public void displayPropertiesPage() throws ObjectNoLongerExistsException, NotAuthorizedException, TaskDelegateException, WTException
ObjectNoLongerExistsException
- if the context object has been
deleted
NotAuthorizedException
- if the current user is not authorized
to view the object
TaskDelegateException
- if an error occurs displaying the
properties page for the object
WTException
- if an error occurs displaying the properties page
for the object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |