mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2026-10-29 15:10:30 +08:00
@@ -19,6 +19,7 @@ package org.jackhuang.hmcl.ui.construct;
|
||||
|
||||
import javafx.beans.property.*;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.css.PseudoClass;
|
||||
import javafx.geometry.Orientation;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Control;
|
||||
@@ -228,4 +229,30 @@ public class ComponentSublist extends Control implements NoPaddingComponent {
|
||||
public void setTip(String tip) {
|
||||
this.tip.set(tip);
|
||||
}
|
||||
|
||||
/// Whether the sublist header should use a larger title font.
|
||||
private static final PseudoClass PSEUDO_LARGE_TITLE = PseudoClass.getPseudoClass("large-title");
|
||||
|
||||
/// The property controlling whether the sublist header uses a larger title font.
|
||||
private final BooleanProperty largeTitle = new SimpleBooleanProperty(this, "largeTitle", false) {
|
||||
@Override
|
||||
protected void invalidated() {
|
||||
pseudoClassStateChanged(PSEUDO_LARGE_TITLE, get());
|
||||
}
|
||||
};
|
||||
|
||||
/// Returns the property controlling whether the sublist header uses a larger title font.
|
||||
public BooleanProperty largeTitleProperty() {
|
||||
return largeTitle;
|
||||
}
|
||||
|
||||
/// Returns whether the sublist header uses a larger title font.
|
||||
public final boolean isLargeTitle() {
|
||||
return largeTitle.get();
|
||||
}
|
||||
|
||||
/// Sets whether the sublist header uses a larger title font.
|
||||
public final void setLargeTitle(boolean value) {
|
||||
largeTitle.set(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,10 +145,7 @@ final class ComponentSublistWrapper extends VBox implements NoPaddingComponent {
|
||||
});
|
||||
});
|
||||
|
||||
Node headerLeft = sublist.getHeaderLeft();
|
||||
if (headerLeft != null) {
|
||||
header.setTitleContent(headerLeft);
|
||||
}
|
||||
FXUtils.onChangeAndOperate(sublist.largeTitleProperty(), header::setLargeTitle);
|
||||
|
||||
InvalidationListener updateTitleTrailing = observable -> {
|
||||
Node titleTrailing = sublist.getTitleTrailing();
|
||||
|
||||
@@ -32,8 +32,7 @@ import javafx.scene.Cursor;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.TextFlow;
|
||||
@@ -550,17 +549,10 @@ public class TerracottaControllerPage extends StackPane {
|
||||
|
||||
private ComponentSublist getThirdPartyDownloadNodes() {
|
||||
ComponentSublist locals = new ComponentSublist();
|
||||
|
||||
var header = new LinePane();
|
||||
header.getStyleClass().add("no-padding");
|
||||
header.setLargeTitle(true);
|
||||
header.setMinHeight(LinePane.USE_COMPUTED_SIZE);
|
||||
HBox.setHgrow(header, Priority.ALWAYS);
|
||||
header.setMouseTransparent(true);
|
||||
header.setLeading(FXUtils.newBuiltinImage("/assets/img/terracotta.png"));
|
||||
header.setTitle(i18n("terracotta.from_local.title"));
|
||||
header.setSubtitle(i18n("terracotta.from_local.desc"));
|
||||
locals.setHeaderLeft(header);
|
||||
locals.setLargeTitle(true);
|
||||
locals.setLeading(new ImageView(FXUtils.newBuiltinImage("/assets/img/terracotta.png")));
|
||||
locals.setTitle(i18n("terracotta.from_local.title"));
|
||||
locals.setSubtitle(i18n("terracotta.from_local.desc"));
|
||||
|
||||
for (TerracottaMetadata.Link link : TerracottaMetadata.PACKAGE_LINKS) {
|
||||
LineButton item = new LineButton();
|
||||
|
||||
Reference in New Issue
Block a user