In Terra Duo, we have a tree view for displaying all the units and who's commanding who. Let me give you the concept behind the treeview.
Have all your elements stored as something. (Arrays, objects. We used arrays.) Each of these elements also needs to store it's parent in some way. If it's at the top of the tree, give it's parent a special value such as -1.
Now, to display your tree, you need a script. What this script will do is draw the specified element, then search through all other elements that have the specified element as a parent, and call itself specifying them. This way, you just need to call the script on the top element and it will draw out the entire tree. Now this can be a little slow and can lead to overlap, so it's not the ideal solution, but it is a simple one.