Chapter 14. Menus and toolbars
Read this chapter for details on menu and toolbar components.
14.1. <rich:dropDownMenu>
The
<rich:dropDownMenu> component is used for creating a drop-down, hierarchical menu. It can be used with the <rich:toolbar> component to create menus in an application's toolbar.
14.1.1. Basic usage
The
<rich:dropDownMenu> component only requires the label attribute for basic usage. Use the label attribute to define the text label that appears as the title of the menu. Clicking on the title drops the menu down.
Alternatively, use the
label facet to define the menu title. If the label facet is used, the label attribute is not necessary.
14.1.2. Menu content
To set the content of the drop-down 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.1.3. Appearance
Use the
jointPoint and direction attributes to determine the direction and location of the menu when it appears. The jointPoint and direction attributes both use the following settings:
topLeft,topRight,bottomLeft,bottomRight- When used with the
jointPointattribute, the menu is attached to the top-left, top-right, bottom-left, or bottom-right of the control as appropriate.When used with thedirectionattribute, the menu appears to the top-left, top-right, bottom-left, or bottom-right of the joint location as appropriate. auto- The direction or joint location is determined automatically.
autoLeft,autoRight,topAuto,bottomAuto- When used with the
jointPointattribute, the joint location is determined automatically, but defaults to either the left, right, top, or bottom of the control as appropriate.When used with thedirectionattribute, the menu direction is determined automatically, but defaults to either the left, right, top, or bottom of the joint location as appropriate.
14.1.4. Expanding and collapsing the menu
By default, the menu drops down when the title is clicked. To drop down with 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.1.5. Reference data
component-type:org.richfaces.DropDownMenucomponent-class:org.richfaces.component.UIDropDownMenucomponent-family:org.richfaces.DropDownMenurenderer-type:org.richfaces.DropDownMenuRenderer
14.1.6. Style classes and skin parameters
Table 14.1. 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. | |
