优化输出

dev
youhong.ai 2023-07-11 17:19:30 +08:00
parent 2b957ba838
commit 81f02278de
8 changed files with 312 additions and 13 deletions

View File

@ -6,11 +6,14 @@ import builderpackage.FileTreeBuilder;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Cursor;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.control.*;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
@ -36,6 +39,7 @@ public class BuilderPackageEcology extends Application {
private TextField packageNumberTextField;
private TextField functionNameTextField;
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("EBU7部开发一部自动打包工具");
@ -80,6 +84,10 @@ public class BuilderPackageEcology extends Application {
Date date = new Date();
param.put("date", simpleDateFormat.format(date));
Button button = new Button("生成升级包");
button.setId("create-btn");
button.setCursor(Cursor.HAND);
button.getStyleClass().add("but");
button.getStyleClass().add("primary");
button.setOnAction(event -> {
// 输出包编号和功能名称的值
String packageNumber = packageNumberTextField.getText();
@ -136,10 +144,11 @@ public class BuilderPackageEcology extends Application {
checkBoxBox.setAlignment(Pos.CENTER_RIGHT);
CheckBox checkBox = new CheckBox("是否是信创环境");
checkBox.setCursor(Cursor.HAND);
checkBox.getStyleClass().add("check-box");
checkBox.selectedProperty().addListener((observable, oldValue, newValue) -> {
this.isEcology = newValue;
});
checkBoxBox.getChildren().add(checkBox);
@ -148,7 +157,7 @@ public class BuilderPackageEcology extends Application {
Scene scene = new Scene(root, 600, 400);
scene.getStylesheets().add("style.css"); // 加载自定义的 CSS 文件
scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm()); // 加载自定义的 CSS 文件
scene.getRoot().setStyle("-fx-font-family: 'serif'");
primaryStage.setScene(scene);
primaryStage.show();
@ -202,10 +211,11 @@ public class BuilderPackageEcology extends Application {
public CheckBoxTreeCell() {
checkBox = new CheckBox();
checkBox.getStyleClass().add("check-box");
checkBox.selectedProperty().addListener((observable, oldValue, newValue) -> {
FileInfo fileInfo = getItem();
fileInfo.setSelected(newValue);
String filePath = fileInfo.getFilePath();
FileInfo item = getItem();
item.setSelected(newValue);
String filePath = item.getFilePath();
if (newValue) {
if (!filePaths.contains(filePath)) {
filePaths.add(filePath);
@ -225,6 +235,35 @@ public class BuilderPackageEcology extends Application {
} else {
checkBox.setSelected(item.isSelected());
checkBox.setText(item.getFileName().replace("_", "__"));
if (item.isDirectory()) {
Node rootIcon = new ImageView(
new javafx.scene.image.Image(Objects.requireNonNull(getClass().getResourceAsStream("icons/folder.png")))
);// 定义一个图片类型节点对象
checkBox.setGraphic(rootIcon);
} else if (item.getFileName().endsWith(".jar")) {
Node fileIcon = new ImageView(
new javafx.scene.image.Image(Objects.requireNonNull(getClass().getResourceAsStream("icons/jar.png")))
);
checkBox.setGraphic(fileIcon);
} else if (item.getFileName().endsWith(".class")) {
Node fileIcon = new ImageView(
new javafx.scene.image.Image(Objects.requireNonNull(getClass().getResourceAsStream("icons/class.png")))
);
checkBox.setGraphic(fileIcon);
} else if (item.getFileName().endsWith(".properties")) {
Node fileIcon = new ImageView(
new javafx.scene.image.Image(Objects.requireNonNull(getClass().getResourceAsStream("icons/code.png")))
);
checkBox.setGraphic(fileIcon);
} else {
Node fileIcon = new ImageView(
new javafx.scene.image.Image(Objects.requireNonNull(getClass().getResourceAsStream("icons/file.png")))
);
checkBox.setGraphic(fileIcon);
}
checkBox.setCursor(Cursor.HAND);
checkBox.setId("tree-checkbox");
setGraphic(checkBox);
// setGraphic(folderIcon);
}

View File

@ -0,0 +1,13 @@
/*颜色*/
* {
-primary-color: #6690FF;
-success-color: #33C651;
-info-color: #52A8F9;
-warn-color: #FFA10A;
-danger-color: #FF4C3F;
-text-color: #303133;
-border-color: #CDD0D6;
-base-color: #F2F3F5;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

View File

@ -1,22 +1,24 @@
@import "cf-colors.css";
.tree-view {
-fx-padding: 10px;
-fx-alignment: center;
}
.tree-cell {
-fx-padding: 5px;
-fx-padding: 6px;
-fx-font-size: 14px;
}
.tree-cell .tree-disclosure-node {
-fx-graphic: url("icons/folder.png");
.tree-cell.expanded {
-fx-alignment: center;
}
.tree-cell .tree-disclosure-node.expanded {
-fx-graphic: url("icons/folder.png");
.tree-cell:selected {
-fx-background-color: -primary-color;
}
.tree-cell .tree-leaf {
-fx-graphic: url("icons/file.png");
}
.button-box {
-fx-spacing: 10px;
@ -26,3 +28,248 @@
.checkbox-label {
-fx-padding: 0 0 0 5px;
}
.check-box {
-fx-cursor: hand;
}
.check-box {
-fx-pref-height: 32px;
}
.check-box .box {
-fx-pref-height: 16px;
-fx-pref-width: 16px;
-fx-border-radius: 3px;
-fx-border-color: -border-color;
-fx-background-color: transparent;
-fx-background-radius: 3px;
}
.check-box .box .mark {
-fx-background-color: rgb(255, 255, 255);
-fx-background-insets: 3px 2px;
-fx-shape: "M369.792 704.32L930.304 128 1024 223.616 369.984 896l-20.288-20.864-0.128 0.128L0 516.8 96.128 423.68l273.664 280.64z";
}
.check-box .container {
-fx-text-fill: -text-color;
-fx-font-size: 14px;
}
.check-box:focused {
-fx-border-color: -primary-color;
}
.check-box:selected {
-fx-text-fill: -primary-color;
}
.check-box:selected .box {
-fx-border-color: -primary-color;
-fx-background-color: -primary-color;
}
.but {
-fx-background-insets: 0;
-fx-border-radius: 3px;
/*-fx-border-color: transparent;*/
-fx-background-radius: 3px;
-fx-pref-height: 32px;
/*-fx-min-height: 32px;*/
-fx-padding: 0px 15px 0px 15px;
-fx-font-size: 14px;
-fx-font-weight: 500;
-fx-text-fill: rgb(255, 255, 255);
-fx-cursor: hand;
}
.but > .ikonli-font-icon {
-fx-icon-size: 17px;
-fx-icon-color: rgb(255, 255, 255);
}
.but.primary {
-fx-background-color: -primary-color;
}
.but.success {
-fx-background-color: -success-color;
}
.but.info {
-fx-background-color: -info-color;
}
.but.warn {
-fx-background-color: -warn-color;
}
.but.danger {
-fx-background-color: -danger-color;
}
/*hover:*/ /*focused:*/
.but.primary:hover, .but.primary:focused {
-fx-background-color: derive(-primary-color, 30%);
}
.but.success:hover, .but.success:focused {
-fx-background-color: derive(-success-color, 30%);
}
.but.info:hover, .but.info:focused {
-fx-background-color: derive(-info-color, 30%);
}
.but.warn:hover, .but.warn:focused {
-fx-background-color: derive(-warn-color, 30%);
}
.but.danger:hover, .but.danger:focused {
-fx-background-color: derive(-danger-color, 30%);
}
/*pressed:*/
.but.primary:pressed {
-fx-background-color: derive(-primary-color, -10%);
}
.but.success:pressed {
-fx-background-color: derive(-success-color, -10%);
}
.but.info:pressed {
-fx-background-color: derive(-info-color, -10%);
}
.but.warn:pressed {
-fx-background-color: derive(-warn-color, -10%);
}
.but.danger:pressed {
-fx-background-color: derive(-danger-color, -10%);
}
/*圆角按钮*/
.but.round {
-fx-border-radius: 16px;
-fx-background-radius: 16px;
}
/*朴素按钮*/
.but.plain, .but.plain:focused {
-fx-background-color: transparent;
}
.but.primary.plain {
-fx-border-color: -primary-color;
-fx-text-fill: -primary-color;
}
.but.success.plain {
-fx-border-color: -success-color;
-fx-text-fill: -success-color;
}
.but.info.plain {
-fx-border-color: -info-color;
-fx-text-fill: -info-color;
}
.but.warn.plain {
-fx-border-color: -warn-color;
-fx-text-fill: -warn-color;
}
.but.danger.plain {
-fx-border-color: -danger-color;
-fx-text-fill: -danger-color;
}
.but.primary.plain > .ikonli-font-icon {
-fx-icon-color: -primary-color;
}
.but.success.plain > .ikonli-font-icon {
-fx-icon-color: -success-color;
}
.but.info.plain > .ikonli-font-icon {
-fx-icon-color: -info-color;
}
.but.warn.plain > .ikonli-font-icon {
-fx-icon-color: -warn-color;
}
.but.danger.plain > .ikonli-font-icon {
-fx-icon-color: -danger-color;
}
.but.primary.plain:hover > .ikonli-font-icon {
-fx-icon-color: rgb(255, 255, 255);
}
.but.success.plain:hover > .ikonli-font-icon {
-fx-icon-color: rgb(255, 255, 255);
}
.but.info.plain:hover > .ikonli-font-icon {
-fx-icon-color: rgb(255, 255, 255);
}
.but.warn.plain:hover > .ikonli-font-icon {
-fx-icon-color: rgb(255, 255, 255);
}
.but.danger.plain:hover > .ikonli-font-icon {
-fx-icon-color: rgb(255, 255, 255);
}
.but.primary.plain:hover {
-fx-background-color: -primary-color;
-fx-text-fill: rgb(255, 255, 255);
}
.but.success.plain:hover {
-fx-background-color: -success-color;
-fx-text-fill: rgb(255, 255, 255);
}
.but.info.plain:hover {
-fx-background-color: -info-color;
-fx-text-fill: rgb(255, 255, 255);
}
.but.warn.plain:hover {
-fx-background-color: -warn-color;
-fx-text-fill: rgb(255, 255, 255);
}
.but.danger.plain:hover {
-fx-background-color: -danger-color;
-fx-text-fill: rgb(255, 255, 255);
}
.but.primary.plain:pressed {
-fx-background-color: derive(-primary-color, -10%);
}
.but.success.plain:pressed {
-fx-background-color: derive(-success-color, -10%);
}
.but.info.plain:pressed {
-fx-background-color: derive(-info-color, -10%);
}
.but.warn.plain:pressed {
-fx-background-color: derive(-warn-color, -10%);
}
.but.danger.plain:pressed {
-fx-background-color: derive(-danger-color, -10%);
}