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.

<rich:panelMenuGroup> component

Figure 6.177.  <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 NameDescription
accesskeyThis 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
actionMethodBinding 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
actionListenerMethodBinding pointing at method accepting an ActionEvent with return type void
ajaxSingleif "true", submits ONLY one field/link, instead of all form controls
alignleft|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
altFor 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
bindingThe attribute takes a value-binding expression for a component property of a backing bean
bypassUpdatesIf "true", after process validations phase it skips updates of model beans on a force render response. It can be used for validating components input
converterId of Converter to be used or reference to a Converter
converterMessageA ValueExpression enabled attribute that, if present, will be used as the text of the converter message, replacing any message that comes from the converter
dataSerialized (on default with JSON) data passed on the client by a developer on AJAX request. It's accessible via "data.foo" syntax
disabledWhen set for a form control, this boolean attribute disables the control for your input
disabledClassClass to be applied to disabled items.
disabledStyleCSS style rules to be applied to disabled items.
eventsQueueName 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.)
expandedIf true group will be displayed expanded initially.
expandModeSet the submission mode for all panel menu groups after expand/collapse except ones where this attribute redefined. (ajax, server, none(Default))
focusid of element to set focus after request completed on client side
hoverClassClass to be applied to hovered items.
hoverStyleCSS style rules to be applied to hovered items.
iconClassClass to be applied to icon element.
iconCollapsedPath to the icon to be displayed for the collapsed item state
iconDisabledPath to the icon to be displayed for the disabled item state
iconExpandedPath to the icon to be displayed for the expanded item state
iconStyleCSS style rules to be applied
idEvery component may have a unique id that is automatically created if omitted
ignoreDupResponsesAttribute 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
immediateTrue 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
labelDisplayed node's text
limitToListIf "true", updates on client side ONLY elements from this 'reRender' property. If "false" (default) updates all rendered by ajax region components
maxlengthWhen 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'selectedChild' attribute of PanelMenu refers to group/item with the same name
onbeforedomupdateJavaScript code for call before DOM has been updated on client side
onblurHTML: script expression; the element lost the focus
onchangeHTML: script expression; the element value was changed
onclickHTML: a script expression; a pointer button is clicked
oncollapseHTML: script expression; group was closed
oncompleteJavaScript code for call after request completed on client side
ondblclickHTML: a script expression; a pointer button is double-clicked
onexpandHTML: script expression; group was opened
onfocusHTML: script expression; the element got the focus
onkeydownHTML: a script expression; a key is pressed down
onkeypressHTML: a script expression; a key is pressed and released
onkeyupHTML: a script expression; a key is released
onmousedownHTML: script expression; a pointer button is pressed down
onmousemoveHTML: a script expression; a pointer is moved within
onmouseoutHTML: a script expression; a pointer is moved away
onmouseoverHTML: a script expression; a pointer is moved onto
onmouseupHTML: script expression; a pointer button is released
onselectHTML: 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
processId['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
renderedIf "false", this component is not rendered
requestDelayAttribute 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
requiredIf "true", this component is checked for non-empty input
requiredMessageA 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
reRenderId['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
sizeThis 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
statusID (in format of call UIComponent.findComponent()) of Request status component
styleCSS style(s) to be applied when this component is rendered.
styleClassCorresponds to the HTML class attribute.
tabindexThis 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
targetTarget frame for action to execute.
timeoutResponse waiting time on a particular request. If a response is not received during this time, the request is aborted
validatorMethodBinding pointing at a method that is called during Process Validations phase of the request processing lifecycle, to validate the current value of this component
validatorMessageA ValueExpression enabled attribute that, if present, will be used as the text of the validator message, replacing any message that comes from the validator
valueThe current value for this component
valueChangeListenerListener for value changes

Table 6.350. Component identification parameters

NameValue
component-typeorg.richfaces.PanelMenuGroup
component-classorg.richfaces.component.html.HtmlPanelMenuGroup
component-familyorg.richfaces.PanelMenuGroup
renderer-typeorg.richfaces.PanelMenuGroupRenderer
tag-classorg.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:

Default icons

Figure 6.178. 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:

Collapsed state

Figure 6.179. Collapsed state


Expanded state

Figure 6.180. 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

FunctionDescription
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 parametersCSS properties
headerWeightFontfont-weight
generalFamilyFontfont-family
headerSizeFontfont-size
headerTextColorcolor
headerBackgroundColorbackground-color

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

Skin parametersCSS properties
headerWeightFontfont-weight
headerFamilyFontfont-family
headerSizeFontfont-size
generalTextColorcolor
tableBorderColorborder-top-color

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

Skin parametersCSS properties
panelBorderColorborder-color

Table 6.355. Skin parameters redefinition for a hovered group element

Skin parametersCSS properties
additionalBackgroundColor background-color

Table 6.356. Skin parameters redefinition for a disabled group element

Skin parametersCSS properties
tabDisabledTextColorcolor

6.69.9. Definition of Custom Style Classes

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

Classes names

Figure 6.181. Classes names


Classes names

Figure 6.182. Classes names


Table 6.357. Classes names that define an upper level groups

Class nameDescription
rich-pmenu-top-group-self-iconDefines styles for a top group icon
rich-pmenu-top-group-self-labelDefines styles for a top group label

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

Class nameDescription
rich-pmenu-groupDefines styles for a group
rich-pmenu-group-self-iconDefines styles for a group icon
rich-pmenu-group-self-labelDefines styles for a group label

Table 6.359. Classes names that define a group state

Class nameDescription
rich-pmenu-hovered-elementDefines styles for a hovered group element
rich-pmenu-disabled-elementDefines 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 and define necessary properties in them.

To change styles of particular <rich:panelMenuGroup> components, define your own style classes in the corresponding <rich:panelMenuGroup> attributes.

6.69.10. Relevant resources links

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