From aa99f13246462d0d08af021a7253346e964a1c0b Mon Sep 17 00:00:00 2001 From: Robin De Mol Date: Sun, 8 Sep 2019 08:49:46 +0200 Subject: [PATCH 1/2] SmartListCell clears styleClass --- src/main/java/tornadofx/ListView.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/tornadofx/ListView.kt b/src/main/java/tornadofx/ListView.kt index 482cffa25..82ed1bc9e 100644 --- a/src/main/java/tornadofx/ListView.kt +++ b/src/main/java/tornadofx/ListView.kt @@ -147,6 +147,7 @@ open class SmartListCell(val scope: Scope = FX.defaultScope, listView: ListVi text = null graphic = null style = null + styleClass.clear() clearCellFragment() } else { FX.ignoreParentBuilder = Once From f91f46a47d28b95e1a656a74686f5b433a255c17 Mon Sep 17 00:00:00 2001 From: Robin De Mol Date: Sun, 8 Sep 2019 09:36:33 +0200 Subject: [PATCH 2/2] Extracted clean up operations to method --- src/main/java/tornadofx/ListView.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/tornadofx/ListView.kt b/src/main/java/tornadofx/ListView.kt index 82ed1bc9e..70ffb0112 100644 --- a/src/main/java/tornadofx/ListView.kt +++ b/src/main/java/tornadofx/ListView.kt @@ -142,12 +142,7 @@ open class SmartListCell(val scope: Scope = FX.defaultScope, listView: ListVi super.updateItem(item, empty) if (item == null || empty) { - textProperty().unbind() - graphicProperty().unbind() - text = null - graphic = null - style = null - styleClass.clear() + cleanUp() clearCellFragment() } else { FX.ignoreParentBuilder = Once @@ -171,6 +166,15 @@ open class SmartListCell(val scope: Scope = FX.defaultScope, listView: ListVi } } + private fun cleanUp() { + textProperty().unbind() + graphicProperty().unbind() + text = null + graphic = null + style = null + styleClass.clear() + } + private fun clearCellFragment() { cellFragment?.apply { cellProperty.value = null