How to Create a Class for a Renderer

Creating Custom ADF Faces Components 30-35 Example 30–22 tagPane acme.tld Tag Library Descriptor Code ?xml version = 1.0 encoding = UTF-8? taglib xmlns:xsi=http:www.w3.org2001XMLSchema-instance xsi:schemaLocation=http:java.sun.comxmlnsjavaee http:java.sun.comxmlnsjavaeeweb-jsptaglibrary_2_1.xsd version=2.1 xmlns=http:java.sun.comxmlnsjavaee descriptionAcme Corporation JSF componentsdescription display-nameacmedisplay-name tlib-version1.0tlib-version short-nameacmeshort-name urihttp:oracle.adfdemo.acmeuri tag description description nametagPanename tag-classoracle.adfdemo.acme.faces.taglib.TagPaneTagtag-class body-contentJSPbody-content attribute nameidname rtexprvaluetruertexprvalue attribute attribute namerenderedname deferred-value typebooleantype deferred-value attribute attribute nametagSelectListenername deferred-method method-signaturevoid method-signature myMethodoracle.adfdemo.acme.faces.event.TagSelectEvent deferred-method attribute attribute namevisiblename deferred-value typebooleantype deferred-value attribute attribute namepartialTriggersname deferred-value deferred-value attribute attribute nameinlineStylename deferred-value attribute attribute nameinlineClassname deferred-value attribute attribute nametagsname deferred-value attribute attribute namebindingname 30-36 Web User Interface Developers Guide for Oracle Application Development Framework deferred-value attribute attribute nameorderByname deferred-value attribute tag taglib

30.4.11 How to Create a Resource Loader

A resource loader is required only if the custom component has image files needed for the components skinning. The images files are packaged into the JAR project so that the consumer of the component library will need to include the JAR into the class path of their web project and add a few entries into their web deployment descriptor file web.xml. The rich client framework uses a resource servlet to deliver images. You need to register this servlet in the web.xml file and then create the resource loader class. A component library requires a resource loader that is auto-loaded by the resource servlet. You create a URL pattern folder mapping for the servlet, which will be used to locate and identify resources within your custom component library. To create a resource loader class: 1. In the Application Navigator, right-click the project and select New. 2. In the New Gallery, expand General and select Java. 3. Select Java Class and click OK. 4. In the Create Java Class File dialog, do the following: ■ Name : Enter a resource loader name. For example, for the tagPane component, you might enter AcmeResourceLoader. ■ Package : Enter a name for the package. For example, for the tagPane component, you might enter oracle.adfdemo.acme.faces.resources. ■ Extends : Enter a name for the class that the tag extends. For example, for the tagPane component, you would enter org.apache.myfaces.trinidad.resource.RegexResourceLoader. ■ In the Optional Attributes section, select the following:. – In the Access Modifiers section, select public. – At the bottom, select Constructors from Superclass and Implement Abstract Methods . 5. In the source editor, register regular expressions that map to more specific resource loaders. For example, you might create an expression that maps image resources located under an images directory. Example 30–23 shows the expression for the tagPane component that maps the acmeimages directory located relative to the META-INF folder of the custom component JAR. As a result of the registration, the custom component images should be located under META-INFacmeimages. Example 30–23 Resource Loader for the tagPane Component public class AcmeResourceLoader extends RegexResourceLoader {