Implementing Menus: ContextMenu, MenuBar and PopupMenuLocate this document in the navigation structure

Definition

A menu is a structured list of items, consisting of different types of items such as MenuActionItem of MenuCheckBox .

You can use menus in a MenuBar, you can assign them to different UI elements as PopupMenus and you can implement them as ContextMenus .

ContextMenu

You can insert a ContextMenu into a view and assign it to the UI element to which it shall belong. Each UI element has the properties contextMenuId to specify the context menu assigned to it and a contextMenuBehaviour property to specify the behavior of the ContextMenu accordingly to this UI element.

MenuBar

The following screenshot illustrates the design of a MenuBar .

PopupMenu

The PopupMenu is used to group actions in a space-saving way. After a user action, the menu is opened according to the UI element to which it is assigned. The following graphic shows the structure of a PopupMenu with the various elements:

The PopupMenu is displayed according to the UI element to which it is assigned.

UI element

Icon for the display of the PopupMenu

Description

LinkToURL

LinkToAction

For interactive elements, a static icon indicates the existence of a PopupMenu

Image

ProgressIndicator

TextView

Header of TableRowGrouping

An orange triangle appears for the PopupMenu when the user places the cursor on the image.

Tray

For the Tray, the icon for the PopupMenu is located in the title bar.

TreeNode

For a TreeNode , the PopupMenu is opened using the right mouse button

Table

In a table, PopupMenus can be implemented if you take as cell editor a UI element that can assign a PopupMenu .

Structure

A menu consists of the following elements:

  • Submenus for hierarchical menu structures, defined as a menu

  • Different menu items which can be defined as the following elements:

    • MenuActionItem

    • MenuRadioButton

    • MenuCheckBox

    • MenuSeparator

      The MenuSeparator element adds a separator between two menu items and thus provides a structure to the menu items. Like all MenuItems , the MenuSeparator can be set to invisible.

The getMenu method can be used to determine the corresponding menu for all menu items and submenus.

Menu Structure

The following UML class diagram shows the aggregated elements with the properties which can be used to create a MenuBar or a PopupMenu .