Navigation:  Application Architecture > Advanced Actions >

Action Attributes

Previous pageReturn to chapter overviewNext page

Action attributes provide a means of specifying a tool’s actions declaratively.  Recall that the ITool.Actions provides the framework with the set of actions that act on a tool.  Although it is possible to implement this property to programmatically construct and return a set of IAction objects, it is often easier to use action attributes to specify, in a declarative manner, the IAction objects that should be constructed.  The abstract Tool class, which all tools should inherit, implements the Actions property so as to process the action attributes on the tool class and construct the corresponding runtime IAction objects.

There are presently 15 action attributes that can be grouped into two categories: initiators and decorators.  All the attributes whose name ends in "Action" are initiators, and all others are decorators.  Each instance of an initiator will result in exactly one runtime IAction object.

The first parameter to all action attributes is known as the logical action identifier.  Action attributes are structured so as to allow a set of decorators to be applied to multiple initiators.  For example, a MenuAction and a ButtonAction (or even two MenuActions with different paths) may both be declared to have the same logical action identifier, in which case all decorators specified on the identifier will be applied to both actions.

The table below describes the function of each attribute. Declaring a useful action requires at least one instance of an initiator.

 

Initiators


MenuAction

Declares a menu action with the action identifier as specified by the first parameter.  Subsequent action attributes that appear with the same identifier will be applied to the same action.  The third parameter specifies the name of the method that will act as a handler for the action with the specified identifier.

ButtonAction

Declares a button action with the action identifier as specified by the first parameter.  Subsequent action attributes that appear with the same identifier will be applied to the same action.  The third parameter specifies the name of the method that will act as a handler for the action with the specified identifier.

DropDownAction

Declares a drop-down button whose action is solely to show a drop-down menu containing other actions.  The action identifier is specified by the first parameter.  Subsequent action attributes that appear with the same identifier will be applied to the same action.  The third parameter specifies the name of the property that will provide an ActionModelNode containing the actions that will appear on the drop-down menu.

DropDownButtonAction

Declares a button action with the action identifier as specified by the first parameter, and a linked button whose action is solely to show a drop-down menu containing other actions.  Subsequent action attributes that appear with the same identifier will be applied to the same action.  The third parameter specifies the name of the method that will act as a handler for the action with the specified identifier.  The fourth parameter specifies the name of the property that will provide an ActionModelNode containing the actions that will appear on the drop-down menu.

KeyboardAction

Declares a keyboard action with the action identifier as specified by the first parameter.  Subsequent action attributes that appear with the same identifier will be applied to the same action.  The third parameter specifies the name of the method that will act as a handler for the action with the specified identifier.

 

Decorators


ActionPermission

Associates user authority tokens with the action. This is currently not used by the Viewer.

CheckedStateObserver

Specifies the name of a Boolean property and corresponding change event that are used to determine the “checked” state of the action with the specified identifier.

EnabledStateObserver

Specifies the name of a Boolean property and corresponding change event that are used to determine the “enabled” state of the action with the specified identifier.

GroupHint

Specifies a period-delimited string that is used to determine an appropriate spot to insert the action into the action model, if it does not already exist in the model.  For a more detailed description of how it works, refer to the Framework Reference page for the GroupHint class.

LabelValueObserver

Specifies the name of a String property and corresponding change event that are used to determine the label value (i.e. the menu caption and the button text) of the action with the specified identifier.

IconSet

Specifies a set of icons that will be displayed for the action with the specified identifier.

IconSetObserver

Specifies the name of an IconSet property and corresponding change event that are used to determine the set of icons for the action with the specified identifier.

Tooltip

Specifies a tooltip that will be displayed for the action with the specified identifier.

TooltipValueObserver

Specifies the name of a String property and corresponding change event that are used to determine the tool tip text of the action with the specified identifier.

VisibleStateObserver

Specifies the name of a Boolean property and corresponding change event that are used to determine the "visible" state of the action with the specified identifier.

Although the order in which attributes appear is irrelevant as far as .NET compilers are concerned, for the purposes of readability, the convention is that for a given logical action, all initiators appear before decorators.