From c75716f11372e287c710ec4efbc120b733800730 Mon Sep 17 00:00:00 2001
From: "XUFENG-PC\\xufeng" <1277032935@qq.com>
Date: Fri, 7 Aug 2020 19:27:00 +0800
Subject: [PATCH 01/30] =?UTF-8?q?=E8=B0=83=E6=95=B4pom=E6=96=87=E4=BB=B6ja?=
=?UTF-8?q?r=E5=8C=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 51 ++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 46 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index 5ebf011..bd21e61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.xwintop
xcore
- 0.0.6
+ 0.0.6-jdk11
jar
xcore
@@ -12,8 +12,8 @@
https://gitee.com/xwintop/xcore
- 1.8
- 1.8
+ 11
+ 11
UTF-8
@@ -47,6 +47,42 @@
+
+ org.openjfx
+ javafx-controls
+ 11.0.2
+
+
+ org.openjfx
+ javafx-base
+ 11.0.2
+
+
+ org.openjfx
+ javafx-graphics
+ 11.0.2
+
+
+ org.openjfx
+ javafx-fxml
+ 11.0.2
+
+
+ org.openjfx
+ javafx-swing
+ 11.0.2
+
+
+ org.openjfx
+ javafx-media
+ 11.0.2
+
+
+ org.openjfx
+ javafx-web
+ 11.0.2
+
+
junit
junit
@@ -83,13 +119,13 @@
org.controlsfx
controlsfx
- 8.40.16
+ 11.0.2
com.jfoenix
jfoenix
- 8.0.9
+ 9.0.10
@@ -200,6 +236,11 @@
-Dfile.encoding=UTF-8
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
--
Gitee
From 450f8ced0b432f67495f9bad8dc45ae06f911f12 Mon Sep 17 00:00:00 2001
From: xufeng <1277032935@qq.com>
Date: Sun, 16 Aug 2020 16:30:13 +0800
Subject: [PATCH 02/30] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BF=BD=E7=95=A5?=
=?UTF-8?q?=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 3 ++-
pom.xml | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index 29ed5a8..17c7c39 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,5 @@
/data
/log/
/target/
-/.idea
\ No newline at end of file
+/.idea
+C:
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index bd21e61..89b88e2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -181,7 +181,7 @@
org.projectlombok
lombok
- 1.18.6
+ 1.18.12
provided
--
Gitee
From 13aebc687a58b7c8ad7bd010578cf0e2efeeb505 Mon Sep 17 00:00:00 2001
From: Yiding He
Date: Mon, 21 Dec 2020 16:42:27 +0800
Subject: [PATCH 03/30] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96?=
=?UTF-8?q?=E5=85=B3=E7=B3=BB=E5=92=8C=20JDK=20=E7=89=88=E6=9C=AC=E5=88=B0?=
=?UTF-8?q?=20java15?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 133 ++++++++++++++++++++++----------------------------------
1 file changed, 53 insertions(+), 80 deletions(-)
diff --git a/pom.xml b/pom.xml
index 89b88e2..e47f28b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.xwintop
xcore
- 0.0.6-jdk11
+ 0.0.6-jdk15-SNAPSHOT
jar
xcore
@@ -12,9 +12,10 @@
https://gitee.com/xwintop/xcore
- 11
- 11
UTF-8
+ true
+ 15
+ 15
@@ -22,65 +23,28 @@
aliyunmaven
http://maven.aliyun.com/nexus/content/groups/public/
-
- spring-snapshots
- http://repo.spring.io/snapshot
-
- true
-
-
-
- spring-milestones
- http://repo.spring.io/milestone
-
-
- apache.snapshots
- Apache Development Snapshot Repository
- https://repository.apache.org/content/repositories/snapshots/
-
- false
-
-
- true
-
-
org.openjfx
javafx-controls
- 11.0.2
-
-
- org.openjfx
- javafx-base
- 11.0.2
-
-
- org.openjfx
- javafx-graphics
- 11.0.2
+ 15
org.openjfx
javafx-fxml
- 11.0.2
+ 15
org.openjfx
javafx-swing
- 11.0.2
-
-
- org.openjfx
- javafx-media
- 11.0.2
+ 15
org.openjfx
javafx-web
- 11.0.2
+ 15
@@ -89,11 +53,13 @@
4.12
test
+
ch.qos.logback
logback-classic
1.2.3
+ provided
@@ -113,13 +79,14 @@
org.quartz-scheduler
quartz
2.3.1
+ provided
org.controlsfx
controlsfx
- 11.0.2
+ 11.0.3
@@ -208,39 +175,45 @@
-
-
- xwintop-maven
- file:C:/gitFiles/maven/repository/
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-resources-plugin
- 3.0.2
-
- UTF-8
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.20
-
- true
- once
- -Dfile.encoding=UTF-8
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.8.1
-
-
-
+
+
+ dev-local
+
+
+ xwintop-maven
+ file:C:/gitFiles/maven/repository/
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 3.0.2
+
+ UTF-8
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.20
+
+ true
+ once
+ -Dfile.encoding=UTF-8
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+
+
+
+
--
Gitee
From 4054d294a8e0c572ad7eae44d5227eea4821d5d9 Mon Sep 17 00:00:00 2001
From: Yiding He
Date: Mon, 21 Dec 2020 18:44:05 +0800
Subject: [PATCH 04/30] =?UTF-8?q?FxAlerts=20=E6=B7=BB=E5=8A=A0=E6=96=B9?=
=?UTF-8?q?=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 12 +++--
.../xwintop/xcore/javafx/dialog/FxAlerts.java | 51 +++++++++++++++----
2 files changed, 47 insertions(+), 16 deletions(-)
diff --git a/.gitignore b/.gitignore
index 17c7c39..46fd667 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,10 @@
# Default ignored files
#/.gitignore
-/xcore.iml
-/data
-/log/
-/target/
-/.idea
+data
+log/
+target/
+.idea/
+.mvnd/
+*.iml
+
C:
\ No newline at end of file
diff --git a/src/main/java/com/xwintop/xcore/javafx/dialog/FxAlerts.java b/src/main/java/com/xwintop/xcore/javafx/dialog/FxAlerts.java
index 96ce31a..26d6290 100644
--- a/src/main/java/com/xwintop/xcore/javafx/dialog/FxAlerts.java
+++ b/src/main/java/com/xwintop/xcore/javafx/dialog/FxAlerts.java
@@ -1,21 +1,31 @@
package com.xwintop.xcore.javafx.dialog;
import com.xwintop.xcore.javafx.FxApp;
-import java.util.Optional;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.TextArea;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.stage.Stage;
+import javafx.stage.Window;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
+import java.util.Optional;
+
/**
* 系统对话框封装
*/
public class FxAlerts {
+ public static void info(String title, String message) {
+ alert(Alert.AlertType.INFORMATION, title, message);
+ }
+
+ public static void warn(String title, String message) {
+ alert(Alert.AlertType.WARNING, title, message);
+ }
+
public static void error(String message) {
alert(Alert.AlertType.ERROR, "错误", message);
}
@@ -24,21 +34,25 @@ public class FxAlerts {
alert(Alert.AlertType.ERROR, title, message);
}
+ public static void error(Window owner, String title, String message) {
+ alert(owner, Alert.AlertType.ERROR, title, message);
+ }
+
public static void error(String title, Throwable throwable) {
boolean noMessage = StringUtils.isBlank(throwable.getMessage());
String message = noMessage ? throwable.toString() : throwable.getMessage();
error(title, message, ExceptionUtils.getStackTrace(throwable));
}
- public static void info(String title, String message) {
- alert(Alert.AlertType.INFORMATION, title, message);
+ public static void error(Window owner, String title, Throwable throwable) {
+ boolean noMessage = StringUtils.isBlank(throwable.getMessage());
+ String message = noMessage ? throwable.toString() : throwable.getMessage();
+ error(owner, title, message, ExceptionUtils.getStackTrace(throwable));
}
- public static void warn(String title, String message) {
- alert(Alert.AlertType.WARNING, title, message);
- }
+ public static void alert(Alert.AlertType alertType, String title, String message) {}
- public static void alert(Alert.AlertType alertType, String title, String message) {
+ public static void alert(Window owner, Alert.AlertType alertType, String title, String message) {
FxApp.runLater(() -> {
try {
Alert alert = new Alert(alertType, message, ButtonType.OK);
@@ -47,7 +61,12 @@ public class FxAlerts {
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
FxApp.setupIcon(stage);
- FxApp.setupModality(alert);
+
+ if (owner != null) {
+ stage.initOwner(owner);
+ } else {
+ FxApp.setupModality(alert);
+ }
alert.showAndWait();
} catch (Exception e) {
@@ -58,10 +77,15 @@ public class FxAlerts {
// 打开一个展示了详细错误信息的错误对话框
public static void error(String title, String message, String details) {
- FxApp.runLater(() -> error0(title, message, details));
+ FxApp.runLater(() -> error0(null, title, message, details));
}
- private static void error0(String title, String message, String details) {
+ // 打开一个展示了详细错误信息的错误对话框
+ public static void error(Window owner, String title, String message, String details) {
+ FxApp.runLater(() -> error0(owner, title, message, details));
+ }
+
+ private static void error0(Window owner, String title, String message, String details) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle(title);
alert.setHeaderText(null);
@@ -84,7 +108,12 @@ public class FxAlerts {
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
FxApp.setupIcon(stage);
- FxApp.setupModality(alert);
+
+ if (owner != null) {
+ stage.initOwner(owner);
+ } else {
+ FxApp.setupModality(alert);
+ }
alert.showAndWait();
}
--
Gitee
From 2b4effa2a6b642bed8cf3b9de4f1368f29e1a639 Mon Sep 17 00:00:00 2001
From: Yiding He
Date: Thu, 24 Dec 2020 15:21:14 +0800
Subject: [PATCH 05/30] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20ListCellFactory,=20T?=
=?UTF-8?q?reeCellFactory,=20ComboBoxDecorator?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.editorconfig | 31 +++-
.../xcore/javafx/cells/ListCellFactory.java | 135 ++++++++++++++++++
.../xcore/javafx/cells/TreeCellFactory.java | 91 ++++++++++++
.../javafx/decorator/ComboBoxDecorator.java | 103 +++++++++++++
4 files changed, 355 insertions(+), 5 deletions(-)
create mode 100644 src/main/java/com/xwintop/xcore/javafx/cells/ListCellFactory.java
create mode 100644 src/main/java/com/xwintop/xcore/javafx/cells/TreeCellFactory.java
create mode 100644 src/main/java/com/xwintop/xcore/javafx/decorator/ComboBoxDecorator.java
diff --git a/.editorconfig b/.editorconfig
index af32f61..ba60bec 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,9 +1,30 @@
-[*]
+root = true
+
+[*.{txt, java, xml, md, properties}]
charset = utf-8
-end_of_line = lf
-insert_final_newline = false
indent_style = space
+end_of_line = lf
+
+[*.{txt, java, xml}]
indent_size = 4
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+insert_final_newline = false
+trim_trailing_whitespace = false
+
+[*.java]
+ij_java_blank_lines_around_field = 1
+ij_java_blank_lines_after_class_header = 1
+ij_java_doc_add_blank_line_after_return = true
+ij_java_doc_add_blank_line_after_param_comments = true
+ij_java_doc_add_blank_line_after_description = true
+ij_java_doc_keep_empty_parameter_tag = false
+ij_java_doc_keep_empty_return_tag = false
+ij_java_doc_keep_empty_throws_tag = false
+
+[*.properties]
+ij_properties_keep_blank_lines = true
+ij_properties_spaces_around_key_value_delimiter = true
-[*.{html, xml, yaml}]
-indent_size = 2
diff --git a/src/main/java/com/xwintop/xcore/javafx/cells/ListCellFactory.java b/src/main/java/com/xwintop/xcore/javafx/cells/ListCellFactory.java
new file mode 100644
index 0000000..b7cc5ec
--- /dev/null
+++ b/src/main/java/com/xwintop/xcore/javafx/cells/ListCellFactory.java
@@ -0,0 +1,135 @@
+package com.xwintop.xcore.javafx.cells;
+
+import javafx.beans.value.ObservableValue;
+import javafx.scene.Node;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.util.Callback;
+
+import java.util.function.Consumer;
+import java.util.function.Function;
+
+/**
+ * 封装对列表节点的配置
+ *
+ * @author yiding.he
+ */
+public class ListCellFactory implements Callback, ListCell> {
+
+ private Function textFunction;
+
+ private Function> textProperty;
+
+ private Function graphicFunction;
+
+ private Function> graphicProperty;
+
+ private Consumer> cellInitializer;
+
+ /**
+ * 对 ListCell 的额外配置
+ */
+ public ListCellFactory setCellInitializer(Consumer> cellInitializer) {
+ this.cellInitializer = cellInitializer;
+ return this;
+ }
+
+ /**
+ * 设置列表项文本
+ */
+ public ListCellFactory withTextFunction(Function toStringFunction) {
+ if (this.textProperty != null) {
+ throw new IllegalStateException("You have already assigned textProperty.");
+ }
+ this.textFunction = toStringFunction;
+ return this;
+ }
+
+ /**
+ * 绑定列表项文本为一个自动更新的属性
+ */
+ public ListCellFactory withTextProperty(Function> toStringProperty) {
+ if (this.textFunction != null) {
+ throw new IllegalStateException("You have already assigned textFunction.");
+ }
+ this.textProperty = toStringProperty;
+ return this;
+ }
+
+ /**
+ * 设置列表项图标
+ */
+ public ListCellFactory withGraphicFunction(Function graphicFunction) {
+ if (this.graphicProperty != null) {
+ throw new IllegalStateException("You have already assigned graphicProperty.");
+ }
+ this.graphicFunction = graphicFunction;
+ return this;
+ }
+
+ /**
+ * 绑定列表项图标为一个自动更新的属性
+ */
+ public ListCellFactory withGraphicProperty(Function> graphicProperty) {
+ if (this.graphicFunction != null) {
+ throw new IllegalStateException("You have already assigned graphicFunction.");
+ }
+ this.graphicProperty = graphicProperty;
+ return this;
+ }
+
+ @Override
+ public ListCell call(ListView param) {
+
+ ListCell listCell = new ListCell() {
+ @Override
+ protected void updateItem(T item, boolean empty) {
+ super.updateItem(item, empty);
+
+ if (textProperty().isBound()) {
+ textProperty().unbind();
+ }
+ if (graphicProperty().isBound()) {
+ graphicProperty().unbind();
+ }
+
+ if (empty) {
+ setText(null);
+ setGraphic(null);
+ } else {
+ setCellText(this, item);
+ setCellGraphic(this, item);
+ }
+ }
+ };
+
+ if (cellInitializer != null) {
+ cellInitializer.accept(listCell);
+ }
+
+ return listCell;
+ }
+
+ private void setCellGraphic(ListCell cell, T item) {
+ if (graphicFunction != null) {
+ cell.setGraphic(graphicFunction.apply(item));
+ }
+ if (graphicProperty != null) {
+ cell.graphicProperty().unbind();
+ cell.graphicProperty().bind(graphicProperty.apply(item));
+ }
+ }
+
+ private void setCellText(ListCell cell, T item) {
+ if (textFunction != null) {
+ cell.setText(textFunction.apply(item));
+ }
+ if (textProperty != null) {
+ cell.textProperty().unbind();
+ cell.textProperty().bind(textProperty.apply(item));
+ }
+ if (textFunction == null && textProperty == null) {
+ cell.setText(String.valueOf(item));
+ }
+ }
+}
diff --git a/src/main/java/com/xwintop/xcore/javafx/cells/TreeCellFactory.java b/src/main/java/com/xwintop/xcore/javafx/cells/TreeCellFactory.java
new file mode 100644
index 0000000..8755272
--- /dev/null
+++ b/src/main/java/com/xwintop/xcore/javafx/cells/TreeCellFactory.java
@@ -0,0 +1,91 @@
+package com.xwintop.xcore.javafx.cells;
+
+import javafx.scene.control.TreeCell;
+import javafx.scene.control.TreeItem;
+import javafx.scene.control.TreeView;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+import javafx.util.Callback;
+
+import java.util.function.Consumer;
+import java.util.function.Function;
+
+/**
+ * 封装对 TreeView 的配置过程
+ *
+ * @author yiding.he
+ */
+public class TreeCellFactory implements Callback, TreeCell> {
+
+ private Consumer onDoubleClick;
+
+ private Function toString;
+
+ private Function, Image> iconSupplier;
+
+ /**
+ * 设置当双击树节点时要做的事
+ */
+ public TreeCellFactory setOnDoubleClick(Consumer onDoubleClick) {
+ this.onDoubleClick = onDoubleClick;
+ return this;
+ }
+
+ /**
+ * 设置树节点文本
+ */
+ public TreeCellFactory setToString(Function toString) {
+ this.toString = toString;
+ return this;
+ }
+
+ /**
+ * 设置树节点图标
+ */
+ public TreeCellFactory setIconSupplier(Function, Image> iconSupplier) {
+ this.iconSupplier = iconSupplier;
+ return this;
+ }
+
+ @Override
+ public TreeCell call(TreeView param) {
+ TreeCell treeCell = new TreeCell() {
+ @Override
+ protected void updateItem(T item, boolean empty) {
+ super.updateItem(item, empty);
+
+ if (empty) {
+ setText(null);
+ setGraphic(null);
+ } else {
+ setCellText(item);
+ setCellIcon(this.getTreeItem());
+ }
+ }
+
+ private void setCellIcon(TreeItem treeItem) {
+ if (iconSupplier != null) {
+ Image image = iconSupplier.apply(treeItem);
+ ImageView imageView = new ImageView(image);
+ imageView.setFitWidth(16);
+ imageView.setFitHeight(16);
+ setGraphic(imageView);
+ }
+ }
+
+ private void setCellText(T item) {
+ setText(toString != null ? toString.apply(item) : String.valueOf(item));
+ }
+ };
+
+ if (onDoubleClick != null) {
+ treeCell.setOnMouseClicked(event -> {
+ if (!treeCell.isEmpty() && event.getClickCount() == 2) {
+ onDoubleClick.accept(treeCell.getItem());
+ }
+ });
+ }
+
+ return treeCell;
+ }
+}
diff --git a/src/main/java/com/xwintop/xcore/javafx/decorator/ComboBoxDecorator.java b/src/main/java/com/xwintop/xcore/javafx/decorator/ComboBoxDecorator.java
new file mode 100644
index 0000000..d9d72a2
--- /dev/null
+++ b/src/main/java/com/xwintop/xcore/javafx/decorator/ComboBoxDecorator.java
@@ -0,0 +1,103 @@
+package com.xwintop.xcore.javafx.decorator;
+
+import com.xwintop.xcore.javafx.cells.ListCellFactory;
+import javafx.scene.control.ComboBox;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.scene.control.cell.ComboBoxListCell;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+import java.util.Collection;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Predicate;
+
+/**
+ * 封装对 ComboBox 的配置
+ */
+@SuppressWarnings("unchecked")
+public class ComboBoxDecorator {
+
+ public static ComboBoxDecorator of(ComboBox comboBox) {
+ return new ComboBoxDecorator<>(comboBox);
+ }
+
+ private ComboBox comboBox;
+
+ private ComboBoxDecorator(ComboBox comboBox) {
+ this.comboBox = comboBox;
+ }
+
+ /**
+ * 设置下拉选项和当前选项的文本
+ */
+ public ComboBoxDecorator setToStringFunction(Function toString) {
+ setCellFactory(new ListCellFactory().withTextFunction(toString));
+ return this;
+ }
+
+ /**
+ * 设置下拉选项的 CellFactory
+ */
+ public ComboBoxDecorator setCellFactory(Callback, ListCell> cellFactory) {
+ this.comboBox.setCellFactory(cellFactory);
+ this.comboBox.setButtonCell(cellFactory.call(null));
+ return this;
+ }
+
+ /**
+ * 设置当前选项的文本
+ */
+ public ComboBoxDecorator setButtonCellToStringFunction(Function toStringFunction) {
+ this.comboBox.setButtonCell(new ComboBoxListCell<>(new StringConverter() {
+ @Override
+ public String toString(T object) {
+ return toStringFunction.apply(object);
+ }
+
+ @Override
+ public T fromString(String string) {
+ return null;
+ }
+ }));
+ return this;
+ }
+
+ /**
+ * 设置选项列表
+ */
+ public ComboBoxDecorator setItems(Collection tCollection) {
+ this.comboBox.getItems().setAll(tCollection);
+ return this;
+ }
+
+ /**
+ * 设置选项列表
+ */
+ @SafeVarargs
+ public final ComboBoxDecorator setItems(T... tCollection) {
+ this.comboBox.getItems().setAll(tCollection);
+ return this;
+ }
+
+ /**
+ * 根据指定规则设置当前选项
+ */
+ public ComboBoxDecorator setInitialValue(Predicate valueMatcher) {
+ this.comboBox.getSelectionModel().select(
+ this.comboBox.getItems().stream().filter(valueMatcher).findFirst().orElse(null)
+ );
+ return this;
+ }
+
+ /**
+ * 设置当选项变化时的处理
+ */
+ public ComboBoxDecorator setOnChange(Consumer newValueConsumer) {
+ this.comboBox.getSelectionModel().selectedItemProperty().addListener(
+ (_ob, _old, _new) -> newValueConsumer.accept(_new)
+ );
+ return this;
+ }
+}
--
Gitee
From 36354daa8b4a1895b0d5266cb45097a678b9d84b Mon Sep 17 00:00:00 2001
From: xufeng <1277032935@qq.com>
Date: Sat, 5 Sep 2020 22:07:48 +0800
Subject: [PATCH 06/30] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B0=83=E5=BA=A6?=
=?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=B1=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 7 +-
.../xwintop/xcore/util/javafx/ActionJob.java | 13 ++
.../xcore/util/javafx/ActionScheduleUtil.java | 145 ++++++++++++++++++
3 files changed, 163 insertions(+), 2 deletions(-)
create mode 100644 src/main/java/com/xwintop/xcore/util/javafx/ActionJob.java
create mode 100644 src/main/java/com/xwintop/xcore/util/javafx/ActionScheduleUtil.java
diff --git a/README.md b/README.md
index 620c533..782b7ef 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@
com.xwintop
xcore
- 0.0.3-SNAPSHOT
+ 0.0.6
provided
@@ -43,4 +43,7 @@ git 托管 maven可参考教程(若无法下载请拉取项目自行编译)。[
- 0.0.4-SNAPSHOT 2020-03-16
1. 优化界面布局
- 0.0.5 2020-03-16
- 1. 添加进度条对话框
\ No newline at end of file
+ 1. 添加进度条对话框
+- 0.0.6 2020-07-04
+ 1. 添加历史输入框功能封装
+ 2. 优化部分功能代码
\ No newline at end of file
diff --git a/src/main/java/com/xwintop/xcore/util/javafx/ActionJob.java b/src/main/java/com/xwintop/xcore/util/javafx/ActionJob.java
new file mode 100644
index 0000000..8206892
--- /dev/null
+++ b/src/main/java/com/xwintop/xcore/util/javafx/ActionJob.java
@@ -0,0 +1,13 @@
+package com.xwintop.xcore.util.javafx;
+
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+public class ActionJob implements Job {
+ @Override
+ public void execute(JobExecutionContext context) throws JobExecutionException {
+ Runnable runnable = (Runnable) context.getMergedJobDataMap().get("runnable");
+ runnable.run();
+ }
+}
diff --git a/src/main/java/com/xwintop/xcore/util/javafx/ActionScheduleUtil.java b/src/main/java/com/xwintop/xcore/util/javafx/ActionScheduleUtil.java
new file mode 100644
index 0000000..d7e24bd
--- /dev/null
+++ b/src/main/java/com/xwintop/xcore/util/javafx/ActionScheduleUtil.java
@@ -0,0 +1,145 @@
+package com.xwintop.xcore.util.javafx;
+
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
+import javafx.geometry.Pos;
+import javafx.scene.control.*;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.Pane;
+import javafx.scene.layout.StackPane;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.quartz.*;
+import org.quartz.impl.StdSchedulerFactory;
+
+/**
+ * @ClassName: ScheduleManager
+ * @Description: 自动任务管理类
+ * @author: xufeng
+ * @date: 2018/1/25 16:35
+ */
+
+@Getter
+@Setter
+@Slf4j
+public class ActionScheduleUtil {
+ private static final String[] quartzChoiceBoxStrings = new String[]{"简单表达式", "Cron表达式"};
+ private SchedulerFactory sf = new StdSchedulerFactory();
+ private String schedulerKeyGroup = "x";
+ private String schedulerKeyName = "x";
+
+ private TextField cronTextField;
+ private ChoiceBox quartzChoiceBox;
+ private Spinner intervalSpinner;
+ private Spinner repeatCountSpinner;
+
+ private Runnable runnable;
+
+ //添加调度控件
+ public void setScheduleNode(Pane pane) {
+ quartzChoiceBox = new ChoiceBox();
+ quartzChoiceBox.setPrefWidth(100);
+ quartzChoiceBox.getItems().addAll(quartzChoiceBoxStrings);
+ quartzChoiceBox.getSelectionModel().select(0);
+ StackPane stackPane = new StackPane();
+ cronTextField = new TextField("* * * * * ?");
+ cronTextField.setVisible(false);
+ stackPane.getChildren().add(cronTextField);
+ HBox simpleScheduleAnchorPane = new HBox();
+ simpleScheduleAnchorPane.setAlignment(Pos.CENTER_LEFT);
+ simpleScheduleAnchorPane.setSpacing(5);
+ stackPane.getChildren().add(simpleScheduleAnchorPane);
+ intervalSpinner = new Spinner<>();
+ intervalSpinner.setEditable(true);
+ intervalSpinner.setPrefWidth(66);
+ intervalSpinner.setTooltip(new Tooltip("单位为秒"));
+ repeatCountSpinner = new Spinner<>();
+ repeatCountSpinner.setEditable(true);
+ repeatCountSpinner.setPrefWidth(66);
+ repeatCountSpinner.setTooltip(new Tooltip("-1为永久任务"));
+ simpleScheduleAnchorPane.getChildren().add(new Label("间隔"));
+ simpleScheduleAnchorPane.getChildren().add(intervalSpinner);
+ simpleScheduleAnchorPane.getChildren().add(new Label("次数"));
+ simpleScheduleAnchorPane.getChildren().add(repeatCountSpinner);
+ JavaFxViewUtil.setSpinnerValueFactory(intervalSpinner, 1, Integer.MAX_VALUE);
+ JavaFxViewUtil.setSpinnerValueFactory(repeatCountSpinner, -1, Integer.MAX_VALUE);
+ quartzChoiceBox.valueProperty().addListener(new ChangeListener() {
+ @Override
+ public void changed(ObservableValue extends String> observable, String oldValue, String newValue) {
+ if (quartzChoiceBoxStrings[0].equals(newValue)) {
+ cronTextField.setVisible(false);
+ simpleScheduleAnchorPane.setVisible(true);
+ } else if (quartzChoiceBoxStrings[1].equals(newValue)) {
+ cronTextField.setVisible(true);
+ simpleScheduleAnchorPane.setVisible(false);
+ }
+ }
+ });
+ Button runQuartzButton = new Button("定时运行");
+ runQuartzButton.setOnAction(event -> {
+ if ("定时运行".equals(runQuartzButton.getText())) {
+ try {
+ ActionScheduleUtil.this.runQuartzAction();
+ runQuartzButton.setText("停止运行");
+ } catch (Exception e) {
+ log.error("运行错误!", e);
+ TooltipUtil.showToast("运行错误:" + e.getMessage());
+ }
+ } else {
+ try {
+ ActionScheduleUtil.this.stopQuartzAction();
+ runQuartzButton.setText("定时运行");
+ } catch (Exception e) {
+ log.error("停止错误!", e);
+ TooltipUtil.showToast("停止错误:" + e.getMessage());
+ }
+ }
+ });
+ pane.getChildren().add(quartzChoiceBox);
+ pane.getChildren().add(stackPane);
+ pane.getChildren().add(runQuartzButton);
+ }
+
+ //设置调度执行事件
+ public void setJobAction(Runnable runnable) {
+ this.runnable = runnable;
+ }
+
+ public void runQuartzAction() throws Exception {
+// schedulerKeyGroup = jobClass.toString();
+ schedulerKeyName = schedulerKeyGroup + System.currentTimeMillis();
+ JobDetail jobDetail = JobBuilder.newJob(ActionJob.class).withIdentity(schedulerKeyName, schedulerKeyGroup).build();
+ jobDetail.getJobDataMap().put("runnable", runnable);
+ ScheduleBuilder scheduleBuilder = null;
+ if (quartzChoiceBoxStrings[0].equals(quartzChoiceBox.getValue())) {
+ scheduleBuilder = SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(intervalSpinner.getValue())// 时间间隔
+ .withRepeatCount(repeatCountSpinner.getValue());// 重复次数
+ } else if (quartzChoiceBoxStrings[1].equals(quartzChoiceBox.getValue())) {
+ if (StringUtils.isEmpty(cronTextField.getText())) {
+ throw new Exception("cron表达式不能为空。");
+ }
+ scheduleBuilder = CronScheduleBuilder.cronSchedule(cronTextField.getText());
+ }
+ // 描叙触发Job执行的时间触发规则,Trigger实例化一个触发器
+ Trigger trigger = TriggerBuilder.newTrigger()// 创建一个新的TriggerBuilder来规范一个触发器
+ .withIdentity(schedulerKeyName, schedulerKeyGroup)// 给触发器一个名字和组名
+ .startNow()// 立即执行
+ .withSchedule(scheduleBuilder).build();// 产生触发器
+
+ // 运行容器,使用SchedulerFactory创建Scheduler实例
+ Scheduler scheduler = sf.getScheduler();
+ // 向Scheduler添加一个job和trigger
+ scheduler.scheduleJob(jobDetail, trigger);
+ if (!scheduler.isStarted()) {
+ scheduler.start();
+ }
+ }
+
+ public void stopQuartzAction() throws Exception {
+ Scheduler sched = sf.getScheduler();
+ sched.unscheduleJob(new TriggerKey(schedulerKeyName, schedulerKeyGroup));
+ sched.deleteJob(new JobKey(schedulerKeyName, schedulerKeyGroup));
+ }
+}
--
Gitee
From 34ad78e83b4bb8287e7b1469281e768666cfaf75 Mon Sep 17 00:00:00 2001
From: xufeng <1277032935@qq.com>
Date: Tue, 19 Jan 2021 13:57:54 +0800
Subject: [PATCH 07/30] =?UTF-8?q?=E8=BF=98=E5=8E=9FAlertUtil=E4=B8=AD?=
=?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=96=B9=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../xwintop/xcore/util/javafx/AlertUtil.java | 56 +++++++++++++++++--
1 file changed, 52 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/xwintop/xcore/util/javafx/AlertUtil.java b/src/main/java/com/xwintop/xcore/util/javafx/AlertUtil.java
index 5916833..ab33c40 100644
--- a/src/main/java/com/xwintop/xcore/util/javafx/AlertUtil.java
+++ b/src/main/java/com/xwintop/xcore/util/javafx/AlertUtil.java
@@ -6,13 +6,14 @@ import static com.xwintop.xcore.javafx.helper.LayoutHelper.vbox;
import com.xwintop.xcore.javafx.FxApp;
import com.xwintop.xcore.javafx.dialog.FxDialog;
import com.xwintop.xcore.javafx.helper.LayoutHelper;
+
+import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
-import javafx.scene.control.Button;
-import javafx.scene.control.ButtonType;
-import javafx.scene.control.Label;
-import javafx.scene.control.TextField;
+import javafx.scene.control.*;
+import javafx.scene.layout.GridPane;
+import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Modality;
@@ -164,4 +165,51 @@ public class AlertUtil {
newStage.showAndWait();
return isOk.get();
}
+
+ @Deprecated
+ public static String showInputAlert(String message) {
+ return showInputAlertDefaultValue(message, null);
+ }
+
+ public static String[] showInputAlert(String message, String... names) {
+ return showInputAlertMore(message, names);
+ }
+
+ public static String[] showInputAlertMore(String message, String... names) {
+ return showInputAlertMore(message, names, new String[names.length]);
+ }
+
+ public static String[] showInputAlertMore(String message, String[] names, String[] defaultValue) {
+ GridPane page1Grid = new GridPane();
+ page1Grid.setVgap(10);
+ page1Grid.setHgap(10);
+
+ TextField[] textFields = new TextField[names.length];
+ for (int i = 0; i < names.length; i++) {
+ TextField textField = new TextField();
+ textField.setText(defaultValue[i]);
+ textField.setMinWidth(100);
+ textField.prefColumnCountProperty().bind(textField.textProperty().length());
+ GridPane.setHgrow(textField, Priority.ALWAYS);
+ page1Grid.add(new Label(names[i]), 0, i);
+ page1Grid.add(textField, 1, i);
+ textFields[i] = textField;
+ }
+
+ Alert alert = new Alert(Alert.AlertType.NONE, null, new ButtonType("取消", ButtonBar.ButtonData.NO),
+ new ButtonType("确定", ButtonBar.ButtonData.YES));
+ alert.setTitle(message);
+ alert.setGraphic(page1Grid);
+ alert.setWidth(200);
+ Optional _buttonType = alert.showAndWait();
+ // 根据点击结果返回
+ if (_buttonType.get().getButtonData().equals(ButtonBar.ButtonData.YES)) {
+ String[] stringS = new String[names.length];
+ for (int i = 0; i < textFields.length; i++) {
+ stringS[i] = textFields[i].getText();
+ }
+ return stringS;
+ }
+ return null;
+ }
}
--
Gitee
From 80c2f689d00e67791ce30631161b4e002434f338 Mon Sep 17 00:00:00 2001
From: xufeng <1277032935@qq.com>
Date: Mon, 25 Jan 2021 19:01:50 +0800
Subject: [PATCH 08/30] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E6=96=87=E4=BB=B6=E5=9B=BE=E6=A0=87=E6=96=B9=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/xwintop/xcore/util/javafx/ImageUtil.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/main/java/com/xwintop/xcore/util/javafx/ImageUtil.java b/src/main/java/com/xwintop/xcore/util/javafx/ImageUtil.java
index 1a46f92..409d33f 100644
--- a/src/main/java/com/xwintop/xcore/util/javafx/ImageUtil.java
+++ b/src/main/java/com/xwintop/xcore/util/javafx/ImageUtil.java
@@ -3,12 +3,15 @@ package com.xwintop.xcore.util.javafx;
import com.xwintop.xcore.util.FileUtil;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.imaging.ImageFormats;
import org.apache.commons.imaging.Imaging;
import javax.imageio.ImageIO;
+import javax.swing.*;
+import javax.swing.filechooser.FileSystemView;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -92,4 +95,17 @@ public class ImageUtil {
ImageIO.write(bufferedImage, FileUtil.getFileSuffixName(file),file);
}
}
+
+ //获取文件图标
+ public static ImageView getFileIconImage(File file) {
+ Icon icon = FileSystemView.getFileSystemView().getSystemIcon(file);
+ BufferedImage bufferedImage = new BufferedImage(
+ icon.getIconWidth(),
+ icon.getIconHeight(),
+ BufferedImage.TYPE_INT_ARGB
+ );
+ icon.paintIcon(null, bufferedImage.getGraphics(), 0, 0);
+ Image fxImage = SwingFXUtils.toFXImage(bufferedImage, null);
+ return new ImageView(fxImage);
+ }
}
--
Gitee
From 9f27580b6091881e9684939d22e1529cf26adf86 Mon Sep 17 00:00:00 2001
From: xufeng <1277032935@qq.com>
Date: Mon, 25 Jan 2021 19:03:17 +0800
Subject: [PATCH 09/30] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E6=96=87=E4=BB=B6=E5=9B=BE=E6=A0=87=E6=96=B9=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../xwintop/xcore/util/javafx/ImageUtil.java | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/xwintop/xcore/util/javafx/ImageUtil.java b/src/main/java/com/xwintop/xcore/util/javafx/ImageUtil.java
index 409d33f..b8540d1 100644
--- a/src/main/java/com/xwintop/xcore/util/javafx/ImageUtil.java
+++ b/src/main/java/com/xwintop/xcore/util/javafx/ImageUtil.java
@@ -29,6 +29,7 @@ public class ImageUtil {
/**
* 获取图片BufferedImage
+ *
* @param path 图片路径
*/
public static BufferedImage getBufferedImage(String path) {
@@ -51,6 +52,7 @@ public class ImageUtil {
/**
* 获取javafx图片
+ *
* @param path 图片路径
*/
public static Image getFXImage(String path) {
@@ -80,22 +82,28 @@ public class ImageUtil {
/**
* 保存图片
+ *
* @param image
* @param file
*/
- public static void writeImage(Image image, File file) throws Exception{
- writeImage(SwingFXUtils.fromFXImage(image, null),file);
+ public static void writeImage(Image image, File file) throws Exception {
+ writeImage(SwingFXUtils.fromFXImage(image, null), file);
}
- public static void writeImage(BufferedImage bufferedImage, File file) throws Exception{
+ public static void writeImage(BufferedImage bufferedImage, File file) throws Exception {
try {
- Imaging.writeImage(bufferedImage,file, ImageFormats.valueOf(FileUtil.getFileSuffixName(file).toUpperCase()),null);
+ Imaging.writeImage(bufferedImage, file, ImageFormats.valueOf(FileUtil.getFileSuffixName(file).toUpperCase()), null);
} catch (Exception e) {
e.printStackTrace();
- ImageIO.write(bufferedImage, FileUtil.getFileSuffixName(file),file);
+ ImageIO.write(bufferedImage, FileUtil.getFileSuffixName(file), file);
}
}
+ //获取文件夹图标
+ public static ImageView getDirectoryIconImage() {
+ return getFileIconImage(FileSystemView.getFileSystemView().getHomeDirectory());
+ }
+
//获取文件图标
public static ImageView getFileIconImage(File file) {
Icon icon = FileSystemView.getFileSystemView().getSystemIcon(file);
--
Gitee
From 187afc2a48eece251e7b0c30aee90c2c50a43f36 Mon Sep 17 00:00:00 2001
From: xufeng <1277032935@qq.com>
Date: Thu, 4 Mar 2021 10:50:13 +0800
Subject: [PATCH 10/30] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Jpro=E6=94=AF=E6=8C=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 141 +++++++++---------
.../xcore/util/javafx/JavaFxSystemUtil.java | 8 +-
.../xcore/util/javafx/JavaFxViewUtil.java | 10 +-
3 files changed, 84 insertions(+), 75 deletions(-)
diff --git a/pom.xml b/pom.xml
index e47f28b..d2482a1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.xwintop
xcore
- 0.0.6-jdk15-SNAPSHOT
+ 0.0.7
jar
xcore
@@ -12,10 +12,9 @@
https://gitee.com/xwintop/xcore
+ 1.8
+ 1.8
UTF-8
- true
- 15
- 15
@@ -23,43 +22,46 @@
aliyunmaven
http://maven.aliyun.com/nexus/content/groups/public/
+
+ spring-snapshots
+ http://repo.spring.io/snapshot
+
+ true
+
+
+
+ spring-milestones
+ http://repo.spring.io/milestone
+
+
+ apache.snapshots
+ Apache Development Snapshot Repository
+ https://repository.apache.org/content/repositories/snapshots/
+
+ false
+
+
+ true
+
+
+
+ jpro - sandec repository
+ https://sandec.bintray.com/repo
+
-
- org.openjfx
- javafx-controls
- 15
-
-
- org.openjfx
- javafx-fxml
- 15
-
-
- org.openjfx
- javafx-swing
- 15
-
-
- org.openjfx
- javafx-web
- 15
-
-
junit
junit
4.12
test
-
ch.qos.logback
logback-classic
1.2.3
- provided
@@ -79,20 +81,26 @@
org.quartz-scheduler
quartz
2.3.1
- provided
org.controlsfx
controlsfx
- 11.0.3
+ 8.40.16
com.jfoenix
jfoenix
- 9.0.10
+ 8.0.9
+
+
+
+
+ com.sandec.jpro
+ jpro-webapi
+ 2019.2.7
@@ -148,7 +156,7 @@
org.projectlombok
lombok
- 1.18.12
+ 1.18.6
provided
@@ -175,45 +183,34 @@
-
-
- dev-local
-
-
- xwintop-maven
- file:C:/gitFiles/maven/repository/
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-resources-plugin
- 3.0.2
-
- UTF-8
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.20
-
- true
- once
- -Dfile.encoding=UTF-8
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.8.1
-
-
-
-
-
-
+
+
+ xwintop-maven
+ file:C:/gitFiles/maven/repository/
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 3.0.2
+
+ UTF-8
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.20
+
+ true
+ once
+ -Dfile.encoding=UTF-8
+
+
+
+
diff --git a/src/main/java/com/xwintop/xcore/util/javafx/JavaFxSystemUtil.java b/src/main/java/com/xwintop/xcore/util/javafx/JavaFxSystemUtil.java
index c7d9cc6..ece99aa 100644
--- a/src/main/java/com/xwintop/xcore/util/javafx/JavaFxSystemUtil.java
+++ b/src/main/java/com/xwintop/xcore/util/javafx/JavaFxSystemUtil.java
@@ -5,6 +5,8 @@ import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.File;
import java.io.IOException;
+
+import com.jpro.webapi.WebAPI;
import javafx.geometry.Rectangle2D;
import javafx.stage.Screen;
import javafx.stage.Stage;
@@ -21,6 +23,7 @@ public class JavaFxSystemUtil {
/**
* 打开目录
+ *
* @param directoryPath 目录路径
*/
public static void openDirectory(String directoryPath) {
@@ -31,14 +34,17 @@ public class JavaFxSystemUtil {
}
}
-
/**
* 获取屏幕尺寸
+ *
* @param width 宽度比
* @param height 高度比
* @return 屏幕尺寸
*/
public static double[] getScreenSizeByScale(double width, double height) {
+ if (WebAPI.isBrowser()) {
+ return new double[]{1280, 900};
+ }
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
double screenWidth = screenSize.width * width;
double screenHeight = screenSize.height * height;
diff --git a/src/main/java/com/xwintop/xcore/util/javafx/JavaFxViewUtil.java b/src/main/java/com/xwintop/xcore/util/javafx/JavaFxViewUtil.java
index a535731..d3b9a61 100644
--- a/src/main/java/com/xwintop/xcore/util/javafx/JavaFxViewUtil.java
+++ b/src/main/java/com/xwintop/xcore/util/javafx/JavaFxViewUtil.java
@@ -3,6 +3,7 @@ package com.xwintop.xcore.util.javafx;
import cn.hutool.cache.impl.TimedCache;
import cn.hutool.core.lang.Singleton;
import com.jfoenix.controls.JFXDecorator;
+import com.jpro.webapi.WebAPI;
import com.xwintop.xcore.javafx.FxApp;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
@@ -210,8 +211,13 @@ public class JavaFxViewUtil {
public static void openNewWindow(String title, String iconUrl, Parent root, double width, double height,
boolean fullScreen, boolean max, boolean min) {
Stage newStage = getNewStageNull(title, iconUrl, root, width, height, fullScreen, max, min);
- newStage.initModality(Modality.APPLICATION_MODAL);
- newStage.show();
+ if (WebAPI.isBrowser()) {
+ WebAPI webAPI = WebAPI.getWebAPI(JavaFxSystemUtil.mainStage);
+ webAPI.openStageAsTab(newStage);
+ } else {
+ newStage.initModality(Modality.APPLICATION_MODAL);
+ newStage.show();
+ }
}
//获取一个新窗口
--
Gitee
From a843dff72fa6fcec52f7ec3bbb96c2fef725ab7b Mon Sep 17 00:00:00 2001
From: xufeng <1277032935@qq.com>
Date: Wed, 10 Mar 2021 13:32:44 +0800
Subject: [PATCH 11/30] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E5=8F=B3=E9=94=AE=E5=8A=9F=E8=83=BD=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../xcore/util/javafx/JavaFxViewUtil.java | 78 +++++++++----------
1 file changed, 35 insertions(+), 43 deletions(-)
diff --git a/src/main/java/com/xwintop/xcore/util/javafx/JavaFxViewUtil.java b/src/main/java/com/xwintop/xcore/util/javafx/JavaFxViewUtil.java
index d3b9a61..bfe24e0 100644
--- a/src/main/java/com/xwintop/xcore/util/javafx/JavaFxViewUtil.java
+++ b/src/main/java/com/xwintop/xcore/util/javafx/JavaFxViewUtil.java
@@ -333,29 +333,25 @@ public class JavaFxViewUtil {
*/
public static void addTableViewOnMouseRightClickMenu(TableView