JBoss.orgCommunity Documentation

Chapter 10. Panels and containers

10.1. <rich:panel>
10.1.1. Basic usage
10.1.2. Adding a header
10.1.3. Reference data
10.2. <rich:accordion>
10.2.1. Basic usage
10.2.2. Switching panels
10.2.3. <rich:accordion> client-side events
10.2.4. <rich:accordion> server-side events
10.2.5. Reference data
10.2.6. <rich:accordionItem>
10.3. <rich:collapsiblePanel>
10.3.1. Basic usage
10.3.2. Expanding and collapsing the panel
10.3.3. Appearance
10.3.4. <rich:collapsiblePanel> server-side events
10.3.5. Reference data
10.4. <rich:popupPanel>
10.4.1. Basic usage
10.4.2. Showing and hiding the pop-up
10.4.3. Modal and non-modal panels
10.4.4. Size and positioning
10.4.5. Contents of the pop-up
10.4.6. Header and controls
10.4.7. Reference data
10.5. <rich:tabPanel>
10.5.1. Switching panels
10.5.2. <rich:tabPanel> client-side events
10.5.3. <rich:tabPanel> server-side events
10.5.4. Reference data
10.5.5. <rich:tab>
10.6. <rich:togglePanel>
10.6.1. Basic usage
10.6.2. Toggling between components
10.6.3. Reference data
10.6.4. <rich:toggleControl>
10.6.5. <rich:togglePanelItem>

Documentation in development

Some concepts covered in this chapter may refer to the previous version of Richfaces, version 3.3.3. This chapter is scheduled for review to ensure all information is up to date.

This chapter details those components which act as panels and containers to hold groups of other components.

The <rich:panel> component is a bordered panel with an optional header.

Figure 10.1. <rich:panel>


The <rich:accordion> is a series of panels stacked on top of each other, each collapsed such that only the header of the panel is showing. When the header of a panel is clicked, it is expanded to show the content of the panel. Clicking on a different header will collapse the previous panel and epand the selected one. Each panel contained in a <rich:accordion> component is a <rich:accordionItem> component.

Figure 10.3. A <rich:accordion> component containing three <rich:accordionItem> components


The <rich:collapsiblePanel> component is a collapsible panel that shows or hides content when the header bar is activated. It is a simplified version of <rich:togglePanel> component.

Figure 10.4. <rich:collapsiblePanel>


The <rich:popupPanel> component provides a pop-up panel or window that appears in front of the rest of the application. The <rich:popupPanel> component functions either as a modal window which blocks interaction with the rest of the application while active, or as a non-modal window. It can be positioned on the screen, dragged to a new position by the user, and re-sized.

If show="true" then the pop-up panel will display when the page is first loaded.

The <rich:popupPanel> component can be shown and hidden manually using the show() and hide() methods from the JavaScript API. These can be implemented using two different approaches:

For explicit referencing when using the functions, the component can be given an id identifier. The component can, however, be referenced using other means, such as through a selector.

Example 10.2, “<rich:popupPanel> example” demonstrates basic use of both the <rich:componentControl> component and the rich:component function to show and hide the <rich:popupPanel> component.


The pop-up panel can be both re-sized and re-positioned by the user. The minimum possible size for the panel can be set with the minWith and minHeight attributes. These abilities can be deactivated by setting resizable or movable to false as necessary.

The pop-up panel can be automatically sized when it is shown if the autosized attribute is set to true.

The <rich:popupPanel> component is usually rendered in front of any other objects on the page. This is achieved by attaching the component to the <body> element of the page, and setting a very high "z-index" (the stack order of the object). This approach is taken because relatively-positioned elements could still overlap the pop-up panel if they exist at higher levels of the DOM hierarchy, even if their z-index is less than the <rich:popupPanel> component. However, to avoid form limitation of the pop-up panel on pages where no such elements exist, the <rich:popupPanel> component can be reattached to its original DOM element by setting domElementAttachment to either parent or form.

Embedded objects inserted into the HTML with the <embed> tag will typically be rendered in front of a <rich:popupPanel> component. The <rich:popupPanel> component can be forcibly rendered in front of these objects by setting overlapEmbedObjects="true".

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 10.5.5, “<rich:tab>” for further details on the <rich:tab> component.

Figure 10.6. A <rich:tabPanel> component containing three <rich:tab> components


Form elements required

All <rich:tabPanel> components should be wrapped in a form element so that the contents of the tab are processed correctly during a tab change in either ajax or server mode.

Alternatively, the contents of a <rich:tab> component within the <rich:tabPanel> component could be wrapped in a form element, such that they will be processed using the inner submitting component only. In this case, the <rich:tabPanel> component will automatically add form tags around the tab's contents, and the contents will not be processed during switching.

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.

The <rich:togglePanel> component is a wrapper for multiple <rich:togglePanelItem> components. Each child component is displayed after being activated with the <rich:toggleControl> behavior.

Refer to Section 10.6.4, “<rich:toggleControl>” and Section 10.6, “<rich:togglePanel>” for details on how to use the components together.

The <rich:togglePanel> component is used as a base for the other switchable components, the <rich:accordion> component and the <rich:tabPanel> component. It provides an abstract switchable component without any associated markup. As such, the <rich:togglePanel> component could be customized to provide a switchable component when neither an accordion component or a tab panel component is appropriate.

The <rich:toggleControl> behavior can be attached to any interface component. It works with a <rich:togglePanel> component to switch between different <rich:togglePanelItem> components.

Refer to Section 10.6, “<rich:togglePanel>” and Section 10.6.5, “<rich:togglePanelItem>” for details on how to use the components together.