glazedlists: how to create a transformed list that has the original list items + associated derived items

StackOverflow https://stackoverflow.com/questions/7040242

  •  23-12-2020
  •  | 
  •  

Pregunta

I have an EventList list1 of parent items.

I want to make a one-way-transform this into a TreeList in the following manner:

Some of the parent items have child items, and I need to create an intermediate list list2 of items containing parent and child, so that I can then create a TreeList from list2 (that I know how to do).

so for example, if list1 = {foo1, foo2, foo3, foo4, foo5} and foo2 is the parent of foo2a and foo2b, and foo5 is the parent of foo5a, foo5b, and foo5c, I need to somehow transform list1 into

list2 = {foo1, foo2, foo2a, foo2b, foo3, foo4, foo5, foo5a, foo5b, foo5c }.

How can I do this? I don't have much experience w/ transformed lists.

(Or can I just bypass it and turn a list of parent items into a TreeList?)

Please help, I'm having a brain cramp :/

(apologies, I posted to the glazedlists user forum yesterday but for some reason my posting permission has been screwed up and it never got sent out)

¿Fue útil?

Solución

TreeList works best when the source list contains the leaf (child) nodes. You might get what you're looking for in CollectionList.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top