Book a Demo
Prev Next

Create Hidden Sub-Menus

When you create items on a Toolbox page, some of them might be very similar and be based on the same type of Metaclass. For example, there are many different types of Action element and, in BPMN 2.0, you can create each type of Event element either stand-alone or edge-mounted on another element. Rather than populate a Toolbox page with every variation, you can create a 'base' Toolbox item and offer a choice of variant from a sub-menu, which is displayed when the base item is dragged onto the diagram but is otherwise hidden. This technique is very useful for 'disambiguating' Stereotypes that can be applied to multiple Metaclasses.

In the submenu, you define just the variant types (as for the Action element list). However, if the variant also has a ToolboxItemImage defined for it, that icon is displayed against the variant name in the sub-menu (as for the BPMN 2.0 Events). You can also use this method to specifically define icons that will be applied to the submenu options.

Define a hidden sub-menu

Step

Action

See also

1

Create a Stereotype element on the same diagram as the ToolboxPage Metaclass, with a name prefixed by the Profile name (this is mandatory). For example:

     MyProfile::MyClass

The name must not match the name of any external stereotype that exists in any other Profile.

The sub-menu element can have an alias.

Add Stereotypes and Metaclasses

2

In this sub-menu Stereotype element, create the attribute isHidden with an initial value of True.

For each sub-menu item, add an attribute to identify that item. Set the 'Initial Value' to the name to display in the menu. For example, if the «MyClass» stereotype could be applied to a UML Class or UML Interface, the attributes for these two options would be:

     MyProfile::MyClass(UML::Class) Initial Value = Class

     MyProfile::MyClass(UML::Interface) Initial Value = Interface

Create Toolbox Profiles

3

Create a second Stereotype element and define an attribute with the same name as the sub-menu Stereotype element, and with the initial value of the text to display in the Toolbox item. For example:

     MyProfile::MyClass = Class Object

Define additional attributes for the rest of the items in the Toolbox, as normal.

Create Toolbox Profiles

4

Create <<Extension>> relationships between each Stereotype element and the ToolboxPage Metaclass element, as illustrated.

A UML Profile diagram showing how to define a hidden menu in a custom toolbox.

When this Profile is in use, and when the Class Object item is dragged onto a diagram from the Toolbox, the hidden menu displays giving the choice of Class or Interface; on selection, the element is dropped onto the diagram.

5

If no icon has been assigned to the Toolbox item from existing definitions, and you want to display one, define the image as a ToolboxItemImage icon.

Assign Icons To Toolbox Items