Skip to content

Commit 157d78d

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # LICENSE
2 parents 33f2de7 + 6ecd371 commit 157d78d

17 files changed

Lines changed: 407 additions & 123 deletions

File tree

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ xJavaFxTool是使用javaFx开发的实用小工具集,利用业余时间把工
3737
- 百度云链接:[https://pan.baidu.com/s/193fhGnJL4dDWcqDnFJcHbA](https://pan.baidu.com/s/193fhGnJL4dDWcqDnFJcHbA) 提取码:mokl
3838
- 腾讯微云链接:[https://share.weiyun.com/5T6FPLW](https://share.weiyun.com/5T6FPLW) 提取码:java
3939

40-
支持插件开发,将插件jar包放至根目录libs下即可自动加载(插件开发示例见[开源项目xJavaFxPlugIn](https://gitee.com/xwintop/xJavaFxPlugIn),后续准备将小工具拆分至各插件中按需加载);
40+
支持插件开发,将插件jar包放至根目录libs下即可自动加载(插件开发示例见[开源项目xJavaFxPlugIn](https://gitee.com/xwintop/xJavaFxPlugIn),后续准备将小工具拆分至各插件中按需加载,目前插件功能暂不完善,后续将各功能拆分至各模块按需加载,减小jar包的大小);
4141

4242
#### 环境搭建说明:
4343
- 开发环境为jdk1.8,基于maven构建;
4444
- 使用eclipase或Intellij Idea开发(推荐使用[Intellij Idea](https://www.jetbrains.com/idea/))
45-
- 本项目使用了[lombok](https://projectlombok.org/),在查看本项目时如果您没有下载lombok 插件,请先安装,不然找不到get/set方法
46-
- 依赖的[xcore包](https://gitee.com/xwintop/xcore)已上传至git托管的maven平台,git托管maven可参考教程。[教程地址:点击进入](http://blog.csdn.net/u011747754/article/details/78574026)
45+
- 本项目使用了[lombok](https://projectlombok.org/),在查看本项目时如果您没有下载lombok 插件,请先安装,不然找不到get/set等方法
46+
- 依赖的[xcore包](https://gitee.com/xwintop/xcore)已上传至git托管的maven平台,git托管maven可参考教程(若无法下载请拉取项目自行编译)[教程地址:点击进入](http://blog.csdn.net/u011747754/article/details/78574026)
4747
- 使用[javafx-maven-plugin](https://github.com/javafx-maven-plugin/javafx-maven-plugin)插件进行打包操作(可打包windows、Linux、Mac安装包);
4848
- 使用[exe4j](https://www.ej-technologies.com/download/exe4j/files)将jar包转成exe执行文件(仅供参考,可使用其它程序打包);
4949
- 使用[InnoSetup](http://www.jrsoftware.org/)可进行制作windows安装包;
@@ -55,7 +55,7 @@ xJavaFxTool是使用javaFx开发的实用小工具集,利用业余时间把工
5555

5656
3、CharacterConverter:编码转换;
5757

58-
4、EncryptAndDecrypt:加密解密(Ascii、Hex、Base64、Base32、URL、MD5、SHA、AES、DES、文件加密DM5、文件加密SHA1、摩斯密码);
58+
4、EncryptAndDecrypt:加密解密(Ascii、Hex、Base64、Base32、URL、MD5、SHA、AES、DES、文件加密DM5、文件加密SHA1、摩斯密码、Druid加密);
5959

6060
5、TimeTool:Time转换(常用格式转换(含时区)、计算时间差、时间叠加计算);
6161

@@ -147,6 +147,8 @@ xJavaFxTool是使用javaFx开发的实用小工具集,利用业余时间把工
147147

148148
49、ClipboardHistoryTool:剪贴板历史工具;
149149

150+
50、FileSearchTool:文件搜索工具;
151+
150152
传输工具目前支持功能如下:
151153

152154
Receiver接收器:

pom.xml

Lines changed: 7 additions & 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.1.7</version>
7+
<version>0.1.8</version>
88
<packaging>jar</packaging>
99
<name>xJavaFxTool</name>
1010
<description>基于JavaFx搭建的实用小工具集合</description>
@@ -248,6 +248,12 @@
248248
<version>9.1.1.0</version>
249249
</dependency>
250250

251+
<dependency>
252+
<groupId>org.apache.lucene</groupId>
253+
<artifactId>lucene-core</artifactId>
254+
<version>7.1.0</version>
255+
</dependency>
256+
251257
</dependencies>
252258
<build>
253259
<plugins>

src/main/java/com/xwintop/xJavaFxTool/controller/developTools/xTransferTool/TransferToolController.java

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,43 @@ private void initEvent() {
9595
contextMenu.getItems().add(menu_tab);
9696
contextMenu.show(hostTextField, null, 0, hostTextField.getHeight());
9797
});
98-
// configurationTreeView.setEditable(true);
98+
99+
selectTextField.textProperty().addListener((observable, oldValue, newValue) -> {
100+
if (contextMenu.isShowing()) {
101+
contextMenu.hide();
102+
}
103+
contextMenu.getItems().clear();
104+
for (Map.Entry<String, String> stringStringEntry : transferToolService.getTaskConfigFileStringMap().entrySet()) {
105+
if (stringStringEntry.getValue().contains(newValue)) {
106+
Map<String, TaskConfig> taskConfigMap = transferToolService.getTaskConfigFileMap().get(stringStringEntry.getKey());
107+
if (taskConfigMap != null && !taskConfigMap.isEmpty()) {
108+
for (Map.Entry<String, TaskConfig> stringTaskConfigEntry : taskConfigMap.entrySet()) {
109+
if (stringTaskConfigEntry.getValue().toString().contains(newValue)) {
110+
MenuItem menu_tab = new MenuItem(stringTaskConfigEntry.getKey());
111+
menu_tab.setOnAction(event1 -> {
112+
transferToolService.addTaskConfigTabPane(stringStringEntry.getKey(), stringTaskConfigEntry.getKey());
113+
});
114+
contextMenu.getItems().add(menu_tab);
115+
}
116+
}
117+
}
118+
Map<String, DataSourceConfigDruid> dataSourceConfigDruidMap = transferToolService.getDataSourceConfigFileMap().get(stringStringEntry.getKey());
119+
if (dataSourceConfigDruidMap != null && !dataSourceConfigDruidMap.isEmpty()) {
120+
for (Map.Entry<String, DataSourceConfigDruid> stringDataSourceConfigDruidEntry : dataSourceConfigDruidMap.entrySet()) {
121+
if (stringDataSourceConfigDruidEntry.getValue().toString().contains(newValue)) {
122+
MenuItem menu_tab = new MenuItem(stringDataSourceConfigDruidEntry.getKey());
123+
menu_tab.setOnAction(event1 -> {
124+
transferToolService.addTaskConfigTabPane(stringStringEntry.getKey(), stringDataSourceConfigDruidEntry.getKey());
125+
});
126+
contextMenu.getItems().add(menu_tab);
127+
}
128+
}
129+
}
130+
}
131+
}
132+
contextMenu.show(selectTextField, null, 0, selectTextField.getHeight());
133+
});
134+
99135
configurationTreeView.setCellFactory(TextFieldTreeCell.forTreeView());
100136
configurationTreeView.setOnMouseClicked(event -> {
101137
TreeItem<String> selectedItem = configurationTreeView.getSelectionModel().getSelectedItem();
@@ -122,7 +158,6 @@ private void initEvent() {
122158
});
123159
MenuItem menu_FoldAll = new MenuItem("折叠所有");
124160
menu_FoldAll.setOnAction(event1 -> {
125-
// configurationTreeView.getRoot().setExpanded(false);
126161
configurationTreeView.getRoot().getChildren().forEach(stringTreeItem -> {
127162
stringTreeItem.setExpanded(false);
128163
});
@@ -262,7 +297,6 @@ private void initEvent() {
262297
String taskConfigString = ClipboardUtil.getStr();
263298
try {
264299
TaskConfig taskConfig = new Yaml().load(taskConfigString);
265-
// String taskConfigName = taskConfig.getName() + "_copy";
266300
String taskConfigName = StringUtils.appendIfMissing(taskConfig.getName(), "_copy", "_copy");
267301
while (transferToolService.getTaskConfigFileMap().get(selectedItem.getValue()).containsKey(taskConfigName)) {
268302
String[] copyName = taskConfigName.split("_copy");
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package com.xwintop.xJavaFxTool.controller.littleTools;
2+
3+
import com.xwintop.xJavaFxTool.services.littleTools.FileSearchToolService;
4+
import com.xwintop.xJavaFxTool.utils.JavaFxViewUtil;
5+
import com.xwintop.xJavaFxTool.view.littleTools.FileSearchToolView;
6+
import com.xwintop.xcore.util.javafx.FileChooserUtil;
7+
import javafx.collections.FXCollections;
8+
import javafx.collections.ObservableList;
9+
import javafx.event.ActionEvent;
10+
import javafx.fxml.FXML;
11+
import lombok.Getter;
12+
import lombok.Setter;
13+
import lombok.extern.slf4j.Slf4j;
14+
15+
import java.io.File;
16+
import java.net.URL;
17+
import java.util.Map;
18+
import java.util.ResourceBundle;
19+
20+
/**
21+
* @ClassName: FileSearchToolController
22+
* @Description: 文件搜索工具
23+
* @author: xufeng
24+
* @date: 2019/7/18 10:21
25+
*/
26+
27+
@Getter
28+
@Setter
29+
@Slf4j
30+
public class FileSearchToolController extends FileSearchToolView {
31+
private FileSearchToolService fileSearchToolService = new FileSearchToolService(this);
32+
private ObservableList<Map<String, String>> searchResultTableData = FXCollections.observableArrayList();
33+
34+
@Override
35+
public void initialize(URL location, ResourceBundle resources) {
36+
initView();
37+
initEvent();
38+
initService();
39+
}
40+
41+
private void initView() {
42+
JavaFxViewUtil.setTableColumnMapValueFactory(fileNameTableColumn, "fileName", false);
43+
JavaFxViewUtil.setTableColumnMapValueFactory(absolutePathTableColumn, "absolutePath", false);
44+
JavaFxViewUtil.setTableColumnMapValueFactory(fileSizeTableColumn, "fileSize", false);
45+
JavaFxViewUtil.setTableColumnMapValueFactory(lastModifiedTableColumn, "lastModified", false);
46+
searchResultTableVIew.setItems(searchResultTableData);
47+
}
48+
49+
private void initEvent() {
50+
FileChooserUtil.setOnDrag(searchDirectoryTextField, FileChooserUtil.FileType.FOLDER);
51+
}
52+
53+
private void initService() {
54+
}
55+
56+
public void searchContentAction() {
57+
58+
}
59+
60+
@FXML
61+
private void refreshIndexAction(ActionEvent event) {
62+
}
63+
64+
@FXML
65+
private void searchDirectoryAction(ActionEvent event) {
66+
File file = FileChooserUtil.chooseDirectory();
67+
if (file != null) {
68+
searchDirectoryTextField.setText(file.getPath());
69+
}
70+
}
71+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.xwintop.xJavaFxTool.services.littleTools;
2+
3+
import com.xwintop.xJavaFxTool.controller.littleTools.FileSearchToolController;
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
import lombok.extern.slf4j.Slf4j;
7+
import org.apache.lucene.document.*;
8+
9+
import java.io.File;
10+
import java.nio.file.DirectoryStream;
11+
import java.nio.file.Files;
12+
import java.nio.file.Path;
13+
import java.nio.file.Paths;
14+
import java.util.Iterator;
15+
16+
/**
17+
* @ClassName: FileSearchToolService
18+
* @Description: 文件搜索工具
19+
* @author: xufeng
20+
* @date: 2019/7/18 10:21
21+
*/
22+
23+
@Getter
24+
@Setter
25+
@Slf4j
26+
public class FileSearchToolService {
27+
private FileSearchToolController fileSearchToolController;
28+
29+
public FileSearchToolService(FileSearchToolController fileSearchToolController) {
30+
this.fileSearchToolController = fileSearchToolController;
31+
}
32+
33+
public void searchContentAction() {
34+
35+
}
36+
37+
private void refreshIndexAction() {
38+
39+
}
40+
41+
private void searchDirectoryAction() {
42+
43+
}
44+
45+
public void addSearchIndexFile(String path) throws Exception {
46+
DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(path));
47+
Iterator<Path> pathIterator = stream.iterator();
48+
while (pathIterator.hasNext()) {
49+
Path curPath = pathIterator.next();
50+
// System.out.println(curPath.toString());
51+
if (Files.isDirectory(curPath)) {
52+
addSearchIndexFile(curPath.toString());
53+
} else {
54+
// System.out.println(curPath.toString());
55+
}
56+
}
57+
}
58+
59+
public void addIndexDocument(File file) throws Exception {
60+
Document doc = new Document();
61+
doc.add(new TextField("fileName", file.getName(), Field.Store.YES));
62+
doc.add(new TextField("absolutePath", file.getAbsolutePath(), Field.Store.YES));
63+
doc.add(new LongPoint("fileSize", file.length()));
64+
doc.add(new TextField("lastModified", DateTools.timeToString(file.lastModified(), DateTools.Resolution.MILLISECOND), Field.Store.YES));
65+
}
66+
}

src/main/java/com/xwintop/xJavaFxTool/utils/Config.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
public class Config {
99
public static Locale defaultLocale = Locale.getDefault();// 设置系统语言
1010

11-
public static final String xJavaFxToolVersions = "V0.1.7";// xJavaFxTool版本信息
12-
public static final int xJavaFxToolVersionsInteger = 8;// xJavaFxTool更新信息
11+
public static final String xJavaFxToolVersions = "V0.1.8-beta1";// xJavaFxTool版本信息
12+
public static final int xJavaFxToolVersionsInteger = 9;// xJavaFxTool更新信息
1313
}

src/main/java/com/xwintop/xJavaFxTool/view/developTools/xTransferTool/TransferToolView.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public abstract class TransferToolView implements Initializable {
1414
@FXML
1515
protected Button treeRefurbishButton;
1616
@FXML
17+
protected TextField selectTextField;
18+
@FXML
1719
protected Button startTransferButton;
1820
@FXML
1921
protected ChoiceBox flowStyleChoiceBox;
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.xwintop.xJavaFxTool.view.littleTools;
2+
3+
import javafx.fxml.FXML;
4+
import javafx.fxml.Initializable;
5+
import javafx.scene.control.*;
6+
import lombok.Getter;
7+
import lombok.Setter;
8+
9+
import java.util.Map;
10+
11+
/**
12+
* @ClassName: FileSearchToolView
13+
* @Description: 文件搜索工具
14+
* @author: xufeng
15+
* @date: 2019/7/18 10:21
16+
*/
17+
18+
@Getter
19+
@Setter
20+
public abstract class FileSearchToolView implements Initializable {
21+
@FXML
22+
protected TextField searchContentTextField;
23+
@FXML
24+
protected CheckBox autoRefreshIndexCheckBox;
25+
@FXML
26+
protected Button refreshIndexButton;
27+
@FXML
28+
protected CheckBox regularCheckBox;
29+
@FXML
30+
protected CheckBox matchCaseCheckBox;
31+
@FXML
32+
protected CheckBox fullTextMatchingCheckBox;
33+
@FXML
34+
protected CheckBox showHideFileCheckBox;
35+
@FXML
36+
protected TextField searchDirectoryTextField;
37+
@FXML
38+
protected Button searchDirectoryButton;
39+
@FXML
40+
protected TableView<Map<String, String>> searchResultTableVIew;
41+
@FXML
42+
protected TableColumn<Map<String, String>, String> fileNameTableColumn;
43+
@FXML
44+
protected TableColumn<Map<String, String>, String> absolutePathTableColumn;
45+
@FXML
46+
protected TableColumn<Map<String, String>, String> fileSizeTableColumn;
47+
@FXML
48+
protected TableColumn<Map<String, String>, String> lastModifiedTableColumn;
49+
50+
}

src/main/resources/com/xwintop/xJavaFxTool/fxmlView/developTools/xTransferTool/TransferTool.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<children>
6767
<HBox alignment="CENTER_LEFT" spacing="5.0">
6868
<children>
69-
<Button fx:id="treeRefurbishButton" disable="true" mnemonicParsing="false" onAction="#treeRefurbishAction" text="刷新" />
69+
<TextField fx:id="selectTextField" promptText="输入搜索内容" HBox.hgrow="ALWAYS" />
7070
<Button fx:id="startTransferButton" mnemonicParsing="false" onAction="#startTransferAction" text="启动任务" />
7171
<Label text="格式化:" />
7272
<ChoiceBox fx:id="flowStyleChoiceBox" />
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import javafx.geometry.Insets?>
4+
<?import javafx.scene.control.Button?>
5+
<?import javafx.scene.control.CheckBox?>
6+
<?import javafx.scene.control.TableColumn?>
7+
<?import javafx.scene.control.TableView?>
8+
<?import javafx.scene.control.TextField?>
9+
<?import javafx.scene.layout.AnchorPane?>
10+
<?import javafx.scene.layout.BorderPane?>
11+
<?import javafx.scene.layout.HBox?>
12+
<?import javafx.scene.layout.VBox?>
13+
14+
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.xwintop.xJavaFxTool.controller.littleTools.FileSearchToolController">
15+
<children>
16+
<BorderPane AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0">
17+
<top>
18+
<VBox spacing="5.0" BorderPane.alignment="CENTER">
19+
<children>
20+
<HBox alignment="CENTER_LEFT" spacing="5.0">
21+
<children>
22+
<TextField fx:id="searchContentTextField" promptText="请输入搜索内容" onKeyReleased="#searchContentAction" HBox.hgrow="ALWAYS" />
23+
<CheckBox fx:id="autoRefreshIndexCheckBox" mnemonicParsing="false" selected="true" text="自动刷新索引" />
24+
<Button fx:id="refreshIndexButton" mnemonicParsing="false" onAction="#refreshIndexAction" text="刷新索引" />
25+
</children>
26+
</HBox>
27+
<HBox alignment="CENTER_LEFT" spacing="5.0">
28+
<children>
29+
<CheckBox fx:id="regularCheckBox" mnemonicParsing="false" text="正则表达式" />
30+
<CheckBox fx:id="matchCaseCheckBox" mnemonicParsing="false" text="区分大小写" />
31+
<CheckBox fx:id="fullTextMatchingCheckBox" mnemonicParsing="false" text="全字匹配" />
32+
<CheckBox fx:id="showHideFileCheckBox" mnemonicParsing="false" selected="true" text="隐藏文件" />
33+
<TextField fx:id="searchDirectoryTextField" promptText="搜索文件夹" HBox.hgrow="ALWAYS" />
34+
<Button fx:id="searchDirectoryButton" mnemonicParsing="false" onAction="#searchDirectoryAction" text="浏览" />
35+
</children>
36+
</HBox>
37+
</children>
38+
</VBox>
39+
</top>
40+
<center>
41+
<TableView fx:id="searchResultTableVIew" BorderPane.alignment="CENTER">
42+
<columns>
43+
<TableColumn fx:id="fileNameTableColumn" minWidth="60.0" prefWidth="120.0" text="名称" />
44+
<TableColumn fx:id="absolutePathTableColumn" minWidth="120.0" prefWidth="240.0" text="路径" />
45+
<TableColumn fx:id="fileSizeTableColumn" maxWidth="120.0" minWidth="40.0" prefWidth="60.0" text="大小" />
46+
<TableColumn fx:id="lastModifiedTableColumn" maxWidth="200.0" minWidth="60.0" prefWidth="120.0" text="修改时间" />
47+
</columns>
48+
<BorderPane.margin>
49+
<Insets top="10.0" />
50+
</BorderPane.margin>
51+
<columnResizePolicy>
52+
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
53+
</columnResizePolicy>
54+
</TableView>
55+
</center>
56+
</BorderPane>
57+
</children>
58+
</AnchorPane>

0 commit comments

Comments
 (0)