• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Advice on Object data types to use for the rich:tree I am trying to create

 
Village Idiot
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a tree that is layed out this way:

-project 1
---device 1
------channel 1-1
------channel 1-2
---device 2
------channel 2-1
---device 3
-project2
--etc
------etc

I have this working right now as far as the project name and the device List. I have an Object (ProjectHolder) with a String variable projectName; and a List variable devicesList;. I can get a tree out of it that shows my projects, and the devices that belong to each underneath it.

Here is the code for the tree:


Now I need to do the channels as well. I was planning to do it the same way I did devices, by making a channelsList, and then including it within the devicesList node there.

But now I realize this will give me a tree that has the project with the correct devices listed, but under each device it is going to list every single channel from each device under each device (contained within the project). So my tree would end up this way if I am correct:


-project 1
---device 1
------channel 1-1
------channel 1-2
------channel 2-1
---device 2
------channel 1-1
------channel 1-2
------channel 2-1
---device 3

I need to figure out what data type to use that will show ownership between devices and channels, and that will still work when I try to iterate through it within the tree.

I was thinking of using Map<Device, String>
but I don't know if this will work with the tree the way I want it to or not. So can anyone suggest the best way to do this? At first I thought I could quickly do it just following the same format I did for projects and devices, but I don't think that is going to work.

All I need is a suggestion for how my ProjectHolder Object should change.

In other words instead of using:

String projectName;
List<String> devicesList;
List<String> channelsList;

I should use:

String projectName;
???
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As rich:tree is a JSF concept, I've moved this post to the JSF forum.
 
reply
    Bookmark Topic Watch Topic
  • New Topic