JBoss.org Community Documentation

- Prev
- Next

## 6.69. < rich:panelMenuGroup >

### 6.69.1. Description

The <rich:panelMenuGroup> component is used to define an expandable group of items inside the panel menu or other group.

Figure 6.201. <rich:panelMenuGroup> component

### 6.69.2. Key Features

- Highly customizable look-and-feel

- Different submission modes inside every group

- Optional submissions on expand collapse groups

- Custom and predefined icons supported

- Support for disabling

Table 6.349. rich : panelMenuGroup attributes

Attribute Name | Description
--- | ---
accesskey | This attribute assigns an access key to an element. An access key is a single character from the document character set. Note: Authors should consider the input method of the expected reader when specifying an accesskey
action | MethodBinding pointing at the application action to be invoked, if this UIComponent is activated by you, during the Apply Request Values or Invoke Application phase of the request processing lifecycle, depending on the value of the immediate property
actionListener | MethodBinding pointing at method accepting an ActionEvent with return type void
ajaxSingle | boolean attribute which provides possibility to limit JSF tree processing(decoding, conversion/validation, value applying) to the component which send the request only
align | left|center|right|justify [CI] Deprecated. This attribute specifies the horizontal alignment of its element with respect to the surrounding context. Possible values: * left: text lines are rendered flush left. * center: text lines are centered. * right: text lines are rendered flush right. * justify: text lines are justified to both margins. The default depends on the base text direction. For left to right text, the default is align=left, while for right to left text, the default is align=right
alt | For a user agents that cannot display images, forms, or applets, this attribute specifies alternate text. The language of the alternate text is specified by the lang attribute
binding | The attribute takes a value-binding expression for a component property of a backing bean
bypassUpdates | If "true", after process validations phase it skips updates of model beans on a force render response. It can be used for validating components input
converter | Id of Converter to be used or reference to a Converter
converterMessage | A ValueExpression enabled attribute that, if present, will be used as the text of the converter message, replacing any message that comes from the converter
data | Serialized (on default with JSON) data passed on the client by a developer on AJAX request. It's accessible via "data.foo" syntax
disabled | When set for a form control, this boolean attribute disables the control for your input
disabledClass | Class to be applied to disabled items.
disabledStyle | CSS style rules to be applied to disabled items.
eventsQueue | Name of requests queue to avoid send next request before complete other from same event. Can be used to reduce number of requests of frequently events (key press, mouse move etc.)
expanded | If true group will be displayed expanded initially. Default value is "false".
expandMode | Set the submission mode for all panel menu groups after expand/collapse except ones where this attribute redefined. Possible value are "ajax", "server", "none". Default value is "none".
focus | id of element to set focus after request completed on client side
hoverClass | Class to be applied to hovered items.
hoverStyle | CSS style rules to be applied to hovered items.
iconClass | Class to be applied to icon element.
iconCollapsed | Path to the icon to be displayed for the collapsed item state. You can also use predefined icons, setting the attribute to one of these possible values: "triangle", "triangleUp", "triangleDown", "disc", "chevron", "chevronUp", "chevronDown", "grid". Default value is "grid".
iconDisabled | Path to the icon to be displayed for the disabled item state.
iconExpanded | Path to the icon to be displayed for the expanded item state. You can also use predefined icons, setting the attribute to one of these possible values: "triangle", "triangleUp", "triangleDown", "disc", "chevron", "chevronUp", "chevronDown", "grid". Default value is "grid".
iconStyle | CSS style rules to be applied
id | Every component may have a unique id that is automatically created if omitted
ignoreDupResponses | Attribute allows to ignore an Ajax Response produced by a request if the newest 'similar' request is in a queue already. ignoreDupResponses="true" does not cancel the request while it is processed on the server, but just allows to avoid unnecessary updates on the client side if the response isn't actual now
immediate | True means, that the default ActionListener should be executed immediately (i.e. during Apply Request Values phase of the request processing lifecycle), rather than waiting until the Invoke Application phase
label | Displayed node's text
limitToList | If "true", updates on client side ONLY elements from this 'reRender' property. If "false" (default) updates all rendered by ajax region components
maxlength | When the type attribute has the value "text" or "password", this attribute specifies the maximum number of characters you may enter. This number may exceed the specified size, in which case the user agent should offer a scrolling mechanism. The default value for this attribute is an unlimited number
name | Refers to group/item with the same name. Default value is "getId()".
onbeforedomupdate | JavaScript code for call before DOM has been updated on client side
onblur | HTML: script expression; the element lost the focus
onchange | HTML: script expression; the element value was changed
onclick | HTML: a script expression; a pointer button is clicked
oncollapse | HTML: script expression; group was closed
oncomplete | JavaScript code for call after request completed on client side
ondblclick | HTML: a script expression; a pointer button is double-clicked
onexpand | HTML: script expression; group was opened
onfocus | HTML: script expression; the element got the focus
onkeydown | HTML: a script expression; a key is pressed down
onkeypress | HTML: a script expression; a key is pressed and released
onkeyup | HTML: a script expression; a key is released
onmousedown | HTML: script expression; a pointer button is pressed down
onmousemove | HTML: a script expression; a pointer is moved within
onmouseout | HTML: a script expression; a pointer is moved away
onmouseover | HTML: a script expression; a pointer is moved onto
onmouseup | HTML: script expression; a pointer button is released
onselect | HTML: script expression; The onselect event occurs when you select some text in a text field. This attribute may be used with the INPUT and TEXTAREA elements
process | Id['s] (in format of call UIComponent.findComponent()) of components, processed at the phases 2-5 in case of AjaxRequest caused by this component. Can be single id, comma-separated list of Id's, or EL Expression with array or Collection
rendered | If "false", this component is not rendered
requestDelay | Attribute defines the time (in ms.) that the request will be wait in the queue before it is ready to send. When the delay time is over, the request will be sent to the server or removed if the newest 'similar' request is in a queue already
required | If "true", this component is checked for non-empty input
requiredMessage | A ValueExpression enabled attribute that, if present, will be used as the text of the validation message for the "required" facility, if the "required" facility is used
reRender | Id['s] (in format of call UIComponent.findComponent()) of components, rendered in case of AjaxRequest caused by this component. Can be single id, comma-separated list of Id's, or EL Expression with array or Collection
size | This attribute tells the user agent the initial width of the control. The width is given in pixels except when type attribute has the value "text" or "password". In that case, its value refers to the (integer) number of characters
status | ID (in format of call UIComponent.findComponent()) of Request status component
style | CSS style(s) to be applied when this component is rendered.
styleClass | Corresponds to the HTML class attribute.
tabindex | This attribute specifies the position of the current element in the tabbing order for the current document. This value must be a number between 0 and 32767. User agents should ignore leading zeros
target | Target frame for action to execute.
timeout | Response waiting time on a particular request. If a response is not received during this time, the request is aborted
validator | MethodBinding pointing at a method that is called during Process Validations phase of the request processing lifecycle, to validate the current value of this component
validatorMessage | A ValueExpression enabled attribute that, if present, will be used as the text of the validator message, replacing any message that comes from the validator
value | The current value for this component
valueChangeListener | Listener for value changes

Table 6.350. Component identification parameters

Name | Value
--- | ---
component-type | org.richfaces.PanelMenuGroup
component-class | org.richfaces.component.html.HtmlPanelMenuGroup
component-family | org.richfaces.PanelMenuGroup
renderer-type | org.richfaces.PanelMenuGroupRenderer
tag-class | org.richfaces.taglib.PanelMenuGroupTag

### 6.69.3. Creating the Component with a Page Tag

To create the simplest variant on a page use the following syntax:

Example:

    ...

          <rich:panelMenu>

                <rich:panelMenuGroup label="Group1">

                      <!--Nested panelMenu components-->

                </rich:panelMenuGroup>

          </rich:panelMenu>

    ...

### 6.69.4. Creating the Component Dynamically Using Java

Example:

    import org.richfaces.component.html.HtmlPanelMenuGroup;

    ...

    HtmlPanelMenuGroup myPanelMenuGroup = new HtmlPanelMenuGroup();

    ...

### 6.69.5. Details of Usage

All attributes except "label" are optional. The "label" attribute defines text to be represented.

Switching mode could be chosen with the "expandMode" attribute for the concrete panelMenu group.

The "expandMode" attribute could be used with three possible parameters:

- Server (default)

Regular form submission request is used.

- Ajax

Ajax submission is used for switching.

- None

"Action" and "actionListener" attributes are ignored. Items don't fire any submits itself. Behavior is fully defined by the components nested into items.

There are three icon-related attributes. The "iconExpanded" attribute defines an icon for an expanded state. The "iconCollapsed" attribute defines an icon for a collapsed state. The "iconDisabled" attribute defines an icon for a disabled state.

Default icons are shown on the picture below:

Figure 6.202. Default icons

Here is an example:

Example:

    ...

          <rich:panelMenu>

                <rich:panelMenuGroup label="Group1" iconExpanded="disc" iconCollapsed="chevron">

                      <!--Nested panelMenu components-->

                </rich:panelMenuGroup>

          </rich:panelMenu>

    ...

As the result the pictures are shown below. The first one represents the collapsed state, the second one - expanded state:

Figure 6.203. Collapsed state

Figure 6.204. Expanded state

It's also possible to define a path to the icon. Simple code is placed below.

    ...

          <rich:panelMenu>

                <rich:panelMenuGroup label="Group1" iconExpanded="\images\img1.png" iconCollapsed="\images\img2.png">

                      <!--Nested menu components-->

                </rich:panelMenuGroup>

          </rich:panelMenu>

    ...

Information about the "process" attribute usage you can find here.

### 6.69.6. JavaScript API

In Java Script code for expanding/collapsing group element creation it's necessary to use Expand()/Collapse() function.

Table 6.351. JavaScript API

Function | Description
--- | ---
expand() | Expand group element
collapse() | Collapse group element

### 6.69.7. Look-and-Feel Customization

For skinnability implementation, the components use a style class redefinition method. Default style classes are mapped on skin parameters.

There are two ways to redefine the appearance of all <rich:panelMenuGroup> components at once:

- Redefine the corresponding skin parameters

- Add to your style sheets style classes used by a <rich:panelMenuGroup> component

### 6.69.8. Skin Parameters Redefinition

Table 6.352. Skin parameters redefinition for a table element of the first level group

Skin parameters | CSS properties
--- | ---
headerWeightFont | font-weight
generalFamilyFont | font-family
headerSizeFont | font-size
headerTextColor | color
headerBackgroundColor | background-color

Table 6.353. Skin parameters redefinition for a table element of second and next level groups

Skin parameters | CSS properties
--- | ---
headerWeightFont | font-weight
headerFamilyFont | font-family
headerSizeFont | font-size
generalTextColor | color
tableBorderColor | border-top-color

Table 6.354. Skin parameters redefinition for wrapper div element of the first level group

Skin parameters | CSS properties
--- | ---
panelBorderColor | border-color

Table 6.355. Skin parameters redefinition for a hovered group element

Skin parameters | CSS properties
--- | ---
additionalBackgroundColor | background-color

Table 6.356. Skin parameters redefinition for a disabled group element

Skin parameters | CSS properties
--- | ---
tabDisabledTextColor | color

### 6.69.9. Definition of Custom Style Classes

On the screenshot there are classes names that define styles for component elements.

Figure 6.205. Classes names

Figure 6.206. Classes names

Table 6.357. Classes names that define an upper level groups

Class name | Description
--- | ---
rich-pmenu-top-group-self-icon | Defines styles for a top group icon
rich-pmenu-top-group-self-label | Defines styles for a top group label

Table 6.358. Classes names that define a second and lower level groups

Class name | Description
--- | ---
rich-pmenu-group | Defines styles for a group
rich-pmenu-group-self-icon | Defines styles for a group icon
rich-pmenu-group-self-label | Defines styles for a group label

Table 6.359. Classes names that define a group state

Class name | Description
--- | ---
rich-pmenu-hovered-element | Defines styles for a hovered group element
rich-pmenu-disabled-element | Defines styles for a disabled group element

In order to redefine styles for all <rich:panelMenuGroup> components on a page using CSS, it's enough to create classes with the same names (possible classes could be found in the tables above) and define necessary properties in them.

Example:

    ...

    .rich-pmenu-disabled-element{

            color: #87b9ff;

    }

    ...

This is a result:

Figure 6.207. Redefinition styles with predefined classes

In the example a disabled element font style and color were changed.

Also it’s possible to change styles of particular <rich:panelMenuGroup> component. In this case you should create own style classes and use them in corresponding <rich:panelMenuGroup> styleClass attributes. An example is placed below:

Example:

    ...

    .myClass{

           background-color: #ecf4fe;

    }

    ...

The "hoverClass" attribute for <rich:panelMenuGroup> is defined as it’s shown in the example below:

Example:

    <rich:panelMenuGroup ... hoverClass="myClass"/>

This is a result:

Figure 6.208. Redefinition styles with own classes and styleClass attributes

As it could be seen on the picture above, the background color for hovered item was changed.

### 6.69.10. Relevant resources links

Some additional information about usage of component can be found here.

- Prev6.68. < rich:panelMenu >
- Top of page
- Front page
- Next6.70. < rich:panelMenuItem >