Defining a New Action Model
Action models are defined in an XML file that follows the structure based on <WT_HOME>/codebase/config/actions/actionsmodels.dtd.
Here is a simple example of an action model definition used for the folder browser toolbar:
<!-- default toolbar for the Folder page -->
<model name="folder_list_toolbar">
<action name="list_cut" type="object"/>
<action name="list_copy" type="object"/>
<action name="fbpaste" type="object"/>
<action name="pasteAsCopy" type="saveas"/>
<action name="list_paste_sharing" type="folder"/>
<action name="list_delete" type="object"/>
<action name="CONTAINERMOVE" type="pdmObject"/>
<action name="PAGERELOADINGMULTICHECKOUT" type="folder"/>
<action name="WFADDTOWORKSPACE" type="folder"/>
<action name="separator" type="separator"/>
<action name="create" type="folder"/>
<action name="create" type="document"/>
<action name="createMulti" type="document"/>
<action name="createPartWizard" type="part"/>
<action name="createMultiPart" type="part"/>
<action name="add_link" type="bookmark"/>
<action name="create" type="problemReport"/>
<action name="create" type="changeRequest"/>
<action name="create" type="changeNotice"/>
<action name="separator" type="separator"/>
</model>
The objecttype name is a way to create a name space as well as packaging for actions related to a specific object or functional area. In the above example, the name “document” creates a unique name space for actions that apply to wt.doc.WTDocument.
It is also possible to create an action model which itself references another action model. The folder browser Actions menu contains a submodel for the New group of actions. For example, the action model for the New group of actions might be defined as follows:
<model name="folder_file_new" resourceBundle="com.ptc.core.ui.tableRB">
<action name="create" type="document" resourceBundle="com.ptc.core.ui.tableRB" />
<!-- More actions here --!>
</model>
Then, in the action model for the Actions menu, include the submodel “folder_file_new”:
<model name="folder_file">
<submodel name="folder_file_new"/>
<action name="create" type="document"/>
<!-- More actions here --!>
</model>
See the figure below for how this appears in the user interface:
Model Attributes
Details about these parameters can also be found in the <WT_HOME>/codebase/config/actions/actionsmodels.dtd.
Parameter | Default Value | Possible values | Req? | Description |
---|
name | | | Yes | This is the name by which the action model is referenced |
menufor | | Any valid class name. | No | Specifies which action should be highlighted by default. This is only applicable if the model is used as a third-level navigation menu. |
defaultActionName | First action in the model is used by default | Action name for one of the actions in the model. | | Specifies which action should be highlighted by default. This is only applicable if the model is used as a third-level navigation menu. |
defaultActionType | First action in the model is used by default | Object type of one of the actions in the model. | | |
resourceBundle | | | | Class name for the resource bundle to use for the properties of the action models that are to be localized |
Action Attributes
Details about these parameters can also be found in <WT_HOME>/codebase/config/actions/actionsmodels.dtd.
Parameter | Possible Values | Req? | Description |
---|
name | Name of any action defined in an actions.xml file | Yes | This is the name of an action defined in an actions.xml file |
type | Name of any objecttype defined in an aactions.xml file | Yes | This is the name of an object type defined in an actions.xml file. |
shortcut | true false | No | This determines whether an action is displayed as a shortcut icon in the toolbar. |
Naming conventions for the name of an action model can be any combination of alpha-numeric characters. Most action models are names include the component that they are used in. Your action models should have a prefix specific to your company to prevent collisions with other action models delivered with the product.
| The action service is designed to hide the icons in the actions menu (or menu bar menus) for any icon which is not contained in a toolbar somewhere else in the system. The StandardNmActionService builds and keeps a list of all known toolbar icons on server startup. The StandardNmActionService is relying on the name of the model to know whether it is a toolbar. Therefore, the name of a model used as a toolbar should contain “toolbar.” If the toolbar model naming convention is not followed, then the action service cannot show icons as designed. However, no functionality breaks if the naming convention is not followed. |
"
Commonly used shortcut actions (recommended maximum up to five) can be configured to appear on a toolbar shortcut area using a shortcut attribute. Example configuration for folder browser table:
<model name="folder_list_toolbar">
………………………………………..
<action name="CONTAINERMOVE"
type="pdmObject" shortcut = "true"/>
<action name="PAGERELOADINGMULTICHECKOUT"
type="folder" shortcut = "true"/>
<action name="WFADDTOWORKSPACE"
type="folder" shortcut = "true"/>
…………………………….
<action name="create"
type="folder" shortcut = "true"/>
<action name="create"
type="document" shortcut = "true"/>
…………………………………
</model>
An action is a shortcut action only in the context of that specific model. Note that icons for actions in the menus are be displayed for actions that also display in the toolbar.
SubModel Attributes
Details about these parameters can also be found in <WT_HOME>/codebase/config/actions/actionsmodels.dtd.
Parameter | Possible Values | Req? | Description |
---|
name | Name of any action model defined in an actionmodels.xml file | Yes | This is the name of an action model defined in an actionmodels.xml file. An example of where an action model with submodels is used is for the > menu on the Folder Contents table. |
Sample Code
The following is sample code for an action model that configures a subtype:
<!-- Copied from ChangeManagement-actionModels.xml -->
<!-- Originally copied from menu for wt.change2.WTChangeRequest2 -->
<model name="sample change request actions" menufor="WCTYPE|
wt.change2.WTChangeRequest2|org.default.www.SampleChangeRequest">
<action name="view" type="object"/>
<action name="SETLIFECYCLESTATE" type="pdmObject"/>
<action name="createSubscription" type="subscription"/>
<action name="separator" type="separator"/>
<action name="reviseChangeItems" type="change"/>
<action name="editCapabilityPackage" type="capabilityPackage"/>
<action name="create" type="approach" />
<action name="create" type="capabilityImplementationProject" />
<action name="separator" type="separator"/>
<action name="sandboxAddToProject" type="object"/>
<action name="SBAddToPrj" type="sandbox"/>
<action name="removeShare" type="object"/>
<action name="separator" type="separator"/>
<action name="ManageSecurity" type="accessPermission"/>
<action name="renameObjectWizard" type="object"/>
<action name="delete" type="object"/>
<action name="separator" type="separator"/>
<action name="separator" type="separator"/>
<action name="discuss" type="forum"/>
<action name="copy" type="object"/>
</model>
Where org.default.www.SampleChangeRequest is the name of the subtype entered in the Type and Attribute Management utility.