Anybody an idea how i preserve my selection state ...
# tornadofx
d
Anybody an idea how i preserve my selection state from a treeView between "docks" from the workspaces? I though i could get the selectionModel in the cellDecorater and then select the vlaue which lies in my item from the ItemViewModel - but this doesnt works out.. or could it be the decorater ? I got a "master/detail" setup and in both docks the "master" is the treeView .. from the detail i know that the ItemViewModel contains the correct value - just
Copy code
selectionModel.select(TreeItem(treeNodeViewModel.item))
does not seelct the item .. the item itself has an autogenerated UUID on which the equals method checks against - or should. My TreeView itself is a fragment and i open the dock via
Copy code
val master = find<ProjectStructureFragment>()
val detail = find<ProjectStructureEditorView>()
workspace.dock(MasterDetailView(master,detail))
And because i use no where any scope - i should not need to use scope right? its everywhere the "default scope" i think In the MasterDetailView is again a Fragment actually which root is a splitpane and will add the two arguments It seems to me somehow i am not able to select the node again.. but if i got the implementation right, javafx will try to find the node based on the TreeNode.value But wenn i select Entry A in one Dock and Entry B in another, the selected values in the docks are saved when i go back and forth - so somehow it remembers the selectionState - but not from the ItemViewModel ?
Finally solved it..
Copy code
if (item.uuid == treeNodeViewModel.item.uuid) {
 selectionModel.select(index)
}
within the cellDecorater of the listview and in the onDock of the composed view i trigger a render event so the listView will render itself again because when i make the master/treeview a view it will dissappear on the back button .. i think because the other docked view now has it