R – Flex Tree Display Custom Data – DataDescriptor

apache-flextree

I am trying to have a tree display custom data that looks like this.

ID  DATA    PARENT  SORT
a   ...              10
aa  ...     a        10
ab  ...     a        20
b   ...              20
c   ...              30

It would look like this in xml

<root>
    <a>
        <aa/>
        <ac/>
    </a>
    <b/>
    <c/>
</root>

I don't want to translate it into XML. I want to tie in to Tree to have it display my data as a hierarchy. I've created a custom data descriptor (implements ITreeDataDescriptor2), and it doesn't quite work. It does display the nodes with the correct indentation, but it doesn't put the nodes inside of their parents

http://pastie.textmate.org/604675

alt text http://files.seanhess.net/trees.png

What do I need to implement / do to get this data to display? It seems like the problem is in the getHierarchicalCollectionAdaptor function, but I'm not really sure what to do. Any ideas?

Best Answer

Try extending DefaultDataDescriptor instead. In all likelihood you have a bug in your code. You will want to override the getChildren, hasChildren and isBranch methods.