|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.actionprovider.HttpAction
public class HttpAction
The HttpAction class is the base class for all actions acquired from the HttpActionProvider.
A basic understanding of the ActionProvider Framework, of which this class is a part, is recommended before attempting to use this class.
For general information on the ActionProvider Framework, including an overview of how
the primary classes of the framework work together, refer to the
package documentation.
com.sas.actionprovider
For examples demonstrating how to use the ActionProvider Framework, including how to override default Actions or add new custom Actions, refer to the Samples Site.
Actions are objects that encapsulate everything needed to:
actionType
attribute. Typically, a Command object associated with the Action contains the logic for actually performing the operation.
When multiple Actions of the same actionType ( e.g. a DRILL_DOWN_ACTION in an OLAPTableView ) appear in different areas of a Component, they all share the same Command instance. This is possible because the APF can apply certain Action attributes to the command during the command execution phase. Often these attributes are specific area-dependent values such as a row and/or column index.
Action attributes that are applied to the command are COMMAND-type attributes
that are designated as such via a property of the AttributeDescriptorInterface
that is
associated with the attribute.
There are 5 properties of the AttributeDescriptorInterface
that are pertinent in the APF:
The visible property is a standard, not supplemental, property and is accessed differently than the others:
action.getAttributeDescriptor("someAttributeName").setVisible(false);
boolean visible = action.getAttributeDescriptor("someAttributeName").isVisible();
Refer to the individually documented fields of the supplemental properties for examples demonstrating their accessibility methods. The fields also document the default values for these properties which may vary according to the type of attribute.
Visit the AppDev Studio Developer's Site to access step-by-step examples, white papers and additional usage information at http://support.sas.com/rnd/appdev/.
Note: A snapshot of the AppDev Studio Developers Site is installed on your local Web server when you install AppDev Studio. To access the site from webAF, select Help -> Developer Site .
HttpActionProvider
Field Summary |
---|
Fields inherited from interface com.sas.swing.util.Action |
---|
ALIGNMENT_CENTER, ALIGNMENT_LEADING, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, ALIGNMENT_TRAILING, ALTERNATE_TEXT, COMMAND_CLASS, DISABLED_IMAGE_KEY, GROUP_NAME, IMAGE_KEY, LABEL, LARGE_DISABLED_ICON, LARGE_DISABLED_ICON_NAME, LARGE_ICON, LARGE_ICON_NAME, LONG_DISABLED_DESCRIPTION, LONG_NAME, MNEMONIC_INDEX, ROLLOVER_ICON_NAME, ROLLOVER_IMAGE_KEY, SHORT_DISABLED_DESCRIPTION, SMALL_DISABLED_ICON, SMALL_DISABLED_ICON_NAME, SMALL_ICON_NAME, STYLE_MAP, TARGET, TEXT_ALIGNMENT, TYPE, TYPE_BOOLEAN, TYPE_NORMAL, URL |
Fields inherited from interface com.sas.actionprovider.ActionStatusKeysInterface |
---|
AREA_DISABLED, DISABLED, ENABLED, IS_CURRENT_STATE_DISABLED, MODEL_MEMBER_DISABLED, MODEL_STATE_DISABLED, MODEL_TYPE_DISABLED, UNSUPPORTED, VIEWER_DISABLED |
Fields inherited from interface com.sas.actionprovider.SupplementalPropertyKeysInterface |
---|
COMMAND, CUSTOM, DYNAMIC, ENCODE, EXTERNAL |
Constructor Summary | |
---|---|
HttpAction()
Default constructor |
|
HttpAction(DynamicAttributeCommandInterface command)
Command Constructor |
Method Summary | |
---|---|
java.lang.String |
getCmdId()
Returns the CMDID that uniquely identifies and references the command
and, if applicable, its set of stored attributes on the HttpActionProvider. |
java.lang.String |
getURLBase()
Returns the base of this Action's URL. |
com.sas.util.SimpleTemplate |
getURLTemplate()
Returns the URLTemplate used in generating the action's URL. |
boolean |
isEscapeDynamicAttributeValues()
Returns the boolean indicating whether the following characters in this action's dynamic attribute values need to be escaped when converted to url query string parameters. |
boolean |
isExternal()
Returns the boolean indicating whether the HttpActionProvider that generates this Action will also be responsible for executing the Action's command. |
boolean |
isLink()
Returning the boolean indicating whether this Action is expected to have its URL attribute set. |
void |
setCmdId(java.lang.String cmdId)
Sets the CMDID that uniquely identifies and references the command
and, if applicable, its set of stored attributes on the HttpActionProvider. |
void |
setEscapedDynamicAttributeValues(boolean escape)
Sets the boolean indicating whether the following characters in this action's dynamic attribute values need to be escaped when converted to url query string parameters. |
void |
setExternal(boolean external)
Sets the boolean indicating whether the HttpActionProvider that generates this Action will also be responsible for executing the Action's command. |
void |
setLink(boolean link)
Sets the boolean indicating whether this Action is expected to have its URL attribute set. |
void |
setURLBase(java.lang.String URLBase)
Sets the base of this Action's URL. |
void |
setURLTemplate(com.sas.util.SimpleTemplate URLTemplate)
Sets the URLTemplate that may be used to generate this Action's URL attribute. |
Methods inherited from class com.sas.actionprovider.BaseAction |
---|
actionPerformed, addPropertyChangeListener, applyCommandAttributes, clone, executeCommand, fireEvent, getActionStrategy, getActionType, getAttributeDescriptor, getAttributeDescriptors, getCommand, getReturnStatus, getValue, isCustom, performAction, putValue, removePropertyChangeListener, setActionStrategy, setActionType, setAttribute, setCommand, setCustom, setReturnStatus |
Methods inherited from class com.sas.entities.BaseEntity |
---|
containsAttributeNamed, equals, equals, getAttribute, getAttribute, getAttributeCount, getAttributes, getEntityKey, getPropertyDescriptors, getStringAttribute, listAttributeNames, removeAllAttributes, sameEntity, setAttribute, setAttributes, setEntityKey, toString |
Constructor Detail |
---|
public HttpAction()
public HttpAction(DynamicAttributeCommandInterface command)
command
- The command that contains to the logic to perform this action.Method Detail |
---|
public boolean isExternal()
Default value is false.
setExternal(boolean)
public void setExternal(boolean external)
external
- The Action's external attribute value.isExternal()
public java.lang.String getCmdId()
CMDID
that uniquely identifies and references the command
and, if applicable, its set of stored attributes on the HttpActionProvider.
Set by the HttpActionProvider.
setCmdId(java.lang.String)
,
HttpActionProvider.CMDID
public void setCmdId(java.lang.String cmdId)
CMDID
that uniquely identifies and references the command
and, if applicable, its set of stored attributes on the HttpActionProvider.
Set by the HttpActionProvider.
the
- Action's cmdId.getCmdId()
,
HttpActionProvider.CMDID
public com.sas.util.SimpleTemplate getURLTemplate()
setURLTemplate(com.sas.util.SimpleTemplate)
public void setURLTemplate(com.sas.util.SimpleTemplate URLTemplate)
Sets the URLTemplate that may be used to generate this Action's URL attribute.
URL generation is influenced by a number of factors. Here is a list of all such factors in order of decreasing precedence.
URLTemplateViewInterface
To have a URL that calls a javascript function of the form:
"function functionName(cmdId,actionProviderName,dynamicAttributes)"
You would have a template with the following pattern:
"javascript: void(functionName('%CMDID','%APNAME','%DYNAMICATTRS'));"
The resulting URL would look like this:
"javascript: void(functionName('54','AP1','AP1_foo=0&AP1_bar=13'));"
HttpActionProvider.CMDID
,
HttpActionProvider.APNAME
and
HttpActionProvider.DYNAMICATTRS
are reserved keys
that the URL generation routines look for in the template's pattern. CMDID and APNAME will be substituted with
the value of the Action's cmdId attribute and the name of the ActionProvider, respectively.
If DYNAMICATTRS is found in the template, then that key will be substituted with a concatenated String consisting of all the name/value pairs of all the Action's remaining visible, instance-based attributes.
The URL generation routines will also attempt to match other pattern keys to all ( even type-based ) Action attributes. If a match occurs, then the method substitutes that attribute's value for that key.
If the Action attribute is a visible instance-based attribute, then the template should also include the PARMPREFIX reserved key because the javascript routine will need to prepend the attribute name with this prefix when submitting it on the request.
Visible instance-based attributes that have specific matches in the template are not included in the concatenated String of DYNAMICATTRS.
For example, the following template pattern:
"javascript: void(functionName('%CMDID','%APNAME','%foo', %DYNAMICATTRS'));"
would result in the following:
href="javascript: void(functionName('54','AP1','0','AP1_bar=13'));"
Templates containing "javascript:" may causes certain side effects. See setEscapedDynamicAttributeValues().
URLTemplate
- The template to use in generating the action's URL.getURLTemplate()
,
setEscapedDynamicAttributeValues(boolean)
,
setURLBase(java.lang.String)
,
setURLTemplate(com.sas.util.SimpleTemplate)
,
URLTemplateViewInterface.setURLTemplate(com.sas.util.SimpleTemplate)
,
HttpActionProvider.setControllerURL(java.lang.String)
,
HttpActionProviderViewInterface.setRequest(javax.servlet.http.HttpServletRequest)
public java.lang.String getURLBase()
setURLBase(java.lang.String)
public void setURLBase(java.lang.String URLBase)
This value takes precedence over any of the other factor that influences the generation of this Action's URL. The following is a list of those other factors in order of decreasing precedence.
URLTemplateViewInterface
URLBase
- The base of this Action's URL.getURLBase()
,
setURLBase(java.lang.String)
,
setURLTemplate(com.sas.util.SimpleTemplate)
,
URLTemplateViewInterface.setURLTemplate(com.sas.util.SimpleTemplate)
,
HttpActionProvider.setControllerURL(java.lang.String)
,
HttpActionProviderViewInterface.setRequest(javax.servlet.http.HttpServletRequest)
public boolean isLink()
Used for Actions that are needed to display some label or image but are not meant to provide any interactive capability.
setLink(boolean)
public void setLink(boolean link)
Used for Actions that are needed to display some label or image but are not meant to provide any interactive capability.
The default value of this attribute is true.
link
- The boolean indicating whether this Action is expected to have
its URL attribute set.isLink()
public boolean isEscapeDynamicAttributeValues()
Typically, escaping these characters is not needed as all values are encoded which sufficiently eliminates any parsing problems for the client.
However, when the attribute value is passed as part of an argument to a javascript call that is associated with an html tag's "href" attribute, the values are un-encoded prior to that javascript call being made and, consequently, can cause problems with mismatched quotes.
The default for this attribute is false, but it automatically gets set to true if the URLTemplate attribute is set with a pattern containing "javascript:".
setEscapedDynamicAttributeValues(boolean)
public void setEscapedDynamicAttributeValues(boolean escape)
Typically, escaping these characters is not needed as all values are encoded which sufficiently eliminates any parsing problems for the client.
However, when the attribute value is passed as part of an argument to a javascript call that is associated with an html tag's "href" attribute, the values are un-encoded prior to that javascript call being made and, consequently, can cause problems with mismatched quotes.
The default for this attribute is false, but it automatically gets set to true if the URLTemplate attribute is set with a pattern containing "javascript:".
escape
- the boolean indicating whether embedded backslashes, single quotes and
double quotes in this action's dynamic attribute values need to be escaped when
converted to url query string parameters.isEscapeDynamicAttributeValues()
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |