aspose file tools*
The moose likes JSF and the fly likes Advice on Object data types to use for the rich:tree I am trying to create Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Advice on Object data types to use for the rich:tree I am trying to create" Watch "Advice on Object data types to use for the rich:tree I am trying to create" New topic
Author

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

Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

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;
???

True wisdom is in knowing you know nothing - Socrates
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

As rich:tree is a JSF concept, I've moved this post to the JSF forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Advice on Object data types to use for the rich:tree I am trying to create