Skip to content

Commit

Permalink
Merge pull request #3 from conduktor/remove_leaky_method_2
Browse files Browse the repository at this point in the history
Remove memory-leaking `EventTarget.tableview` extension function && Bump version to v2.0.2-cdk
  • Loading branch information
guizmaii authored Aug 10, 2021
2 parents 149a692 + 9c451a3 commit f5e08fd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>no.tornado</groupId>
<artifactId>tornadofx</artifactId>
<version>2.0.1-cdk</version>
<version>2.0.2-cdk</version>
<packaging>jar</packaging>
<name>TornadoFX</name>
<description>Lightweight JavaFX Framework for Kotlin</description>
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/tornadofx/ItemControls.kt
Original file line number Diff line number Diff line change
Expand Up @@ -192,22 +192,6 @@ fun <T> EventTarget.tableview(items: ObservableList<T>? = null, op: TableView<T>
}
}

fun <T> EventTarget.tableview(items: ReadOnlyListProperty<T>, op: TableView<T>.() -> Unit = {}) = tableview(items as ObservableValue<ObservableList<T>>, op)

fun <T> EventTarget.tableview(items: ObservableValue<out ObservableList<T>>, op: TableView<T>.() -> Unit = {}) = TableView<T>().attachTo(this, op) {
fun rebinder() {
(it.items as? SortedFilteredList<T>)?.bindTo(it)
}
it.itemsProperty().bind(items)
rebinder()
it.itemsProperty().onChange {
rebinder()
}
items.onChange {
rebinder()
}
}

fun <T> EventTarget.treeview(root: TreeItem<T>? = null, op: TreeView<T>.() -> Unit = {}) = TreeView<T>().attachTo(this, op) {
if (root != null) it.root = root
}
Expand Down

0 comments on commit f5e08fd

Please sign in to comment.