I want to represent the data I have in a Tree and show it using TreeTableView. The items shown are wrapped in a case class:
case class Foo(name: StringProperty, desc:StringPropert) {
def this(_name: String, _desc: String) = this(StringProperty(_name), StringProperty(_dest))
}
Populating the tree is done asynchronously (calling an external program which takes time) via (basically):
val runner = Future {
// run command
}
runner onComplete {
case Success(ret) => // parse ret and update TreeTableView somehow
...
}
Since this is done async, I started with an empty node for the tree:
val ViewPkgs = new TreeItem[Foo](new Foo("root", "desc"))
...
val ViewTable = new TreeTableView[Foo](ViewPkgs) { columns ++= ... }
How do I update the list of packages from the async call above?
What I tried is creating a
val ViewBuf = ObservableBuffer[Foo]()
ViewPkgs.children = ObservableBuffer( ViewBuf.map { p => new TreeItem[Foo](p) } )
but that didn't help.
Thanks for any suggestions.