Dynamic Commands in a Right-Click Menu

The right-click menu can include dynamic commands. Dynamic indicates that the content varies depending on the specific circumstances.

For example, the right-click menu for a document object could be configured to display the list of files checked into that object, and clicking on a file name opens the file.

Dynamic commands require a JPO:method to generate the command structure. The JPO:method is specified using the Dynamic Command Program and Dynamic Command Function settings on the command object. The menu is generated when the right mouse click event is fired. The command in the right-click menu, when clicked, call the page specified by the href of the command, which could be a popup or processing page depending on the Target Location specified for the command.

If these settings are configured on a menu, the returned items are listed as submenus/commands of that menu. If configured on a command, the returned items replace the current commands.

If the JPO:method returns a large number of items, a second column is added to the popup menu. The menu expands according to the current browser size; if needed, a scroll bar is added.

If your code contains complex logic or lengthy database calls, a Loading... message shows in the right-click menu until the data has been received and generated.

The Business Process Services (AEF and APP prefixes) install these dynamic menu commands that can also be used in customized menus:


  • AEFClipboardCollectionsRMB menu--Opens a submenu that contains these commands:
    • AEFAddToClipboardCollectionRMB--adds the object to the user's Clipboard collection
    • AEFNewAddToCollectionsRMB--opens the Select Collection dialog box where the user can select an existing collection or create a new collection
  • AEFGenericDeleteRMB command--Adds a Delete item to the right-click menu using the generic delete functionality.

This command uses emxAEFUtil:getGenericDelete as the JPO:method (Dynamic Command Program and Dynamic Command Function settings).


  • APPQuickFileList command -- Opens a list of files checked into the object. The file names, used as the command labels, includes the file size in parentheses.

This command uses emxAPPQuickFile:listQuickFiles as the JPO:method (Dynamic Command Program and Dynamic Command Function settings) to generate the list of files.


  • APPRelatedFiles command--Lists files checked into related objects. Related objects are determined based on the emxFramework.QuickFileAccess.Relationships.Default property in emxSystem.properties. The file names, used as the command labels, includes the file size in parentheses.

This command uses emxAPPQuickFile:listRelatedFiles as the JPO:method (Dynamic Command Program and Dynamic Command Function settings) to generate the list of files.

In addition, the Pull Right=true setting is specified.


  • APPReferenceDocumentQuickFiles command--Lists files checked into related objects that are connected to the selected object with the Reference Document relationship. To add additional relationships for this command, edit the Relationship Filter setting on the command (default value is from[<relationship_ReferenceDocument>].to.id).

This command uses emxAPPQuickFile:listReferenceDocuments as the JPO:method (Dynamic Command Program and Dynamic Command Function settings) to generate the list of files.

In addition, the Pull Right=true setting is specified.


  • APPVersionQuickFiles--Lists all versions of files checked into the object or checked into objects connected to it. Clicking a file name opens the user's File Download dialog allowing the user to save or open the file.

This command uses emxAPPQuickFile:listFileVersion as the JPO:method (Dynamic Command Program and Dynamic Command Function settings) to generate the list of files, with the Access Expression=type.kindof=="$<type_DOCUMENTS>" setting.


  • APPAllFileDetails--Opens the Quick File window for the object, listing details for all files checked into this object or related objects.

This command uses emxAPPQuickFile:getQuickFileTable as the JPO:method (Dynamic Command Program and Dynamic Command Function settings) to open the Quick Files page for the object.

This code shows an example method signature:

public static List getRelatedFileItem(Context context, String[] 
args) throws FrameworkException

The JPO:method is provided a single args[] array containing a packed Map with these inputs:


  • paramMap--Contains the request parameters passed to emxTable.jsp or emxIndentedTable.jsp stored as a map with request parameter names as keys. Also contains objectId, relId, etc.
  • commandMap--Details of the dynamic command or menu.

The JPO:method returns a list with each entry corresponding to a menu command. Each entry in the list is a map with this structure:

Key Description Example Value

name

The name of the command object.

APPRelatedFiles

label

The text to display in the menu.

Related Files

href

The URL to execute when this command is clicked.

${COMMON_DIR/emxTree.jsp

${SUITE_DIR}/emxEditPartDialog.jsp

image

Icon to use as the toolbar command. By default, no icon is shown.

images/iconEditStatus.gif

alt

Mouse-over text for the command.

Related Files

settings

Key/value pairs of settings for the dynamic command. The key of the map is the setting name. See Settings for Toolbar Link Command Objects for a list of the supported settings. Typical settings used for dynamic commands include:

Registered Suite

Access Expression

Access Program

Access Function

 

Children

A MapList that contains a HashMap for each command or submenu. Each map has the same structure as the parent HashMap.