mirror of
https://github.com/corda/corda.git
synced 2024-12-21 13:57:54 +00:00
explorer: Use built-in row selection observable instead of custom one
This commit is contained in:
parent
0dae8e9f68
commit
f4de05c982
@ -177,7 +177,13 @@ class CashViewer : View() {
|
||||
class Selected(val node: ViewerNode) : ViewerNodeSelection()
|
||||
}
|
||||
|
||||
val selectedViewerNode = SimpleObjectProperty<ViewerNodeSelection>(ViewerNodeSelection.None)
|
||||
val selectedViewerNode = Bindings.createObjectBinding({
|
||||
if (cashViewerTable.selectionModel.selectedItems.size == 0) {
|
||||
ViewerNodeSelection.None
|
||||
} else {
|
||||
ViewerNodeSelection.Selected(cashViewerTable.selectionModel.selectedItems[0].value)
|
||||
}
|
||||
}, arrayOf(cashViewerTable.selectionModel.selectedItems))
|
||||
|
||||
data class StateRow (
|
||||
val originated: LocalDateTime,
|
||||
@ -262,19 +268,6 @@ class CashViewer : View() {
|
||||
}
|
||||
}
|
||||
|
||||
cashViewerTable.setOnMouseClicked { event: MouseEvent ->
|
||||
if (event.button == MouseButton.PRIMARY) {
|
||||
val selected = cashViewerTable.selectedItem
|
||||
selectedViewerNode.set(
|
||||
if (selected == null) {
|
||||
ViewerNodeSelection.None
|
||||
} else {
|
||||
ViewerNodeSelection.Selected(selected)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Bindings.bindContent(topSplitPane.items, panesShown)
|
||||
|
||||
rightPane.visibleProperty().bind(EasyBind.map(selectedViewerNode) {
|
||||
|
Loading…
Reference in New Issue
Block a user