14.4. <rich:panelMenu>
The
<rich:panelMenu> component is used in conjunction with <rich:panelMenuItem> and <rich:panelMenuGroup> to create an expanding, hierarchical menu. The <rich:panelMenu> component's appearance can be highly customized, and the hierarchy can stretch to any number of sub-levels.

Example 14.2. richpanelMenu
<rich:panelMenu mode="ajax" topGroupExpandedRightIcon="chevronUp" topGroupCollapsedRightIcon="chevronDown" groupExpandedLeftIcon="disc" groupCollapsedLeftIcon="disc"> <rich:panelMenuGroup label="Group 1"> <rich:panelMenuItem label="Item 1.1"/> <rich:panelMenuItem label="Item 1.2"/> <rich:panelMenuItem label="Item 1.3"/> </rich:panelMenuGroup> <rich:panelMenuGroup label="Group 2"> <rich:panelMenuItem label="Item 2.1"/> <rich:panelMenuItem label="Item 2.2"/> <rich:panelMenuItem label="Item 2.3"/> <rich:panelMenuGroup label="Group 2.4"> <rich:panelMenuItem label="Item 2.4.1"/> <rich:panelMenuItem label="Item 2.4.2"/> <rich:panelMenuItem label="Item 2.4.3"/> </rich:panelMenuGroup> <rich:panelMenuItem label="Item 2.5"/> </rich:panelMenuGroup> <rich:panelMenuItem label="Item 3"/> </rich:panelMenu>

14.4.1. Basic usage
The
<rich:panelMenu> component does not need any extra attributes declared for basic usage. However, it does require child <rich:panelMenuGroup> and <rich:panelMenuItem> components. Refer to Section 14.4.9, “<rich:panelMenuGroup>” and Section 14.4.10, “<rich:panelMenuItem>” for details on these child components.
14.4.2. Interactivity options
The
activeItem attribute is used to point to the name of the currently selected menu item.
By default, the event to expand the menu is a mouse click. Set the
expandEvent attribute to specify a different event to expand menus. Multiple levels of sub-menus can be expanded in one action. Set expandSingle="true" to only expand one sub-menu at a time.
Similarly, the default event to collapse the menu is a mouse click. Set the
collapseEvent attribute to specify a different event to collapse menus.
As with other control components, set
disabled="true" to disable the <rich:panelMenu> comonent. Child menu components can be disabled in the same way.
14.4.3. Appearance
Icons for the panel menu can be chosen from a set of standard icons. Icons can be set for the top panel menu, child panel menus, and child item. There are three different menu states that the icon represents, as well as icons for both the left and right side of the item title.
topGroupExpandedLeftIcon,topGroupExpandedRightIcon- These attributes determine the icons for the top level menu when it is expanded.
topGroupCollapsedLeftIcon,topGroupCollapsedRightIcon- These attributes determine the icons for the top level menu when it is collapsed.
topGroupDisabledLeftIcon,topGroupDisabledRightIcon- These attributes determine the icons for the top level menu when it is disabled.
topItemLeftIcon,topItemRightIcon- These attributes determine the icons for a top level menu item.
topItemDisabledLeftIcon,topItemDisabledRightIcon- These attributes determine the icons for a top level menu item when it is disabled.
groupExpandedLeftIcon,groupExpandedRightIcon- These attributes determine the icons for sub-menus that are not the top-level menu when they are expanded.
groupCollapsedLeftIcon,groupCollapsedRightIcon- These attributes determine the icons for sub-menus that are not the top-level menu when they are collapsed.
groupDisabledLeftIcon,groupDisabledRightIcon- These attributes determine the icons for sub-menus that are not the top-level menu when they are disabled.
itemLeftIcon,itemRightIcon- These attributes determine the icons for items in the menus.
itemDisabledLeftIcon,itemDisabledRightIcon- These attributes determine the icons for items in the menus when they are disabled.
Example 14.2, “richpanelMenu” demonstrates the use of icon declaration at the panel menu level. The standard icons are shown in Figure 14.3, “
<Standard icons>”.
Alternatively, point the icon attributes to the paths of image files. The image files are then used as icons.
Any icons specified by child
<rich:panelMenuGroup> and <rich:panelMenuItem> components overwrite the relevant icons declared with the parent <rich:panelMenu> component.
14.4.4. Submission modes
The
itemMode attribute defines the submission mode for normal menu items that link to content, and the groupMode attribute defines the submission mode for menu items that expand and collapse. The settings for these attributes apply to the entire menu unless a menu item defines its own individual itemMode or groupMode. The possible values for itemMode and groupMode are as follows:
server, the default setting, which submits the form normally and completely refreshes the page.ajax, which performs an Ajax form submission, and re-renders elements specified with therenderattribute.client, which causes theactionandactionListeneritems to be ignored, and the behavior is fully defined by the nested components instead of responses from submissions.
14.4.5. <rich:panelMenu> server-side events
The
<rich:panelMenu> component fires the ItemChangeEvent event on the server side when the menu is changed. The event only fires in the server and ajax submission modes. The event provides the itemChangeListener attribute to reference the event listener. Refer to Section 11.6.6, “<rich:itemChangeListener>” for details on the <rich:itemChangeListener> tag.
14.4.6. JavaScript API
The
<rich:panelMenu> component can be controlled through the JavaScript API. The JavaScript API provides the following functions:
expandAll()- Expand all the panel menu groups in the component.
collapseAll()- Collapse all the panel menu groups in the component.
selectItem(id)- Select the menu item with the
ididentifier.
14.4.7. Reference data
component-type:org.richfaces.PanelMenucomponent-class:org.richfaces.component.UIPanelMenucomponent-family:org.richfaces.PanelMenurenderer-type:org.richfaces.PanelMenuRendererhandler-class:org.richfaces.view.facelets.html.PanelMenuTagHandler
14.4.8. Style classes and skin parameters
Table 14.3. Style classes (selectors) and corresponding skin parameters
| Class (selector) | Skin Parameters | Mapped CSS properties |
|---|---|---|
| No skin parameters. | |
| panelBorderColor
|
border-top-color
|
| No skin parameters. | |
| No skin parameters. | |
| No skin parameters. | |
| No skin parameters. | |
| panelBorderColor
|
border-top-color
|
generalTextColor
|
color
| |
| No skin parameters. | |
| additionalBackgroundColor
|
background-color
|
| No skin parameters. | |
| tabDisabledTextColor
|
color
|
| No skin parameters. | |
| No skin parameters. | |
| generalSizeFont
|
font-size
|
generalFamilyFont
|
font-family
| |
| panelBorderColor
|
border-top-color
|
| No skin parameters. | |
| No skin parameters. | |
| generalTextColor
|
color
|
| additionalBackgroundColor
|
background
|
| tabDisabledTextColor
|
color
|
| No skin parameters. | |
| No skin parameters. | |
| generalSizeFont
|
font-size
|
generalFamilyFont
|
font-family
| |
| No skin parameters. | |
| panelBorderColor
|
border-color
|
generalTextColor
|
color
| |
| No skin parameters. | |
| headerTextColor
|
color
|
| No skin parameters. | |
| tabDisabledTextColor
|
color
|
| No skin parameters. | |
| No skin parameters. | |
| generalSizeFont
|
font-size
|
generalFamilyFont
|
font-family
| |
| panelBorderColor
|
border-color
|
| No skin parameters. | |
| No skin parameters. | |
| headerTextColor
|
color
|
headerBackgroundColor
|
background-color
| |
| tabDisabledTextColor
|
color
|
additionalBackgroundColor
|
background-color
| |
| No skin parameters. | |
| No skin parameters. | |
| generalSizeFont
|
font-size
|
generalFamilyFont
|
font-family
| |
| No skin parameters. | |
14.4.9. <rich:panelMenuGroup>
The
<rich:panelMenuGroup> component defines a group of <rich:panelMenuItem> components inside a <rich:panelMenu>.
14.4.9.1. Basic usage
The
<rich:panelMenuGroup> component needs the label attribute declared, which specifies the text to show for the menu entry. Alternatively, the label facet can be used to specify the menu text.
In addition, the
<rich:panelMenuGroup> component at least one <rich:panelMenuGroup> or <rich:panelMenuItem> components as child elements.
14.4.9.2. Appearance
Icons for the menu group are inherited from the parent
<rich:panelMenu> component. Refer to Section 14.4.3, “Appearance” for details on icon attributes and facets. Alternatively, the menu group's icons can be re-defined at the <rich:panelMenuGroup> component level, and these settings will be used instead of the parent component's settings.
14.4.9.3. Submission modes
If the
mode attribute is unspecified, the submission behavior for the group is inherited from the parent <rich:panelMenu>. Otherwise, the groupMode setting of the panel menu is used instead of the parent's behavior. Refer to Section 14.4.4, “Submission modes” for submission mode settings.
14.4.9.4. <rich:panelMenuGroup> server-side events
The
<rich:panelMenuGroup> component fires the ActionEvent event on the server side when the menu group receives a user action. The event only fires in the server and ajax submission modes. The event provides the action attribute to specify the user action method, and the actionListener attribute to reference the event listener.
14.4.9.5. JavaScript API
The
<rich:panelMenuGroup> component can be controlled through the JavaScript API. The JavaScript API provides the following functions:
expand()- Expand this panel menu group.
collapse()- Collapse this panel menu group.
select(id)- Select the menu item with the
ididentifier.
14.4.9.6. Reference data
component-type:org.richfaces.PanelMenuGroupcomponent-class:org.richfaces.component.UIPanelMenuGroupcomponent-family:org.richfaces.PanelMenuGroup
14.4.10. <rich:panelMenuItem>
The
<rich:panelMenuItem> component represents a single item inside a <rich:panelMenuGroup> component, which is in turn part of a <rich:panelMenu> component.
14.4.10.1. Basic usage
The
<rich:panelMenuItem> component needs the label attribute declared, which specifies the text to show for the menu entry. Alternatively, the label facet can be used to specify the menu text.
14.4.10.2. Appearance
Icons for the menu item are inherited from the parent
<rich:panelMenu> or <rich:panelMenuGroup> component. Refer to Section 14.4.3, “Appearance” for details on icon attributes and facets. Alternatively, the menu item's icons can be re-defined at the <rich:panelMenuItem> component level, and these settings will be used instead of the parent component's settings.
14.4.10.3. Submission modes
If the
mode is unspecified, the submission behavior for the item is inherited from the parent <rich:panelMenu>. Otherwise, the itemMode setting from the panel menu is used instead of the parent's behavior.
14.4.10.4. <rich:panelMenuItem> server-side events
The
<rich:panelMenuItem> component fires the ActionEvent event on the server side when the menu item receives a user action. The event only fires in the server and ajax submission modes. The event provides the action attribute to specify the user action performed, and the actionListener attribute to reference the event listener.
14.4.10.5. JavaScript API
The
<rich:panelMenuItem> component can be controlled through the JavaScript API. The JavaScript API provides the following functions:
select()- Select this menu item.
14.4.10.6. Reference data
component-type:org.richfaces.PanelMenuItemcomponent-class:org.richfaces.component.UIPanelMenuItemcomponent-family:org.richfaces.PanelMenuItem