6.67.  < rich:panelBarItem >

6.67.1. Description

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

<rich:panelBarItem> component

Figure 6.171.  <rich:panelBarItem> component


6.67.2. Key Features

  • Highly customizable look and feel

  • Groups any content inside each Panels

Table 6.339. rich : panelBarItem 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
headerClassThe component header style class
headerClassActiveThe component header style class active
headerStyleThe component header style
headerStyleActiveThe component header style active
idEvery component may have a unique id that is automatically created if omitted
labelLabel text appears on a panel item header
nameAttribute defines item name
onenterEvent must occurs on than item has been entered
onleaveEvent must occurs on than item has been leaved
renderedIf "false", this component is not rendered

Table 6.340. Component identification parameters

NameValue
component-typeorg.richfaces.PanelBarItem
component-classorg.richfaces.component.html.HtmlPanelBarItem
component-familyorg.richfaces.PanelBarItem
renderer-typeorg.richfaces.PanelBarItemRenderer
tag-classorg.richfaces.taglib.PanelBarItemTag

6.67.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.67.4. Creating the Component Dynamically Using Java

Example:


import org.richfaces.component.html.HtmlPanelBarItem;
...
HtmlPanelBarItem myBarItem = new HtmlPanelBarItem();
...

6.67.5. Details of Usage

The "label" attribute defines text to be represented. If you can use the "label" facet, you can even not use the "label" attribute.

Example:


...
    <rich:panelBarItem...>
        <f:facet name="label">  
            <h:graphicImage value="/images/img1.png"/>
        </f:facet>
        ...
        <!--Any Content inside-->
        ...
    </rich:panelBarItem>
...

As it was mentioned above, panelBarItem is used for grouping any content inside within one panelBar, thus its customization deals only with specification of sizes and styles for rendering.

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.

6.67.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:panelBarItem> components at once:

  • Redefine the corresponding skin parameters

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

6.67.7. Skin Parameters Redefinition

Table 6.341. Skin parameters redefinition for a content

Skin parametersCSS properties
generalTextColorcolor
preferableDataSizeFontfont-size
preferableDataFamilyFontfont-family

Table 6.342. Skin parameters redefinition for a header element (active or inactive)

Skin parametersCSS properties
headerTextColorcolor
headerBackgroundColorbackground-color
headerSizeFontfont-size
headerWeightFontfont-weight
headerFamilyFontfont-family

6.67.8. Definition of Custom Style Classes

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

Style classes

Figure 6.172. Style classes


Table 6.343. Classes names that define a component appearance

Class nameClass description
rich-panelbar-headerDefines styles for a wrapper <div> element of a header element
rich-panelbar-header-actDefines styles for a wrapper <div> element of an active header element
rich-panelbar-contentDefines styles for a content

Table 6.344. Style component classes

A class attributeA component element defined by an attribute
headerClassApplicable to a header element
contentClassApplicable to a content

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

CSS code piece used on a page:

Example:


...
    
.rich-panelbar-header{
        
font-size:14px;
    
}
    
.myClass{
        
font-style:italic;
    
}
...

The component is defined in the following way:

Example:


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

Hence, a font size of all <rich:panelBarItem> headers is changed on a page as well as a font for the particular <rich:panelBarItem> content.