From 44dd5800f80ec3c343c0b13cdf5c24359dedbea4 Mon Sep 17 00:00:00 2001 From: mine_ Date: Mon, 27 Oct 2025 16:00:19 +0800 Subject: [PATCH 01/12] =?UTF-8?q?feat:=20=E4=B8=BAtwoLineListItem=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E6=88=AA=E6=96=AD=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jackhuang/hmcl/ui/construct/TwoLineListItem.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TwoLineListItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TwoLineListItem.java index 0405202e3f..72bf52788a 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TwoLineListItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TwoLineListItem.java @@ -26,6 +26,7 @@ import javafx.scene.Node; import javafx.scene.control.Label; import javafx.scene.layout.HBox; +import javafx.scene.layout.Region; import javafx.scene.layout.VBox; import org.jackhuang.hmcl.ui.FXUtils; import org.jackhuang.hmcl.util.AggregatedObservableList; @@ -34,7 +35,7 @@ public class TwoLineListItem extends VBox { private static final String DEFAULT_STYLE_CLASS = "two-line-list-item"; private static Label createTagLabel(String tag) { - Label tagLabel = new Label(); + Label tagLabel = FXUtils.newSafeTruncatedLabel(tag); tagLabel.setText(tag); HBox.setMargin(tagLabel, new Insets(0, 8, 0, 0)); return tagLabel; @@ -54,7 +55,6 @@ public TwoLineListItem(String titleString, String subtitleString) { } public TwoLineListItem() { - setMouseTransparent(true); HBox firstLine = new HBox(); firstLine.getStyleClass().add("first-line"); @@ -62,6 +62,7 @@ public TwoLineListItem() { Label lblTitle = new Label(); lblTitle.getStyleClass().add("title"); lblTitle.textProperty().bind(title); + FXUtils.showTooltipWhenTruncated(lblTitle); firstLineChildren = new AggregatedObservableList<>(); firstLineChildren.appendList(FXCollections.singletonObservableList(lblTitle)); @@ -71,6 +72,7 @@ public TwoLineListItem() { Label lblSubtitle = new Label(); lblSubtitle.getStyleClass().add("subtitle"); lblSubtitle.textProperty().bind(subtitle); + FXUtils.showTooltipWhenTruncated(lblSubtitle); HBox secondLine = new HBox(); secondLine.getChildren().setAll(lblSubtitle); From 853f28eaf2b7c94345df841bec8714b6f98b195c Mon Sep 17 00:00:00 2001 From: mine_ Date: Mon, 3 Nov 2025 21:21:42 +0800 Subject: [PATCH 02/12] =?UTF-8?q?feat:=20=E6=9B=B4=E6=94=B9twoLineListItem?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/construct/IconedTwoLineListItem.java | 1 + .../hmcl/ui/construct/TwoLineListItem.java | 65 +++++++++++++++---- .../hmcl/ui/download/VersionsPage.java | 2 +- .../hmcl/ui/versions/DownloadListPage.java | 3 +- .../hmcl/ui/versions/DownloadPage.java | 1 + .../hmcl/ui/versions/GameItemSkin.java | 2 +- .../hmcl/ui/versions/ModListPageSkin.java | 2 +- HMCL/src/main/resources/assets/css/root.css | 10 ++- .../resources/assets/lang/I18N.properties | 2 + .../resources/assets/lang/I18N_zh.properties | 2 + .../assets/lang/I18N_zh_CN.properties | 2 + 11 files changed, 74 insertions(+), 18 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/IconedTwoLineListItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/IconedTwoLineListItem.java index 3687dfea7a..9b77925e77 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/IconedTwoLineListItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/IconedTwoLineListItem.java @@ -18,6 +18,7 @@ import org.jackhuang.hmcl.setting.Theme; import org.jackhuang.hmcl.ui.FXUtils; import org.jackhuang.hmcl.ui.SVG; +import org.jackhuang.hmcl.util.Pair; import org.jackhuang.hmcl.util.StringUtils; public class IconedTwoLineListItem extends HBox { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TwoLineListItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TwoLineListItem.java index 72bf52788a..fffe57e7ad 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TwoLineListItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TwoLineListItem.java @@ -17,7 +17,10 @@ */ package org.jackhuang.hmcl.ui.construct; +import javafx.beans.InvalidationListener; import javafx.beans.binding.Bindings; +import javafx.beans.property.IntegerProperty; +import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; @@ -26,27 +29,37 @@ import javafx.scene.Node; import javafx.scene.control.Label; import javafx.scene.layout.HBox; -import javafx.scene.layout.Region; import javafx.scene.layout.VBox; import org.jackhuang.hmcl.ui.FXUtils; import org.jackhuang.hmcl.util.AggregatedObservableList; +import java.util.stream.Collectors; + +import static org.jackhuang.hmcl.util.i18n.I18n.i18n; + public class TwoLineListItem extends VBox { private static final String DEFAULT_STYLE_CLASS = "two-line-list-item"; + private static final int UNLIMITED_TAGS = -1; - private static Label createTagLabel(String tag) { + private static Label createTagLabel(String tag, String StyleClass) { Label tagLabel = FXUtils.newSafeTruncatedLabel(tag); - tagLabel.setText(tag); - HBox.setMargin(tagLabel, new Insets(0, 8, 0, 0)); + HBox.setMargin(tagLabel, new Insets(0, 6, 0, 0)); + tagLabel.getStyleClass().add(StyleClass); return tagLabel; } private final StringProperty title = new SimpleStringProperty(this, "title"); - private final ObservableList