This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
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:
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.