2 Replies Latest reply on Jul 21, 2009 5:02 PM by meghiddo

    I ave two Objects, need to bind to tree and still show owner

      I really need some help here.

      I have a ProjectHolder Object that holds just one String value - projectName.

      Then I have a DeviceHolder Object that holds a String for deviceName and a List that holds a List of channels for that Device.

      I need to create a tree that has the ProjectHolder projectNames as the roots, which is easy enough and I dont neeed help with that.

      But then under each projectName I need to have the DeviceHolder Object that belongs to that project as the branch underneath it.

      In other words:

      ProjectHolder Object 1
      --DeviceHolder Object 1-1
      --DeviceHolder Object 1-2
      ProjectHolder Object 2
      --DeviceHolder Object 2-1
      --DeviceHolder Object 2-2

      etc

      Is this possible? Can I have two separate Objects bound to my tree and makea way so it knows which DeviceHolder Object belongs to which ProjectHolder Object?

        • 1. Re: I ave two Objects, need to bind to tree and still show o

          Im looking at something like:


          <rich:tree>
           <rich:treeNodesAdaptor nodes="#{projectBean.projects}" var="project">
           <rich:treeNode>
           <h:outputText value="#{project.projectName}" />
           </rich:treeNode>
           <rich:recursiveTreeNodesAdaptor roots="#{deviceBean.devices}" var="device">
           <rich:treeNode>
           <h:outputText value="#{device}" />
           </rich:treeNode>
           <rich:recursiveTreeNodesAdaptor roots="#{device.channelsList}" var="channel">
           <rich:treeNode>
           <h:outputText value="#{channel}" />
           </rich:treeNode>
           </rich:recursiveTreeNodesAdaptor>
           </rich:recursiveTreeNodesAdaptor>
           </rich:treeNodesAdaptor>
           </rich:tree>


          I mean that will make a tree, but will it have the correct order and list the correct set of devices and channels under the correct project?

          If not is there a way to make it recognize this?

          • 2. Re: I ave two Objects, need to bind to tree and still show o

            no that wont do it, I get a bunch of projects, but under each one every single device gets listed, not just the devices belonging to the project....the channels are right though...