From 98a899c7e2cca50dce5e7a04ea8ed7c7edfeedf8 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 25 May 2021 13:21:13 +0200 Subject: [PATCH] scope checklist cell and properly update graphic property --- .../main/java/org/cryptomator/ui/health/CheckListCell.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/health/CheckListCell.java b/main/ui/src/main/java/org/cryptomator/ui/health/CheckListCell.java index b4863213e..16b691a28 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/health/CheckListCell.java +++ b/main/ui/src/main/java/org/cryptomator/ui/health/CheckListCell.java @@ -3,6 +3,7 @@ package org.cryptomator.ui.health; import org.cryptomator.ui.controls.FontAwesome5Icon; import org.cryptomator.ui.controls.FontAwesome5IconView; +import javafx.beans.binding.Bindings; import javafx.beans.value.ObservableValue; import javafx.concurrent.Worker; import javafx.geometry.Insets; @@ -11,6 +12,7 @@ import javafx.scene.Node; import javafx.scene.control.ContentDisplay; import javafx.scene.control.ListCell; +@HealthCheckScoped class CheckListCell extends ListCell { private final FontAwesome5IconView stateIcon = new FontAwesome5IconView(); @@ -28,10 +30,11 @@ class CheckListCell extends ListCell { if (item != null) { textProperty().bind(item.titleProperty()); item.stateProperty().addListener(this::stateChanged); - setGraphic(graphicForState(item.getState())); + graphicProperty().bind(Bindings.createObjectBinding(() -> graphicForState(item.getState()),item.stateProperty())); stateIcon.setGlyph(glyphForState(item.getState())); } else { textProperty().unbind(); + graphicProperty().unbind(); setGraphic(null); setText(null); }