@@ -18,10 +18,10 @@
|
|||||||
package org.jackhuang.hmcl.ui.export;
|
package org.jackhuang.hmcl.ui.export;
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
|
import com.jfoenix.controls.JFXCheckBox;
|
||||||
import com.jfoenix.controls.JFXTreeView;
|
import com.jfoenix.controls.JFXTreeView;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.CheckBox;
|
|
||||||
import javafx.scene.control.CheckBoxTreeItem;
|
import javafx.scene.control.CheckBoxTreeItem;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TreeItem;
|
import javafx.scene.control.TreeItem;
|
||||||
@@ -44,6 +44,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.jackhuang.hmcl.ui.FXUtils.onEscPressed;
|
||||||
import static org.jackhuang.hmcl.util.Lang.mapOf;
|
import static org.jackhuang.hmcl.util.Lang.mapOf;
|
||||||
import static org.jackhuang.hmcl.util.Pair.pair;
|
import static org.jackhuang.hmcl.util.Pair.pair;
|
||||||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
||||||
@@ -67,6 +68,8 @@ public final class ModpackFileSelectionPage extends BorderPane implements Wizard
|
|||||||
rootNode = getTreeItem(profile.getRepository().getRunDirectory(version), "minecraft");
|
rootNode = getTreeItem(profile.getRepository().getRunDirectory(version), "minecraft");
|
||||||
treeView.setRoot(rootNode);
|
treeView.setRoot(rootNode);
|
||||||
treeView.setSelectionModel(new NoneMultipleSelectionModel<>());
|
treeView.setSelectionModel(new NoneMultipleSelectionModel<>());
|
||||||
|
onEscPressed(treeView, () -> controller.onPrev(true));
|
||||||
|
setMargin(treeView, new Insets(10, 10, 5, 10));
|
||||||
this.setCenter(treeView);
|
this.setCenter(treeView);
|
||||||
|
|
||||||
HBox nextPane = new HBox();
|
HBox nextPane = new HBox();
|
||||||
@@ -142,15 +145,14 @@ public final class ModpackFileSelectionPage extends BorderPane implements Wizard
|
|||||||
}
|
}
|
||||||
|
|
||||||
HBox graphic = new HBox();
|
HBox graphic = new HBox();
|
||||||
CheckBox checkBox = new CheckBox();
|
JFXCheckBox checkBox = new JFXCheckBox();
|
||||||
checkBox.selectedProperty().bindBidirectional(node.selectedProperty());
|
checkBox.selectedProperty().bindBidirectional(node.selectedProperty());
|
||||||
checkBox.indeterminateProperty().bindBidirectional(node.indeterminateProperty());
|
checkBox.indeterminateProperty().bindBidirectional(node.indeterminateProperty());
|
||||||
graphic.getChildren().add(checkBox);
|
graphic.getChildren().add(checkBox);
|
||||||
|
|
||||||
if (TRANSLATION.containsKey(basePath)) {
|
if (TRANSLATION.containsKey(basePath)) {
|
||||||
Label comment = new Label();
|
Label comment = new Label(TRANSLATION.get(basePath));
|
||||||
comment.setText(TRANSLATION.get(basePath));
|
comment.setStyle("-fx-text-fill: -monet-on-surface-variant;");
|
||||||
comment.setStyle("-fx-text-fill: gray;");
|
|
||||||
comment.setMouseTransparent(true);
|
comment.setMouseTransparent(true);
|
||||||
graphic.getChildren().add(comment);
|
graphic.getChildren().add(comment);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ package org.jackhuang.hmcl.ui.export;
|
|||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.shape.SVGPath;
|
|
||||||
import org.jackhuang.hmcl.mod.ModpackExportInfo;
|
import org.jackhuang.hmcl.mod.ModpackExportInfo;
|
||||||
import org.jackhuang.hmcl.mod.mcbbs.McbbsModpackExportTask;
|
import org.jackhuang.hmcl.mod.mcbbs.McbbsModpackExportTask;
|
||||||
import org.jackhuang.hmcl.mod.multimc.MultiMCModpackExportTask;
|
import org.jackhuang.hmcl.mod.multimc.MultiMCModpackExportTask;
|
||||||
@@ -77,8 +77,7 @@ public final class ModpackTypeSelectionPage extends VBox implements WizardPage {
|
|||||||
graphic.setMouseTransparent(true);
|
graphic.setMouseTransparent(true);
|
||||||
graphic.setLeft(new TwoLineListItem(i18n("modpack.type." + type), i18n("modpack.type." + type + ".export")));
|
graphic.setLeft(new TwoLineListItem(i18n("modpack.type." + type), i18n("modpack.type." + type + ".export")));
|
||||||
|
|
||||||
SVGPath arrow = new SVGPath();
|
Node arrow = SVG.ARROW_FORWARD.createIcon();
|
||||||
arrow.setContent(SVG.ARROW_FORWARD.getPath());
|
|
||||||
BorderPane.setAlignment(arrow, Pos.CENTER);
|
BorderPane.setAlignment(arrow, Pos.CENTER);
|
||||||
graphic.setRight(arrow);
|
graphic.setRight(arrow);
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,10 @@ public final class NBTEditorPage extends SpinnerPane implements DecoratorPage {
|
|||||||
.whenComplete(Schedulers.javafx(), (result, exception) -> {
|
.whenComplete(Schedulers.javafx(), (result, exception) -> {
|
||||||
if (exception == null) {
|
if (exception == null) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
root.setCenter(new NBTTreeView(result));
|
NBTTreeView view = new NBTTreeView(result);
|
||||||
|
BorderPane.setMargin(view, new Insets(10));
|
||||||
|
onEscPressed(view, cancelButton::fire);
|
||||||
|
root.setCenter(view);
|
||||||
} else {
|
} else {
|
||||||
LOG.warning("Fail to open nbt file", exception);
|
LOG.warning("Fail to open nbt file", exception);
|
||||||
Controllers.dialog(i18n("nbt.open.failed") + "\n\n" + StringUtils.getStackTrace(exception), null, MessageDialogPane.MessageType.WARNING, cancelButton::fire);
|
Controllers.dialog(i18n("nbt.open.failed") + "\n\n" + StringUtils.getStackTrace(exception), null, MessageDialogPane.MessageType.WARNING, cancelButton::fire);
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ package org.jackhuang.hmcl.ui.nbt;
|
|||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||||
import javafx.scene.control.*;
|
import com.jfoenix.controls.JFXTreeView;
|
||||||
|
import javafx.scene.control.TreeCell;
|
||||||
|
import javafx.scene.control.TreeItem;
|
||||||
|
import javafx.scene.control.TreeView;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.util.Callback;
|
import javafx.util.Callback;
|
||||||
@@ -34,7 +37,7 @@ import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
|||||||
/**
|
/**
|
||||||
* @author Glavo
|
* @author Glavo
|
||||||
*/
|
*/
|
||||||
public final class NBTTreeView extends TreeView<Tag> {
|
public final class NBTTreeView extends JFXTreeView<Tag> {
|
||||||
|
|
||||||
public NBTTreeView(NBTTreeView.Item tree) {
|
public NBTTreeView(NBTTreeView.Item tree) {
|
||||||
this.setRoot(tree);
|
this.setRoot(tree);
|
||||||
@@ -45,7 +48,7 @@ public final class NBTTreeView extends TreeView<Tag> {
|
|||||||
Holder<Object> lastCell = new Holder<>();
|
Holder<Object> lastCell = new Holder<>();
|
||||||
EnumMap<NBTTagType, Image> icons = new EnumMap<>(NBTTagType.class);
|
EnumMap<NBTTagType, Image> icons = new EnumMap<>(NBTTagType.class);
|
||||||
|
|
||||||
return view -> new TreeCell<Tag>() {
|
return view -> new TreeCell<>() {
|
||||||
private void setTagText(String text) {
|
private void setTagText(String text) {
|
||||||
String name = ((Item) getTreeItem()).getName();
|
String name = ((Item) getTreeItem()).getName();
|
||||||
|
|
||||||
|
|||||||
@@ -1573,6 +1573,47 @@
|
|||||||
-fx-fill: transparent;
|
-fx-fill: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* *
|
||||||
|
* JFX Tree View *
|
||||||
|
* *
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
.tree-view {
|
||||||
|
-fx-padding: 5;
|
||||||
|
-fx-background-radius: 6;
|
||||||
|
-fx-background-color: -monet-surface-container-low;
|
||||||
|
-fx-border-radius: 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-cell {
|
||||||
|
-fx-padding: 5;
|
||||||
|
-fx-background-radius: 6;
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
-fx-text-fill: -monet-on-surface;
|
||||||
|
-fx-border-radius: 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-cell:focused {
|
||||||
|
-fx-background-color: -monet-secondary-container;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-cell .arrow {
|
||||||
|
-fx-background-color: -monet-on-surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-cell .jfx-rippler {
|
||||||
|
-jfx-rippler-disabled: true;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-view > .virtual-flow > .scroll-bar {
|
||||||
|
-fx-skin: "org.jackhuang.hmcl.ui.construct.FloatScrollBarSkin";
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-view > .virtual-flow > .scroll-bar .track {
|
||||||
|
-fx-fill: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* *
|
* *
|
||||||
* JFX Decorator *
|
* JFX Decorator *
|
||||||
|
|||||||
Reference in New Issue
Block a user