1 Reply Latest reply on Nov 2, 2008 11:58 AM by nbelaevski

    CDK compositions rendering issue

    suplizio

      I have used the CDK to create reusable components (specific to my purposes) that contain references to other components. Apparently, the CDK does not support component aggregations/compositions. How then can I interpret its output into an actual component tree?

      Why? I need to dynamically create each component at runtime based upon a complex rendering model. Any hints (besides abandoning the CDK path entirely), would be very, very helpful! Certainly someone has done something like this before, no?

      <?xml version="1.0" encoding="UTF-8"?>
      <f:root xmlns:f="http://ajax4jsf.org/cdk/template"
      xmlns:c=" http://java.sun.com/jsf/core"
      xmlns:ui=" http://ajax4jsf.org/cdk/ui"
      xmlns:u=" http://ajax4jsf.org/cdk/u"
      xmlns:x=" http://ajax4jsf.org/cdk/x"
      xmlns:h="http://java.sun.com/jsf/html"
      class="com.company.app.rp.renderkit.html.DateItemRenderer"
      baseclass="com.company.app.rp.renderkit.DateItemRendererBase"
      component="com.company.app.rp.component.UIDateItem">

      <!--
      Renders a Date object and converts it according to the date format.The UIDateItem
      class extends HtmlOutputText, so that it may inherit both the #setStyle #setStyleClass
      methonds, one of which is referenced below (component.style)
      @author chq-jasons
      @version 1.0
      @since JSF 1.2, JDK 1.5
      -->
      <f:clientid var="clientId" />
      <h:outputText value="#{component.date}" id="#{clientId}" x:passThruWithExclusions="value,id" style="#{component.style}}">
      <f:convertDateTime pattern="#{component.dateFormat}" />
      </h:outputText>
      <f:call name="writeClass"/>
      </f:root>

      The output rendered in the browser....
      <h:outputtext id="j_id16" style="">
      <f:convertdatetime/>
      </h:outputtext>



        • 1. Re: CDK compositions rendering issue
          nbelaevski

          Hi,

          CDK is not supporting that feature. You can code several methods creating and encoding necessary components and call them using f:call however that's definitely not a good way.

          I suggest that you abandon CDK and use Facelets templating for that.