Преглед на файлове

add event count to viewer

Armin Schrenk преди 6 месеца
родител
ревизия
7af82b831f

+ 10 - 0
src/main/java/org/cryptomator/ui/eventview/EventListCellController.java

@@ -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;
 	}

+ 4 - 0
src/main/resources/css/light_theme.css

@@ -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;

+ 4 - 1
src/main/resources/fxml/eventview_cell.fxml

@@ -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}">