The <rich:panelMenuGroup> component is used to define an expandable group of items inside the panel menu or other group.
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 | if "true", submits ONLY one field/link, instead of all form controls |
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. |
expandMode | Set the submission mode for all panel menu groups after expand/collapse except ones where this attribute redefined. (ajax, server, none(Default)) |
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 |
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 |
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 | 'selectedChild' attribute of PanelMenu refers to group/item with the same name |
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 |
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>
...
Example:
import org.richfaces.component.html.HtmlPanelMenuGroup;
...
HtmlPanelMenuGroup myPanelMenuGroup = new HtmlPanelMenuGroup();
...
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:
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:
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.
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 |
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
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 |
On the screenshot there are classes names that define styles for component elements.
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 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.
Some additional information about usage of component can be found here.