Adding Custom Menus and Toolbar Buttons

Custom menus and/or toolbar buttons can be added to the Workspace application or your custom WCC application using configuration settings in the application’s configuration file, config.xml.

Note: Note that although custom menus and toolbar buttons are configured in the config.xml file, adding them to your application involves more than that. You must also modify files in your local WCC development environment, then after modifying and testing it, you can deploy the application to a node (see Deploying an Application After Customizing ).

The record element that specifies a custom menu or toolbar button has a jsxid attribute value of customMenus:

<record jsxid="customMenus">
    <!-- custom menu or toolbar elements added here -->
</record>

The <record jsxid="customMenus"> element can have either toolbar or menu child elements, that display custom toolbar buttons and menus, respectively.

Both the toolbar and menu elements have three attributes:

  • parent - The name of the list or toolbar on which the custom menu or button is to be displayed. The following values are valid(1):
    • “AuditEventList”
    • "BusinessServiceList"
    • "EventViewList"
    • “MainAppToolbar” (this only applies to the Workspace application, not to custom WCC applications)
    • “ProcessInstanceList”
    • “ProcessTemplateList’
    • "ProcessViewList"
    • "WorkItemList"
    • "WorkViewList"
  • width - The display width in pixels. Note, however, that this is used only with a parent of "MainAppToolbar". For all other parents, it is ignored.
  • prototype - The path to the default prototype XML file. This is the General Interface prototype that defines the GUI components for the menu or toolbar.

Both the toolbar and menu elements may also have optional locale child elements that define prototype XML files that are localized for specific languages. If a locale child element exists, and it corresponds to the language and locale currently selected by the user, the language-specific prototype is loaded, otherwise the default prototype is loaded.

Each locale child element has three attributes:

  • localeKey - Locale identifier. This value must correspond to one of the key attribute values defined in the locale element of the JSXAPPS\base\locale\locale.xml configuration file. The key attribute values are of the format: ll or ll_CC, where ll is a lowercase, two- letter ISO 639 language code, and CC is the optional, uppercase, two-letter ISO 3166 country code. For a list of codes, visit these web sites:
  • width - The display width in pixels. Note, however, that this is used only with a parent of "MainAppToolbar". For all other parents, it is ignored.
  • prototype - The path to the prototype XML file containing language-specific data. This is the General Interface prototype that defines the GUI components for the menu or toolbar.

The following is an example <record jsxid="customMenus"> element that would cause a custom menu and toolbar button to appear on the work item list (parent = "WorkItemList"):

<record jsxid="customMenus">
   <menu parent="WorkItemList"
         prototype="customMenusSample/prototypes/menus/MenuSample.xml"></menu>
   <toolbar parent="WorkItemList" 
         prototype="customMenusSample/prototypes/toolbars/ToolbarSample.xml"></toolbar>
</record> 

The prototype attribute references the prototype for the custom menu or toolbar button—in the example above, they reference the prototypes provided in the custom menus sample: MenuSample.xml and ToolbarSample.xml (for more information about the custom menus sample, see Provided Custom Menus Sample).

The prototypes themselves reference the event handlers for the custom buttons and/or menu selections. For example, the ToolbarSample.xml prototype executes the sampleToolbarHandler, which is located in the AppMain.js file in the following directory:

StudioHome\wcc\version\JSXAPPS\WCCProjectName\application\js

where:

  • StudioHome is the directory in which TIBCO Business Studio was installed.
  • version is the version number of Workspace that was installed with TIBCO Business Studio.
  • WCCProjectName is the name of the General Interface Builder project that contains your custom application. If you are working with the Workspace application, this is "workspace".

Add your custom application code to the appropriate handler in AppMain.js.

1

A custom WCC application can define new parent values in customMenus and provide its own custom handling for adding the menu or toolbar specified by the new parent name. See the loadWorkspaceCustomMenu method in the mixin interface (JSXAPPS\wcc\application\js\AppMain.js) for an example of how this is handled for the MainAppToolbar value.