Skip to content

Commit 1311d60

Browse files
committed
WIP: 代码格式化,调整 newui
1 parent d9f30dd commit 1311d60

7 files changed

Lines changed: 123 additions & 68 deletions

File tree

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ insert_final_newline = false
55
indent_style = space
66
indent_size = 4
77

8-
[*.{html, xml, yaml}]
8+
[*.{html, xml, yaml, fxml}]
99
indent_size = 2

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
import lombok.Data;
44

55
/**
6-
* @ClassName: PluginJarInfo
7-
* @Description: 插件信息
8-
* @author: xufeng
9-
* @date: 2020/1/20 17:28
6+
* 插件信息
7+
*
8+
* @author xufeng
109
*/
1110

1211
@Data
Lines changed: 61 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,61 @@
1-
package com.xwintop.xJavaFxTool.model;
2-
3-
import lombok.AllArgsConstructor;
4-
import lombok.Data;
5-
import lombok.NoArgsConstructor;
6-
7-
@Data
8-
@NoArgsConstructor
9-
@AllArgsConstructor
10-
public class ToolFxmlLoaderConfiguration {
11-
private String url;//资源url
12-
private String resourceBundleName;//国际化资源文件
13-
private String className;//class名称
14-
private String title;//标题(配合国际化资源文件,无着默认显示原字符)
15-
private String iconPath;//图标路径
16-
private Boolean isDefaultShow = false;// 是否默认打开
17-
private String menuId;// 菜单id
18-
private String menuParentId;// 菜单父id
19-
private Boolean isMenu = false;//是否为菜单
20-
private String controllerType = "Node";// 内容类型
21-
}
1+
package com.xwintop.xJavaFxTool.model;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
@Data
8+
@NoArgsConstructor
9+
@AllArgsConstructor
10+
public class ToolFxmlLoaderConfiguration {
11+
12+
/**
13+
* 资源url
14+
*/
15+
private String url;
16+
17+
/**
18+
* 国际化资源文件
19+
*/
20+
private String resourceBundleName;
21+
22+
/**
23+
* class名称
24+
*/
25+
private String className;
26+
27+
/**
28+
* 标题(配合国际化资源文件,无则默认显示原字符)
29+
*/
30+
private String title;
31+
32+
/**
33+
* 图标路径
34+
*/
35+
private String iconPath;
36+
37+
/**
38+
* 是否在启动时自动加载
39+
*/
40+
private Boolean isDefaultShow = false;
41+
42+
/**
43+
* 菜单id
44+
*/
45+
private String menuId;
46+
47+
/**
48+
* 菜单父id
49+
*/
50+
private String menuParentId;
51+
52+
/**
53+
* 是否为菜单
54+
*/
55+
private Boolean isMenu = false;
56+
57+
/**
58+
* 内容类型
59+
*/
60+
private String controllerType = "Node";
61+
}

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
package com.xwintop.xJavaFxTool.newui;
22

3+
import com.xwintop.xJavaFxTool.Main;
4+
import com.xwintop.xJavaFxTool.model.PluginJarInfo;
5+
import com.xwintop.xJavaFxTool.plugin.PluginManager;
36
import com.xwintop.xJavaFxTool.services.index.SystemSettingService;
47
import javafx.scene.layout.VBox;
8+
import lombok.extern.slf4j.Slf4j;
59

10+
import java.util.List;
11+
import java.util.ResourceBundle;
12+
13+
@Slf4j
614
public class NewLauncherController {
715

816
public VBox pluginCategories;
@@ -13,10 +21,21 @@ public void openConfigDialog() {
1321

1422
public void initialize() {
1523

16-
for (int i = 0; i < 5; i++) {
17-
PluginCategoryController category =
18-
PluginCategoryController.newInstance("最近使用");
24+
List<PluginJarInfo> pluginList = PluginManager.getInstance().getPluginList();
25+
ResourceBundle menuResourceBundle = Main.RESOURCE_BUNDLE;
26+
27+
for (PluginJarInfo jarInfo : pluginList) {
28+
String parentId = jarInfo.getMenuParentId();
29+
if (parentId.startsWith("p-")) {
30+
parentId = parentId.substring(2);
31+
String categoryName = menuResourceBundle.getString(parentId);
32+
String pluginName = jarInfo.getName();
33+
log.info("plugin: {} - {}", categoryName, pluginName);
34+
}
35+
}
1936

37+
for (int i = 0; i < 5; i++) {
38+
PluginCategoryController category = PluginCategoryController.newInstance("最近使用");
2039
addCategory(category);
2140

2241
for (int j = 0; j < 10; j++) {

src/main/resources/com/xwintop/xJavaFxTool/fxmlView/newui/main.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
-fx-background-radius: 5;
99
-fx-padding: 5 5 10 5;
1010
-fx-border-color: transparent;
11-
-fx-border-style: dashed;
11+
-fx-border-style: solid;
1212
-fx-border-width: 1;
1313
-fx-border-radius: 5;
14+
-fx-cursor: hand;
1415
}
1516

1617
.app-layout .app-item:hover {
17-
-fx-border-color: #aaaaaa;
18+
-fx-border-color: #a0bde3;
1819
}
1920

2021
.app-layout .app-item .hyperlink {

src/main/resources/com/xwintop/xJavaFxTool/fxmlView/newui/main.fxml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,27 @@
88
xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/10.0.2-internal"
99
fx:controller="com.xwintop.xJavaFxTool.newui.NewLauncherController">
1010

11-
<padding>
12-
<Insets topRightBottomLeft="5" />
13-
</padding>
11+
<padding>
12+
<Insets topRightBottomLeft="5"/>
13+
</padding>
1414

15-
<TabPane VBox.vgrow="ALWAYS">
16-
<Tab closable="false" text="开始">
17-
<ScrollPane fitToWidth="true" style="-fx-border-width: 0 1 1 1;-fx-border-color: #CCCCCC;-fx-background:#FFFFFF">
18-
<VBox>
19-
<HBox alignment="BASELINE_LEFT" style="-fx-padding: 10">
20-
<Label text="搜索:" />
21-
<TextField prefWidth="200" styleClass="search-text" />
22-
<Pane HBox.hgrow="ALWAYS"/>
23-
<Hyperlink onAction="#openConfigDialog" text="设置" />
24-
</HBox>
25-
<VBox fx:id="pluginCategories" alignment="TOP_CENTER">
26-
</VBox>
27-
</VBox>
28-
</ScrollPane>
29-
</Tab>
30-
</TabPane>
15+
<TabPane VBox.vgrow="ALWAYS" tabMinWidth="45">
16+
<Tab closable="false" text="开始">
17+
<ScrollPane fitToWidth="true" style="-fx-border-width: 0 1 1 1;-fx-border-color: #CCCCCC;-fx-background:#FFFFFF">
18+
<VBox>
19+
<padding>
20+
<Insets left="15"/>
21+
</padding>
22+
<HBox alignment="BASELINE_LEFT" style="-fx-padding: 10">
23+
<Label text="搜索:"/>
24+
<TextField prefWidth="200" styleClass="search-text"/>
25+
<Pane HBox.hgrow="ALWAYS"/>
26+
<Hyperlink onAction="#openConfigDialog" text="设置"/>
27+
</HBox>
28+
<VBox fx:id="pluginCategories" alignment="TOP_CENTER">
29+
</VBox>
30+
</VBox>
31+
</ScrollPane>
32+
</Tab>
33+
</TabPane>
3134
</VBox>
Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
1-
<?import javafx.scene.control.Hyperlink?>
21
<?import javafx.scene.control.Label?>
32
<?import javafx.scene.image.Image?>
43
<?import javafx.scene.image.ImageView?>
5-
<?import javafx.scene.layout.*?>
4+
<?import javafx.scene.layout.HBox?>
5+
<?import javafx.scene.layout.VBox?>
66
<VBox spacing="5" styleClass="app-item"
7-
fx:id="root"
7+
fx:id="root" alignment="CENTER"
88
fx:controller="com.xwintop.xJavaFxTool.newui.PluginItemController"
99
xmlns:fx="http://javafx.com/fxml/1">
10-
<HBox alignment="CENTER" VBox.vgrow="ALWAYS">
11-
<ImageView fitWidth="36" fitHeight="36">
12-
<Image url="/images/icon.jpg"/>
13-
</ImageView>
14-
</HBox>
15-
<HBox alignment="CENTER">
16-
<Label fx:id="pluginName" styleClass="app-item-title"/>
17-
</HBox>
18-
<HBox spacing="10" alignment="CENTER" style="-fx-padding: 0 0 5 0">
19-
<Hyperlink text="打开应用" style="-fx-font-weight: bold"/>
20-
<Pane HBox.hgrow="ALWAYS"/>
21-
<ImageView fitWidth="16" fitHeight="16" style="-fx-cursor: hand">
22-
<Image url="/images/help.png"/>
23-
</ImageView>
24-
</HBox>
10+
<HBox alignment="CENTER" VBox.vgrow="ALWAYS">
11+
<ImageView fitWidth="48" fitHeight="48">
12+
<Image url="/images/icon.jpg"/>
13+
</ImageView>
14+
</HBox>
15+
<HBox alignment="CENTER">
16+
<Label fx:id="pluginName" styleClass="app-item-title"/>
17+
</HBox>
2518
</VBox>

0 commit comments

Comments
 (0)