com.sas.actionprovider.strategies
Class BaseActionStrategy

com.sas.actionprovider.strategies.BaseActionStrategy
All Implemented Interfaces:
ActionStatusKeysInterface, ActionStrategyInterface
Direct Known Subclasses:
BaseMapStrategy, BaseOLAPStrategy, BaseRelationalStrategy, BaseRemoteFileStrategy, MapResizeStrategy

public abstract class BaseActionStrategy
implements ActionStrategyInterface, ActionStatusKeysInterface

This class is the base class for all ActionStrategy classes used in the ActionProviderFramework.

ActionStrategy objects may do one or all of the following tasks for the Action object to which they are associated.


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 .

Since:
3.1.3
See Also:
BaseAction.setActionStrategy(com.sas.actionprovider.strategies.ActionStrategyInterface)

Field Summary
protected static java.lang.String TEMPLATE_DELIMITER
          Default marker for tokenizing template patterns in Action attribute values.
 
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
 
Constructor Summary
BaseActionStrategy()
           Default Constructor Calls the Utility Object Constructor with null parameter.
BaseActionStrategy(boolean swing, java.lang.Object utilObject)
           Utility Object Constructor Calls the setUtilObject(java.lang.Object) method Calls the setSwing(boolean) method Calls the initialize() method
 
Method Summary
protected  void addDynamicValueInfo(java.lang.String valueName, java.lang.String methodName, java.lang.Object methodObject, java.lang.String filterAlias)
           Register the information for determining a dynamic value.
protected  void addDynamicValueInfo(java.lang.String valueName, java.lang.String methodName, java.lang.Object methodObject, java.lang.String filterAlias, boolean nullValid)
           Register the information for determining a dynamic value.
 int getActionStatus(BaseAction action, ActionSupportFilter filter)
          Returns a status value indicating whether the Action is enabled for a specific area as described by various filter attributes.
protected  java.lang.Object getCustomAttributeValue(java.lang.String attributeName, ActionSupportFilter filter)
          Returns a value for a specific custom attribute.
protected  java.lang.Object getDynamicValue(java.lang.String valueName, ActionSupportFilter filter, java.lang.Object defaultValue)
           Returns the value of a dynamic Action attribute.
protected  java.lang.Object getUtilObject()
           Returns the default utility object on which methods are invoked to determine dynamic attribute values and Action status values.
protected  void initialize()
           Initialize this strategy object.
 void initializeAction(BaseAction action, java.lang.String areaType, java.util.Locale locale)
           Initializes all default settings for an Action.
protected  void initializeActionAttributes(BaseAction action, java.lang.String areaType, java.util.Locale locale)
           Initializes an Action with all its default attributes, default AttributeDescriptor property settings and default values for non-locale-dependent attributes.
protected  boolean isSwing()
          Returns the boolean indicating whether the strategy should function in swing mode or not.
 void setActionAttributes(BaseAction action, ActionSupportFilter filter)
           Sets all the dynamic attributes of the Action.
 void setLocaleDependentDefaultAttributes(BaseAction action, java.lang.String areaType, java.util.Locale locale)
           Sets the Action's default locale dependent attribute values.
protected  void setSwing(boolean swing)
          Set the boolean indicating whether the strategy should function in swing mode or not.
protected  void setUtilObject(java.lang.Object util)
           Sets the default utility object on which to invoke the methods that determine dynamic attribute values and Action status values.
 

Field Detail

TEMPLATE_DELIMITER

protected static java.lang.String TEMPLATE_DELIMITER
Default marker for tokenizing template patterns in Action attribute values.

Constructor Detail

BaseActionStrategy

public BaseActionStrategy()

Default Constructor

Calls the Utility Object Constructor with null parameter.

See Also:
initialize()

BaseActionStrategy

public BaseActionStrategy(boolean swing,
                          java.lang.Object utilObject)

Utility Object Constructor

Calls the setUtilObject(java.lang.Object) method

Calls the setSwing(boolean) method

Calls the initialize() method

Parameters:
swing - boolean indicating whether the strategy is to be used in a Swing environment.
utilObject - The default object used for encapsulating common methods called by the strategy.
See Also:
initialize()
Method Detail

initialize

protected void initialize()

Initialize this strategy object.

This method should be overridden to register the dynamic value information for specific strategies. Registration is accomplished via the addDynamicValueInfo(java.lang.String, java.lang.String, java.lang.Object, java.lang.String) method. the

See Also:
#setReturnStatus

initializeAction

public void initializeAction(BaseAction action,
                             java.lang.String areaType,
                             java.util.Locale locale)

Initializes all default settings for an Action.

This base implementation calls the initializeAction() method followed by the setLocaleDependentDefaultAttributes() method.

Specified by:
initializeAction in interface ActionStrategyInterface
Parameters:
action - The instance of the Action to be initialized.
areaType - The area in which the Action will be used.
locale - The locale

setUtilObject

protected void setUtilObject(java.lang.Object util)

Sets the default utility object on which to invoke the methods that determine dynamic attribute values and Action status values.

Parameters:
util - the utility object

getUtilObject

protected java.lang.Object getUtilObject()

Returns the default utility object on which methods are invoked to determine dynamic attribute values and Action status values.

Returns:
the utility object

setSwing

protected void setSwing(boolean swing)
Set the boolean indicating whether the strategy should function in swing mode or not.

Parameters:
swing - the boolean indicating whether the strategy should function in swing mode or not.

isSwing

protected boolean isSwing()
Returns the boolean indicating whether the strategy should function in swing mode or not.

Returns:
the boolean indicating whether the strategy should function in swing mode or not.

initializeActionAttributes

protected void initializeActionAttributes(BaseAction action,
                                          java.lang.String areaType,
                                          java.util.Locale locale)

Initializes an Action with all its default attributes, default AttributeDescriptor property settings and default values for non-locale-dependent attributes. values.

This base implementation does nothing to the Action.

Parameters:
action - The instance of the Action to be initialized.
areaType - The areaType of the Viewer where the Action will be presented.
locale - The locale

setLocaleDependentDefaultAttributes

public void setLocaleDependentDefaultAttributes(BaseAction action,
                                                java.lang.String areaType,
                                                java.util.Locale locale)

Sets the Action's default locale dependent attribute values.

This base implementation does nothing to the Action.

Specified by:
setLocaleDependentDefaultAttributes in interface ActionStrategyInterface
Parameters:
action - The instance of the Action to be initialized.
locale - The locale
areaType - The areaType of the Viewer where the Action will be presented.

setActionAttributes

public void setActionAttributes(BaseAction action,
                                ActionSupportFilter filter)

Sets all the dynamic attributes of the Action.

Specified by:
setActionAttributes in interface ActionStrategyInterface
Parameters:
action - The Action to set dynamic attribute values on.
filter - The ActionSupportFilter that contains area-specific information relating to where the Action will be used.

getActionStatus

public int getActionStatus(BaseAction action,
                           ActionSupportFilter filter)
Returns a status value indicating whether the Action is enabled for a specific area as described by various filter attributes.

If enabled, the value is: ActionStatusKeysInterface.ENABLED

If disabled, the value may be one of the following values which indicate why the Action is disabled.

The status of an Action with a CommandSupportedInterface command whose isSupported() method returns false will have the ActionStatusKeysInterface.UNSUPPORTED status bit set.

The status of an Action with a CommandStatusInterface command will have the status bit value returned by the command's getCommandStatus() method.

The Action's status may also be set with bit values that are determined by the support class in addition to a command.

Specified by:
getActionStatus in interface ActionStrategyInterface
Parameters:
action - The action for which status is to be determined.
filter - The ActionSupportFilter that encapsulates all information describing the specific area.
Returns:
the boolean indicating whether the Action is enabled
See Also:
CommandSupportedInterface, CommandStatusInterface

getDynamicValue

protected java.lang.Object getDynamicValue(java.lang.String valueName,
                                           ActionSupportFilter filter,
                                           java.lang.Object defaultValue)

Returns the value of a dynamic Action attribute.

This base implementation first looks for a registered com.sas.actionprovider.DynamicValueInfo object for the specified valueName argument. Depending on the contents of the DynamicValueInfo object, the method will return a dynamic value either from the filter or a method call, see com.sas.actionprovider.DynamicValueInfo#setValueMethod, on the DynamicValueInfo's valueObject. See com.sas.actionprovider.DynamicValueInfo#setValueObject.

If a DynamicValueInfo object is not registered for the specified valueName then this implementation returns null.

Parameters:
valueName - The name of the Action attribute.
filter - The ActionSupportFilter that contains area-specific information relating to where the Action will be used.
defaultValue - The current value of this attribute on the default Action.
Returns:
the value of a dynamic Action attribute.
See Also:
com.sas.actionprovider.DynamicValueInfo#setValueObject, com.sas.actionprovider.DynamicValueInfo#setValueMethod, addDynamicValueInfo(java.lang.String, java.lang.String, java.lang.Object, java.lang.String)

addDynamicValueInfo

protected void addDynamicValueInfo(java.lang.String valueName,
                                   java.lang.String methodName,
                                   java.lang.Object methodObject,
                                   java.lang.String filterAlias)

Register the information for determining a dynamic value.

Parameters:
valueName - The name of the dynamic value.
methodName - The name of the method to call on the methodObject when determining this value dynamically. If null, the dynamic value is considered to be available directly from the ActionSupport filter.
methodObject - The Object on which the method will be invoked.
filterAlias - The name of the attribute on the filter.
See Also:
BaseAction.setActionStrategy(com.sas.actionprovider.strategies.ActionStrategyInterface), BaseActionProvider.getDefaultAction(java.lang.String, java.lang.String, java.lang.String)

addDynamicValueInfo

protected void addDynamicValueInfo(java.lang.String valueName,
                                   java.lang.String methodName,
                                   java.lang.Object methodObject,
                                   java.lang.String filterAlias,
                                   boolean nullValid)

Register the information for determining a dynamic value.

Parameters:
valueName - The name of the dynamic value.
methodName - The name of the method to call on the methodObject when determining this value dynamically. If null, the dynamic value is considered to be available directly from the ActionSupport filter.
methodObject - The Object on which the method will be invoked.
filterAlias - The name of the attribute on the filter.
nullValid - If true, dynamic values equal to null will be applied to the Actions.
See Also:
BaseAction.setActionStrategy(com.sas.actionprovider.strategies.ActionStrategyInterface), BaseActionProvider.getDefaultAction(java.lang.String, java.lang.String, java.lang.String)

getCustomAttributeValue

protected java.lang.Object getCustomAttributeValue(java.lang.String attributeName,
                                                   ActionSupportFilter filter)
Returns a value for a specific custom attribute.

If a support class can derive custom attribute values, then it should override this method.

This base implementation always returns null.

Parameters:
attributeName - The name of the custom attribute
filter - The object that encapsulates all the specific query information.
Returns:
a value for a specific custom attribute.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.