1 Reply Latest reply on Feb 26, 2008 11:38 PM by Venkat

    Dynamic icons in rich tree

    Ashish Singh Newbie

      Hi Guys,

      I have a use case in which i need to show a tree containing hierarchal data.
      This tree can have N type of nodes.
      All of my nodes have same features except hierarchal data type and icon for the same.
      To achieve the same i am looking for following feature:
      1. Ability to define icon based on entity type by using one rich node tag. It should be able to evaluate the entity type on run time and then i will use entity type information to display icons for that entity(Using some component). As of now this can be achieved by using multiple tree nodes having different nodefaces which is bit restricting.
      2. Ability to change icon for tree node based on tree node state.
      These are different for iconExpanded and collapsed icons.
      For example we can consider tree component from swing/Ice faces.

      And good work guys :)

      Any help will be highly appreciated.
      Regards,
      Ashish

        • 1. Re: Dynamic icons in rich tree
          Venkat Newbie

           

          "toashishk" wrote:
          1. Ability to define icon based on entity type by using one rich node tag. It should be able to evaluate the entity type on run time and then i will use entity type information to display icons for that entity(Using some component). As of now this can be achieved by using multiple tree nodes having different nodefaces which is bit restricting.

          I don't understand what is restricting you.

          "toashishk" wrote:
          2. Ability to change icon for tree node based on tree node state.
          These are different for iconExpanded and collapsed icons.


          I have used below example code to achieve the functionality you mentioned above.
          <rich:tree switchType="client" value="#{leftNavigationBean.menuNode}" var="node" nodeFace="#{node.type}"
           componentState="#{leftNavigationBean.TreeState}" selectedClass="selectedTreeNode" id="Tree">
           <rich:treeNode type="menu-group" iconLeaf="/images/closed.gif" icon="/images/open.gif">
           <h:outputText value="#{node.value}" />
           </rich:treeNode>
          
           <rich:treeNode type="menu-item" icon="/images/page.gif">
           <h:commandLink value="#{node.value}" action="#{leftNavigationBean.go}">
           <f:param value="#{node.id}" name="menuId" />
           </h:commandLink>
           </rich:treeNode>
          </rich:tree>