background image

The dataScroller Component Tag

<< Registering a Custom Renderer | Registering a Custom Component >>
<< Registering a Custom Renderer | Registering a Custom Component >>

The dataScroller Component Tag

By using the component family and renderer type to look up renderers for components, the
JavaServer Faces implementation allows a component to be rendered by multiple renderers and
allows a renderer to render multiple components.
Each of the attribute tags specifies a render-dependent attribute and its type. The attribute
element doesn't affect the runtime execution of your application. Instead, it provides
information to tools about the attributes the Renderer supports.
The object that is responsible for rendering a component (be it the component itself or a
renderer to which the component delegates the rendering) can use facets to aid in the rendering
process. These facets allow the custom component developer to control some aspects of
rendering the component. Consider this custom component tag example:
<d:dataScroller>
<f:facet name=
"header">
<h:panelGroup>
<h:outputText value=
"Account Id"/>
<h:outputText value=
"Customer Name"/>
<h:outputText value=
"Total Sales"/>
</h:panelGroup>
</f:facet>
<f:facet name=
"next">
<h:panelGroup>
<h:outputText value=
"Next"/>
<h:graphicImage url=
"/images/arrow-right.gif" />
</h:panelGroup>
</f:facet>
...
</d:dataScroller>
The dataScroller component tag includes a component that will render the header and a
component that will render the Next button. If the renderer associated with this component
renders the facets you can include the following facet elements in the renderer element:
<facet>
<description>This facet renders as the
header of the table. It should be a panelGroup
with the same number of columns as the data
</description>
<display-name>header</display-name>
<facet-name>header</facet-name>
</facet>
<facet>
<description>This facet renders as the content
of the
"next" button in the scroller. It should be a
panelGroup that includes an outputText tag that
has the text
"Next" and a right arrow icon.
</description>
Registering a Custom Renderer with a Render Kit
The Java EE 5 Tutorial · September 2007
456