I have a tree of "demos", when a "demo" is selecte...
# tornadofx
h
I have a tree of "demos", when a "demo" is selected I want to show the corresponding
View
. Would the following class make sense as the model for the items in my tree:
Copy code
data class Demo(val title: String, val view: KClass<out UIComponent>)

class DemoModel : ItemViewModel<Demo>() {
    val title: StringProperty = bind { SimpleStringProperty(item?.title) }
    val view: ObjectProperty<KClass<out UIComponent>> = bind { SimpleObjectProperty<KClass<out UIComponent>>(item?.view) }
}
When a demo is selected in the tree I could then
find(selecetedDemo.view)
to display the demo.