0 Replies Latest reply on Oct 22, 2011 12:43 PM by David Wagner

    RF4 composite component using rich:tree?

    David Wagner Newbie

      I'm trying to create a composite component using facelets that contains a rich:tree element. The idea is that this component would encapsulate a course catalog (course name / class schedules). I want to be able to map the selectionChangeListener attribute in as a parameter. I'd also like to be able to expose the base node and leaf node selection events so that I can attach different handlers in different contexts. I have a non-component version of this arrangement working, but it would be easier to reuse as a component.

       

      So the component looks like this:

       

      <cc:interface>

        <cc:attribute name="selectionChangeListener" method-signature="void listener()" required="true" />

        <cc:attribute name="render" required="false"  targets="courses"/>

        <cc:attribute name="execute" required="false"  targets="courses" default="@this"/>

        <cc:actionSource name="courses" />

      </cc:interface>

       

      <cc:implementation>

      <h:panelGrid columns="1">

        <h:outputLabel for="term" value="operating year" />

        <rich:select id="term" value="#{opYear.year}" listWidth="30">

        <f:selectItems value="#{opYear.yearOptions}" />

        <a4j:ajax event="click" execute="@this" render="courses" />

        </rich:select>

       

                <h:panelGroup layout="block" style="height:300px;overflow:scroll;">

        <rich:tree id="courses" var="node" nodeType="#{node.type}"

        toggleType="client" 

        render="#{cc.attrs.render}" execute="#{cc.attrs.execute}"

        value="#{courseTree.courseOptions}"

        selectionChangeListener="#{cc.attrs.selectionChangeListener}">

       

        <rich:treeNode id="bcn" type="baseCourse">

                                                        <b>#{node.name}</b>

        </rich:treeNode>

        <rich:treeNode id="cin" type="courseInstance">

                                                        <i>#{node.name}</i>

        </rich:treeNode>

       

        </rich:tree>

        </h:panelGroup>

      </h:panelGrid>

       

      </cc:implementation>

       

      The mapped bean has the selectionChangeListener method:

       

      public void chooseCourse(TreeSelectionChangeEvent e) {

                          trace().info("chooseCourse...");

           ...


       

      So the problem is that the selectionChangeListener is not being called. The component renders the tree ok (no more compile or execute errors), but nothing happens on click.

      I'm only guessing about the "method-signature" idiom in the interface. Is this even documented anywhere? Where would I even look for help?

       

      Thanks in advance if anybody knows how this works.