• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is it possible to use List<java Object> and bind it to my rich:tree rather than List<Sring>?  RSS feed

 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is one main question here, and then others that are followups depending on the answer to this, so I will ask the big question first -

Is it possible to use Collections that are loaded with java Objects rather than String variables to bind to my rich:tree? I know I can bind a List loaded with String values to my tree and have it display, but can I use a List that is loaded with java Objects and have it also display a tree somehow?

If you don't understand what I am trying to ask just read on

I have been looking at various things, and so far all I have been able to get to display a tree is a List full of String values.

Now if I load this List with the actual java Object itself, including all the variables within that Object of course, where the tree should be is a blank space. There may be a problem with how I am doing my rich:tree tag attributes and such so my first question is - if I have a List loaded with java Objects, and those Objects have two String variables - name and device, is there a way to bind this List to a rich:tree, and have it use the name String variable as the root and the device String variable as the nodes under each root? I have tried many variations but there are just so many different ways to try this I figured it would be better to ask here and hope someone answers.

And, if that is not possible, I was also looking at the TreeNodeImple data type. Now in the examples I have seen it uses String values like this:




but is it possible to replace String with my Project Object and still have that work (like I have been trying to do with List), like this:



And if so, then the same question I had for the List data type, how can I bind this to the rich:tree correctly so it uses the name String variable from Project as the root and the device String variable as the node?

But all this hinges on the question, is it possible to use Collections loaded with Objects rather than Strings as the variable I bind to the rich:tree?


edit - here is an idea of how I have been trying to bind this stuff to my jsf page (projectTreeNode is a TreeNodeImpl data type):

 
Jason Irwin
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not used rich:tree, but I am doing a similar thing with rich:dataTable. So long as the <Object> has explicit getters and setters, it will simply work. So in your example, "Project" would need to have a public "getName()" and "getDevice()".

What you cannot seem to do is pass parameters into the EL #{project.value('something')}. There may be a way around this, but I have not needed to investigate it.

J.
 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well if it is possible, then the problem is how I am binding it to the rich:tree tag. I will just have to keep trying different variations till it works I guess
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!