Please help me understand ViewModel, UiComponent a...
# tornadofx
m
Please help me understand ViewModel, UiComponent and Scope interactions. I have a View containing an ListView and its items are rendered in Fragments. Those fragments are actually buttons that when clicked, should open a tab inside a completely different View and pass on their model to that tab. What's the best practise here? This is as far as I got basically: Fragment:
Copy code
//inside the Button Fragment
...
setOnMouseClicked {
  find<TabPaneView>().openTab(persistentFolder) //persistentFolder is my Model bound to the Fragment
}
...
TabPaneView:
Copy code
class TabPaneView : View("Logs") {
  override val root = tabpane {
    tabClosingPolicy = TabPane.TabClosingPolicy.ALL_TABS
  }

  fun openTab(persistentFolder: PersistentFolderModel) {
    root.tab(persistentFolder.nameProperty.value) {

    }
  }
}
I don't know if this is the way to go here. Ideally I'd like to create a Fragment that holds a Tab as its root but that seems impossible since Tab can't be a root element.