Skip to content

Commit cdd6427

Browse files
committed
Merge remote-tracking branch 'github/jdk17dev' into jdk17dev
2 parents f2dbb37 + add8e98 commit cdd6427

15 files changed

Lines changed: 100 additions & 276 deletions

File tree

README_EN.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ xJavaFxTool is a practical gadget set developed by javaFx. It uses some time to
2121
Due to the hot SpringBoot, the project has been released SpringBoot-javafx version, [xJavaFxTool-spring](https://gitee.com/xwintop/xJavaFxTool-spring) welcome reference, thank you.
2222

2323
#### Download trial address:
24-
- Jar package that can be run directly (local need to have jdk1.8 environment)[xJavaFxTool-0.2.3.jar](https://xwintop.gitee.io/maven/package/xJavaFxTool/xJavaFxTool-0.2.3.jar)
25-
- Windows x64 installation package (compatible with xp, windows7, 8, 10, etc.)[xJavaFxTool-0.2.3-windows-x64.exe](https://xwintop.gitee.io/maven/package/xJavaFxTool/xJavaFxTool-0.2.3-windows-x64.exe)
26-
- Mac OS X x64 [xJavaFxTool-0.2.3-macosx-x64.pkg](https://xwintop.gitee.io/maven/package/xJavaFxTool/xJavaFxTool-0.2.3-macosx-x64.pkg)
24+
- Jar package that can be run directly (local need to have jdk1.8 environment)[xJavaFxTool-0.3.1.jar](https://github.com/864381832/xJavaFxTool/releases/download/0.3.1/xJavaFxTool-0.3.1.jar)
25+
- Windows x64 installation package (compatible with xp, windows7, 8, 10, etc.)[xJavaFxTool-0.3.1-windows-x64.exe](https://github.com/864381832/xJavaFxTool/releases/download/0.3.1/xJavaFxTool-0.3.1-windows-x64.exe)
26+
- Mac OS x64 [xJavaFxTool-0.3.1-macos.pkg](https://github.com/864381832/xJavaFxTool/releases/download/0.3.1/xJavaFxTool-0.3.1-macos.pkg)
27+
- Linux x64 [xJavaFxTool-0.3.1-linux-x64.zip](https://github.com/864381832/xJavaFxTool/releases/download/0.3.1/xJavaFxTool-0.3.1-linux-x64.zip)
2728
#### If the above link fails, use the download link below:
2829
- Baidu cloud link: [https://pan.baidu.com/s/193fhGnJL4dDWcqDnFJcHbA](https://pan.baidu.com/s/193fhGnJL4dDWcqDnFJcHbA) extraction code: mokl
2930
- Tencent micro cloud link: [https://share.weiyun.com/5T6FPLW](https://share.weiyun.com/5T6FPLW) extraction code: java
@@ -36,8 +37,7 @@ the plug-in jar package can be automatically loaded under the root directory lib
3637
- Developed with eclipase or Intellij Idea (Recommended to use [Intellij Idea](https://www.jetbrains.com/idea/) )
3738
- This project uses [lombok](https://projectlombok.org/) . If you have not downloaded the lombok plugin when viewing this project, please install it first, otherwise you can't find the get/set method.
3839
- The dependent [xcore](https://gitee.com/xwintop/xcore) package has been uploaded to the git-hosted maven platform. The git hosting maven can refer to the tutorial (if you can't download it, please pull the project to compile it yourself ). Tutorial address: Click to enter
39-
- Package using the [javafx-maven-plugin](https://github.com/javafx-maven-plugin/javafx-maven-plugin) (can be packaged for windows, Linux, Mac installation packages)
40-
- Use [exe4j](https://www.ej-technologies.com/download/exe4j/files) to convert the jar package into an exe executable file (for reference only, you can use other programs to package)
40+
- Package using the [javapackager](https://github.com/fvarrui/JavaPackager) (can be packaged for windows, Linux, Mac installation packages)
4141
- Use [InnoSetup](http://www.jrsoftware.org/) to make windows installation packages
4242

4343
#### The currently integrated gadgets are:

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.xwintop</groupId>
66
<artifactId>xJavaFxTool</artifactId>
7-
<version>0.3.1</version>
7+
<version>0.3.2</version>
88
<packaging>jar</packaging>
99
<name>xJavaFxTool</name>
1010
<description>基于JavaFx搭建的实用小工具集合</description>

src/main/java/com/xwintop/xJavaFxTool/controller/IndexController.java

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
import com.xwintop.xJavaFxTool.services.IndexService;
1313
import com.xwintop.xJavaFxTool.services.index.SystemSettingService;
1414
import com.xwintop.xJavaFxTool.utils.Config;
15+
import com.xwintop.xJavaFxTool.utils.VersionChecker;
1516
import com.xwintop.xJavaFxTool.view.IndexView;
1617
import com.xwintop.xcore.javafx.FxApp;
18+
import com.xwintop.xcore.javafx.dialog.FxAlerts;
1719
import com.xwintop.xcore.javafx.dialog.FxDialog;
1820
import com.xwintop.xcore.util.ConfigureUtil;
1921
import com.xwintop.xcore.util.HttpClientUtil;
@@ -74,16 +76,12 @@ public void initialize(URL location, ResourceBundle resources) {
7476
initView();
7577
initEvent();
7678
initService();
77-
initNotepad();
78-
}
79-
80-
private void initNotepad() {
81-
// if (Config.getBoolean(Config.Keys.NotepadEnabled, true)) {
82-
// addNodepadAction(null);
83-
// }
8479
}
8580

8681
private void initView() {
82+
if (Config.getBoolean(Config.Keys.NotepadEnabled, true)) {
83+
addNodepadAction(null);
84+
}
8785
this.indexService.addWebView(XJavaFxToolApplication.RESOURCE_BUNDLE.getString("feedback"), QQ_URL, null);
8886
this.tongjiWebView.getEngine().load(STATISTICS_URL);
8987
this.tabPaneMain.getSelectionModel().select(0);
@@ -164,24 +162,31 @@ private void addCategory(PluginCategoryController category) {
164162
}
165163

166164
private void addMenu(PluginJarInfo jarInfo) {
167-
MenuItem menu = moreToolsMenu.getItems().stream().filter(menuItem1 -> jarInfo.getMenuParentId().equals(menuItem1.getId())).findAny().orElse(null);
168-
if (menu == null) {
169-
menu = new Menu(XJavaFxToolApplication.RESOURCE_BUNDLE.getString(jarInfo.getMenuParentTitle()));
170-
menu.setId(jarInfo.getMenuParentId());
171-
moreToolsMenu.getItems().add(menu);
172-
}
173-
MenuItem menuItem = new MenuItem(jarInfo.getTitle());
165+
MenuItem menu = moreToolsMenu.getItems().stream().filter(menuItem1 -> jarInfo.getMenuParentId().equals(menuItem1.getId())).findAny().orElse(null);
166+
if (menu == null) {
167+
menu = new Menu(XJavaFxToolApplication.RESOURCE_BUNDLE.getString(jarInfo.getMenuParentTitle()));
168+
menu.setId(jarInfo.getMenuParentId());
169+
moreToolsMenu.getItems().add(menu);
170+
}
171+
MenuItem menuItem = new MenuItem(jarInfo.getTitle());
172+
if (jarInfo.getIconImage() == null) {
174173
if (StringUtils.isNotEmpty(jarInfo.getIconPath())) {
175174
ImageView imageView = new ImageView(new Image(jarInfo.getIconPath()));
176175
imageView.setFitHeight(18);
177176
imageView.setFitWidth(18);
178177
menuItem.setGraphic(imageView);
179178
}
180-
menuItem.setOnAction((ActionEvent event) -> {
181-
indexService.loadPlugin(jarInfo);
182-
});
183-
((Menu)menu).getItems().add(menuItem);
184-
menuItemMap.put(menuItem.getText(), menuItem);
179+
} else {
180+
ImageView imageView = new ImageView(jarInfo.getIconImage());
181+
imageView.setFitHeight(18);
182+
imageView.setFitWidth(18);
183+
menuItem.setGraphic(imageView);
184+
}
185+
menuItem.setOnAction((ActionEvent event) -> {
186+
indexService.loadPlugin(jarInfo);
187+
});
188+
((Menu) menu).getItems().add(menuItem);
189+
menuItemMap.put(menuItem.getText(), menuItem);
185190
}
186191

187192
public void selectAction(String selectText) {
@@ -239,6 +244,13 @@ private void SettingAction() {
239244
SystemSettingService.openSystemSettings(bundle.getString("Setting"));
240245
}
241246

247+
@FXML
248+
private void checkerVersionAction() {
249+
if (!VersionChecker.checkNewVersion()) {
250+
FxAlerts.info("提示", "已经是新版本");
251+
}
252+
}
253+
242254
@FXML
243255
private void aboutAction() {
244256
AlertUtil.showInfoAlert(bundle.getString("aboutText") + Config.xJavaFxToolVersions);

src/main/java/com/xwintop/xJavaFxTool/model/PluginJarInfo.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.xwintop.xJavaFxTool.model;
22

33
import com.alibaba.fastjson.annotation.JSONField;
4+
import javafx.scene.image.Image;
45
import lombok.Data;
56
import lombok.NoArgsConstructor;
67

@@ -83,4 +84,7 @@ public File getFile() {
8384
public String getDefaultIconPath() {
8485
return bundleName == null ? "" : (bundleName.replace("locale.", "/logo/") + ".png");
8586
}
87+
88+
@JSONField(serialize = false)
89+
private Image iconImage;
8690
}

src/main/java/com/xwintop/xJavaFxTool/newui/NewLauncherController.java

Lines changed: 0 additions & 188 deletions
This file was deleted.

src/main/java/com/xwintop/xJavaFxTool/newui/PluginItemController.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
@Slf4j
2424
public class PluginItemController {
2525
public static final String FXML_PATH = "/com/xwintop/xJavaFxTool/fxmlView/newui/plugin-item.fxml";
26+
2627
public static PluginItemController newInstance(PluginJarInfo pluginJarInfo) {
2728
FXMLLoader fxmlLoader = FxmlHelper.loadFromResource(FXML_PATH);
2829
PluginItemController controller = fxmlLoader.getController();
@@ -73,13 +74,17 @@ private void onMouseLeftClicked(MouseEvent event) {
7374
}
7475

7576
private void updateIcon() {
76-
URL iconUrl = ResourceUtils.getResource(this.pluginJarInfo.getIconPath(), this.pluginJarInfo.getDefaultIconPath(), "/logo/plugin.png");
77-
if (iconUrl != null) {
78-
String url = iconUrl.toExternalForm();
79-
if (url.endsWith("plugin.png")) {
80-
log.info("please add logo to " + this.pluginJarInfo.getDefaultIconPath());
77+
if (this.pluginJarInfo.getIconImage() != null) {
78+
imgLogo.setImage(this.pluginJarInfo.getIconImage());
79+
} else {
80+
URL iconUrl = ResourceUtils.getResource(this.pluginJarInfo.getIconPath(), this.pluginJarInfo.getDefaultIconPath(), "/logo/plugin.png");
81+
if (iconUrl != null) {
82+
String url = iconUrl.toExternalForm();
83+
if (url.endsWith("plugin.png")) {
84+
log.info("please add logo to " + this.pluginJarInfo.getDefaultIconPath());
85+
}
86+
imgLogo.setImage(new Image(url));
8187
}
82-
imgLogo.setImage(new Image(url));
8388
}
8489
}
8590

src/main/java/com/xwintop/xJavaFxTool/plugin/PluginParser.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.xwintop.xJavaFxTool.AppException;
44
import com.xwintop.xJavaFxTool.model.PluginJarInfo;
55
import com.xwintop.xJavaFxTool.utils.Config;
6+
import javafx.scene.image.Image;
67
import lombok.extern.slf4j.Slf4j;
78
import org.apache.commons.lang3.StringUtils;
89
import org.dom4j.Document;
@@ -71,6 +72,11 @@ public static void parse(File pluginFile, PluginJarInfo pluginJarInfo, ClassLoad
7172
pluginJarInfo.setBundleName(resourceBundleName);
7273
pluginJarInfo.setControllerType(controllerType);
7374
pluginJarInfo.setTitle(title);
75+
pluginJarInfo.setIconPath(pluginElement.elementTextTrim("iconPath"));
76+
if (StringUtils.isNotBlank(pluginJarInfo.getIconPath())) {
77+
Image iconImage = new Image(jarFile.getInputStream(jarFile.getJarEntry(StringUtils.removeStart(pluginJarInfo.getIconPath(),"/"))));
78+
pluginJarInfo.setIconImage(iconImage);
79+
}
7480

7581
if (controllerType.equals("Node")) {
7682
pluginJarInfo.setFxmlPath(url);

0 commit comments

Comments
 (0)