set correct style class for all used check state icons

This commit is contained in:
Armin Schrenk
2021-07-12 20:03:14 +02:00
parent c6a79de6f3
commit 6292ad059c

View File

@@ -14,6 +14,8 @@ import java.util.Optional;
public class CheckStateIconView extends FontAwesome5IconView {
private final static List<FontAwesome5Icon> ATTENTION_ICONS = List.of(FontAwesome5Icon.CHECK, FontAwesome5Icon.EXCLAMATION_TRIANGLE, FontAwesome5Icon.TIMES);
private final ObjectProperty<Check> check = new SimpleObjectProperty<>();
private final OptionalBinding<Check.CheckState> state;
private final OptionalBinding<DiagnosticResult.Severity> severity;
@@ -26,7 +28,7 @@ public class CheckStateIconView extends FontAwesome5IconView {
this.severity = EasyBind.wrapNullable(check).mapObservable(Check::highestResultSeverityProperty);
glyphProperty().bind(EasyBind.combine(state, severity, this::glyphForState)); //TODO: does the binding need to be stored?
this.subscriptions = List.of(
EasyBind.includeWhen(getStyleClass(), "glyph-icon-muted", glyphProperty().isEqualTo(FontAwesome5Icon.INFO_CIRCLE)),
EasyBind.includeWhen(getStyleClass(), "glyph-icon-muted", EasyBind.map(glyphProperty(), glyph -> glyph == null || !ATTENTION_ICONS.contains(glyph))),
EasyBind.includeWhen(getStyleClass(), "glyph-icon-primary", glyphProperty().isEqualTo(FontAwesome5Icon.CHECK)),
EasyBind.includeWhen(getStyleClass(), "glyph-icon-orange", glyphProperty().isEqualTo(FontAwesome5Icon.EXCLAMATION_TRIANGLE)),
EasyBind.includeWhen(getStyleClass(), "glyph-icon-red", glyphProperty().isEqualTo(FontAwesome5Icon.TIMES))