RichFaces CDK faces-config extensions

    The RichFaces CDK extension elements have namespache http://richfaces.org/cdk/extensions and its default prefix is 'cdk:'. These extensions defined in the appropriate XML schema ( not included with ALPHA1 release ). In this article, all tags are given as example.

    Top level extension:

     

            <cdk:function>
                <description>Long, long description</description>
                <display-name>test string</display-name>
                <cdk:function-class>org.richfaces.cdk.test.functions.TestFunctions</cdk:function-class>
                <cdk:function-name>testString</cdk:function-name>
                <cdk:function-signature>java.lang.String testString(java.util.List&lt;java.lang.String&gt;,char)</cdk:function-signature>
            </cdk:function>
            <cdk:faces-event>
            </cdk:faces-event>
            <cdk:prefix>org.richfaces</cdk:prefix>
            <cdk:taglib>
            </cdk:taglib>
    
    

     

    Application extension:

    Component extension:

    <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xi="http://www.w3.org/2001/XInclude"
        xmlns:cdk="http://richfaces.org/cdk/extensions"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
        version="2.0">
    ..............................
        <component>
       .... standard component elements ....
        <component-extension>
            <cdk:base-class>foo.Bar</cdk:base-class>
            <cdk:generate>true</cdk:generate>        <cdk:component-family>foo.Family</cdk:component-family>
            <cdk:renderer-type>org.richfaces.cdk.TestPanelRenderer</cdk:renderer-type>
            <cdk:tag>
                 <cdk:tag-name>testPanel</cdk:tag-name>
                 <cdk:handler-class>...</cdk:handler-class>
                 <cdk:base-class>...</cdk:base-class>
                 <cdk:generate>true</cdk:generate>
                 <cdk:tag-type>Facelets</cdk:tag-type><!-- Jsp -->
            </cdk:tag>
        </component-extension>
     </component>
    </faces-config>
     

    <cdk:generate> tells CDK to generate concrete component class ( base UI... or renderer-specific ).

    <cdk:base-class> defines superclass of the generated component class ( which name is taken form standard <component-class> tag )

    <cdk:component-family> defines component family used in the generated class.

     

    Attribute extensions:

    <component>
        <property>
            <description><![CDATA[test2 property]]></description>
            <display-name>test2 event property</display-name>
            <icon>ontest2.png</icon>
            <property-name>ontest2</property-name>
            <property-class>int</property-class>
            <default-value>3</default-value>
            <suggested-value>15</suggested-value>
            <property-extension>
                <cdk:literal>true</cdk:literal>
                <cdk:generate>true</cdk:generate>
                <cdk:hidden>true</cdk:hidden>
                <cdk:required>true</cdk:required>
                <cdk:pass-through>true</cdk:pass-through>
                <cdk:event-name>ontest2</cdk:event-name>
                <cdk:event-name default="true">action</cdk:event-name>
                <cdk:signature>
                   <cdk:return-type>void</cdk:return-type>
                   <cdk:param>boolean</cdk:param>
                   <cdk:param>java.lang.String</cdk:param>
                </cdk:signature>
                <cdk:aliasFor>foo</cdk:aliasFor>
            </property-extension>
        </property>
    </component>
    

     

    <aliasFor>  defines this property as alias for another. CDK will generate getters/setters for that property which delegate calls to the original attribute methods.

    <literal> if true, no EL-expressions are allowed for this attribute.

    <event-name> defines behavior event name for this attribute.

    <hidden> attributes are not presented in the tag.

    <signature> defines Java method signature for attributes that holds MethodExpression objects.

    <generate>  forces CDK to generate attribute getter/setter methods.

     

    Facet extensions:

              <facet>
                   <description>Header facet</description>
                   <facet-name>header</facet-name>
                   <facet-extension>
                      <cdk:generate>true</cdk:generate>
                   </facet-extension>
              </facet>
    

    <generate>  forces CDK to generate getter/setter methods for facet. In the example above these methods will be generated:

    public UIComponent getHeader(){
              return getFacets().get("header");
    }
    public void setHeader(UIComponent header){
              getFacets().put("header",header);
    }
    

    RenderKit extension:

    Renderer extension:

           <renderer>
               ..........................
                <renderer-extension>
                    <cdk:renders-children>true</cdk:renders-children>
              </renderer-extension>
           </renderer>
    
    

     

     

    Converter:

     

    Behavior