14.2. <rich:contextMenu>
The
<rich:contextMenu> component is used for creating a hierarchical context menu that are activated on events like onmouseover , onclick etc. The component can be applied to any element on the page.
14.2.1. Basic usage
To set the content of the context menu and any sub-menus, use the
<rich:menuItem>, <rich:menuGroup>, and <rich:menuSeparator> components. These components are detailed in Section 14.3, “Menu sub-components”.
14.2.2. Appearance
Use the
direction attribute to determine the direction of the menu when it appears. The direction attribute uses the following settings:
topLeft,topRight,bottomLeft,bottomRight- The menu appears to the top-left, top-right, bottom-left, or bottom-right of the activation point.
auto- The direction is determined automatically.
autoLeft,autoRight,topAuto,bottomAuto- The menu direction is determined automatically, but defaults to either the left, right, top, or bottom of the activation point as appropriate.
14.2.3. Expanding and collapsing the menu
By default, the menu is activated when the
contextmenu event is observed (ie. a right-click). To activate on a different event, use the showEvent attribute to define the event instead.
Menus can be navigated using the keyboard. Additionally, menus can be navigated programmatically using the JavaScript API. The JavaScript API allows the following methods:
show()- The
show()method shows the menu. hide()- The
hide()method hides the menu. activateItem(menuItemId)- The
activateItem(menuItemId)activates the menu item with themenuItemIdidentifier.
Use the
mode attribute to determine how the menu requests are submitted:
server, the default setting, submits the form normally and completely refreshes the page.ajaxperforms an Ajax form submission, and re-renders elements specified with therenderattribute.clientcauses theactionandactionListeneritems to be ignored, and the behavior is fully defined by the nested components or custom JavaScript instead of responses from submissions.
14.2.4. Reference data
component-type:org.richfaces.ContextMenucomponent-class:org.richfaces.component.UIContextMenucomponent-family:org.richfaces.ContextMenurenderer-type:org.richfaces.ContextMenuRenderer
14.2.5. Style classes and skin parameters
Table 14.2. Style classes (selectors) and corresponding skin parameters
| Class (selector) | Skin Parameters | Mapped CSS properties |
|---|---|---|
| headerFamilyFont
|
font-family
|
| tabDisabledTextColor
|
color
|
| headerFamilyFont
|
font-family
|
| No skin parameters. | |
| No skin parameters. | |
| panelBorderColor
|
border-color
|
additionalBackgroundColor
|
background-color
| |
| additionalBackgroundColor
|
border-color
|
| No skin parameters. | |
| generalFamilyFont
|
font-family
|
generalSizeFont
|
font-size
| |
| headerBackgroundColor
|
border-color
|
tabBackgroundColor
|
background-color
| |
| No skin parameters. | |
| tabDisabledTextColor
|
color
|
| generalTextColor
|
color
|
| No skin parameters. | |
| No skin parameters. | |
| panelBorderColor
|
border-top-color
|
| No skin parameters. | |
