com.sas.actionprovider
Class BaseActionProvider

com.sas.actionprovider.BaseActionProvider
Direct Known Subclasses:
HttpActionProvider, SwingActionProvider

public abstract class BaseActionProvider

The BaseActionProvider class is the Base class for the ActionProviders of the Action Provider Framework (APF).

Components that implement the appropriate viewer interface:

may query an ActionProvider for Actions via its getActions() method.

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.0

Constructor Summary
BaseActionProvider()
          Default Constructor
 
Method Summary
 void addContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
          Add a listener for the com.sas.commands.ActionProviderEvent event.
 BaseAction getAction(java.lang.String actionType, ActionSupportFilter filter)
          Returns the Action corresponding to the specified actionType.
 ActionOrderList getActionOrderList(java.lang.String supportType, ActionProviderViewInterface viewer, java.lang.String areaType)
          Returns the order list that is used to control the structure and ordering of the ActionList returned via the getActions() method.
 ActionList getActions(ActionSupportFilter filter)
          Returns a list of the Actions that are supported for the component area specified by the filter.
 BaseAction getDefaultAction(java.lang.String supportType, java.lang.String areaType, java.lang.String actionType)
          Returns the Action associated with the specified actionType and areaType on the support class that is associated with the supportType argument.
 java.util.Locale getLocale()
          Gets the locale that is given to each support class that this ActionProvider instantiates.
 java.lang.String getName()
          Returns the name of the ActionProvider.
 java.util.Collection listActionTypes(java.lang.String supportType, java.lang.String areaType)
          Returns a Collection of String keys that are the valid actionTypes for the specified area of the specified support class.
 java.util.Collection listAreaTypes(java.lang.String supportType)
          Returns a Collection of keys that are the valid areaTypes for the specified support class.
 java.util.Collection listDefaultActions(java.lang.String supportType, java.lang.String areaType)
          Returns a Collection of the valid actions for the given areaType as defined by the support class associated with the supportType argument.
 BaseAction newActionInstance(java.lang.String supportType, java.lang.String areaType, java.lang.String actionType)
          Returns a new instance of a default actionType.
 void removeContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
          Remove a listener for the com.sas.commands.ActionProviderEvent event.
 void setAction(BaseAction action, java.util.Collection viewers, Area area)
          Register a new Action with the ActionProvider for the purpose of either overriding a default Action or adding a custom Action.
 void setActionOrderList(java.lang.String supportType, 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 setLocale(java.util.Locale loc)
          Sets the locale that is given to each support class that this ActionProvider instantiates.
 void setName(java.lang.String name)
          Sets the name of the ActionProvider
 

Constructor Detail

BaseActionProvider

public BaseActionProvider()
Default Constructor

Method Detail

getActions

public ActionList getActions(ActionSupportFilter filter)
Returns a list of the Actions that are supported for the component area specified by the filter.

Note: If poolingOn attribute is true on the ActionSupportFilter argument then the acquired ActionList must be returned via the returnActionList() method.

Note: If poolingOn attribute is true then the entityKey attribute of the returned ActionLists and Actions is not guaranteed to be unique.

Parameters:
filter - Encapsulates a set of attributes that identify the viewer and the specific area for which it is querying.
Returns:
a list of Actions
Throws:
java.lang.IllegalArgumentException - if filter attributes invalid.
java.lang.IllegalStateException - if an instance of the support class could not be acquired.

getAction

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

Note: If poolingOn attribute is true on the ActionSupportFilter argument then the acquired ActionList must be returned via the returnAction() method.

Note: If poolingOn attribute is true then the entityKey attribute of the returned Action is not guaranteed to be unique.

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.

setAction

public void setAction(BaseAction action,
                      java.util.Collection viewers,
                      Area area)
Register a new Action with the ActionProvider for the purpose of either overriding a default Action or adding a custom Action.

If the actionType of the registered action is not present in the default ActionOrderList for the specified areaType, then the default ActionOrderList is updated so that the new action is positioned at the end of the root-level ActionOrderList.

To change the default order and positioning of the new Action, the new ActionType must be removed from the default ActionOrderList and added to the position of choice.

Parameters:
action - The Action object to be registered with the ActionProvider.
viewers - A collection of all the viewer instances to which this Action should be available.
area - The Area object that specifies a general area type and, possibly, more specific area type values.

Valid values for the Area's type and value are provided by the support class associated with the Action's specified supportType.

Throws:
java.lang.IllegalArgumentException - if the action, viewers or Area method args are invalid.
java.lang.IllegalStateException - if the support class to which this action should be registered could not be acquired.
See Also:
newActionInstance(java.lang.String, java.lang.String, java.lang.String)

setLocale

public void setLocale(java.util.Locale loc)
Sets the locale that is given to each support class that this ActionProvider instantiates.

Parameters:
loc - the locale that is given to each support class that this ActionProvider instantiates.
See Also:
getLocale()

getLocale

public java.util.Locale getLocale()
Gets the locale that is given to each support class that this ActionProvider instantiates.

Returns:
the locale that is given to each support class that this ActionProvider instantiates.
See Also:
setLocale(java.util.Locale)

listDefaultActions

public java.util.Collection listDefaultActions(java.lang.String supportType,
                                               java.lang.String areaType)
Returns a Collection of the valid actions for the given areaType as defined by the support class associated with the supportType argument.

Caution should be exercised when changing any of these Actions' attributes because the Actions that a support class actually returns will be based on these default actions. Users should only change these Action attributes if they are sure that those changes should apply to all viewer components that might request these actions.

Users should use the setAction() method if they want to restrict their changes to certain viewers or other conditions.

Parameters:
supportType - The key that maps to a specific support class from which to retrieve the actions.
areaType - The key specifying which area-based subset of actions should be returned.
Returns:
an ActionList of all the actions valid for the specified areaType on a specific support class.
Throws:
java.lang.IllegalArgumentException - if any of the arguments are invalid.
java.lang.IllegalStateException - if support class needed to query for default actions could not be acquired.
See Also:
setAction(com.sas.actionprovider.BaseAction, java.util.Collection, com.sas.actionprovider.Area), listActionTypes(java.lang.String, java.lang.String), listAreaTypes(java.lang.String)

getDefaultAction

public BaseAction getDefaultAction(java.lang.String supportType,
                                   java.lang.String areaType,
                                   java.lang.String actionType)
Returns the Action associated with the specified actionType and areaType on the support class that is associated with the supportType argument.

Caution should be exercised when changing any of this Action's attributes because the Action that a support class actually returns will be based on this default action. Users should only change these Action attributes if they are sure that those changes should apply to all viewer components that might request this action.

Users should use the setAction() method if they want to restrict their changes to certain viewers or other conditions.

Parameters:
supportType - The key that maps to a specific support class from which to retrieve the actions.
areaType - The key specifying which area-based subset of actions should be returned.
actionType - The key associated with a particular default action.
Returns:
the Action associated with the specified actionType and areaType on the support class that is associated with the supportType argument.
Throws:
java.lang.IllegalArgumentException - if any of the arguments are invalid.
java.lang.IllegalStateException - if support class needed to query for default action could not be acquired.
See Also:
setAction(com.sas.actionprovider.BaseAction, java.util.Collection, com.sas.actionprovider.Area), listActionTypes(java.lang.String, java.lang.String), listAreaTypes(java.lang.String)

getName

public java.lang.String getName()
Returns the name of the ActionProvider. If name has not been set, the method returns a default name for this actionprovider.

Returns:
Name of the ActionProvider
See Also:
setName(java.lang.String)

setName

public void setName(java.lang.String name)
Sets the name of the ActionProvider

Parameters:
name - Name of the ActionProvider
See Also:
getName()

newActionInstance

public BaseAction newActionInstance(java.lang.String supportType,
                                    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.

Parameters:
supportType - The key associated with a support class.
areaType - The key associated with a defined areaType of the support class.
actionType - The key associated with a defined actionType of the support class.
Returns:
a new action of the specified type.
Throws:
java.lang.IllegalArgumentException - if any of the arguments are invalid.
java.lang.IllegalStateException - if support class needed to query for the new action instance could not be acquired.
See Also:
listAreaTypes(java.lang.String), listActionTypes(java.lang.String, java.lang.String)

listAreaTypes

public java.util.Collection listAreaTypes(java.lang.String supportType)
Returns a Collection of keys that are the valid areaTypes for the specified support class.

The areaType keys are String Objects.

Parameters:
supportType - The key associated with a support class.
Returns:
a Collection of String keys that define the valid areaTypes for the specified support class.
Throws:
java.lang.IllegalArgumentException - if any of the arguments are invalid.
java.lang.IllegalStateException - if support class could not be acquired. #listActionTypes

listActionTypes

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

The actionType keys are String Objects.

Parameters:
supportType - The key associated with a support class.
areaType - The key associated with a defined areaType of the support class.
Returns:
a Collection of String keys that are the valid actionTypes for the specified area of the specified support class.
Throws:
java.lang.IllegalArgumentException - if any of the arguments are invalid.
java.lang.IllegalStateException - if support class could not be acquired. #listAreaTypes #getDefaultAction #listDefaultActions

setActionOrderList

public void setActionOrderList(java.lang.String supportType,
                               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.

Parameters:
supportType - The supportType key that identifies the support class to which this order list affects.
orderList - The order list.
viewer - The viewer this order list affects.

If null, the specified orderlist becomes the default.

areaType - The area this order list affects.
Throws:
java.lang.IllegalArgumentException - if any of the arguments are invalid.
java.lang.IllegalStateException - if support class needed for registration of this list could not be acquired.
See Also:
getActionOrderList(java.lang.String, com.sas.actionprovider.ActionProviderViewInterface, java.lang.String)

getActionOrderList

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

Parameters:
supportType - The supportType key that identifies the support class to which this order list affects.
viewer - The viewer this order list affects.

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

areaType - The area this order list affects.
Returns:
the order list that is used to control the structure and ordering of the ActionList returned via the getActions() method.
Throws:
java.lang.IllegalStateException - if support class needed to query for the order list could not be acquired.
java.lang.IllegalArgumentException - if any of the arguments are invalid.
See Also:
setActionOrderList(java.lang.String, com.sas.actionprovider.ActionOrderList, com.sas.actionprovider.ActionProviderViewInterface, java.lang.String)

addContentsChangedListener

public void addContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
Add a listener for the com.sas.commands.ActionProviderEvent event.

Parameters:
listener - an object which handles ActionProviderEvent events. The listener is not added a second time if it already exists in the list of listeners for this event. If listener is null, it is ignored.
See Also:
ContentsChangedSource

removeContentsChangedListener

public void removeContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
Remove a listener for the com.sas.commands.ActionProviderEvent event. Nothing happens if the listener is not in the list of listeners for this event.

Parameters:
listener - an object which handles ActionProviderEvent events
See Also:
ContentsChangedSource



Copyright © 2009 SAS Institute Inc. All Rights Reserved.