tornadofx / tornadofx / populateTree


fun <T> populateTree(item: TreeItem<T>, itemFactory: (T) -> TreeItem<T>, childFactory: (TreeItem<T>) -> Iterable<T>?): Unit

Add children to the given item by invoking the supplied childFactory function, which converts a TreeItem&lt;T> to a List&lt;T>?.

If the childFactory returns a non-empty list, each entry in the list is converted to a TreeItem&lt;T> via the supplied itemProcessor function. The default itemProcessor from TreeTableView.populate and TreeTable.populate simply wraps the given T in a TreeItem, but you can override it to add icons etc. Lastly, the populateTree function is called for each of the generated child items.