From 0395ef2b44d1ab76171fe211cec9ddfb5596cb20 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 7 Jul 2021 13:00:30 +0200 Subject: [PATCH] remove glyph icon styleclass from result icon view --- .../ui/health/CheckListController.java | 2 +- .../ui/health/ResultListCellController.java | 23 ++++++++++++------- .../fxml/health_result_listcell.fxml | 2 -- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/health/CheckListController.java b/src/main/java/org/cryptomator/ui/health/CheckListController.java index fc11917aa..38fa73e51 100644 --- a/src/main/java/org/cryptomator/ui/health/CheckListController.java +++ b/src/main/java/org/cryptomator/ui/health/CheckListController.java @@ -87,7 +87,7 @@ public class CheckListController implements FxController { @FXML public synchronized void cancelRun() { - Preconditions.checkState(runningProperty().get()); + Preconditions.checkState(somethingsRunning.get()); checkExecutor.cancel(); } diff --git a/src/main/java/org/cryptomator/ui/health/ResultListCellController.java b/src/main/java/org/cryptomator/ui/health/ResultListCellController.java index 683d0fb93..b74a92f7b 100644 --- a/src/main/java/org/cryptomator/ui/health/ResultListCellController.java +++ b/src/main/java/org/cryptomator/ui/health/ResultListCellController.java @@ -22,6 +22,12 @@ import javafx.scene.control.Button; // unscoped because each cell needs its own controller public class ResultListCellController implements FxController { + //TODO: use different glyphs! + private static final FontAwesome5Icon INFO_ICON = FontAwesome5Icon.INFO_CIRCLE; + private static final FontAwesome5Icon GOOD_ICON = FontAwesome5Icon.CHECK; + private static final FontAwesome5Icon WARN_ICON = FontAwesome5Icon.EXCLAMATION_TRIANGLE; + private static final FontAwesome5Icon CRIT_ICON = FontAwesome5Icon.TIMES; + private final Logger LOG = LoggerFactory.getLogger(ResultListCellController.class); private final ObjectProperty result; @@ -51,10 +57,11 @@ public class ResultListCellController implements FxController { @FXML public void initialize() { // see getGlyph() for relevant glyphs: - EasyBind.includeWhen(iconView.getStyleClass(), "glyph-icon-muted", iconView.glyphProperty().isEqualTo(FontAwesome5Icon.INFO_CIRCLE)); - EasyBind.includeWhen(iconView.getStyleClass(), "glyph-icon-primary", iconView.glyphProperty().isEqualTo(FontAwesome5Icon.CHECK)); - EasyBind.includeWhen(iconView.getStyleClass(), "glyph-icon-orange", iconView.glyphProperty().isEqualTo(FontAwesome5Icon.EXCLAMATION_TRIANGLE)); - EasyBind.includeWhen(iconView.getStyleClass(), "glyph-icon-red", iconView.glyphProperty().isEqualTo(FontAwesome5Icon.TIMES)); + iconView.getStyleClass().remove("glyph-icon"); + EasyBind.includeWhen(iconView.getStyleClass(), "glyph-icon-muted", iconView.glyphProperty().isEqualTo(INFO_ICON)); + EasyBind.includeWhen(iconView.getStyleClass(), "glyph-icon-primary", iconView.glyphProperty().isEqualTo(GOOD_ICON)); + EasyBind.includeWhen(iconView.getStyleClass(), "glyph-icon-orange", iconView.glyphProperty().isEqualTo(WARN_ICON)); + EasyBind.includeWhen(iconView.getStyleClass(), "glyph-icon-red", iconView.glyphProperty().isEqualTo(CRIT_ICON)); } @FXML @@ -101,10 +108,10 @@ public class ResultListCellController implements FxController { return null; } return switch (r.diagnosis().getSeverity()) { - case INFO -> FontAwesome5Icon.INFO_CIRCLE; - case GOOD -> FontAwesome5Icon.CHECK; - case WARN -> FontAwesome5Icon.EXCLAMATION_TRIANGLE; - case CRITICAL -> FontAwesome5Icon.TIMES; + case INFO -> INFO_ICON; + case GOOD -> GOOD_ICON; + case WARN -> WARN_ICON; + case CRITICAL -> CRIT_ICON; }; } diff --git a/src/main/resources/fxml/health_result_listcell.fxml b/src/main/resources/fxml/health_result_listcell.fxml index 687842917..5fc6134af 100644 --- a/src/main/resources/fxml/health_result_listcell.fxml +++ b/src/main/resources/fxml/health_result_listcell.fxml @@ -7,8 +7,6 @@ - -