|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.actionprovider.BaseAction
public abstract class BaseAction
The BaseAction class is the base class for all Actions acquired via the Action Provider Framework (APF).
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:
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 .
DynamicAttributeCommandInterface
,
BaseCommand
,
BaseActionProvider.getActions(com.sas.actionprovider.ActionSupportFilter)
,
putValue(java.lang.String, java.lang.Object)
,
getAttributeDescriptor(java.lang.String)
,
AttributeDescriptorInterface
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 | |
---|---|
BaseAction()
Default constructor |
|
BaseAction(DynamicAttributeCommandInterface command)
Constructor that takes an instance of a command. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
Performs the operation associated with this Action. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a listener for this classes property changes. |
protected void |
applyCommandAttributes(DynamicAttributeCommandInterface command)
Applies all dynamic attributes on the Action to the command. |
java.lang.Object |
clone()
Create a new BaseAction object using this Object's attributes. |
protected void |
executeCommand(DynamicAttributeCommandInterface command)
Call the command's execute() method. |
protected void |
fireEvent(DynamicAttributeCommandInterface command)
If the command implements the ContentsChangedInterface and the
command's isContentsChanged() method returns true, then this method tells the SwingActionProvider
to fire a ActionProviderEvent to its listeners. |
ActionStrategyInterface |
getActionStrategy()
Returns the strategy object for this Action. |
java.lang.String |
getActionType()
Returns the actionType key that uniquely identifies this type of action. |
AttributeDescriptorInterface |
getAttributeDescriptor(java.lang.String attributeName)
Returns the AttributeDescriptorInterface associated with the named attribute. |
AttributeDescriptorInterface[] |
getAttributeDescriptors()
Returns an array containing an AttributeDescriptorInterface for each attribute of this Action. |
DynamicAttributeCommandInterface |
getCommand()
Returns this Action's command instance. |
int |
getReturnStatus()
Returns this Action's returnStatus attribute which determines if and possibly why this action should be returned to a requesting viewer when it is in a disabled state. |
java.lang.Object |
getValue(java.lang.String attributeName)
Get the value of the specified attribute. |
boolean |
isCustom()
Returns the boolean indicating whether this Action represents a non-default actionType or a replacement action for a default actionType. |
void |
performAction()
Performs the operation associated with this Action. |
void |
putValue(java.lang.String attributeName,
java.lang.Object attributeValue)
Set the value of the specified key attribute. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a listener of this classes property changes. |
void |
setActionStrategy(ActionStrategyInterface actionStrategy)
Sets the strategy object for this Action. |
void |
setActionType(java.lang.String actionType)
Sets the actionType key that uniquely identifies this type of action. |
protected boolean |
setAttribute(java.lang.String attributeName,
java.util.Map propertyDescriptors,
java.lang.Object[] args)
Set an attribute and its value. |
void |
setCommand(DynamicAttributeCommandInterface command)
Sets the Action's command instance. |
void |
setCustom(boolean custom)
Sets the boolean indicating whether this Action represents a non-default actionType or a replacement action for a default actionType. |
void |
setReturnStatus(int returnStatus)
Sets this Action's returnStatus attribute if this action should be returned to a requesting viewer when it is in a disabled state. |
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 BaseAction()
public BaseAction(DynamicAttributeCommandInterface command)
Constructor that takes an instance of a command.
command
- The command that contains the logic to execute this action.Method Detail |
---|
public DynamicAttributeCommandInterface getCommand()
The command is the object that gets executed when a user performs an Action.
setCommand(com.sas.commands.DynamicAttributeCommandInterface)
public void setCommand(DynamicAttributeCommandInterface command)
The command is the object that gets executed when a user performs an Action.
command
- Action's command instance.getCommand()
public int getReturnStatus()
By default, this value is ActionStatusKeysInterface.ENABLED
which means that the Action will be returned only when
it is in an enabled state.
BaseActionProviderSupport.getActionStatus(com.sas.actionprovider.BaseAction, com.sas.actionprovider.ActionSupportFilter)
,
setReturnStatus(int)
public void setReturnStatus(int returnStatus)
If the returnStatus has a matching bit for every bit on the status determined by the support classes getActionsStatus() method, then the Action will be returned in a disabled state. Otherwise, the Action will not be returned.
For example, if the Action's status includes both MODEL_MEMBER_DISABLED and IS_CURRENT_STATE_DISABLED then the Action's returnStatus would need to have both of those values set to force the support class to return the Action.
By default, this value is ActionStatusKeysInterface.ENABLED
which means that the Action will be returned only when
it is in an enabled state.
Other valid values for this attribute:
ActionStatusKeysInterface.MODEL_TYPE_DISABLED
ActionStatusKeysInterface.MODEL_STATE_DISABLED
ActionStatusKeysInterface.MODEL_MEMBER_DISABLED
ActionStatusKeysInterface.IS_CURRENT_STATE_DISABLED
ActionStatusKeysInterface.DISABLED
ActionStatusKeysInterface.VIEWER_DISABLED
ActionStatusKeysInterface.AREA_DISABLED
ActionStatusKeysInterface.UNSUPPORTED
viewer
- The viewer that requested this action.BaseActionProviderSupport.getActionStatus(com.sas.actionprovider.BaseAction, com.sas.actionprovider.ActionSupportFilter)
,
getReturnStatus()
public java.lang.String getActionType()
Returns the actionType key that uniquely identifies this type of action.
setActionType(java.lang.String)
public void setActionType(java.lang.String actionType)
Sets the actionType key that uniquely identifies this type of action.
On default Actions, the value of this attribute is set by the APF support class that creates the Action.
On custom Actions, the value may be any that does not conflict with an actionType defined on the APF support class.
actionType
- an key representing the actionType.getActionType()
public boolean isCustom()
Returns the boolean indicating whether this Action represents a non-default actionType or a replacement action for a default actionType.
setCustom(boolean)
public void setCustom(boolean custom)
Sets the boolean indicating whether this Action represents a non-default actionType or a replacement action for a default actionType.
custom
- The Action's custom setting.isCustom()
public java.lang.Object getValue(java.lang.String attributeName)
Get the value of the specified attribute.
getValue
in interface javax.swing.Action
attributeName
- the action attribute's name.
putValue(java.lang.String, java.lang.Object)
public void putValue(java.lang.String attributeName, java.lang.Object attributeValue)
Set the value of the specified key attribute.
putValue
in interface javax.swing.Action
attributeName
- the attribute's name.attributeValue
- the value to be set for the attribute.
java.lang.IllegalArgumentException
- when an assignment to an Action's attribute fails.getValue(java.lang.String)
protected boolean setAttribute(java.lang.String attributeName, java.util.Map propertyDescriptors, java.lang.Object[] args) throws AttributeSetException
setAttribute
in class BaseEntity
attributeName
- the name of the attributepropertyDescriptors
- a map containing the Java properties associated with
the entity. This map is used to determine whether the attribute is
associated with a java property. If so, then the write method associated
with the property is used to set the attribute value.value
- the value to associate with the attribute
Attribute values may be null.
AttributeSetException
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a listener for this classes property changes.
addPropertyChangeListener
in interface javax.swing.Action
listener
- the listener.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a listener of this classes property changes.
removePropertyChangeListener
in interface javax.swing.Action
listener
- the listener.public void actionPerformed(java.awt.event.ActionEvent event)
Swing Only:
The following steps occur during this method:
This method required by the ActionListener
interface.
actionPerformed
in interface java.awt.event.ActionListener
event
- The event which indicates that a component-defined action occured. This high-level
event is generated by a component (such as a Button) when the component-specific action
occurs (such as being pressed). This parameter is not referenced in this method's implementation.public void performAction()
Swing Only:
The following steps occur during this method:
protected void applyCommandAttributes(DynamicAttributeCommandInterface command)
Applies all dynamic attributes on the Action to the command.
command
- The command instance to which this Action's dynamic attributes should be applied.protected void executeCommand(DynamicAttributeCommandInterface command)
Call the command's execute() method.
command
- The command whose execute() method is to be calledpublic ActionStrategyInterface getActionStrategy()
setActionStrategy(com.sas.actionprovider.strategies.ActionStrategyInterface)
public void setActionStrategy(ActionStrategyInterface actionStrategy)
getActionStrategy()
protected void fireEvent(DynamicAttributeCommandInterface command)
If the command implements the ContentsChangedInterface
and the
command's isContentsChanged() method returns true, then this method tells the SwingActionProvider
to fire a ActionProviderEvent
to its listeners.
command
- The command whose execution may require an Event to be fired.public AttributeDescriptorInterface getAttributeDescriptor(java.lang.String attributeName) throws java.util.NoSuchElementException
attributeName
- The name of the attribute.
java.util.NoSuchElementException
public AttributeDescriptorInterface[] getAttributeDescriptors()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class BaseEntity
java.lang.CloneNotSupportedException
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |