com.sas.actionprovider.support
Class BaseActionProviderCompositeSupport

com.sas.actionprovider.support.BaseActionProviderCompositeSupport
Direct Known Subclasses:
BaseHttpActionProviderCompositeSupport, BaseSwingActionProviderCompositeSupport

public abstract class BaseActionProviderCompositeSupport

The BaseActionProviderCompositeSupport class is the base class for all composite support classes of the Action Provider Framework( APF ). Support classes provide the functionality for registering and accessing Actions.

A composite support class is a grouping mechanism for other support classes. It allows a support class developer to group together different support classes to serve the needs of specialized view components. For example:

The HttpRemoteFileSelector Transformation Bean acquires it actions from a composite support class. This HttpRemoteFileSelectorComposite support delegates all requests for actions of table-type areas to the HttpRemoteFileSelectorTableViewSupport.

A basic understanding of the ActionProvider Framework, of which this class is a part, is recommended before attempting to use this class.



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
See Also:
RemoteFileSelector, HttpRemoteFileSelectorCompositeSupport, HttpRemoteFileSelectorTableViewSupport

Field Summary
 
Fields inherited from class com.sas.actionprovider.support.BaseActionProviderSupport
AREA_DISABLED, AREA_VALUE_ATTRKEY, DISABLED, ENABLED, IS_CURRENT_STATE_DISABLED, MODEL_MEMBER_DISABLED, MODEL_STATE_DISABLED, MODEL_TYPE_DISABLED, NON_SPECIFIC_AREA, UNSUPPORTED, VIEWER_DISABLED
 
Constructor Summary
BaseActionProviderCompositeSupport()
          Default Constructor
BaseActionProviderCompositeSupport(java.lang.Class actionClass)
          ActionClass Constructor
 
Method Summary
protected  void addSupport(java.lang.String className)
          Adds a delegate support class to this composite.
protected abstract  void addSupportClassInstances()
          Subclasses should register their sub-support class instances via addSupport in their implementations of this method.
 BaseAction getAction(java.lang.String actionType, ActionSupportFilter actionFilter)
          Returns the Action corresponding to the specified actionType.
 ActionOrderList getActionOrderList(ActionProviderViewInterface viewer, java.lang.String areaType)
          Returns the order list that is used to control the structure and ordering of the ActionList returned by the getActions() method.
 ActionList getActions(ActionSupportFilter actionFilter)
          Returns an ActionList containing all the actions, both default and custom, that are available according to the information provided by the viewer component on the ActionSupportFilter.
protected  java.util.Map getAreaScopeAttributeMap(ActionSupportFilter filter)
          Returns mappings for a pre-defined set of Action attribute keys to their corresponding dynamic values for a specific area.
 BaseAction getDefaultAction(java.lang.String areaType, java.lang.String actionType)
          Return the specific default action registered for a specific areaType.
protected abstract  java.lang.Class getSupportClass(java.lang.String supportClassName)
          Returns the support class associated with the specified class name.
protected  BaseActionProviderSupport getSupportInstance(java.lang.String supportClassName)
          Instantiates and returns the instance of the specified supportClass argument.
 void initialize()
          Initializes all the delegate support classes.
 java.util.Collection listActionTypes(java.lang.String areaType)
          Returns a Collection of String keys that define the valid actionTypes for the specified area of this support class.
 java.util.Collection listAreaTypes()
          Returns a Collection of String keys that define the valid areaTypes for this support class.
 BaseAction newActionInstance(java.lang.String areaType, java.lang.String actionType)
          Returns a new instance of a default actionType.
 void reset()
           
 void setAction(BaseAction action, java.util.Collection viewers, Area area)
          Override a default Action or add a custom action.
 void setActionOrderList(ActionOrderList orderList, ActionProviderViewInterface viewer, java.lang.String areaType)
          Sets the order list that is used to control the structure and ordering of the ActionList returned via the getActions() method.
 void setActionProvider(BaseActionProvider actionProvider)
          Sets the instance of the ActionProvider that is using this support class.
 void setLocale(java.util.Locale loc)
          Initializes the support class.
protected  boolean validArea(Area area, ActionSupportFilter actionFilter)
          Validates that the given Area's value constraints are met by the information provided on the given ActionSupportFilter.
protected  void validateSupport(BaseActionProviderSupport support)
          Validates that the areaTypes defined by specified support class instance are not defined by a support class that has already been added.
 
Methods inherited from class com.sas.actionprovider.support.BaseActionProviderSupport
addDefaultAction, getActionId, getActionProvider, getActionScopeAttribute, getActionScopeAttributeMap, getLocale, listDefaultActions
 

Constructor Detail

BaseActionProviderCompositeSupport

public BaseActionProviderCompositeSupport()
Default Constructor


BaseActionProviderCompositeSupport

public BaseActionProviderCompositeSupport(java.lang.Class actionClass)
ActionClass Constructor

Parameters:
actionClass - The base type of class this support class should create instances of and return for all of its default action types unless overridden on a per-actionType basis.
Method Detail

initialize

public void initialize()
Initializes all the delegate support classes.

Called by the ActionProvider after it sets the locale on this support class.

Specified by:
initialize in class BaseActionProviderSupport
See Also:
setLocale(java.util.Locale)

addSupport

protected void addSupport(java.lang.String className)
Adds a delegate support class to this composite.

Parameters:
className - The name of the delegate support class to add.
Throws:
java.lang.IllegalArgumentException - if className is null.
java.lang.IllegalArgumentException - if support instance cannot be instantiated.

validateSupport

protected void validateSupport(BaseActionProviderSupport support)
Validates that the areaTypes defined by specified support class instance are not defined by a support class that has already been added.

Parameters:
support - The instance of the support class being validated.
Throws:
java.lang.IllegalStateException - if key is already registered to a support class.

validArea

protected boolean validArea(Area area,
                            ActionSupportFilter actionFilter)
Validates that the given Area's value constraints are met by the information provided on the given ActionSupportFilter.

This method's return value is used by the getActions() method to determine whether an Action with an accompanying Area specification should be returned to the requesting viewer.

An Area object is optionally specified during Action registration and may define specific areas, within a more general areaType, for which the Action is to be available.

This Method's implementation ensures that the current area for which actions are being requested, as represented by ActionSupportFilter attributes, match the Area specification associated with an Action.

The method should only return false if none of the Area's values match the current area represented on the filter. If the Area is null or its 'type' is null then the method should return true.

The types of values on the Area object and the determination of what constitutes as a match with ActionSupportFilter attributes varies among different viewers/support class combinations.

Specified by:
validArea in class BaseActionProviderSupport
Parameters:
area - The Area object that may or may not specify certain area 'values'.
actionFilter - the ActionSupportFilter that the component passed as an argument on the getActions() method.
Returns:
a boolean indicating whether the current area represented on the actionFilter matches any of the specified values on the Area object.
See Also:
setAction(com.sas.actionprovider.BaseAction, java.util.Collection, com.sas.actionprovider.Area), getActions(com.sas.actionprovider.ActionSupportFilter)

getSupportInstance

protected BaseActionProviderSupport getSupportInstance(java.lang.String supportClassName)
Instantiates and returns the instance of the specified supportClass argument.

Parameters:
supportClassName - The name of the support Class to be instantiated.
Returns:
an instance of the support associated with the supportType argument.
Throws:
java.lang.IllegalArgumentException - if supportClass is null.
java.lang.IllegalStateException - if instantiation of support class from the support class fails for any reason.

setAction

public void setAction(BaseAction action,
                      java.util.Collection viewers,
                      Area area)
Override a default Action or add a custom action.

Overrides:
setAction in class BaseActionProviderSupport
Parameters:
action - The custom or override action object.
viewers - The collection of viewers to which this Action should be available.
area - The Area object that specifies the area where this action should be available.
Throws:
java.lang.IllegalArgumentException - if any of the arguments are invalid.

setActionOrderList

public void setActionOrderList(ActionOrderList orderList,
                               ActionProviderViewInterface viewer,
                               java.lang.String areaType)
Sets the order list that is used to control the structure and ordering of the ActionList returned via the getActions() method.

Overrides:
setActionOrderList in class BaseActionProviderSupport
Parameters:
orderList - The order list.
viewer - The viewer this order list affects.

If null, the specified orderlist becomes the all-viewer scope orderList for this support class.

areaType - The area this order list affects.
Throws:
java.lang.IllegalArgumentException - if any of the arguments are null or if areaType is not valid.
See Also:
getActionOrderList(com.sas.actionprovider.ActionProviderViewInterface, java.lang.String)

getActionOrderList

public ActionOrderList getActionOrderList(ActionProviderViewInterface viewer,
                                          java.lang.String areaType)
Returns the order list that is used to control the structure and ordering of the ActionList returned by the getActions() method.

Overrides:
getActionOrderList in class BaseActionProviderSupport
Parameters:
viewer - The viewer this order list affects.

If null, the all-viewer scope orderlist for this support class is returned.

If non-null and an orderList has not be registered for the viewer, the all-viewer scope orderList for this support class is returned.

areaType - The area this order list affects.
Returns:
The ActionOrderList that is used to control the structure and ordering of the ActionList returned by the getActions() method.
Throws:
java.lang.IllegalArgumentException - if areaType is not valid.
See Also:
setActionOrderList(com.sas.actionprovider.ActionOrderList, com.sas.actionprovider.ActionProviderViewInterface, java.lang.String)

getActions

public ActionList getActions(ActionSupportFilter actionFilter)
Returns an ActionList containing all the actions, both default and custom, that are available according to the information provided by the viewer component on the ActionSupportFilter.

Overrides:
getActions in class BaseActionProviderSupport
Parameters:
actionFilter - the ActionSupportFilter that the component passed as an argument on the getActions() method.
Returns:
an ActionList containing all the available custom actions. Null if no actions available.
Throws:
java.lang.IllegalArgumentException - if the filter is invalid.

getAction

public BaseAction getAction(java.lang.String actionType,
                            ActionSupportFilter actionFilter)
Returns the Action corresponding to the specified actionType.

Overrides:
getAction in class BaseActionProviderSupport
Parameters:
actionType - the type of action to be returned.
actionFilter - the ActionSupportFilter.
Returns:
an Action containing all the available custom actions. Null if no actions available.
Throws:
java.lang.IllegalArgumentException - if the filter is invalid or actionType is null.

getDefaultAction

public BaseAction getDefaultAction(java.lang.String areaType,
                                   java.lang.String actionType)
Return the specific default action registered for a specific areaType.

Overrides:
getDefaultAction in class BaseActionProviderSupport
Parameters:
areaType - areaType the areaType key which is associated with a defined area.
actionType - The actionType key that is associated with the action to be returned.
Returns:
the default action registered for a specific areaType.
See Also:
BaseActionProviderSupport.listDefaultActions(java.lang.String)

listAreaTypes

public java.util.Collection listAreaTypes()
Returns a Collection of String keys that define the valid areaTypes for this support class.

Overrides:
listAreaTypes in class BaseActionProviderSupport
Returns:
a Collection of String keys that define the valid areaTypes for this support class.
See Also:
listActionTypes(java.lang.String)

listActionTypes

public java.util.Collection listActionTypes(java.lang.String areaType)
Returns a Collection of String keys that define the valid actionTypes for the specified area of this support class.

Overrides:
listActionTypes in class BaseActionProviderSupport
Parameters:
areaType - The key associated with a defined areaType.
Returns:
a Collection of String keys that define the valid actionTypes for the specified area of this support class.
Throws:
java.lang.IllegalArgumentException - if areaType is null.
See Also:
listAreaTypes()

setLocale

public void setLocale(java.util.Locale loc)
Initializes the support class.

Called by the ActionProvider after it sets the locale on this support class.

Overrides:
setLocale in class BaseActionProviderSupport
Parameters:
loc - The locale object used by this support class.
See Also:
setLocale(java.util.Locale)

setActionProvider

public void setActionProvider(BaseActionProvider actionProvider)
Sets the instance of the ActionProvider that is using this support class.

Overrides:
setActionProvider in class BaseActionProviderSupport
Parameters:
actionProvider - the instance of the ActionProvider that is using this support class.
See Also:
BaseActionProviderSupport.getActionProvider()

reset

public void reset()
Overrides:
reset in class BaseActionProviderSupport

newActionInstance

public BaseAction newActionInstance(java.lang.String areaType,
                                    java.lang.String actionType)
Returns a new instance of a default actionType.

Returns null if actionType is valid but not defined by the support class.

Specified by:
newActionInstance in class BaseActionProviderSupport
Parameters:
areaType - the key associated with a defined area type.
actionType - the key associated with a defined action type.
Returns:
a new action of the specified type.

getAreaScopeAttributeMap

protected java.util.Map getAreaScopeAttributeMap(ActionSupportFilter filter)
Returns mappings for a pre-defined set of Action attribute keys to their corresponding dynamic values for a specific area.

This implementation just returns null because, typically, there are no attributes that the Composite proper needs to set. The Composite's delegate support classes typically need to derive attribute values.

Specified by:
getAreaScopeAttributeMap in class BaseActionProviderSupport
Parameters:
filter - Defines the specific area.
Returns:
mappings for a pre-defined set of Action Attribues keys

addSupportClassInstances

protected abstract void addSupportClassInstances()
Subclasses should register their sub-support class instances via addSupport in their implementations of this method.

Called during instantiation of the Composite support class.

See Also:
addSupport(java.lang.String)

getSupportClass

protected abstract java.lang.Class getSupportClass(java.lang.String supportClassName)
Returns the support class associated with the specified class name.

Parameters:
supportClassName - The name of the class being requested.
Returns:
the support class associated with the specified supportType.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.