From 73fde5d020af44e06367b81c81947a19462b5aa4 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Sun, 10 Apr 2016 01:54:44 +0200 Subject: [PATCH] null-safe status indicators --- .../org/cryptomator/ui/controls/DirectoryListCell.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/controls/DirectoryListCell.java b/main/ui/src/main/java/org/cryptomator/ui/controls/DirectoryListCell.java index 43bdc4359..1df6e7dd4 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/controls/DirectoryListCell.java +++ b/main/ui/src/main/java/org/cryptomator/ui/controls/DirectoryListCell.java @@ -56,13 +56,8 @@ public class DirectoryListCell extends DraggableListCell { pathText.setTextOverrun(OverrunStyle.ELLIPSIS); pathText.getStyleClass().add("detail-label"); - statusIndicator.fillProperty().bind(EasyBind.monadic(itemProperty()).flatMap(Vault::unlockedProperty).map(unlocked -> { - return unlocked ? GREEN_FILL : RED_FILL; - })); - - statusIndicator.strokeProperty().bind(EasyBind.monadic(itemProperty()).flatMap(Vault::unlockedProperty).map(unlocked -> { - return unlocked ? GREEN_STROKE : RED_STROKE; - })); + statusIndicator.fillProperty().bind(EasyBind.monadic(itemProperty()).flatMap(Vault::unlockedProperty).filter(Boolean.TRUE::equals).map(unlocked -> GREEN_FILL).orElse(RED_FILL)); + statusIndicator.strokeProperty().bind(EasyBind.monadic(itemProperty()).flatMap(Vault::unlockedProperty).filter(Boolean.TRUE::equals).map(unlocked -> GREEN_STROKE).orElse(RED_STROKE)); tooltipProperty().bind(EasyBind.monadic(itemProperty()).flatMap(Vault::path).map(p -> new Tooltip(p.toString()))); contextMenuProperty().bind(EasyBind.monadic(itemProperty()).flatMap(Vault::unlockedProperty).map(unlocked -> {