HTML and CSS Reference
In-Depth Information
Figure 6-2. UML diagram of the UIComponent hierarchy
For our random text component we will extend the UIComponentBase class. That leaves us with only one method
to implement, i.e., getFamily() . Every component must have “Component Family” identifier. The identifier is used to
match components with renderers. Pairing of components and renderers is done in TLD as you will see in step 4.
As of JSF 2.0 you must annotate components with the @FacesComponent annotation. This saves you the hassle of
having to create a TagHandler as was required in prior versions of JSF. @FacesComponent requires a single value, the
“Component Type” identifier. This is similar to the “Component Family” identifier. The purpose of the “Component
Type” is to allow the JSF a pplication singleton to instantiate components based on its type at runtime. Based
on the code in Listing 6-3 it would be possible to instantiate a new UIComponent by executing the following code:
UIComponent myComp = context.getApplication().createComponent(RandomTextComponent.COMPONENT_TYPE);
Search WWH ::




Custom Search