X

The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

How-to determine the ADF tree node type using EL

Frank Nimphius
Master Principal Product Manager
Creating an ADF tree in ADF produces an entry similar to this in the PageDef file of the view.
<tree IterBinding="AllCountriesIterator" id="AllCountries">
   <nodeDefinition
      DefName="oracle.summit.model.views.CountryVO" Name="AllCountries0">

     <AttrNames>
       <Item Value="Country"/>
    </AttrNames>
     <Accessors>
    <Item Value="CustomerVO"/>
  </Accessors>
  </nodeDefinition>
   <nodeDefinition
      DefName="oracle.summit.model.views.CustomerVO" Name="AllCountries1"

      TargetIterator="${bindings.AllCustomersIterator}">
      <AttrNames>
        <Item Value="Id"/>
        <Item Value="Name"/>
     </AttrNames>
</nodeDefinition>
</tree>

Notice the DefName attribute on each node containing a reference to the actual View Object instance used to render a specific node.

With this information you can now use EL to render the tree nodes differently. For example, the page source below renders the node as a command link if the node presents a customer. For Countries, the node is simply rendered as an output text.
<af:tree value="#{bindings.AllCountries.treeModel}" var="node" ...>
  <f:facet name="nodeStamp">
    <af:group id="g1">
      <af:commandLink id="cl4" text="#{node}"                                                                            
                 rendered="#{node.hierTypeBinding.viewDefName == 
                                       'oracle.summit.model.views.CustomerVO'}"
      .../>
     
<af:outputText id="ot4" value="#{node}"                                                                              
               rendered="#{node.hierTypeBinding.viewDefName ==
                                     'oracle.summit.model.views.CountryVO'}"/>
    </af:group>
  </f:facet>
</af:tree>      
The EL expression  #{node.hierTypeBinding.viewDefName} returns the name of the node type, which in ADF is the absolute name of the collection instance rendering the node.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.