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