add event count to viewer

This commit is contained in:
Armin Schrenk
2025-03-07 11:50:40 +01:00
parent a86f42fa44
commit 7af82b831f
3 changed files with 18 additions and 1 deletions

View File

@@ -58,6 +58,7 @@ public class EventListCellController implements FxController {
private final StringProperty eventMessage;
private final StringProperty eventDescription;
private final ObjectProperty<FontAwesome5Icon> eventIcon;
private final ObservableValue<String> eventCount;
private final ObservableValue<Boolean> vaultUnlocked;
private final ObservableValue<String> readableTime;
private final ObservableValue<String> readableDate;
@@ -83,6 +84,7 @@ public class EventListCellController implements FxController {
this.eventMessage = new SimpleStringProperty();
this.eventDescription = new SimpleStringProperty();
this.eventIcon = new SimpleObjectProperty<>();
this.eventCount = ObservableUtil.mapWithDefault(event, e -> e.count() == 1? "" : "("+ e.count() +")", "");
this.vaultUnlocked = ObservableUtil.mapWithDefault(event.flatMap(e -> e.v().unlockedProperty()), Function.identity(), false);
this.readableTime = ObservableUtil.mapWithDefault(event, e -> LOCAL_TIME_FORMATTER.format(e.timestamp()), "");
this.readableDate = ObservableUtil.mapWithDefault(event, e -> LOCAL_DATE_FORMATTER.format(e.timestamp()), "");
@@ -261,6 +263,14 @@ public class EventListCellController implements FxController {
return message.getValue();
}
public ObservableValue<String> countProperty() {
return eventCount;
}
public String getCount() {
return eventCount.getValue();
}
public ObservableValue<String> descriptionProperty() {
return description;
}

View File

@@ -321,6 +321,10 @@
-fx-font-size: 1.0em;
}
.list-cell .header-misc {
-fx-font-size: 1.0em;
}
.list-cell .detail-label {
-fx-text-fill: TEXT_FILL_MUTED;
-fx-font-size: 0.8em;

View File

@@ -23,7 +23,10 @@
<FontAwesome5IconView glyph="${controller.icon}" HBox.hgrow="NEVER" glyphSize="16"/>
</VBox>
<VBox spacing="4" HBox.hgrow="ALWAYS">
<Label styleClass="header-label" text="${controller.message}"/>
<HBox spacing="4">
<Label styleClass="header-label" text="${controller.message}"/>
<Label styleClass="header-misc" text="${controller.count}"/>
</HBox>
<Label text="${controller.description}"/>
</VBox>
<Button fx:id="eventActionsButton" contentDisplay="GRAPHIC_ONLY" onAction="#toggleEventActionsMenu" managed="${controller.actionsButtonVisible}" visible="${controller.actionsButtonVisible}">