1.移动界面包路径;2.添加关闭tab时跳转至开始界面

This commit is contained in:
xufeng 2023-02-01 16:38:47 +08:00
parent 495b5eb140
commit eb278a4f86
9 changed files with 22 additions and 22 deletions

View File

@ -17,8 +17,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.test.skip>true</maven.test.skip>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<jpro.version>2022.1.3</jpro.version>
</properties>
<repositories>
@ -45,7 +45,7 @@
<dependency>
<groupId>com.gitee.xwintop</groupId>
<artifactId>xcore</artifactId>
<version>0.0.8-jdk17</version>
<version>0.0.8</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

View File

@ -5,8 +5,8 @@ import com.xwintop.xJavaFxTool.controller.index.PluginManageController;
import com.xwintop.xJavaFxTool.event.AppEvents;
import com.xwintop.xJavaFxTool.event.PluginEvent;
import com.xwintop.xJavaFxTool.model.PluginJarInfo;
import com.xwintop.xJavaFxTool.newui.PluginCategoryController;
import com.xwintop.xJavaFxTool.newui.PluginItemController;
import com.xwintop.xJavaFxTool.controller.plugin.PluginCategoryController;
import com.xwintop.xJavaFxTool.controller.plugin.PluginItemController;
import com.xwintop.xJavaFxTool.plugin.PluginManager;
import com.xwintop.xJavaFxTool.plugin.PluginParser;
import com.xwintop.xJavaFxTool.services.IndexService;

View File

@ -1,4 +1,4 @@
package com.xwintop.xJavaFxTool.newui;
package com.xwintop.xJavaFxTool.controller.plugin;
import com.xwintop.xcore.javafx.helper.FxmlHelper;
import javafx.fxml.FXMLLoader;
@ -10,7 +10,7 @@ public class PluginCategoryController {
public static PluginCategoryController newInstance(String categoryName) {
FXMLLoader fxmlLoader = FxmlHelper.loadFromResource(
"/com/xwintop/xJavaFxTool/fxmlView/newui/plugin-category.fxml"
"/com/xwintop/xJavaFxTool/fxmlView/plugin/plugin-category.fxml"
);
PluginCategoryController controller = fxmlLoader.getController();
controller.lblCategoryName.setText(categoryName);

View File

@ -1,4 +1,4 @@
package com.xwintop.xJavaFxTool.newui;
package com.xwintop.xJavaFxTool.controller.plugin;
import com.xwintop.xJavaFxTool.controller.IndexController;
import com.xwintop.xJavaFxTool.model.PluginJarInfo;
@ -19,7 +19,7 @@ import lombok.extern.slf4j.Slf4j;
@Data
@Slf4j
public class PluginItemController {
public static final String FXML_PATH = "/com/xwintop/xJavaFxTool/fxmlView/newui/plugin-item.fxml";
public static final String FXML_PATH = "/com/xwintop/xJavaFxTool/fxmlView/plugin/plugin-item.fxml";
public static PluginItemController newInstance(PluginJarInfo pluginJarInfo) {
FXMLLoader fxmlLoader = FxmlHelper.loadFromResource(FXML_PATH);

View File

@ -11,7 +11,6 @@ import com.xwintop.xJavaFxTool.utils.Config;
import com.xwintop.xJavaFxTool.utils.XJavaFxSystemUtil;
import com.xwintop.xcore.javafx.dialog.FxAlerts;
import com.xwintop.xcore.util.javafx.AlertUtil;
import com.xwintop.xcore.util.javafx.JavaFxSystemUtil;
import com.xwintop.xcore.util.javafx.JavaFxViewUtil;
import javafx.application.Platform;
import javafx.event.ActionEvent;
@ -19,7 +18,6 @@ import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextArea;
@ -27,13 +25,9 @@ import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Region;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Modality;
import javafx.stage.Stage;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
@ -98,7 +92,10 @@ public class IndexService {
indexController.getTabPaneMain().getSelectionModel().select(tab);
}
if (closeRequest != null) {
tab.setOnCloseRequest(closeRequest);
tab.setOnCloseRequest(event1 -> {
closeRequest.handle(event1);
indexController.getTabPaneMain().getSelectionModel().select(0);
});
}
}
}
@ -135,7 +132,10 @@ public class IndexService {
}
if (tab != null) {
tab.setOnClosed(event -> this.jarInfoMap.remove(pluginJarInfo));
tab.setOnClosed(event -> {
this.jarInfoMap.remove(pluginJarInfo);
indexController.getTabPaneMain().getSelectionModel().select(0);
});
jarInfoMap.put(pluginJarInfo, tab);
}
}
@ -205,13 +205,13 @@ public class IndexService {
HTMLView browser = null;
if (url.startsWith("http")) {
// webEngine.load(url);
String contentIframe2 = "<iframe frameborder=\"0\" style=\"width: 100%; height: 100%;\" src=\""+url+"\"> </iframe>";
String contentIframe2 = "<iframe frameborder=\"0\" style=\"width: 100%; height: 100%;\" src=\"" + url + "\"> </iframe>";
browser = new HTMLView(contentIframe2);
} else {
PluginContainer pluginContainer = new PluginContainer(plugin);
// webEngine.load(pluginContainer.getResource(url).toExternalForm());
try {
browser = new HTMLView(IOUtils.toString(pluginContainer.getResource(url).openStream(),"utf-8"));
browser = new HTMLView(IOUtils.toString(pluginContainer.getResource(url).openStream(), "utf-8"));
} catch (IOException e) {
throw new RuntimeException(e);
}

View File

@ -4,7 +4,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.web.WebView?>
<AnchorPane prefHeight="654.0" prefWidth="1044.0" stylesheets="/com/xwintop/xJavaFxTool/fxmlView/newui/main.css"
<AnchorPane prefHeight="654.0" prefWidth="1044.0" stylesheets="/com/xwintop/xJavaFxTool/fxmlView/plugin/main.css"
xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="com.xwintop.xJavaFxTool.controller.IndexController">
<TabPane fx:id="tabPaneMain" tabClosingPolicy="ALL_TABS" tabMinWidth="45.0" AnchorPane.bottomAnchor="0.0"

View File

@ -2,7 +2,7 @@
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.layout.VBox?>
<VBox spacing="5" styleClass="app-category"
fx:controller="com.xwintop.xJavaFxTool.newui.PluginCategoryController"
fx:controller="com.xwintop.xJavaFxTool.controller.plugin.PluginCategoryController"
fx:id="root"
xmlns:fx="http://javafx.com/fxml/1">
<Label styleClass="app-category-title" text="最近使用" fx:id="lblCategoryName"/>

View File

@ -5,7 +5,7 @@
<?import javafx.scene.layout.VBox?>
<VBox spacing="5" styleClass="app-item"
fx:id="root" alignment="CENTER"
fx:controller="com.xwintop.xJavaFxTool.newui.PluginItemController"
fx:controller="com.xwintop.xJavaFxTool.controller.plugin.PluginItemController"
xmlns:fx="http://javafx.com/fxml/1">
<HBox alignment="CENTER" VBox.vgrow="ALWAYS">
<ImageView fitWidth="48" fitHeight="48" fx:id="imgLogo">