11.5. <rich:tabPanel>
The
<rich:tabPanel> component provides a set of tabbed panels for displaying one panel of content at a time. The tabs can be highly customized and themed. Each tab within a <rich:tabPanel> container is a <rich:tab> component. Refer to Section 11.5.7, “<rich:tab>” for further details on the <rich:tab> component.
Note
All
<rich:tabPanel> components should be wrapped in a form element when using either ajax or server mode, as usual for submitting components.
11.5.1. Switching panels
The
activeItem attribute holds the active tab name. This name is a reference to the name identifier of the active child <rich:tab> component.
The switching mode for performing submissions is determined by the
switchType attribute, which can have one of the following three values:
server- The default setting. Activation of a
<rich:tab>component causes the parent<rich:tabPanel>component to perform a common submission, completely refreshing the page. Only one tab at a time is rendered to the client side. ajax- Activation of a
<rich:tab>component causes the parent<rich:tabPanel>component to perform an Ajax form submission, and the content of the tab panel is refreshed. Only one tab at a time is rendered to the client side. client- Activation of a
<rich:tab>component causes the parent<rich:tabPanel>component to update on the client side. All the tabs are rendered to the client during the initial page render. JavaScript changes the styles such that one tab becomes hidden while the other is shown.
11.5.2. <rich:tabPanel> client-side events
In addition to the standard Ajax events and HTML events, the
<rich:tabPanel> component uses the client-side events common to all switchable panels:
- The
itemchangeevent points to the function to perform when the switchable item is changed. - The
beforeitemchangeevent points to the function to perform when before the switchable item is changed.
11.5.3. <rich:tabPanel> server-side events
The
<rich:tabPanel> component uses the server-side events common to all switchable panels:
- The
ItemChangeEventevent occurs on the server side when an item is changed through Ajax using theservermode. It can be processed using theItemChangeListenerattribute. Refer to Section 11.6.6, “<rich:itemChangeListener>” for details on the<rich:itemChangeListener>tag.
11.5.4. JavaScript API
The
<rich:tabPanel> component can be controlled through the JavaScript API. The JavaScript API provides the following functions, which are common to all switchable panels:
getItems()- Return an array of the tabs contained in the tab panel.
getItemsNames()- Return an array of the names of the tabs contained in the tab panel.
switchToItem(itemName)- Switch to and display the item identified by the
itemNamestring passed as a parameter. firstItem(),prevItem(),nextItem(),lastItem()- Get the name of the first item, the previous item, the next item, or the last item.
11.5.5. Reference data
component-type:org.richfaces.TabPanelcomponent-class:org.richfaces.component.UITabPanelcomponent-family:org.richfaces.TabPanelrenderer-type:org.richfaces.TabPanelRendererhandler-class:org.richfaces.view.facelets.html.TogglePanelTagHandler
11.5.6. Style classes and skin parameters
Table 11.5. Style classes (selectors) and corresponding skin parameters
| Class (selector) | Skin Parameters | Mapped CSS properties |
|---|---|---|
| panelBorderColor
|
border
|
tabBackgroundColor
|
background-color
| |
generalTextColor
|
color
| |
| additionalBackgroundColor
|
background-color
|
| No skin parameters. | |
| tabDisabledTextColor
|
color
|
| additionalBackgroundColor
|
background-color
|
panelBorderColor
|
border-color
| |
| No skin parameters. | |
| panelBorderColor
|
border-bottom
|
| generalFamilyFont
|
font-family
|
generalSizeFont
|
font-size
| |
| No skin parameters. | |
| additionalBackgroundColor
|
background
|
panelBorderColor
|
border
| |
generalFamilyFont
|
font-family
| |
generalSizeFont
|
font-size
| |
| additionalBackgroundColor
|
background
|
panelBorderColor
|
border
| |
generalFamilyFont
|
font-family
| |
| tabBackgroundColor
|
background
|
panelBorderColor
|
border
| |
| generalBackgroundColor
|
background
|
panelBorderColor
|
border
| |
generalFamilyFont
|
font-family
| |
generalSizeFont
|
font-size
| |
11.5.7. <rich:tab>
The
<rich:tab> component represents an individual tab inside a <rich:tabPanel> component, including the tab's content. Clicking on the tab header will bring its corresponding content to the front of other tabs.
11.5.7.1. Basic usage
Basic usage of the
<rich:tab> component requires only the tab header and tab content. No additional attributes are required.
The
header attribute provides the text on the tab header. The content of the tab is then detailed inside the <rich:tab> tags.
Alternatively, the
header facet could be used in place of the header attribute. This would allow custom components to be applied to the tab header. The component also supports three facets to customize the appearance depending on the current state of the tab:
headerActivefacet- This facet is used when the tab is the currently active tab.
headerInactivefacet- This facet is used when the tab is not currently active.
headerDisabledfacet- This facet is used when the tab is disabled.
The
header facet is used in place of any state-based facet that has not been defined.
11.5.7.2. Switching tabs
The switching mode for performing submissions can be inherited from the
switchType attribute of the parent <rich:tabPanel> component, or set individually for each <rich:tab> component. Refer to Section 11.5, “<rich:tabPanel>” for details on the switchType attribute.
An individual tab can be disabled by setting
disabled="true". Disabled tabs cannot be activated or switched to.
11.5.7.3. <rich:tab> client-side events
In addition to the standard HTML events, the
<rich:tab> component uses the client-side events common to all switchable panel items:
- The
enterevent points to the function to perform when the mouse enters the tab. - The
leaveattribute points to the function to perform when the mouse leaves the tab.
11.5.7.4. Reference data
component-type:org.richfaces.Tabcomponent-class:org.richfaces.component.UITabcomponent-family:org.richfaces.Tabrenderer-type:org.richfaces.TabRenderer
11.5.7.5. Style classes and skin parameters
The
<rich:tab> component uses the same styles as those applied to the parent <rich:tabPanel> component. Refer to Section 11.5.6, “Style classes and skin parameters” for details.
