6.66.  < rich:panelBar >

6.66.1. Description

panelBar is used for grouping any content which is loaded on the client side and appears as groups divided on child panels after the header is clicked.

<rich:panelBar> with content inside

Figure 6.169.  <rich:panelBar> with content inside


6.66.2. Key Features

  • Skinnable slide panel and child items

  • Groups any content inside each panel

Table 6.334. rich : panelBar attributes

Attribute NameDescription
bindingThe attribute takes a value-binding expression for a component property of a backing bean
contentClassThe component content style class
contentStyleThe component content style
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.
headerClassThe component header style class
headerClassActiveThe component header style class active
headerStyleThe component header style
headerStyleActiveThe component header style active
heightThe height of the slide panel. Might be defined as pixels or as percentage. The default height is 100%
idEvery component may have a unique id that is automatically created if omitted
immediateA flag indicating that this component value must be converted and validated immediately (that is, during Apply Request Values phase), rather than waiting until a Process Validations phase
labelA localized user presentable name for this component.
onclickJavaScript code for call before header onclick
onitemchangeEvent must occurs on than item has been changed
onmousemoveEvent must occurs on than item has been changed
onmouseoutEvent must occurs on than item has been changed
onmouseoverEvent must occurs on than item has been changed
renderedIf "false", this component is not rendered
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.
selectedPanelAttribure defines name of selected item
styleCSS style(s) is/are to be applied when this component is rendered
styleClassCorresponds to the HTML class attribute.
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 of this component
valueChangeListenerListener for value changes
widthThe width of the slide panel. Might be defined as pixels or as percentage. The default width is 100%

Table 6.335. Component identification parameters

NameValue
component-typeorg.richfaces.PanelBar
component-classorg.richfaces.component.html.HtmlPanelBar
component-familyorg.richfaces.PanelBar
renderer-typeorg.richfaces.PanelBarRenderer
tag-classorg.richfaces.taglib.PanelBarTag

6.66.3. Creating the Component with a Page Tag

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

Example:


...
    <rich:panelBar>
        <!--//... -->
        <rich:panelBarItem label="Canon">
            ...
        </rich:panelBarItem>
        <rich:panelBarItem label="Nikon">
            ...
        </rich:panelBarItem>
    </rich:panelBar>
...

6.66.4. Creating the Component Dynamically Using Java

Example:


import org.richfaces.component.html.HtmlPanelBar;
...
HtmlPanelBar myBar = new HtmlPanelBar();
...

6.66.5. Details of Usage

As it was mentioned above, panelBar is used for grouping any content on the client, thus its customization deals only with specification of sizes and styles for rendering.

"width" and "height" (both are 100% on default) attributes stand apart.

Style attributes are described further.

panelBar could contain any number of child panelBarItem components inside, which content is uploaded onto the client and headers are controls to open the corresponding child element.

The "label" attribute is a generic attribute. The "label" attribute provides an association between a component, and the message that the component (indirectly) produced. This attribute defines the parameters of localized error and informational messages that occur as a result of conversion, validation, or other application actions during the request processing lifecycle. With the help of this attribute you can replace the last parameter substitution token shown in the messages. For example, {1} for “DoubleRangeValidator.MAXIMUM”, {2} for “ShortConverter.SHORT”.

6.66.6. 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:panelBar> components at once:

  • Redefine the corresponding skin parameters

  • Add to your style sheets style classes used by a <rich:panelBar> component

6.66.7. Skin Parameters Redefinition

Table 6.336. Skin parameter redefinition for a whole component

Skin parameterCSS properties
headerBackgroundColorborder-color

6.66.8. Definition of Custom Style Classes

There is one predefined class for the <rich:panelBar> , which is applicable to a whole component, specifying padding, borders, and etc.

Style classes

Figure 6.170. Style classes


Table 6.337. Class name that define a component appearance

Class nameClass description
rich-panelbarDefines styles for a wrapper <div> element of a component

Other classes responsible for elements rendering are described for child <rich:panelBarItem> elements and could be found in the components chapters.

Table 6.338. Style component classes

A class attributeA component element defined by an attribute
styleClassApplicable to a whole component (together with headers)
headerClassApplicable to a header element
contentClassApplicable to a content

In order to redefine styles for all <rich:panelBar> 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:panelBar> components, define your own style classes in the corresponding <rich:panelBar> attributes.

CSS code piece used on a page:

Example:


...
    
. rich-panelbar{
        
padding:10px;
    
}
    
.myClass{
        
font-style:italic;
    
}
...

When using headerClass and headerClassActive attributes the declaration of headerClass should precede the one of headerClassActive:

Example:


...
    
.headerClass{
        
...
    
}
    
.headerClassActive{
        
...
    
}
...

The component is defined in the following way:

Example:


...
    <rich:panelBar contentClass="myClass">
        <rich:panelBarItem>
        ...
        </rich:panelBarItem>
    </rich:panelBar>
...

Hence, padding for all <rich:panelBar> is changed on a page as well as a font for particular <rich:panelBarItem> content.

6.66.9. Relevant Resources Links

Here you can see the example of <rich:panelBar> usage and sources for the given example.