com.esri.adf.web.data.tasks
Class TaskActionDescriptor

java.lang.Object
  extended by java.beans.FeatureDescriptor
      extended by com.esri.adf.web.data.tasks.ButtonDescriptor
          extended by com.esri.adf.web.data.tasks.TaskActionDescriptor
All Implemented Interfaces:
TaskActionDescriptorModel, Serializable

public class TaskActionDescriptor
extends ButtonDescriptor
implements TaskActionDescriptorModel

The TaskActionDescriptor class provides metadata for the task actions.

Action methods are of 2 types - those that take no arguments and those that take TaskEvent as its argument. The latter is the more frequently used approach since it gives access to useful ADF objects.

This is the out of box implementation of the TaskActionDescriptorModel interface and supports the rendering of action buttons as text-only buttons, image-only buttons and image-and-text buttons.

See Also:
Serialized Form

Field Summary
static int ACTION_LISTENER_METHOD
          The action method type that takes TaskEvent as its argument
static int ACTION_METHOD
          The action method type that takes no arguments
protected  Method actionMethod
          The method that processes this action.
protected  int actionType
          The action method type.
 
Fields inherited from class com.esri.adf.web.data.tasks.ButtonDescriptor
defaultImage, disabled, disabledImage, hoverImage, IMAGE_RENDERER_TYPE, IMAGEANDTEXT_RENDERER_TYPE, justBeenDisabled, rendererType, selectedImage, showLoadingImage, style, styleClass, TEXT_RENDERER_TYPE, toolTip, VALIDATE_ALL_PARAMS, VALIDATE_NONE_PARAMS
 
Constructor Summary
TaskActionDescriptor(Class taskClass, String actionMethodName, String displayName)
           Creates a TaskActionDescriptor for the given actionMethodName with a text button renderer.
TaskActionDescriptor(Method actionMethod)
           Creates a TaskActionDescriptor for the given actionMethod with a text button renderer.
 
Method Summary
 Element generateXML(Object task)
           Generates the XML content for this action.
 Method getActionMethod()
          Returns the method that processes the action
 int getActionType()
          Returns the action method type.
 String getName()
           Returns the name of the action method.
 Object processAction(Object task, TaskEvent event)
          Calls the action method on the specified task by passing it the TaskEvent object.
 String toString()
           
 
Methods inherited from class com.esri.adf.web.data.tasks.ButtonDescriptor
generateButtonXML, getDefaultImage, getDisabledImage, getHoverImage, getParamsToValidate, getRendererType, getSelectedImage, getStyle, getStyleClass, getToolTip, isDisabled, isShowLoadingImage, setDefaultImage, setDisabled, setDisabledImage, setHoverImage, setParamsToValidate, setRendererType, setSelectedImage, setShowLoadingImage, setStyle, setStyleClass, setToolTip
 
Methods inherited from class java.beans.FeatureDescriptor
attributeNames, getDisplayName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.esri.adf.web.data.tasks.TaskActionDescriptorModel
getDisplayName, getRendererType, isHidden
 

Field Detail

ACTION_METHOD

public static final int ACTION_METHOD
The action method type that takes no arguments

See Also:
Constant Field Values

ACTION_LISTENER_METHOD

public static final int ACTION_LISTENER_METHOD
The action method type that takes TaskEvent as its argument

See Also:
Constant Field Values

actionMethod

protected transient Method actionMethod
The method that processes this action. Action methods are of 2 types - those that take no arguments and those that take TaskEvent as its argument. The latter is the more frequently used approach since it gives access to useful ADF objects.


actionType

protected int actionType
The action method type. ACTION_METHOD and ACTION_LISTENER_METHOD are the 2 possible action types. The latter is the more frequently used approach since it gives access to useful ADF objects.

Constructor Detail

TaskActionDescriptor

public TaskActionDescriptor(Class taskClass,
                            String actionMethodName,
                            String displayName)

Creates a TaskActionDescriptor for the given actionMethodName with a text button renderer.

If the action method does not take any argument it is deemed to be of type ACTION_METHOD, otherwise it is of type ACTION_LISTENER_METHOD.

Parameters:
taskClass - the task Class
actionMethodName - the name of the action method
displayName - the display text for the action button

TaskActionDescriptor

public TaskActionDescriptor(Method actionMethod)

Creates a TaskActionDescriptor for the given actionMethod with a text button renderer.

If the action method does not take any argument it is deemed to be of type ACTION_METHOD, otherwise it is of type ACTION_LISTENER_METHOD.

Parameters:
actionMethod - the method that processes the action
Method Detail

getName

public String getName()
Description copied from interface: TaskActionDescriptorModel

Returns the name of the action method.

Note that action methods take TaskEvent as its argument.

Specified by:
getName in interface TaskActionDescriptorModel
Overrides:
getName in class FeatureDescriptor
Returns:
the name of the action method

getActionMethod

public Method getActionMethod()
Returns the method that processes the action

Returns:
the method that processes the action

getActionType

public int getActionType()
Returns the action method type. ACTION_METHOD and ACTION_LISTENER_METHOD are the 2 possible action types. The latter is the more frequently used approach since it gives access to useful ADF objects.

Returns:
the action method type

processAction

public Object processAction(Object task,
                            TaskEvent event)
Description copied from interface: TaskActionDescriptorModel
Calls the action method on the specified task by passing it the TaskEvent object.

Specified by:
processAction in interface TaskActionDescriptorModel
Parameters:
task - the task object on which the action method will be invoked
event - the TaskEvent method which will be passed as an argument to the action method
Returns:
the value returned by the action method

generateXML

public Element generateXML(Object task)
Description copied from interface: TaskActionDescriptorModel

Generates the XML content for this action. This XML is then transformed by the XSL used by the task control to generate the appropriate markup.

Note that if you implement this method and generate custom XML, you'll also need to provide the XSL that transforms this XML into the appropriate markup. The XSL file that the task control should use can be specified by using the xslFile attribute of the task tag.

Specified by:
generateXML in interface TaskActionDescriptorModel
Parameters:
task - the task object
Returns:
the generated XML Element

toString

public String toString()
Overrides:
toString in class Object