作者 钟来

初始提交

正在显示 31 个修改的文件 包含 3698 行增加0 行删除
  1 +# Compiled class file
  2 +*.class
  3 +
  4 +# Log file
  5 +*.log
  6 +
  7 +# BlueJ files
  8 +*.ctxt
  9 +
  10 +# Mobile Tools for Java (J2ME)
  11 +.mtj.tmp/
  12 +
  13 +# Package Files #
  14 +*.jar
  15 +*.war
  16 +*.ear
  17 +*.zip
  18 +*.tar.gz
  19 +*.rar
  20 +
  21 +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
  22 +hs_err_pid*
  23 +
  24 +target/
  25 +pom.xml.tag
  26 +pom.xml.releaseBackup
  27 +pom.xml.versionsBackup
  28 +pom.xml.next
  29 +release.properties
  30 +dependency-reduced-pom.xml
  31 +buildNumber.properties
  32 +.mvn/timing.properties
  33 +
  34 +# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
  35 +!/.mvn/wrapper/maven-wrapper.jar
  36 +
  37 +### IntelliJ IDEA ###
  38 +.idea
  39 +*.iws
  40 +*.iml
  41 +*.ipr
  42 +
  43 +.DS_Store
  44 +!.mvn/wrapper/maven-wrapper.jar
  45 +
  46 +### STS ###
  47 +.apt_generated
  48 +.classpath
  49 +.factorypath
  50 +.project
  51 +.settings
  52 +.springBeans
  53 +
  54 +### NetBeans ###
  55 +nbproject/private/
  56 +build/
  57 +nbbuild/
  58 +dist/
  59 +nbdist/
  60 +.nb-gradle/
  1 +The MIT License (MIT)
  2 +
  3 +Copyright (c) 2018 zhazhapan
  4 +
  5 +Permission is hereby granted, free of charge, to any person obtaining a copy of
  6 +this software and associated documentation files (the "Software"), to deal in
  7 +the Software without restriction, including without limitation the rights to
  8 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  9 +the Software, and to permit persons to whom the Software is furnished to do so,
  10 +subject to the following conditions:
  11 +
  12 +The above copyright notice and this permission notice shall be included in all
  13 +copies or substantial portions of the Software.
  14 +
  15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1 +**JavaFX开发的工具集**
  2 +
  3 +包括JSON解析,文件批量重命名、复制,文件的拆分与合并,剪贴板历史,随机生成器,二维码生成,编码转换
  4 +
  5 +[download wetool-1.1.jar](http://oq3iwfipo.bkt.clouddn.com/tools/zhazhapan/wetool-1.1.jar)
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <modelVersion>4.0.0</modelVersion>
  6 + <groupId>com.zhazhapan</groupId>
  7 + <artifactId>wetool</artifactId>
  8 + <version>1.4</version>
  9 + <properties>
  10 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  11 + </properties>
  12 + <build>
  13 + <plugins>
  14 + <plugin>
  15 + <groupId>org.apache.maven.plugins</groupId>
  16 + <artifactId>maven-compiler-plugin</artifactId>
  17 + <configuration>
  18 + <source>1.8</source>
  19 + <target>1.8</target>
  20 + </configuration>
  21 + </plugin>
  22 + <plugin>
  23 + <groupId>com.googlecode.addjars-maven-plugin</groupId>
  24 + <artifactId>addjars-maven-plugin</artifactId>
  25 + <version>1.0.5</version>
  26 + <executions>
  27 + <execution>
  28 + <goals>
  29 + <goal>add-jars</goal>
  30 + </goals>
  31 + <configuration>
  32 + <resources>
  33 + <resource>
  34 + <directory>${basedir}/lib</directory>
  35 + </resource>
  36 + </resources>
  37 + </configuration>
  38 + </execution>
  39 + </executions>
  40 + </plugin>
  41 + <plugin>
  42 + <groupId>org.apache.maven.plugins</groupId>
  43 + <artifactId>maven-shade-plugin</artifactId>
  44 + <version>2.3</version>
  45 + <executions>
  46 + <execution>
  47 + <phase>package</phase>
  48 + <goals>
  49 + <goal>shade</goal>
  50 + </goals>
  51 + <configuration>
  52 + <transformers>
  53 + <transformer
  54 + implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
  55 + <mainClass>com.zhazhapan.util.visual.WeToolApplication</mainClass>
  56 + </transformer>
  57 + </transformers>
  58 + <artifactSet>
  59 + </artifactSet>
  60 + </configuration>
  61 + </execution>
  62 + </executions>
  63 + </plugin>
  64 + </plugins>
  65 + </build>
  66 + <dependencies>
  67 + <dependency>
  68 + <groupId>com.google.zxing</groupId>
  69 + <artifactId>core</artifactId>
  70 + <version>3.3.2</version>
  71 + </dependency>
  72 + <dependency>
  73 + <groupId>com.zhazhapan</groupId>
  74 + <artifactId>qiniu</artifactId>
  75 + <version>1.0.7</version>
  76 + </dependency>
  77 + <dependency>
  78 + <groupId>mysql</groupId>
  79 + <artifactId>mysql-connector-java</artifactId>
  80 + <version>8.0.9-rc</version>
  81 + </dependency>
  82 + </dependencies>
  83 +</project>
  1 +package com.zhazhapan.util.visual;
  2 +
  3 +import com.alibaba.fastjson.JSONArray;
  4 +import com.alibaba.fastjson.JSONObject;
  5 +import com.zhazhapan.config.JsonParser;
  6 +import com.zhazhapan.modules.constant.ValueConsts;
  7 +import com.zhazhapan.util.FileExecutor;
  8 +import com.zhazhapan.util.dialog.Alerts;
  9 +import com.zhazhapan.util.visual.constant.LocalValueConsts;
  10 +import com.zhazhapan.util.visual.model.ConfigModel;
  11 +import com.zhazhapan.util.visual.model.WaverModel;
  12 +
  13 +import java.util.List;
  14 +
  15 +/**
  16 + * @author pantao
  17 + * @since 2018/4/2
  18 + */
  19 +class ConfigParser {
  20 +
  21 + private static final String FILE_FILTER_TIP_PATH = "fileFilter.showTip";
  22 +
  23 + private static final String WIDTH_PATH = "initialize.width";
  24 +
  25 + private static final String HEIGHT_PATH = "initialize.height";
  26 +
  27 + private static final String FILE_REGEX_PATH = "fileFilter.regex";
  28 +
  29 + private static final String TAB_PATH = "initialize.tabs.load";
  30 +
  31 + private static final String CLIPBOARD_SIZE_PATH = "clipboardSize";
  32 +
  33 + private static final String FULLSCREEN = "initialize.fullscreen";
  34 +
  35 + private static final String AUTO_WRAP = "autoWrap";
  36 +
  37 + private static final String MYSQL_HOST = "mysql.host";
  38 +
  39 + private static final String MYSQL_DB = "mysql.database";
  40 +
  41 + private static final String MYSQL_CONDITION = "mysql.condition";
  42 +
  43 + private static final String MYSQL_USERNAME = "mysql.username";
  44 +
  45 + private static final String MYSQL_PASSWORD = "mysql.password";
  46 +
  47 + private static final String WAVE = "waveViewer";
  48 +
  49 + private static final String TABLE_NAME = "tableName";
  50 +
  51 + private static final String DATA_FIELD = "dataField";
  52 +
  53 + private static final String DATE_FIELD = "dateField";
  54 +
  55 + private static final String TITLE = "title";
  56 +
  57 + private static final String RESULT_SIZE = "firstResultSize";
  58 +
  59 + /**
  60 + * 解析配置文件到 {@link ConfigModel}
  61 + */
  62 + static void parserConfig() {
  63 + try {
  64 + JsonParser parser = new JsonParser(FileExecutor.read(WeToolApplication.class.getResourceAsStream
  65 + (LocalValueConsts.CONFIG_PATH)), ValueConsts.TRUE);
  66 + ConfigModel.setWidth(parser.getDoubleUseEval(WIDTH_PATH));
  67 + ConfigModel.setHeight(parser.getDoubleUseEval(HEIGHT_PATH));
  68 + ConfigModel.setTabs(parser.getArray(TAB_PATH));
  69 + ConfigModel.setFileFilterRegex(parser.getString(FILE_REGEX_PATH));
  70 + ConfigModel.setFileFilterTip(parser.getBooleanUseEval(FILE_FILTER_TIP_PATH));
  71 + ConfigModel.setClipboardSize(parser.getIntegerUseEval(CLIPBOARD_SIZE_PATH));
  72 + ConfigModel.setFullscreen(parser.getBooleanUseEval(FULLSCREEN));
  73 + ConfigModel.setAutoWrap(parser.getBooleanUseEval(AUTO_WRAP));
  74 + ConfigModel.setHost(parser.getStringUseEval(MYSQL_HOST));
  75 + ConfigModel.setDatabase(parser.getStringUseEval(MYSQL_DB));
  76 + ConfigModel.setCondition(parser.getStringUseEval(MYSQL_CONDITION));
  77 + ConfigModel.setUsername(parser.getStringUseEval(MYSQL_USERNAME));
  78 + ConfigModel.setPassword(parser.getStringUseEval(MYSQL_PASSWORD));
  79 + JSONArray array = parser.getJsonObject().getJSONArray(WAVE);
  80 + List<WaverModel> waves = ConfigModel.getWaver();
  81 + array.forEach(obj -> {
  82 + JSONObject object = (JSONObject) obj;
  83 + WaverModel model = new WaverModel();
  84 + model.setTableName(object.getString(TABLE_NAME));
  85 + model.setDataField(object.getString(DATA_FIELD));
  86 + model.setDateField(object.getString(DATE_FIELD));
  87 + model.setTitle(object.getString(TITLE));
  88 + model.setFirstResultSize(object.getInteger(RESULT_SIZE));
  89 + waves.add(model);
  90 + });
  91 + } catch (Exception e) {
  92 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.LOAD_CONFIG_ERROR);
  93 + }
  94 + }
  95 +}
  1 +package com.zhazhapan.util.visual;
  2 +
  3 +import com.zhazhapan.modules.constant.ValueConsts;
  4 +import com.zhazhapan.util.Checker;
  5 +import com.zhazhapan.util.ThreadPool;
  6 +import com.zhazhapan.util.dialog.Alerts;
  7 +import com.zhazhapan.util.visual.constant.LocalValueConsts;
  8 +import com.zhazhapan.util.visual.model.ConfigModel;
  9 +import com.zhazhapan.util.visual.model.ControllerModel;
  10 +import javafx.application.Application;
  11 +import javafx.application.Platform;
  12 +import javafx.scene.Scene;
  13 +import javafx.scene.image.Image;
  14 +import javafx.scene.layout.VBox;
  15 +import javafx.stage.Stage;
  16 +import javafx.stage.WindowEvent;
  17 +
  18 +import javax.imageio.ImageIO;
  19 +import java.awt.*;
  20 +import java.awt.event.ActionListener;
  21 +import java.awt.event.MouseEvent;
  22 +import java.awt.event.MouseListener;
  23 +import java.util.ArrayList;
  24 +import java.util.List;
  25 +
  26 +/**
  27 + * @author pantao
  28 + * @since 2018/3/30
  29 + */
  30 +public class WeToolApplication extends Application {
  31 +
  32 + public static Stage stage = null;
  33 +
  34 + private TrayIcon trayIcon;
  35 +
  36 + private boolean isTraySuccess = false;
  37 +
  38 + public static void main(String[] args) {
  39 + ThreadPool.init();
  40 + launch(args);
  41 + }
  42 +
  43 + @Override
  44 + public void start(Stage stage) {
  45 + VBox root = WeUtils.loadFxml(LocalValueConsts.MAIN_VIEW);
  46 + if (Checker.isNull(root)) {
  47 + Alerts.showError(ValueConsts.FATAL_ERROR, LocalValueConsts.INIT_ERROR);
  48 + WeUtils.exitSystem();
  49 + }
  50 + assert root != null;
  51 + stage.setScene(new Scene(root));
  52 + stage.getIcons().add(new Image(getClass().getResourceAsStream(LocalValueConsts.ICON)));
  53 + stage.setTitle(LocalValueConsts.MAIN_TITLE);
  54 + stage.setOnCloseRequest((WindowEvent event) -> {
  55 + if (isTraySuccess) {
  56 + stage.hide();
  57 + } else {
  58 + stage.setIconified(true);
  59 + }
  60 + event.consume();
  61 + });
  62 + ConfigParser.parserConfig();
  63 + stage.setWidth(ConfigModel.getWidth());
  64 + stage.setHeight(ConfigModel.getHeight());
  65 + stage.setFullScreen(ConfigModel.isFullscreen());
  66 + ControllerModel.getMainController().loadTabs();
  67 + WeToolApplication.stage = stage;
  68 + if (Checker.isWindows()) {
  69 + enableTray();
  70 + }
  71 + stage.show();
  72 + }
  73 +
  74 + /**
  75 + * 系统托盘
  76 + */
  77 + private void enableTray() {
  78 + Platform.setImplicitExit(false);
  79 + PopupMenu popupMenu = new PopupMenu();
  80 + List<MenuItem> items = new ArrayList<>(8);
  81 + items.add(new MenuItem((LocalValueConsts.WOX)));
  82 + items.add(new MenuItem(LocalValueConsts.COLOR_PICKER));
  83 + items.add(new MenuItem(LocalValueConsts.SHOW));
  84 + items.add(new MenuItem(LocalValueConsts.HIDE));
  85 + items.add(new MenuItem(LocalValueConsts.EXIT));
  86 + ActionListener actionListener = e -> {
  87 + MenuItem item = (MenuItem) e.getSource();
  88 + switch (item.getLabel()) {
  89 + case LocalValueConsts.EXIT:
  90 + SystemTray.getSystemTray().remove(trayIcon);
  91 + WeUtils.exitSystem();
  92 + break;
  93 + case LocalValueConsts.SHOW:
  94 + Platform.runLater(stage::show);
  95 + break;
  96 + case LocalValueConsts.HIDE:
  97 + Platform.runLater(stage::hide);
  98 + break;
  99 + case LocalValueConsts.COLOR_PICKER:
  100 + WeUtils.startColorPicker();
  101 + break;
  102 + case LocalValueConsts.WOX:
  103 + WeUtils.startWox();
  104 + break;
  105 + default:
  106 + break;
  107 + }
  108 + };
  109 + //双击事件方法
  110 + MouseListener mouseListener = new MouseListener() {
  111 + @Override
  112 + public void mouseReleased(MouseEvent e) {
  113 + }
  114 +
  115 + @Override
  116 + public void mousePressed(MouseEvent e) {
  117 + }
  118 +
  119 + @Override
  120 + public void mouseExited(MouseEvent e) {
  121 + }
  122 +
  123 + @Override
  124 + public void mouseEntered(MouseEvent e) {
  125 + }
  126 +
  127 + @Override
  128 + public void mouseClicked(MouseEvent e) {
  129 + Platform.setImplicitExit(false);
  130 + if (e.getClickCount() == ValueConsts.TWO_INT) {
  131 + Platform.runLater(() -> {
  132 + if (stage.isShowing()) {
  133 + stage.hide();
  134 + } else {
  135 + stage.show();
  136 + }
  137 + });
  138 + }
  139 + }
  140 + };
  141 + items.forEach(item -> {
  142 + item.addActionListener(actionListener);
  143 + popupMenu.add(item);
  144 + });
  145 + try {
  146 + SystemTray tray = SystemTray.getSystemTray();
  147 + java.awt.Image image = ImageIO.read(getClass().getResourceAsStream(LocalValueConsts.ICON));
  148 + trayIcon = new TrayIcon(image, LocalValueConsts.MAIN_TITLE, popupMenu);
  149 + trayIcon.setImageAutoSize(true);
  150 + trayIcon.setToolTip(LocalValueConsts.MAIN_TITLE);
  151 + trayIcon.addMouseListener(mouseListener);
  152 + tray.add(trayIcon);
  153 + isTraySuccess = true;
  154 + } catch (Exception e) {
  155 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.TRAY_ERROR);
  156 + }
  157 + }
  158 +}
  1 +package com.zhazhapan.util.visual;
  2 +
  3 +import com.zhazhapan.modules.constant.ValueConsts;
  4 +import com.zhazhapan.util.*;
  5 +import com.zhazhapan.util.dialog.Alerts;
  6 +import com.zhazhapan.util.visual.constant.LocalValueConsts;
  7 +import com.zhazhapan.util.visual.controller.FileManagerController;
  8 +import com.zhazhapan.util.visual.controller.WaveController;
  9 +import com.zhazhapan.util.visual.model.ConfigModel;
  10 +import com.zhazhapan.util.visual.model.ControllerModel;
  11 +import javafx.application.Platform;
  12 +import javafx.collections.ObservableList;
  13 +import javafx.fxml.FXMLLoader;
  14 +import javafx.scene.control.ListView;
  15 +import javafx.scene.control.TextArea;
  16 +import javafx.scene.input.DragEvent;
  17 +import javafx.scene.layout.VBox;
  18 +import javafx.stage.FileChooser;
  19 +
  20 +import java.io.File;
  21 +import java.io.IOException;
  22 +import java.nio.file.Paths;
  23 +import java.sql.SQLException;
  24 +import java.util.Date;
  25 +import java.util.List;
  26 +import java.util.regex.Pattern;
  27 +
  28 +import static com.zhazhapan.util.visual.WeToolApplication.stage;
  29 +
  30 +/**
  31 + * @author pantao
  32 + * @since 2018/3/31
  33 + */
  34 +public class WeUtils {
  35 +
  36 + private static final String CURRENT_DIR = Paths.get(ValueConsts.DOT_SIGN).toAbsolutePath().normalize().toString();
  37 +
  38 + private static final String COLOR_PICKER = CURRENT_DIR + File.separator + "ColorPicker.exe";
  39 +
  40 + private static final String WOX = CURRENT_DIR + File.separator + "Wox.exe";
  41 +
  42 + private static final String WOX_URL = "https://github.com/Wox-launcher/Wox/releases/latest";
  43 +
  44 + private static final String WOX_ERROR = LocalValueConsts.CAN_NOT_FOUND + WOX;
  45 +
  46 + private static final String WOX_TIP = "请下载 Wox-x.x.x.exe 文件到 " + CURRENT_DIR + " 目录,并重命名为:Wox.exe";
  47 +
  48 + private static final String COLOR_PICKER_ERROR = LocalValueConsts.CAN_NOT_FOUND + COLOR_PICKER;
  49 +
  50 + private static final String COLOR_PICKER_URL = "http://oq3iwfipo.bkt.clouddn.com/tools/zhazhapan/ColorPicker.exe";
  51 +
  52 + private static Pattern FILE_FILTER = Pattern.compile(ConfigModel.getFileFilterRegex());
  53 +
  54 + public static void startColorPicker() {
  55 + if (Checker.isWindows()) {
  56 + ThreadPool.executor.submit(() -> {
  57 + if (Checker.isNotExists(COLOR_PICKER)) {
  58 + Downloader.download(CURRENT_DIR, COLOR_PICKER_URL);
  59 + }
  60 + if (Checker.isExists(COLOR_PICKER)) {
  61 + run(COLOR_PICKER);
  62 + } else {
  63 + Platform.runLater(() -> Alerts.showError(LocalValueConsts.MAIN_TITLE, COLOR_PICKER_ERROR));
  64 + }
  65 + });
  66 + } else {
  67 + Alerts.showWarning(LocalValueConsts.MAIN_TITLE, LocalValueConsts.NOT_SUPPORT);
  68 + }
  69 + }
  70 +
  71 + public static void startWox() {
  72 + if (Checker.isWindows()) {
  73 + if (Checker.isNotExists(WOX)) {
  74 + openLink(WOX_URL);
  75 + Alerts.showInformation(LocalValueConsts.MAIN_TITLE, WOX_TIP);
  76 + }
  77 + if (Checker.isExists(WOX)) {
  78 + run(WOX);
  79 + } else {
  80 + Alerts.showError(LocalValueConsts.MAIN_TITLE, WOX_ERROR);
  81 + }
  82 + } else {
  83 + Alerts.showWarning(LocalValueConsts.MAIN_TITLE, LocalValueConsts.NOT_SUPPORT);
  84 + }
  85 + }
  86 +
  87 + public static void run(String executableFile) {
  88 + Platform.runLater(() -> {
  89 + try {
  90 + Runtime.getRuntime().exec(executableFile);
  91 + } catch (IOException e) {
  92 + Alerts.showError(LocalValueConsts.MAIN_TITLE, e.getMessage());
  93 + }
  94 + });
  95 + }
  96 +
  97 + public static void closeMysqlConnection() {
  98 + WaveController controller = ControllerModel.getWaveController();
  99 + if (Checker.isNotNull(controller)) {
  100 + try {
  101 + if (Checker.isNotNull(controller.statement)) {
  102 + controller.statement.close();
  103 + }
  104 + if (Checker.isNotNull(controller.connection)) {
  105 + controller.connection.close();
  106 + }
  107 + } catch (SQLException e) {
  108 + Alerts.showError(LocalValueConsts.MAIN_TITLE, e.getMessage());
  109 + }
  110 + }
  111 + }
  112 +
  113 + public static void deleteFiles(File file) {
  114 + if (Checker.isNotNull(file)) {
  115 + if (file.isDirectory()) {
  116 + try {
  117 + FileExecutor.deleteDirectory(file);
  118 + } catch (IOException e) {
  119 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.DELETE_FILE_ERROR);
  120 + }
  121 + } else {
  122 + FileExecutor.deleteFile(file);
  123 + }
  124 + }
  125 + }
  126 +
  127 + public static String whois(String domain) {
  128 + try {
  129 + return NetUtils.whois(domain);
  130 + } catch (Exception e) {
  131 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.NETWORK_ERROR);
  132 + return null;
  133 + }
  134 + }
  135 +
  136 + public static String getLocationByIp(String ip) {
  137 + try {
  138 + return NetUtils.getLocationByIp(ip);
  139 + } catch (Exception e) {
  140 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.NETWORK_ERROR);
  141 + return null;
  142 + }
  143 + }
  144 +
  145 + public static void putDragFileInTextArea(TextArea textArea, DragEvent event) {
  146 + List<File> files = event.getDragboard().getFiles();
  147 + if (Checker.isNotEmpty(files)) {
  148 + textArea.setText(readFile(files.get(0)));
  149 + }
  150 + }
  151 +
  152 + public static void mergeFiles(ObservableList<File> fileObservableList, String filter, boolean isDelete) {
  153 + if (Checker.isNotEmpty(fileObservableList)) {
  154 + File file = getSaveFile();
  155 + File[] files = new File[fileObservableList.size()];
  156 + files = fileObservableList.toArray(files);
  157 + try {
  158 + FileExecutor.mergeFiles(files, file, Checker.checkNull(filter));
  159 + if (isDelete) {
  160 + for (File f : fileObservableList) {
  161 + f.delete();
  162 + }
  163 + fileObservableList.clear();
  164 + }
  165 + showSuccessInfo();
  166 + } catch (IOException e) {
  167 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.MERGE_FILE_ERROR);
  168 + }
  169 + }
  170 + }
  171 +
  172 + public static void removeSelectedItems(ListView<File> fileListView) {
  173 + ObservableList<File> files = fileListView.getSelectionModel().getSelectedItems();
  174 + if (Checker.isNotEmpty(files)) {
  175 + fileListView.getItems().removeAll(files);
  176 + }
  177 + }
  178 +
  179 + public static void splitFile(File file, long[] points, String folder, boolean deleteSrc) {
  180 + try {
  181 + FileExecutor.splitFile(file, points, folder);
  182 + if (deleteSrc) {
  183 + file.delete();
  184 + }
  185 + showSuccessInfo();
  186 + } catch (IOException e) {
  187 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.SPLIT_FILE_ERROR);
  188 + }
  189 + }
  190 +
  191 + public static String getFolder(File file) {
  192 + return file.isDirectory() ? file.getAbsolutePath() : file.getParent();
  193 + }
  194 +
  195 + public static void copyFiles(ObservableList<File> list, String folder, boolean deleteSrc) {
  196 + if (Checker.isNotEmpty(list) && Checker.isNotEmpty(folder)) {
  197 + ThreadPool.executor.submit(() -> {
  198 + File[] files = new File[list.size()];
  199 + list.toArray(files);
  200 + try {
  201 + FileExecutor.copyFiles(files, folder);
  202 + if (deleteSrc) {
  203 + int i = 0;
  204 + for (File f : list) {
  205 + list.set(i++, new File(folder + ValueConsts.SEPARATOR + f.getName()));
  206 + f.delete();
  207 + }
  208 + }
  209 + showSuccessInfo();
  210 + } catch (IOException e) {
  211 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.COPY_FILE_ERROR);
  212 + }
  213 + });
  214 + }
  215 + }
  216 +
  217 + public static void showSuccessInfo() {
  218 + Alerts.showInformation(LocalValueConsts.MAIN_TITLE, LocalValueConsts.OPERATION_SUCCESS);
  219 + }
  220 +
  221 + public static String replaceVariable(String s) {
  222 + return Checker.checkNull(s).replaceAll(LocalValueConsts.DATE_VARIABLE, Formatter.dateToString(new Date()))
  223 + .replaceAll(LocalValueConsts.TIME_VARIABLE, Formatter.datetimeToCustomString(new Date(),
  224 + LocalValueConsts.TIME_FORMAT));
  225 + }
  226 +
  227 + public static int stringToInt(String integer) {
  228 + int result = Formatter.stringToInt(integer);
  229 + return result > -1 ? result : 0;
  230 + }
  231 +
  232 + public static double stringToDouble(String digit) {
  233 + double result = Formatter.stringToDouble(digit);
  234 + return result < 0 ? 0 : result;
  235 + }
  236 +
  237 + @SuppressWarnings("unchecked")
  238 + public static void putFilesInListViewOfFileManagerTab(Object files) {
  239 + FileManagerController fileManagerController = ControllerModel.getFileManagerController();
  240 + if (Checker.isNotNull(fileManagerController)) {
  241 + int idx = fileManagerController.fileManagerTab.getSelectionModel().getSelectedIndex();
  242 + switch (idx) {
  243 + case 0:
  244 + putFilesInListView(files, fileManagerController.selectedFilesOfRenameTab);
  245 + break;
  246 + case 1:
  247 + putFilesInListView(files, fileManagerController.selectedFilesOfCopyTab);
  248 + case 2:
  249 + File file = null;
  250 + if (files instanceof File) {
  251 + file = (File) files;
  252 + } else if (files instanceof List) {
  253 + List<File> list = (List<File>) files;
  254 + if (Checker.isNotEmpty(list)) {
  255 + file = list.get(0);
  256 + }
  257 + }
  258 + if (Checker.isNotNull(file)) {
  259 + fileManagerController.splittingFile = file;
  260 + fileManagerController.fileContent.setText(readFile(file));
  261 + }
  262 + break;
  263 + case 3:
  264 + putFilesInListView(files, fileManagerController.selectedFilesOfMergeTab);
  265 + break;
  266 + case 4:
  267 + if (files instanceof File) {
  268 + fileManagerController.srcFolderOfDeleteTab.setText(getFolder((File) files));
  269 + }
  270 + break;
  271 + default:
  272 + break;
  273 + }
  274 + }
  275 + }
  276 +
  277 + @SuppressWarnings("unchecked")
  278 + private static void putFilesInListView(Object files, ListView listView) {
  279 + ObservableList items = listView.getItems();
  280 + if (files instanceof List) {
  281 + putFilesInListView((List<File>) files, items);
  282 + } else if (files instanceof File) {
  283 + putFilesInListView((File) files, items);
  284 + }
  285 + }
  286 +
  287 + public static void putFilesInListView(List<File> files, ObservableList items) {
  288 + if (Checker.isNotEmpty(files)) {
  289 + files.forEach(file -> putFilesInListView(file, items));
  290 + }
  291 + }
  292 +
  293 + @SuppressWarnings("unchecked")
  294 + private static void putFilesInListView(File file, ObservableList items) {
  295 + if (Checker.isNotNull(file)) {
  296 + if (FILE_FILTER.matcher(file.getName()).matches()) {
  297 + if (file.isDirectory()) {
  298 + putFilesInListView((List<File>) FileExecutor.listFiles(file, null, ValueConsts.TRUE), items);
  299 + } else if (!items.contains(file)) {
  300 + items.add(file);
  301 + }
  302 + } else if (ConfigModel.isFileFilterTip()) {
  303 + Alerts.showInformation(LocalValueConsts.MAIN_TITLE, LocalValueConsts.FILE_NOT_MATCH, file
  304 + .getAbsolutePath());
  305 + }
  306 + }
  307 + }
  308 +
  309 + public static void saveFile(File file, String fileContent) {
  310 + if (Checker.isNotEmpty(fileContent)) {
  311 + try {
  312 + FileExecutor.saveFile(file, fileContent);
  313 + } catch (IOException e) {
  314 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.SAVE_FILE_ERROR);
  315 + }
  316 + }
  317 + }
  318 +
  319 + public static String readFile(File file) {
  320 + String result;
  321 + try {
  322 + result = FileExecutor.readFile(file);
  323 + } catch (IOException e) {
  324 + result = "";
  325 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.READ_FILE_ERROR);
  326 + }
  327 + return result;
  328 + }
  329 +
  330 + public static File getSaveFile() {
  331 + return getFileChooser().showSaveDialog(stage);
  332 + }
  333 +
  334 + public static List<File> getChooseFiles() {
  335 + return getFileChooser().showOpenMultipleDialog(stage);
  336 + }
  337 +
  338 + public static File getChooseFile() {
  339 + return getFileChooser().showOpenDialog(stage);
  340 + }
  341 +
  342 + private static FileChooser getFileChooser() {
  343 + FileChooser chooser = new FileChooser();
  344 + chooser.setTitle(LocalValueConsts.MAIN_TITLE);
  345 + chooser.setInitialDirectory(new File(System.getProperty("user.home")));
  346 + return chooser;
  347 + }
  348 +
  349 + public static void openLink(String url) {
  350 + try {
  351 + Utils.openLink(url);
  352 + } catch (Exception e) {
  353 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.OPEN_LINK_ERROR);
  354 + }
  355 + }
  356 +
  357 + public static void exitSystem() {
  358 + closeMysqlConnection();
  359 + System.exit(ValueConsts.ZERO_INT);
  360 + }
  361 +
  362 + public static VBox loadFxml(String url) {
  363 + try {
  364 + return FXMLLoader.load(WeUtils.class.getResource(url));
  365 + } catch (Exception e) {
  366 + Alerts.showException(ValueConsts.FATAL_ERROR, e);
  367 + return null;
  368 + }
  369 + }
  370 +}
  1 +package com.zhazhapan.util.visual.constant;
  2 +
  3 +import com.zhazhapan.util.Utils;
  4 +
  5 +/**
  6 + * @author pantao
  7 + * @since 2018/3/30
  8 + */
  9 +public class LocalValueConsts {
  10 +
  11 + public static final String CAN_NOT_FOUND = "找不到可执行文件:";
  12 +
  13 + public static final String NOT_SUPPORT = "抱歉,暂时不支持 " + Utils.getCurrentOS().toUpperCase() + " 平台";
  14 +
  15 + public static final String DELETE_FILE_ERROR = "删除文件失败";
  16 +
  17 + public static final String WAVE_VIEW = "/view/WaveView.fxml";
  18 +
  19 + public static final String WAVE_VIEWER = "波动图表";
  20 +
  21 + public static final String QINIU_TOOL_VIEW = "/view/MainWindow.fxml";
  22 +
  23 + public static final String QINIU_TOOL = "七牛云对象存储";
  24 +
  25 + public static final String NETWORK_ERROR = "网络异常";
  26 +
  27 + public static final String NETWORK_TOOL_VIEW = "/view/NetworkToolView.fxml";
  28 +
  29 + public static final String NETWORK_TOOL = "网络工具";
  30 +
  31 + public static final String CHARSET_CONVERTER_VIEW = "/view/CharsetConverterView.fxml";
  32 +
  33 + public static final String CHARSET_CONVERTER = "编码转换器";
  34 +
  35 + public static final String QR_CODE_ERROR = "生成二维码失败";
  36 +
  37 + public static final String QR_CODE_GENERATOR_VIEW = "/view/QrCodeGeneratorView.fxml";
  38 +
  39 + public static final String QR_CODE_GENERATOR = "二维码生成器";
  40 +
  41 + public static final String TRAY_ERROR = "设置系统托盘失败";
  42 +
  43 + public static final String WOX = "wox";
  44 +
  45 + public static final String COLOR_PICKER = "color picker";
  46 +
  47 + public static final String HIDE = "hide";
  48 +
  49 + public static final String SHOW = "show";
  50 +
  51 + public static final String EXIT = "exit";
  52 +
  53 + public static final int ONE_THOUSAND = 1000;
  54 +
  55 + public static final String CLIPBOARD_HISTORY_VIEW = "/view/ClipboardHistoryView.fxml";
  56 +
  57 + public static final String CLIPBOARD_HISTORY = "剪贴板历史";
  58 +
  59 + public static final String RANDOM_GENERATOR_VIEW = "/view/RandomGeneratorView.fxml";
  60 +
  61 + public static final String RANDOM_GENERATOR = "随机生成器";
  62 +
  63 + public static final String FILE_NOT_MATCH = "文件不匹配";
  64 +
  65 + public static final String CONFIG_PATH = "/config.json";
  66 +
  67 + public static final String LOAD_CONFIG_ERROR = "加载配置文件失败";
  68 +
  69 + public static final String ABOUT_DETAIL = "当前版本:v1.4\r\n\r\n项目地址:https://github" +
  70 + ".com/zhazhapan/wetool\r\n\r\n外部依赖:\r\n\thttps://gitee.com/zhazhapan_admin/qiniu" +
  71 + "\r\n\r\n外部工具:\r\n\thttps://gitee.com/zhazhapan_admin/ColorPicker\r\n\thttps://github" +
  72 + ".com/Wox-launcher/Wox\r\n\r\n取色器说明:\r\n\t退出:Ctrl + Alt + Q\r\n\t复制:Ctrl + Alt + C";
  73 +
  74 + public static final String ABOUT_APP = "关于应用";
  75 +
  76 + public static final String MERGE_FILE_ERROR = "合并文件失败";
  77 +
  78 + public static final String OPERATION_SUCCESS = "操作成功";
  79 +
  80 + public static final String SPLIT_FILE_ERROR = "拆分文件失败";
  81 +
  82 + public static final String COPY_FILE_ERROR = "复制文件失败";
  83 +
  84 + public static final String AFTER_FILENAME = "文件名称之后";
  85 +
  86 + public static final String BEFORE_FILENAME = "文件名称之前";
  87 +
  88 + public static final String TIME_FORMAT = "HH.mm.ss";
  89 +
  90 + public static final String TIME_VARIABLE = "%(TIME|time)%";
  91 +
  92 + public static final String DATE_VARIABLE = "%(DATE|date)%";
  93 +
  94 + public static final String FILE_MANAGER_VIEW = "/view/FileManagerView.fxml";
  95 +
  96 + public static final String FILE_MANAGER = "文件批处理";
  97 +
  98 + public static final String PARSE_JSON_ERROR = "解析JSON失败";
  99 +
  100 + public static final String SAVE_FILE_ERROR = "保存文件失败";
  101 +
  102 + public static final String READ_FILE_ERROR = "读取文件失败";
  103 +
  104 + public static final String OPEN_LINK_ERROR = "打开链接失败";
  105 +
  106 + public static final String JSON_PATH_GRAMMAR_URL = "https://github.com/alibaba/fastjson/wiki/JSONPath";
  107 +
  108 + public static final String ICON = "/images/wetool.png";
  109 +
  110 + public static final String FXML_LOAD_ERROR = "加载视图失败";
  111 +
  112 + public static final String INIT_ERROR = "初始化失败,无法继续运行";
  113 +
  114 + public static final String JSON_PARSER_VIEW = "/view/JsonParserView.fxml";
  115 +
  116 + public static final String MAIN_VIEW = "/view/WeToolMainView.fxml";
  117 +
  118 + public static final String JSON_PARSER = "JSON解析器";
  119 +
  120 + public static final String MAIN_TITLE = "Visual Commons Tool";
  121 +}
  1 +package com.zhazhapan.util.visual.controller;
  2 +
  3 +import cn.hutool.core.codec.Base64;
  4 +import cn.hutool.core.util.CharsetUtil;
  5 +import com.zhazhapan.util.Checker;
  6 +import com.zhazhapan.util.visual.WeUtils;
  7 +import com.zhazhapan.util.visual.model.ConfigModel;
  8 +import com.zhazhapan.util.visual.model.ControllerModel;
  9 +import javafx.fxml.FXML;
  10 +import javafx.scene.control.ComboBox;
  11 +import javafx.scene.control.TextArea;
  12 +import javafx.scene.input.DragEvent;
  13 +import javafx.scene.input.TransferMode;
  14 +
  15 +/**
  16 + * @author pantao
  17 + * @since 2018/4/4
  18 + */
  19 +public class CharsetConverterController {
  20 +
  21 + private final String BASE64 = "BASE64";
  22 +
  23 + @FXML
  24 + public TextArea originalContent;
  25 +
  26 + @FXML
  27 + public ComboBox<String> originalCharset;
  28 +
  29 + @FXML
  30 + public ComboBox<String> convertCharset;
  31 +
  32 + @FXML
  33 + public TextArea convertedContent;
  34 +
  35 + @FXML
  36 + private void initialize() {
  37 + String[] charset = {"UTF-8", "ISO-8859-1", "GBK", BASE64};
  38 + originalCharset.getItems().addAll(charset);
  39 + originalCharset.getSelectionModel().selectFirst();
  40 + convertCharset.getItems().addAll(charset);
  41 + convertCharset.getSelectionModel().selectFirst();
  42 + originalCharset.getSelectionModel().selectedItemProperty().addListener((o, ov, nv) -> convert());
  43 + convertCharset.getSelectionModel().selectedItemProperty().addListener((o, ov, nv) -> convert());
  44 + originalContent.textProperty().addListener((o, ov, nv) -> convert());
  45 + originalContent.setWrapText(ConfigModel.isAutoWrap());
  46 + convertedContent.setWrapText(ConfigModel.isAutoWrap());
  47 + ControllerModel.setCharsetConverterController(this);
  48 + }
  49 +
  50 + private void convert() {
  51 + String originalText = originalContent.getText();
  52 + if (Checker.isNotEmpty(originalText)) {
  53 + String srcCharset = originalCharset.getSelectionModel().getSelectedItem();
  54 + String destCharset = convertCharset.getSelectionModel().getSelectedItem();
  55 + String result;
  56 + boolean baseDecode = BASE64.equals(srcCharset);
  57 + boolean baseEncode = BASE64.equals(destCharset);
  58 + if (baseDecode && baseEncode) {
  59 + result = originalText;
  60 + } else if (baseDecode) {
  61 + result = Base64.decodeStr(originalText);
  62 + } else if (baseEncode) {
  63 + result = Base64.encode(originalText);
  64 + } else {
  65 + result = CharsetUtil.convert(originalText, srcCharset, destCharset);
  66 + }
  67 + convertedContent.setText(result);
  68 + }
  69 + }
  70 +
  71 + public void dragFileDropped(DragEvent event) {
  72 + WeUtils.putDragFileInTextArea(originalContent, event);
  73 + }
  74 +
  75 + public void dragFileOver(DragEvent event) {
  76 + event.acceptTransferModes(TransferMode.COPY);
  77 + }
  78 +}
  1 +package com.zhazhapan.util.visual.controller;
  2 +
  3 +import cn.hutool.core.date.DateUtil;
  4 +import com.zhazhapan.util.Checker;
  5 +import com.zhazhapan.util.visual.model.ConfigModel;
  6 +import com.zhazhapan.util.visual.model.ControllerModel;
  7 +import javafx.fxml.FXML;
  8 +import javafx.scene.control.TextArea;
  9 +import javafx.util.Pair;
  10 +
  11 +import java.util.Date;
  12 +
  13 +/**
  14 + * @author pantao
  15 + * @since 2018/4/3
  16 + */
  17 +public class ClipboardHistoryController {
  18 +
  19 + @FXML
  20 + public TextArea clipboardHistory;
  21 +
  22 + @FXML
  23 + private void initialize() {
  24 + clipboardHistory.setWrapText(ConfigModel.isAutoWrap());
  25 + ControllerModel.setClipboardHistoryController(this);
  26 + for (int i = ConfigModel.getClipboardHistorySize() - 1; i >= 0; i--) {
  27 + Pair<Date, String> pair = ConfigModel.getClipboardHistoryItem(i);
  28 + if (Checker.isNotNull(pair)) {
  29 + insert(pair.getKey(), pair.getValue());
  30 + }
  31 + }
  32 + }
  33 +
  34 + public void insert(Date date, String content) {
  35 + if (Checker.isNotEmpty(content)) {
  36 + String contentVariable = "%content%";
  37 + String dateVariable = "%datetime%";
  38 + String template = "---------------------------------------\r\n" + dateVariable + "\r\n" +
  39 + "---------------------------------------\r\n\r\n" + contentVariable + "\r\n\r\n";
  40 + content = template.replace(dateVariable, DateUtil.formatDateTime(date)).replace(contentVariable, content);
  41 + clipboardHistory.setText(content + clipboardHistory.getText());
  42 + }
  43 + }
  44 +}
  1 +package com.zhazhapan.util.visual.controller;
  2 +
  3 +import com.zhazhapan.modules.constant.ValueConsts;
  4 +import com.zhazhapan.util.ArrayUtils;
  5 +import com.zhazhapan.util.Checker;
  6 +import com.zhazhapan.util.FileExecutor;
  7 +import com.zhazhapan.util.Formatter;
  8 +import com.zhazhapan.util.dialog.Alerts;
  9 +import com.zhazhapan.util.visual.WeUtils;
  10 +import com.zhazhapan.util.visual.constant.LocalValueConsts;
  11 +import com.zhazhapan.util.visual.model.ConfigModel;
  12 +import com.zhazhapan.util.visual.model.ControllerModel;
  13 +import javafx.collections.ObservableList;
  14 +import javafx.event.ActionEvent;
  15 +import javafx.fxml.FXML;
  16 +import javafx.scene.control.*;
  17 +import javafx.scene.control.cell.TextFieldListCell;
  18 +import javafx.scene.input.DragEvent;
  19 +import javafx.scene.input.TransferMode;
  20 +
  21 +import java.io.File;
  22 +import java.util.Arrays;
  23 +import java.util.List;
  24 +import java.util.Objects;
  25 +
  26 +/**
  27 + * @author pantao
  28 + * @since 2018/3/31
  29 + */
  30 +public class FileManagerController {
  31 +
  32 + @FXML
  33 + public ListView<File> selectedFilesOfRenameTab;
  34 +
  35 + @FXML
  36 + public TextField filePrefixOfRenameTab;
  37 +
  38 + @FXML
  39 + public TextField filePostfixOfRenameTab;
  40 +
  41 + @FXML
  42 + public TextField startNumberOfRenameTab;
  43 +
  44 + @FXML
  45 + public ListView<String> destFilesOfRenameTab;
  46 +
  47 + @FXML
  48 + public TextField fileQueryStringOfRenameTab;
  49 +
  50 + @FXML
  51 + public TextField fileReplaceStringOfRenameTab;
  52 +
  53 + @FXML
  54 + public TextField fileAddableText;
  55 +
  56 + @FXML
  57 + public ComboBox<String> fileAddableCombo;
  58 +
  59 + @FXML
  60 + public TextField destFolderOfCopyTab;
  61 +
  62 + @FXML
  63 + public ListView<File> selectedFilesOfCopyTab;
  64 +
  65 + @FXML
  66 + public CheckBox isDeleteSrcOfCopyTab;
  67 +
  68 + @FXML
  69 + public TabPane fileManagerTab;
  70 +
  71 + @FXML
  72 + public CheckBox isDeleteSrcOfSplitTab;
  73 +
  74 + @FXML
  75 + public TextField splitPoint;
  76 +
  77 + @FXML
  78 + public TextArea fileContent;
  79 +
  80 + @FXML
  81 + public TextField destFolderOfSplitTab;
  82 +
  83 + @FXML
  84 + public File splittingFile;
  85 +
  86 + @FXML
  87 + public ListView<File> selectedFilesOfMergeTab;
  88 +
  89 + @FXML
  90 + public TextField contentFilter;
  91 +
  92 + @FXML
  93 + public CheckBox deleteSrcOfMergeTab;
  94 +
  95 + @FXML
  96 + public TextField srcFolderOfDeleteTab;
  97 +
  98 + @FXML
  99 + public TextArea filenameOfDeleteTab;
  100 +
  101 + @FXML
  102 + private void initialize() {
  103 + //设置多选
  104 + selectedFilesOfRenameTab.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
  105 + selectedFilesOfCopyTab.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
  106 + selectedFilesOfMergeTab.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
  107 + //设置可编辑
  108 + destFilesOfRenameTab.setCellFactory(TextFieldListCell.forListView());
  109 + destFilesOfRenameTab.setEditable(true);
  110 +
  111 + fileAddableCombo.getItems().addAll(LocalValueConsts.BEFORE_FILENAME, LocalValueConsts.AFTER_FILENAME);
  112 + fileAddableCombo.getSelectionModel().selectLast();
  113 + fileAddableCombo.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) ->
  114 + generateRenameDestFilesOfAddable());
  115 +
  116 + fileContent.setWrapText(ConfigModel.isAutoWrap());
  117 + ControllerModel.setFileManagerController(this);
  118 + }
  119 +
  120 + @SuppressWarnings("unchecked")
  121 + public void dragFileDropped(DragEvent event) {
  122 + Object target = event.getGestureTarget();
  123 + if (target instanceof ListView) {
  124 + WeUtils.putFilesInListView(event.getDragboard().getFiles(), ((ListView<File>) target).getItems());
  125 + }
  126 + }
  127 +
  128 + public void dragFileOver(DragEvent event) {
  129 + event.acceptTransferModes(TransferMode.COPY);
  130 + }
  131 +
  132 + public void generateRenameDestFilesOfFormat() {
  133 + ObservableList<File> list = selectedFilesOfRenameTab.getItems();
  134 + if (Checker.isNotEmpty(list)) {
  135 + String startNumber = Checker.checkNull(startNumberOfRenameTab.getText());
  136 + int len = startNumber.length();
  137 + startNumber = startNumber.replaceAll(ValueConsts.SHARP, ValueConsts.EMPTY_STRING);
  138 + int i = WeUtils.stringToInt(startNumber);
  139 + int numLen = len - startNumber.length() + String.valueOf(i).length();
  140 + ObservableList<String> destFiles = destFilesOfRenameTab.getItems();
  141 + destFiles.clear();
  142 + for (File file : list) {
  143 + String postfix = WeUtils.replaceVariable(filePostfixOfRenameTab.getText());
  144 + if (Checker.isEmpty(postfix) || ValueConsts.DOT_SIGN.equals(postfix)) {
  145 + postfix = FileExecutor.getFileSuffix(file);
  146 + }
  147 + String prefix = WeUtils.replaceVariable(filePrefixOfRenameTab.getText());
  148 + String fileName = prefix + Formatter.numberFormat(i++, numLen) + (postfix.startsWith(ValueConsts
  149 + .DOT_SIGN) ? postfix : ValueConsts.DOT_SIGN + postfix);
  150 + destFiles.add(file.getParent() + ValueConsts.SEPARATOR + fileName);
  151 + }
  152 + }
  153 + }
  154 +
  155 + public void renameFiles() {
  156 + ObservableList<File> srcFiles = selectedFilesOfRenameTab.getItems();
  157 + ObservableList<String> destFiles = destFilesOfRenameTab.getItems();
  158 + int len = srcFiles.size();
  159 + if (Checker.isNotEmpty(srcFiles) && len == destFiles.size()) {
  160 + for (int i = 0; i < len; i++) {
  161 + File srcFile = srcFiles.get(0);
  162 + File destFile = new File(destFiles.get(i));
  163 + FileExecutor.renameTo(srcFile, destFile);
  164 + srcFiles.remove(srcFile);
  165 + srcFiles.add(destFile);
  166 + }
  167 + WeUtils.showSuccessInfo();
  168 + }
  169 + }
  170 +
  171 + public void removeFilesFromRenameTab() {
  172 + ObservableList<File> files = selectedFilesOfRenameTab.getSelectionModel().getSelectedItems();
  173 + if (Checker.isNotEmpty(files)) {
  174 + ObservableList<File> fileList = selectedFilesOfRenameTab.getItems();
  175 + ObservableList<String> destFiles = destFilesOfRenameTab.getItems();
  176 + if (Checker.isNotEmpty(destFiles)) {
  177 + int i = 0;
  178 + for (File file : files) {
  179 + destFiles.remove(fileList.indexOf(file) - (i++));
  180 + }
  181 + }
  182 + fileList.removeAll(files);
  183 + }
  184 + }
  185 +
  186 + public void generateRenameDestFilesOfReplace() {
  187 + ObservableList<File> list = selectedFilesOfRenameTab.getItems();
  188 + if (Checker.isNotEmpty(list)) {
  189 + ObservableList<String> destFiles = destFilesOfRenameTab.getItems();
  190 + destFiles.clear();
  191 + final String dateVariable = "%date%";
  192 + final String timeVariable = "%time%";
  193 + for (File file : list) {
  194 + String fn = file.getName();
  195 + String queryStr = Checker.checkNull(fileQueryStringOfRenameTab.getText());
  196 + if (queryStr.toLowerCase().contains(dateVariable)) {
  197 + fn = fn.replaceAll("\\d{4}-\\d{2}-\\d{2}", dateVariable);
  198 + }
  199 + if (queryStr.toLowerCase().contains(timeVariable)) {
  200 + fn = fn.replaceAll("\\d{2}\\.\\d{2}\\.\\d{2}", timeVariable);
  201 + }
  202 + fn = fn.replaceAll(queryStr, Checker.checkNull(fileReplaceStringOfRenameTab.getText()));
  203 + destFiles.add(file.getParent() + ValueConsts.SEPARATOR + WeUtils.replaceVariable(fn));
  204 + }
  205 + }
  206 + }
  207 +
  208 + public void generateRenameDestFilesOfAddable() {
  209 + ObservableList<File> list = selectedFilesOfRenameTab.getItems();
  210 + if (Checker.isNotEmpty(list)) {
  211 + ObservableList<String> destFiles = destFilesOfRenameTab.getItems();
  212 + destFiles.clear();
  213 + for (File file : list) {
  214 + String text = WeUtils.replaceVariable(fileAddableText.getText());
  215 + String fn = file.getName();
  216 + int idx = fn.lastIndexOf(ValueConsts.DOT_SIGN);
  217 + fn = LocalValueConsts.BEFORE_FILENAME.equals(fileAddableCombo.getSelectionModel().getSelectedItem())
  218 + ? text + fn : fn.substring(0, idx) + text + fn.substring(idx);
  219 + destFiles.add(file.getParent() + ValueConsts.SEPARATOR + fn);
  220 + }
  221 + }
  222 + }
  223 +
  224 + public void copyFiles() {
  225 + WeUtils.copyFiles(selectedFilesOfCopyTab.getItems(), destFolderOfCopyTab.getText(), isDeleteSrcOfCopyTab
  226 + .isSelected());
  227 + }
  228 +
  229 + public void browseSrcFolder() {
  230 + File file = WeUtils.getChooseFile();
  231 + if (Checker.isNotNull(file)) {
  232 + int idx = fileManagerTab.getSelectionModel().getSelectedIndex();
  233 + switch (idx) {
  234 + case 1:
  235 + destFolderOfCopyTab.setText(file.getParent());
  236 + break;
  237 + case 2:
  238 + destFolderOfSplitTab.setText(file.getParent());
  239 + default:
  240 + break;
  241 + }
  242 + }
  243 + }
  244 +
  245 + public void dragFileDroppedOfCopyTab(DragEvent event) {
  246 + List<File> files = event.getDragboard().getFiles();
  247 + if (Checker.isNotEmpty(files)) {
  248 + Object target = event.getGestureTarget();
  249 + if (target instanceof ListView) {
  250 + WeUtils.putFilesInListView(event.getDragboard().getFiles(), selectedFilesOfCopyTab.getItems());
  251 + } else if (target instanceof TextField) {
  252 + destFolderOfCopyTab.setText(WeUtils.getFolder(files.get(0)));
  253 + }
  254 + }
  255 + }
  256 +
  257 + public void splitFile() {
  258 + String pointStr = splitPoint.getText();
  259 + String folder = destFolderOfSplitTab.getText();
  260 + if (Checker.isNotNull(splittingFile) && Checker.isNotEmpty(pointStr) && Checker.isNotEmpty(folder)) {
  261 + String[] points = pointStr.split(ValueConsts.COMMA_SIGN);
  262 + int len = points.length;
  263 + long[] ps = new long[points.length];
  264 + for (int i = 0; i < len; i++) {
  265 + ps[i] = Formatter.stringToLong(points[i]);
  266 + }
  267 + Arrays.sort(ps);
  268 + ps = ArrayUtils.unique(ps, ValueConsts.ONE_INT, Long.MAX_VALUE);
  269 + WeUtils.splitFile(splittingFile, ps, folder, isDeleteSrcOfSplitTab.isSelected());
  270 + }
  271 + }
  272 +
  273 + public void dragFileDroppedOfSplitTab(DragEvent event) {
  274 + List<File> files = event.getDragboard().getFiles();
  275 + if (Checker.isNotEmpty(files)) {
  276 + Object target = event.getGestureTarget();
  277 + File file = files.get(0);
  278 + if (target instanceof TextArea) {
  279 + splittingFile = file;
  280 + fileContent.setText(WeUtils.readFile(file));
  281 + } else if (target instanceof TextField) {
  282 + destFolderOfSplitTab.setText(WeUtils.getFolder(file));
  283 + }
  284 + }
  285 + }
  286 +
  287 + public void generateSplitPoint() {
  288 + int caret = fileContent.getCaretPosition();
  289 + String points = Checker.checkNull(splitPoint.getText()).trim();
  290 + if (!points.contains(String.valueOf(caret))) {
  291 + splitPoint.setText(points + (Checker.isEmpty(points) || points.endsWith(",") ? caret : "," + caret));
  292 + }
  293 + }
  294 +
  295 + public void scrollTo() {
  296 + String points = splitPoint.getText();
  297 + if (Checker.isNotEmpty(points) && Checker.isNotEmpty(fileContent.getText())) {
  298 + int position = splitPoint.getCaretPosition();
  299 + String before = points.substring(0, position);
  300 + String after = points.substring(position);
  301 + String point = "";
  302 + if (Checker.isNotEmpty(before)) {
  303 + String[] temp = before.split(ValueConsts.COMMA_SIGN);
  304 + point = temp[temp.length - 1].trim();
  305 + }
  306 + if (Checker.isNotEmpty(after)) {
  307 + point += after.split(ValueConsts.COMMA_SIGN)[0].trim();
  308 + }
  309 + int caret = Formatter.stringToInt(point);
  310 + fileContent.setScrollTop(caret > -1 ? caret : 0);
  311 + }
  312 + }
  313 +
  314 + public void mergeFiles() {
  315 + WeUtils.mergeFiles(selectedFilesOfMergeTab.getItems(), contentFilter.getText(), deleteSrcOfMergeTab
  316 + .isSelected());
  317 + }
  318 +
  319 + public void removeFilesOfCopyTab() {
  320 + WeUtils.removeSelectedItems(selectedFilesOfCopyTab);
  321 + }
  322 +
  323 + public void goForward() {
  324 + ObservableList<File> files = selectedFilesOfMergeTab.getSelectionModel().getSelectedItems();
  325 + if (Checker.isNotEmpty(files)) {
  326 + ObservableList<File> list = selectedFilesOfMergeTab.getItems();
  327 + int len = files.size();
  328 + if (len < list.size()) {
  329 + for (int i = 0; i < len; i++) {
  330 + int idx = list.indexOf(files.get(i));
  331 + if (idx > i) {
  332 + File temp = list.get(idx - 1);
  333 + list.set(idx - 1, files.get(i));
  334 + list.set(idx, temp);
  335 + }
  336 + }
  337 + }
  338 + }
  339 + }
  340 +
  341 + public void goBack() {
  342 + ObservableList<File> files = selectedFilesOfMergeTab.getSelectionModel().getSelectedItems();
  343 + if (Checker.isNotEmpty(files)) {
  344 + ObservableList<File> list = selectedFilesOfMergeTab.getItems();
  345 + int size = list.size();
  346 + int len = files.size();
  347 + if (files.size() < size) {
  348 + for (int i = len - 1, j = 0; i >= 0; i--) {
  349 + int idx = list.indexOf(files.get(i));
  350 + if (idx < (size - (++j))) {
  351 + File temp = list.get(idx + 1);
  352 + list.set(idx + 1, files.get(i));
  353 + list.set(idx, temp);
  354 + }
  355 + }
  356 + }
  357 + }
  358 + }
  359 +
  360 + public void removeFilesOfMergeTab() {
  361 + WeUtils.removeSelectedItems(selectedFilesOfMergeTab);
  362 + }
  363 +
  364 + public void deleteFiles() {
  365 + String filenames = filenameOfDeleteTab.getText();
  366 + if (Checker.isNotEmpty(filenames)) {
  367 + deleteFiles(new File(srcFolderOfDeleteTab.getText()), filenames.split(ValueConsts.COMMA_SIGN));
  368 + Alerts.showInformation(LocalValueConsts.MAIN_TITLE, LocalValueConsts.OPERATION_SUCCESS);
  369 + }
  370 + }
  371 +
  372 + private void deleteFiles(File folder, String[] filenames) {
  373 + if (folder.exists() && folder.isDirectory()) {
  374 + File[] files = folder.listFiles();
  375 + if (Checker.isNotNull(files) && files.length > 0) {
  376 + for (File file : files) {
  377 + String filename = file.getName();
  378 + for (String fn : filenames) {
  379 + String nf = fn.trim();
  380 + if (Checker.isNotEmpty(nf) && filename.endsWith(fn)) {
  381 + WeUtils.deleteFiles(file);
  382 + break;
  383 + }
  384 + }
  385 + if (file.isDirectory()) {
  386 + deleteFiles(file, filenames);
  387 + }
  388 + }
  389 + }
  390 + }
  391 + }
  392 +
  393 + public void dragFileDroppedOfDeleteTab(DragEvent event) {
  394 + List<File> files = event.getDragboard().getFiles();
  395 + if (Checker.isNotEmpty(files)) {
  396 + srcFolderOfDeleteTab.setText(WeUtils.getFolder(files.get(0)));
  397 + }
  398 + }
  399 +
  400 + public void dragFilesDroppedOfDeleteTab(DragEvent event) {
  401 + List<File> files = event.getDragboard().getFiles();
  402 + if (Checker.isNotEmpty(files)) {
  403 + for (File file : files) {
  404 + String fns = Checker.checkNull(filenameOfDeleteTab.getText()).trim();
  405 + boolean endsWith = Checker.isEmpty(fns) || fns.endsWith(ValueConsts.COMMA_SIGN);
  406 + filenameOfDeleteTab.appendText((endsWith ? "" : ", ") + file.getName());
  407 + }
  408 + }
  409 + }
  410 +}
  1 +package com.zhazhapan.util.visual.controller;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONArray;
  5 +import com.alibaba.fastjson.JSONPath;
  6 +import com.zhazhapan.util.Checker;
  7 +import com.zhazhapan.util.Formatter;
  8 +import com.zhazhapan.util.ThreadPool;
  9 +import com.zhazhapan.util.dialog.Alerts;
  10 +import com.zhazhapan.util.visual.WeUtils;
  11 +import com.zhazhapan.util.visual.constant.LocalValueConsts;
  12 +import com.zhazhapan.util.visual.model.ConfigModel;
  13 +import com.zhazhapan.util.visual.model.ControllerModel;
  14 +import javafx.application.Platform;
  15 +import javafx.fxml.FXML;
  16 +import javafx.scene.control.TextArea;
  17 +import javafx.scene.control.TextField;
  18 +import javafx.scene.input.DragEvent;
  19 +import javafx.scene.input.KeyCode;
  20 +import javafx.scene.input.KeyEvent;
  21 +import javafx.scene.input.TransferMode;
  22 +
  23 +/**
  24 + * @author pantao
  25 + * @since 2018/3/31
  26 + */
  27 +public class JsonParserController {
  28 +
  29 + @FXML
  30 + public TextArea jsonContent;
  31 +
  32 + @FXML
  33 + public TextArea parsedJsonContent;
  34 +
  35 + @FXML
  36 + public TextField jsonPath;
  37 +
  38 + @FXML
  39 + private void initialize() {
  40 + jsonContent.setWrapText(ConfigModel.isAutoWrap());
  41 + parsedJsonContent.setWrapText(ConfigModel.isAutoWrap());
  42 + ControllerModel.setJsonParserController(this);
  43 + }
  44 +
  45 + public void parseJson() {
  46 + String json = jsonContent.getText();
  47 + String path = jsonPath.getText();
  48 + ThreadPool.executor.submit(() -> {
  49 + try {
  50 + JSONArray jsonArray = JSON.parseArray("[" + json + "]");
  51 + Object object = JSONPath.eval(jsonArray, "[0]");
  52 + String parsedJson;
  53 + if (Checker.isEmpty(path)) {
  54 + parsedJson = object.toString();
  55 + } else {
  56 + parsedJson = JSONPath.eval(object, (object instanceof JSONArray ? "" : ".") + path).toString();
  57 + }
  58 + Platform.runLater(() -> parsedJsonContent.setText(Formatter.formatJson(Checker.checkNull(parsedJson))));
  59 + } catch (Exception e) {
  60 + Platform.runLater(() -> Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts
  61 + .PARSE_JSON_ERROR));
  62 + }
  63 + });
  64 + }
  65 +
  66 + public void seeJsonPathGrammar() {
  67 + WeUtils.openLink(LocalValueConsts.JSON_PATH_GRAMMAR_URL);
  68 + }
  69 +
  70 + public void dragFileOver(DragEvent event) {
  71 + event.acceptTransferModes(TransferMode.COPY);
  72 + }
  73 +
  74 + public void dragFileDropped(DragEvent event) {
  75 + WeUtils.putDragFileInTextArea(jsonContent, event);
  76 + }
  77 +
  78 + public void jsonPathEnter(KeyEvent keyEvent) {
  79 + if (keyEvent.getCode() == KeyCode.ENTER) {
  80 + parseJson();
  81 + }
  82 + }
  83 +}
  1 +package com.zhazhapan.util.visual.controller;
  2 +
  3 +import cn.hutool.core.util.ClipboardUtil;
  4 +import com.zhazhapan.modules.constant.ValueConsts;
  5 +import com.zhazhapan.qiniu.QiniuApplication;
  6 +import com.zhazhapan.qiniu.view.MainWindow;
  7 +import com.zhazhapan.util.Checker;
  8 +import com.zhazhapan.util.ReflectUtils;
  9 +import com.zhazhapan.util.dialog.Alerts;
  10 +import com.zhazhapan.util.visual.WeToolApplication;
  11 +import com.zhazhapan.util.visual.WeUtils;
  12 +import com.zhazhapan.util.visual.constant.LocalValueConsts;
  13 +import com.zhazhapan.util.visual.model.ConfigModel;
  14 +import com.zhazhapan.util.visual.model.ControllerModel;
  15 +import javafx.application.Platform;
  16 +import javafx.collections.ObservableList;
  17 +import javafx.fxml.FXML;
  18 +import javafx.scene.control.ProgressBar;
  19 +import javafx.scene.control.Tab;
  20 +import javafx.scene.control.TabPane;
  21 +import javafx.scene.layout.VBox;
  22 +import org.apache.log4j.Logger;
  23 +
  24 +import java.io.File;
  25 +import java.lang.reflect.InvocationTargetException;
  26 +import java.util.Date;
  27 +import java.util.List;
  28 +import java.util.Timer;
  29 +import java.util.TimerTask;
  30 +
  31 +/**
  32 + * @author pantao
  33 + * @since 2018/3/30
  34 + */
  35 +public class MainController {
  36 +
  37 + private static Logger logger = Logger.getLogger(MainController.class);
  38 +
  39 + @FXML
  40 + public TabPane tabPane;
  41 +
  42 + @FXML
  43 + public ProgressBar jvm;
  44 +
  45 + @FXML
  46 + private void initialize() {
  47 + // 监听剪贴板
  48 + ConfigModel.appendClipboardHistory(new Date(), ClipboardUtil.getStr());
  49 + Timer timer = new Timer();
  50 + TimerTask task = new TimerTask() {
  51 + @Override
  52 + public void run() {
  53 + String clipboard;
  54 + String last;
  55 + try {
  56 + // 忽略系统休眠时抛出的异常
  57 + clipboard = ClipboardUtil.getStr();
  58 + last = ConfigModel.getLastClipboardHistoryItem().getValue();
  59 + } catch (Exception e) {
  60 + logger.warn(e.getMessage());
  61 + clipboard = last = ValueConsts.EMPTY_STRING;
  62 +
  63 + }
  64 + if (Checker.isNotEmpty(clipboard) && !last.equals(clipboard)) {
  65 + Date date = new Date();
  66 + ConfigModel.appendClipboardHistory(date, clipboard);
  67 + ClipboardHistoryController controller = ControllerModel.getClipboardHistoryController();
  68 + if (Checker.isNotNull(controller)) {
  69 + final String clip = clipboard;
  70 + Platform.runLater(() -> controller.insert(date, clip));
  71 + }
  72 + }
  73 + boolean isVisible = WeToolApplication.stage.isShowing() && !WeToolApplication.stage.isMaximized() &&
  74 + !WeToolApplication.stage.isIconified();
  75 + // 监听JVM内存变化
  76 + if (isVisible) {
  77 + System.gc();
  78 + Platform.runLater(() -> {
  79 + double total = Runtime.getRuntime().totalMemory();
  80 + double used = total - Runtime.getRuntime().freeMemory();
  81 + jvm.setProgress(used / total);
  82 + });
  83 + }
  84 + }
  85 + };
  86 + timer.scheduleAtFixedRate(task, LocalValueConsts.ONE_THOUSAND, LocalValueConsts.ONE_THOUSAND);
  87 + ControllerModel.setMainController(this);
  88 + }
  89 +
  90 + public void loadTabs() {
  91 + for (Object tabName : ConfigModel.getTabs()) {
  92 + try {
  93 + ReflectUtils.invokeMethod(this, "open" + tabName + "Tab", null);
  94 + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
  95 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.FXML_LOAD_ERROR);
  96 + }
  97 + }
  98 + }
  99 +
  100 + public void quit() {
  101 + WeUtils.exitSystem();
  102 + }
  103 +
  104 + public void openNetworkToolTab() {
  105 + addTab(new Tab(LocalValueConsts.NETWORK_TOOL), LocalValueConsts.NETWORK_TOOL_VIEW);
  106 + }
  107 +
  108 + public void openCharsetConverterTab() {
  109 + addTab(new Tab(LocalValueConsts.CHARSET_CONVERTER), LocalValueConsts.CHARSET_CONVERTER_VIEW);
  110 + }
  111 +
  112 + public void openClipboardHistoryTab() {
  113 + addTab(new Tab(LocalValueConsts.CLIPBOARD_HISTORY), LocalValueConsts.CLIPBOARD_HISTORY_VIEW);
  114 + }
  115 +
  116 + public void openRandomGeneratorTab() {
  117 + addTab(new Tab(LocalValueConsts.RANDOM_GENERATOR), LocalValueConsts.RANDOM_GENERATOR_VIEW);
  118 + }
  119 +
  120 + public void openQrCodeGeneratorTab() {
  121 + addTab(new Tab(LocalValueConsts.QR_CODE_GENERATOR), LocalValueConsts.QR_CODE_GENERATOR_VIEW);
  122 + }
  123 +
  124 + public void openJsonParserTab() {
  125 + addTab(new Tab(LocalValueConsts.JSON_PARSER), LocalValueConsts.JSON_PARSER_VIEW);
  126 + }
  127 +
  128 + private void addTab(Tab tab, String url) {
  129 + ObservableList<Tab> tabs = tabPane.getTabs();
  130 + for (Tab t : tabs) {
  131 + if (t.getText().equals(tab.getText())) {
  132 + tabPane.getSelectionModel().select(t);
  133 + return;
  134 + }
  135 + }
  136 + VBox box = WeUtils.loadFxml(url);
  137 + if (Checker.isNull(box)) {
  138 + Alerts.showError(ValueConsts.ERROR, LocalValueConsts.FXML_LOAD_ERROR);
  139 + } else {
  140 + tab.setContent(box);
  141 + tab.setClosable(true);
  142 + tabs.add(tab);
  143 + tabPane.getSelectionModel().select(tab);
  144 + }
  145 + }
  146 +
  147 + public void openFile() {
  148 + File file = WeUtils.getChooseFile();
  149 + if (Checker.isNotNull(file)) {
  150 + Tab tab = tabPane.getSelectionModel().getSelectedItem();
  151 + if (Checker.isNotNull(tab)) {
  152 + String tabText = Checker.checkNull(tab.getText());
  153 + String fileContent = WeUtils.readFile(file);
  154 + switch (tabText) {
  155 + case LocalValueConsts.JSON_PARSER:
  156 + JsonParserController controller = ControllerModel.getJsonParserController();
  157 + if (Checker.isNotNull(controller)) {
  158 + controller.jsonContent.setText(fileContent);
  159 + }
  160 + break;
  161 + case LocalValueConsts.FILE_MANAGER:
  162 + WeUtils.putFilesInListViewOfFileManagerTab(file);
  163 + break;
  164 + case LocalValueConsts.QR_CODE_GENERATOR:
  165 + QrCodeGeneratorController qrCodeGeneratorController = ControllerModel
  166 + .getQrCodeGeneratorController();
  167 + if (Checker.isNotNull(qrCodeGeneratorController)) {
  168 + qrCodeGeneratorController.content.setText(fileContent);
  169 + }
  170 + case LocalValueConsts.CHARSET_CONVERTER:
  171 + CharsetConverterController charsetConverterController = ControllerModel
  172 + .getCharsetConverterController();
  173 + if (Checker.isNotNull(charsetConverterController)) {
  174 + charsetConverterController.originalContent.setText(fileContent);
  175 + }
  176 + break;
  177 + default:
  178 + break;
  179 + }
  180 + }
  181 + }
  182 + }
  183 +
  184 + public void saveFile() {
  185 + File file = WeUtils.getSaveFile();
  186 + if (Checker.isNotNull(file)) {
  187 + Tab tab = tabPane.getSelectionModel().getSelectedItem();
  188 + if (Checker.isNotNull(tab)) {
  189 + String tabText = Checker.checkNull(tab.getText());
  190 + String fileContent = null;
  191 + switch (tabText) {
  192 + case LocalValueConsts.JSON_PARSER:
  193 + JsonParserController jsonParserController = ControllerModel.getJsonParserController();
  194 + if (Checker.isNotNull(jsonParserController)) {
  195 + fileContent = jsonParserController.parsedJsonContent.getText();
  196 + }
  197 + break;
  198 + case LocalValueConsts.FILE_MANAGER:
  199 + FileManagerController fileManagerController = ControllerModel.getFileManagerController();
  200 + if (Checker.isNotNull(fileManagerController)) {
  201 + int idx = fileManagerController.fileManagerTab.getSelectionModel().getSelectedIndex();
  202 + if (idx == ValueConsts.TWO_INT) {
  203 + fileContent = fileManagerController.fileContent.getText();
  204 + }
  205 + }
  206 + break;
  207 + case LocalValueConsts.CLIPBOARD_HISTORY:
  208 + ClipboardHistoryController clipboardHistoryController = ControllerModel
  209 + .getClipboardHistoryController();
  210 + if (Checker.isNotNull(clipboardHistoryController)) {
  211 + fileContent = clipboardHistoryController.clipboardHistory.getText();
  212 + }
  213 + break;
  214 + case LocalValueConsts.CHARSET_CONVERTER:
  215 + CharsetConverterController charsetConverterController = ControllerModel
  216 + .getCharsetConverterController();
  217 + if (Checker.isNotNull(charsetConverterController)) {
  218 + fileContent = charsetConverterController.convertedContent.getText();
  219 + }
  220 + break;
  221 + case LocalValueConsts.NETWORK_TOOL:
  222 + NetworkToolController networkToolController = ControllerModel.getNetworkToolController();
  223 + if (Checker.isNotNull(networkToolController)) {
  224 + fileContent = networkToolController.whoisResult.getText();
  225 + }
  226 + default:
  227 + break;
  228 + }
  229 + if (Checker.isNotEmpty(fileContent)) {
  230 + WeUtils.saveFile(file, fileContent);
  231 + }
  232 + }
  233 + }
  234 + }
  235 +
  236 + public void openFileManagerTab() {
  237 + addTab(new Tab(LocalValueConsts.FILE_MANAGER), LocalValueConsts.FILE_MANAGER_VIEW);
  238 + }
  239 +
  240 + public void openMultiFile() {
  241 + List<File> files = WeUtils.getChooseFiles();
  242 + if (Checker.isNotEmpty(files)) {
  243 + Tab tab = tabPane.getSelectionModel().getSelectedItem();
  244 + if (Checker.isNotNull(tab)) {
  245 + String tabText = Checker.checkNull(tab.getText());
  246 + switch (tabText) {
  247 + case LocalValueConsts.FILE_MANAGER:
  248 + WeUtils.putFilesInListViewOfFileManagerTab(files);
  249 + break;
  250 + default:
  251 + break;
  252 + }
  253 + }
  254 + }
  255 + }
  256 +
  257 + public void about() {
  258 + Alerts.showInformation(LocalValueConsts.MAIN_TITLE, LocalValueConsts.ABOUT_APP, LocalValueConsts.ABOUT_DETAIL);
  259 + }
  260 +
  261 + public void closeAllTab() {
  262 + tabPane.getTabs().clear();
  263 + }
  264 +
  265 + public void openAllTab() {
  266 + ConfigModel.setTabs(ConfigModel.getSupportTabs());
  267 + loadTabs();
  268 + }
  269 +
  270 + public void openQiniuToolTab() {
  271 + QiniuApplication.initLoad(ValueConsts.TRUE);
  272 + Tab tab = new Tab(LocalValueConsts.QINIU_TOOL);
  273 + tab.setOnCloseRequest((event) -> MainWindow.setOnClosed(event, ValueConsts.TRUE));
  274 + addTab(tab, LocalValueConsts.QINIU_TOOL_VIEW);
  275 + }
  276 +
  277 + public void openWaveViewerTab() {
  278 + Tab tab = new Tab(LocalValueConsts.WAVE_VIEWER);
  279 + tab.setOnCloseRequest(event -> WeUtils.closeMysqlConnection());
  280 + addTab(tab, LocalValueConsts.WAVE_VIEW);
  281 + }
  282 +
  283 + public void openColorPicker() {
  284 + WeUtils.startColorPicker();
  285 + }
  286 +
  287 + public void openWox() {
  288 + WeUtils.startWox();
  289 + }
  290 +}
  1 +package com.zhazhapan.util.visual.controller;
  2 +
  3 +import cn.hutool.core.util.NetUtil;
  4 +import com.zhazhapan.config.JsonParser;
  5 +import com.zhazhapan.util.Checker;
  6 +import com.zhazhapan.util.NetUtils;
  7 +import com.zhazhapan.util.ThreadPool;
  8 +import com.zhazhapan.util.dialog.Alerts;
  9 +import com.zhazhapan.util.visual.WeUtils;
  10 +import com.zhazhapan.util.visual.constant.LocalValueConsts;
  11 +import com.zhazhapan.util.visual.model.ControllerModel;
  12 +import javafx.application.Platform;
  13 +import javafx.fxml.FXML;
  14 +import javafx.scene.control.TextArea;
  15 +import javafx.scene.control.TextField;
  16 +
  17 +/**
  18 + * @author pantao
  19 + * @since 2018/4/13
  20 + */
  21 +public class NetworkToolController {
  22 +
  23 + @FXML
  24 + public TextField privateIpv4;
  25 +
  26 + @FXML
  27 + public TextField privateIpv6;
  28 +
  29 + @FXML
  30 + public TextField publicIp;
  31 +
  32 + @FXML
  33 + public TextField publicAddress;
  34 +
  35 + @FXML
  36 + public TextField macAddress;
  37 +
  38 + @FXML
  39 + public TextField systemInfo;
  40 +
  41 + @FXML
  42 + public TextField ipAddress;
  43 +
  44 + @FXML
  45 + public TextField ipLocation;
  46 +
  47 + @FXML
  48 + public TextField domain;
  49 +
  50 + @FXML
  51 + public TextArea whoisResult;
  52 +
  53 + @FXML
  54 + private void initialize() {
  55 + ControllerModel.setNetworkToolController(this);
  56 + //防止UI线程阻塞
  57 + ThreadPool.executor.submit(() -> {
  58 + try {
  59 + JsonParser parser = NetUtils.getPublicIpAndLocation();
  60 + Platform.runLater(() -> {
  61 + try {
  62 + publicIp.setText(parser.getStringUseEval("ip"));
  63 + publicAddress.setText(parser.getStringUseEval("address"));
  64 + privateIpv4.setText(NetUtils.getLocalIp());
  65 + macAddress.setText(NetUtil.getLocalMacAddress());
  66 + systemInfo.setText(NetUtils.getSystemName() + " " + NetUtils.getSystemArch() + " " + NetUtils
  67 + .getSystemVersion());
  68 + } catch (Exception e) {
  69 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.NETWORK_ERROR);
  70 + }
  71 + });
  72 + } catch (Exception e) {
  73 + Platform.runLater(() -> Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.NETWORK_ERROR));
  74 + }
  75 + });
  76 + }
  77 +
  78 + public void queryIpLocation() {
  79 + String ip = ipAddress.getText();
  80 + if (Checker.isNotEmpty(ip)) {
  81 + ThreadPool.executor.submit(() -> {
  82 + String location = WeUtils.getLocationByIp(ip);
  83 + if (Checker.isNotEmpty(location)) {
  84 + Platform.runLater(() -> ipLocation.setText(location));
  85 + }
  86 + });
  87 + }
  88 + }
  89 +
  90 + public void queryWhois() {
  91 + String domainName = domain.getText();
  92 + if (Checker.isNotEmpty(domainName)) {
  93 + String result = WeUtils.whois(domainName);
  94 + if (Checker.isNotEmpty(result)) {
  95 + whoisResult.setText(result);
  96 + }
  97 + }
  98 + }
  99 +}
  1 +package com.zhazhapan.util.visual.controller;
  2 +
  3 +import cn.hutool.extra.qrcode.QrCodeUtil;
  4 +import com.zhazhapan.modules.constant.ValueConsts;
  5 +import com.zhazhapan.util.dialog.Alerts;
  6 +import com.zhazhapan.util.visual.WeUtils;
  7 +import com.zhazhapan.util.visual.constant.LocalValueConsts;
  8 +import com.zhazhapan.util.visual.model.ConfigModel;
  9 +import com.zhazhapan.util.visual.model.ControllerModel;
  10 +import javafx.fxml.FXML;
  11 +import javafx.scene.control.TextArea;
  12 +import javafx.scene.image.Image;
  13 +import javafx.scene.image.ImageView;
  14 +import javafx.scene.input.DragEvent;
  15 +import javafx.scene.input.TransferMode;
  16 +
  17 +import java.io.File;
  18 +import java.io.FileInputStream;
  19 +import java.io.InputStream;
  20 +
  21 +/**
  22 + * @author pantao
  23 + * @since 2018/4/4
  24 + */
  25 +public class QrCodeGeneratorController {
  26 +
  27 + @FXML
  28 + public TextArea content;
  29 +
  30 + @FXML
  31 + public ImageView qrCode;
  32 +
  33 + @FXML
  34 + private void initialize() {
  35 + content.setWrapText(ConfigModel.isAutoWrap());
  36 + ControllerModel.setQrCodeGeneratorController(this);
  37 + }
  38 +
  39 + public void generateQrCode() {
  40 + int size = (int) Double.min(qrCode.getFitHeight(), qrCode.getFitWidth());
  41 + File image = new File(ValueConsts.USER_DESKTOP + ValueConsts.SEPARATOR + "qrcode.jpg");
  42 + try {
  43 + QrCodeUtil.generate(content.getText(), size, size, image);
  44 + InputStream is = new FileInputStream(image);
  45 + qrCode.setImage(new Image(is));
  46 + is.close();
  47 + image.delete();
  48 + } catch (Exception e) {
  49 + Alerts.showError(LocalValueConsts.MAIN_TITLE, LocalValueConsts.QR_CODE_ERROR);
  50 + }
  51 + }
  52 +
  53 + public void dragFileDropped(DragEvent event) {
  54 + WeUtils.putDragFileInTextArea(content, event);
  55 + }
  56 +
  57 + public void dragFileOver(DragEvent event) {
  58 + event.acceptTransferModes(TransferMode.COPY);
  59 + }
  60 +}
  1 +package com.zhazhapan.util.visual.controller;
  2 +
  3 +import cn.hutool.core.util.RandomUtil;
  4 +import com.zhazhapan.modules.constant.ValueConsts;
  5 +import com.zhazhapan.util.Checker;
  6 +import com.zhazhapan.util.Formatter;
  7 +import com.zhazhapan.util.RandomUtils;
  8 +import com.zhazhapan.util.visual.WeUtils;
  9 +import javafx.fxml.FXML;
  10 +import javafx.scene.control.TextField;
  11 +
  12 +import java.util.ArrayList;
  13 +import java.util.List;
  14 +
  15 +/**
  16 + * @author pantao
  17 + * @since 2018/4/2
  18 + */
  19 +public class RandomGeneratorController {
  20 +
  21 + @FXML
  22 + public TextField uuidResult;
  23 +
  24 + @FXML
  25 + public TextField floor;
  26 +
  27 + @FXML
  28 + public TextField ceil;
  29 +
  30 + @FXML
  31 + public TextField ignoreRange;
  32 +
  33 + @FXML
  34 + public TextField precision;
  35 +
  36 + @FXML
  37 + public TextField numberResult;
  38 +
  39 + @FXML
  40 + public TextField emailResult;
  41 +
  42 + @FXML
  43 + public TextField lowerCaseLength;
  44 +
  45 + @FXML
  46 + public TextField lowerCaseResult;
  47 +
  48 + @FXML
  49 + public TextField upperCaseLength;
  50 +
  51 + @FXML
  52 + public TextField upperCaseResult;
  53 +
  54 + @FXML
  55 + public TextField letterLength;
  56 +
  57 + @FXML
  58 + public TextField letterResult;
  59 +
  60 + @FXML
  61 + public TextField stringLength;
  62 +
  63 + @FXML
  64 + public TextField stringResult;
  65 +
  66 + @FXML
  67 + public TextField textLength;
  68 +
  69 + @FXML
  70 + public TextField textResult;
  71 +
  72 + public void generateUUID() {
  73 + uuidResult.setText(RandomUtil.randomUUID());
  74 + }
  75 +
  76 + public void generateNumber() {
  77 + String flo = floor.getText();
  78 + String cei = ceil.getText();
  79 + int p = WeUtils.stringToInt(precision.getText());
  80 + if (p == 0) {
  81 + String[] ranges = Checker.checkNull(ignoreRange.getText()).split(ValueConsts.COMMA_SIGN);
  82 + List<int[]> rl = new ArrayList<>(ranges.length);
  83 + for (String range : ranges) {
  84 + String[] rs = range.trim().split("-");
  85 + if (rs.length > 1 && Checker.isDecimal(rs[0].trim()) && Checker.isDecimal(rs[1].trim())) {
  86 + int[] ri = new int[]{Formatter.stringToInt(rs[0]), Formatter.stringToInt(rs[1])};
  87 + rl.add(ri);
  88 + }
  89 + }
  90 + int[][] r = new int[rl.size()][2];
  91 + rl.toArray(r);
  92 + int f = WeUtils.stringToInt(flo);
  93 + int c = Checker.isDecimal(cei) ? Formatter.stringToInt(cei) : Integer.MAX_VALUE;
  94 + numberResult.setText(String.valueOf(RandomUtils.getRandomIntegerIgnoreRange(f, c, r)));
  95 + } else {
  96 + double f = WeUtils.stringToDouble(flo);
  97 + double c = Checker.isDecimal(cei) ? Formatter.stringToDouble(cei) : Double.MAX_VALUE;
  98 + numberResult.setText(String.valueOf(RandomUtils.getRandomDouble(f, c, p)));
  99 + }
  100 + }
  101 +
  102 + public void generateEmail() {
  103 + emailResult.setText(RandomUtils.getRandomEmail());
  104 + }
  105 +
  106 + public void generateLowerCase() {
  107 + lowerCaseResult.setText(RandomUtils.getRandomStringOnlyLowerCase(getLength(lowerCaseLength.getText())));
  108 + }
  109 +
  110 + public void generateUpperCase() {
  111 + upperCaseResult.setText(RandomUtils.getRandomStringOnlyUpperCase(getLength(upperCaseLength.getText())));
  112 + }
  113 +
  114 + public void generateLetter() {
  115 + letterResult.setText(RandomUtils.getRandomStringOnlyLetter(getLength(letterLength.getText())));
  116 + }
  117 +
  118 + public void generateString() {
  119 + stringResult.setText(RandomUtils.getRandomStringWithoutSymbol(getLength(stringLength.getText())));
  120 + }
  121 +
  122 + public void generateText() {
  123 + textResult.setText(RandomUtils.getRandomString(getLength(textLength.getText())));
  124 + }
  125 +
  126 + private int getLength(String len) {
  127 + int length = WeUtils.stringToInt(len);
  128 + return length < 1 ? RandomUtils.getRandomInteger(ValueConsts.NINE_INT, ValueConsts.SIXTEEN_INT) : length;
  129 + }
  130 +}
  1 +package com.zhazhapan.util.visual.controller;
  2 +
  3 +import com.zhazhapan.modules.constant.ValueConsts;
  4 +import com.zhazhapan.util.Checker;
  5 +import com.zhazhapan.util.Formatter;
  6 +import com.zhazhapan.util.dialog.Alerts;
  7 +import com.zhazhapan.util.visual.WeUtils;
  8 +import com.zhazhapan.util.visual.constant.LocalValueConsts;
  9 +import com.zhazhapan.util.visual.model.ConfigModel;
  10 +import com.zhazhapan.util.visual.model.ControllerModel;
  11 +import com.zhazhapan.util.visual.model.WaverModel;
  12 +import javafx.application.Platform;
  13 +import javafx.fxml.FXML;
  14 +import javafx.scene.chart.AreaChart;
  15 +import javafx.scene.chart.XYChart;
  16 +import javafx.scene.control.ComboBox;
  17 +import javafx.scene.control.DatePicker;
  18 +import javafx.scene.control.TextField;
  19 +
  20 +import java.sql.*;
  21 +import java.time.LocalDate;
  22 +import java.util.Date;
  23 +import java.util.List;
  24 +
  25 +/**
  26 + * @author pantao
  27 + * @since 2018/4/19
  28 + */
  29 +public class WaveController {
  30 +
  31 + private final String INSERT = "插入";
  32 +
  33 + private final String DELETE = "删除";
  34 +
  35 + private final String UPDATE = "更新";
  36 +
  37 + @FXML
  38 + public ComboBox<String> tableCombo;
  39 +
  40 + @FXML
  41 + public DatePicker startDate;
  42 +
  43 + @FXML
  44 + public DatePicker endDate;
  45 +
  46 + @FXML
  47 + public AreaChart<String, Object> chart;
  48 +
  49 + @FXML
  50 + public ComboBox<String> crudMethod;
  51 +
  52 + @FXML
  53 + public TextField sqlNumber;
  54 +
  55 + @FXML
  56 + public TextField sql;
  57 +
  58 + @FXML
  59 + public DatePicker sqlDate;
  60 +
  61 + public Connection connection = null;
  62 +
  63 + public Statement statement = null;
  64 +
  65 + @FXML
  66 + private void initialize() {
  67 + List<WaverModel> waves = ConfigModel.getWaver();
  68 + if (Checker.isNotEmpty(waves)) {
  69 + try {
  70 + Class.forName("com.mysql.jdbc.Driver");
  71 + String url = "jdbc:mysql://" + ConfigModel.getHost() + "/" + ConfigModel.getDatabase() + "?" +
  72 + ConfigModel.getCondition();
  73 + connection = DriverManager.getConnection(url, ConfigModel.getUsername(), ConfigModel.getPassword());
  74 + statement = connection.createStatement();
  75 + } catch (Exception e) {
  76 + Platform.runLater(() -> Alerts.showError(LocalValueConsts.MAIN_TITLE, e.getMessage()));
  77 + }
  78 + waves.forEach(waverModel -> tableCombo.getItems().add(waverModel.getTableName()));
  79 + tableCombo.getSelectionModel().selectedItemProperty().addListener((o, ov, nv) -> getWaveDataToLineChart());
  80 + tableCombo.getSelectionModel().selectFirst();
  81 + crudMethod.getItems().addAll(INSERT, DELETE, UPDATE);
  82 + crudMethod.getSelectionModel().selectFirst();
  83 + crudMethod.getSelectionModel().selectedItemProperty().addListener((o, ov, nv) -> generateSql());
  84 + }
  85 + ControllerModel.setWaveController(this);
  86 + }
  87 +
  88 + public void generateSql() {
  89 + WaverModel wave = ConfigModel.getWaver().get(tableCombo.getSelectionModel().getSelectedIndex());
  90 + LocalDate localDate = sqlDate.getValue();
  91 + String date;
  92 + if (Checker.isNull(localDate)) {
  93 + date = Formatter.dateToString(new Date());
  94 + } else {
  95 + date = Formatter.dateToString(Formatter.localDateToDate(localDate));
  96 + }
  97 + switch (crudMethod.getSelectionModel().getSelectedItem()) {
  98 + case INSERT:
  99 + sql.setText("insert into " + wave.getTableName() + "(" + wave.getDataField() + "," + wave
  100 + .getDateField() + ") values('" + sqlNumber.getText() + "','" + date + "')");
  101 + break;
  102 + case DELETE:
  103 + sql.setText("delete from " + wave.getTableName() + " where " + wave.getDateField() + "='" + date + "'");
  104 + break;
  105 + case UPDATE:
  106 + sql.setText("update " + wave.getTableName() + " set " + wave.getDataField() + "='" + sqlNumber
  107 + .getText() + "' where " + wave.getDateField() + "='" + date + "'");
  108 + default:
  109 + break;
  110 + }
  111 + }
  112 +
  113 + public void getWaveDataToLineChart() {
  114 + if (Checker.isNotNull(statement)) {
  115 + chart.getData().clear();
  116 + WaverModel wave = ConfigModel.getWaver().get(tableCombo.getSelectionModel().getSelectedIndex());
  117 + String sql = "select " + wave.getDataField() + "," + wave.getDateField() + " from " + wave.getTableName();
  118 + LocalDate startLocalDate = startDate.getValue();
  119 + LocalDate endLocalDate = endDate.getValue();
  120 + boolean startIsNull = Checker.isNull(startLocalDate);
  121 + boolean endIsNull = Checker.isNull(endLocalDate);
  122 + if (!startIsNull) {
  123 + String start = Formatter.dateToString(Formatter.localDateToDate(startDate.getValue()));
  124 + sql += " where " + wave.getDateField() + ">='" + start + "' and";
  125 + }
  126 + String and = "and";
  127 + if (!endIsNull) {
  128 + String end = Formatter.dateToString(Formatter.localDateToDate(endDate.getValue()));
  129 + if (sql.endsWith(and)) {
  130 + sql += " " + wave.getDateField() + "<='" + end + "'";
  131 + } else {
  132 + sql += " where " + wave.getDateField() + "<='" + end + "'";
  133 + }
  134 + }
  135 + if (sql.endsWith(and)) {
  136 + sql = sql.substring(0, sql.length() - 4);
  137 + }
  138 + sql += " order by " + wave.getDateField();
  139 + if (startIsNull && endIsNull) {
  140 + sql += " limit 0," + wave.getFirstResultSize();
  141 + }
  142 + XYChart.Series<String, Object> series = new XYChart.Series<>();
  143 + series.setName(wave.getTitle());
  144 + try {
  145 + ResultSet resultSet = statement.executeQuery(sql);
  146 + while (resultSet.next()) {
  147 + String data = resultSet.getString(ValueConsts.ONE_INT);
  148 + String date = resultSet.getString(ValueConsts.TWO_INT);
  149 + Object value = data;
  150 + if (Checker.isDecimal(data)) {
  151 + if (data.contains(ValueConsts.DOT_SIGN)) {
  152 + int idx = data.lastIndexOf(ValueConsts.DOT_SIGN) + 3;
  153 + if (data.length() > idx) {
  154 + data = data.substring(0, idx);
  155 + }
  156 + value = WeUtils.stringToDouble(data);
  157 + } else {
  158 + value = WeUtils.stringToInt(data);
  159 + }
  160 + }
  161 + series.getData().add(new XYChart.Data<>(date.split(" ")[0], value));
  162 + }
  163 + } catch (SQLException e) {
  164 + System.out.println(sql);
  165 + Alerts.showError(LocalValueConsts.MAIN_TITLE, e.getMessage());
  166 + }
  167 + chart.getData().add(series);
  168 + chart.setTitle(wave.getTitle());
  169 + }
  170 + }
  171 +
  172 + public void executeSql() {
  173 + if (Checker.isNotNull(statement)) {
  174 + try {
  175 + statement.executeUpdate(WeUtils.replaceVariable(sql.getText()));
  176 + Alerts.showInformation(LocalValueConsts.MAIN_TITLE, LocalValueConsts.OPERATION_SUCCESS);
  177 + getWaveDataToLineChart();
  178 + } catch (SQLException e) {
  179 + Alerts.showError(LocalValueConsts.MAIN_TITLE, e.getMessage());
  180 + }
  181 + }
  182 + }
  183 +}
  1 +package com.zhazhapan.util.visual.model;
  2 +
  3 +import cn.hutool.core.util.ClipboardUtil;
  4 +import cn.hutool.core.util.ObjectUtil;
  5 +import com.alibaba.fastjson.JSONArray;
  6 +import com.zhazhapan.modules.constant.ValueConsts;
  7 +import com.zhazhapan.util.Checker;
  8 +import javafx.util.Pair;
  9 +
  10 +import java.util.*;
  11 +
  12 +/**
  13 + * 配置参数
  14 + *
  15 + * @author pantao
  16 + * @since 2018/4/2
  17 + */
  18 +public class ConfigModel {
  19 +
  20 + private static List<Pair<Date, String>> clipboardHistory = new LinkedList<>();
  21 +
  22 + private static double width = 1000;
  23 +
  24 + private static double height = 700;
  25 +
  26 + private static JSONArray supportTabs;
  27 +
  28 + private static String fileFilterRegex = "^[^.].*$";
  29 +
  30 + private static boolean fileFilterTip = true;
  31 +
  32 + private static int clipboardSize = 20;
  33 +
  34 + private static JSONArray tabs = new JSONArray();
  35 +
  36 + private static boolean fullscreen = false;
  37 +
  38 + private static boolean autoWrap = false;
  39 +
  40 + private static String host = "127.0.0.1:3306";
  41 +
  42 + private static String database = "efo";
  43 +
  44 + private static String condition = "useUnicode=true&characterEncoding=utf-8&useSSL=true";
  45 +
  46 + private static String username = "zhazhapan";
  47 +
  48 + private static String password = "zhazhapan";
  49 +
  50 + private static List<WaverModel> waver = new ArrayList<>();
  51 +
  52 + static {
  53 + tabs.add("JsonParser");
  54 + tabs.add("FileManager");
  55 + tabs.add("RandomGenerator");
  56 + tabs.add("ClipboardHistory");
  57 + tabs.add("QrCodeGenerator");
  58 + tabs.add("CharsetConverter");
  59 + tabs.add("NetworkTool");
  60 + tabs.add("QiniuTool");
  61 + tabs.add("WaveViewer");
  62 + supportTabs = ObjectUtil.cloneByStream(tabs);
  63 + }
  64 +
  65 + public static String getHost() {
  66 + return host;
  67 + }
  68 +
  69 + public static void setHost(String host) {
  70 + ConfigModel.host = host;
  71 + }
  72 +
  73 + public static String getDatabase() {
  74 + return database;
  75 + }
  76 +
  77 + public static void setDatabase(String database) {
  78 + ConfigModel.database = database;
  79 + }
  80 +
  81 + public static String getCondition() {
  82 + return condition;
  83 + }
  84 +
  85 + public static void setCondition(String condition) {
  86 + ConfigModel.condition = condition;
  87 + }
  88 +
  89 + public static String getUsername() {
  90 + return username;
  91 + }
  92 +
  93 + public static void setUsername(String username) {
  94 + ConfigModel.username = username;
  95 + }
  96 +
  97 + public static String getPassword() {
  98 + return password;
  99 + }
  100 +
  101 + public static void setPassword(String password) {
  102 + ConfigModel.password = password;
  103 + }
  104 +
  105 + public static List<WaverModel> getWaver() {
  106 + return waver;
  107 + }
  108 +
  109 + public static JSONArray getSupportTabs() {
  110 + return supportTabs;
  111 + }
  112 +
  113 + public static boolean isAutoWrap() {
  114 + return autoWrap;
  115 + }
  116 +
  117 + public static void setAutoWrap(boolean autoWrap) {
  118 + ConfigModel.autoWrap = autoWrap;
  119 + }
  120 +
  121 + public static boolean isFullscreen() {
  122 + return fullscreen;
  123 + }
  124 +
  125 + public static void setFullscreen(boolean fullscreen) {
  126 + ConfigModel.fullscreen = fullscreen;
  127 + }
  128 +
  129 + public static int getClipboardHistorySize() {
  130 + return clipboardHistory.size();
  131 + }
  132 +
  133 + public static void appendClipboardHistory(Date date, String content) {
  134 + if (getClipboardHistorySize() < clipboardSize) {
  135 + clipboardHistory.add(new Pair<>(date, Checker.checkNull(content)));
  136 + } else {
  137 + clipboardHistory.remove(ValueConsts.ZERO_INT);
  138 + appendClipboardHistory(date, content);
  139 + }
  140 + }
  141 +
  142 + public static Pair<Date, String> getLastClipboardHistoryItem() {
  143 + Optional<Pair<Date, String>> last = Optional.ofNullable(getClipboardHistoryItem(getClipboardHistorySize() - 1));
  144 + return last.orElse(new Pair<>(new Date(), Checker.checkNull(ClipboardUtil.getStr())));
  145 + }
  146 +
  147 + public static Pair<Date, String> getClipboardHistoryItem(int index) {
  148 + if (index >= 0 && index < clipboardSize) {
  149 + return clipboardHistory.get(index);
  150 + }
  151 + return null;
  152 + }
  153 +
  154 + public static void setClipboardSize(int clipboardSize) {
  155 + ConfigModel.clipboardSize = clipboardSize;
  156 + }
  157 +
  158 + public static double getWidth() {
  159 + return width;
  160 + }
  161 +
  162 + public static void setWidth(double width) {
  163 + ConfigModel.width = width;
  164 + }
  165 +
  166 + public static double getHeight() {
  167 + return height;
  168 + }
  169 +
  170 + public static void setHeight(double height) {
  171 + ConfigModel.height = height;
  172 + }
  173 +
  174 + public static JSONArray getTabs() {
  175 + return tabs;
  176 + }
  177 +
  178 + public static void setTabs(JSONArray tabs) {
  179 + ConfigModel.tabs = tabs;
  180 + }
  181 +
  182 + public static String getFileFilterRegex() {
  183 + return fileFilterRegex;
  184 + }
  185 +
  186 + public static void setFileFilterRegex(String fileFilterRegex) {
  187 + ConfigModel.fileFilterRegex = fileFilterRegex;
  188 + }
  189 +
  190 + public static boolean isFileFilterTip() {
  191 + return fileFilterTip;
  192 + }
  193 +
  194 + public static void setFileFilterTip(boolean fileFilterTip) {
  195 + ConfigModel.fileFilterTip = fileFilterTip;
  196 + }
  197 +}
  1 +package com.zhazhapan.util.visual.model;
  2 +
  3 +import com.zhazhapan.util.visual.controller.*;
  4 +
  5 +/**
  6 + * 保存打开的窗口controller对象
  7 + *
  8 + * @author pantao
  9 + * @since 2018/3/31
  10 + */
  11 +public class ControllerModel {
  12 +
  13 + private static NetworkToolController networkToolController = null;
  14 +
  15 + private static JsonParserController jsonParserController = null;
  16 +
  17 + private static FileManagerController fileManagerController = null;
  18 +
  19 + private static ClipboardHistoryController clipboardHistoryController = null;
  20 +
  21 + private static MainController mainController = null;
  22 +
  23 + private static QrCodeGeneratorController qrCodeGeneratorController = null;
  24 +
  25 + private static CharsetConverterController charsetConverterController = null;
  26 +
  27 + private static WaveController waveController = null;
  28 +
  29 + public static WaveController getWaveController() {
  30 + return waveController;
  31 + }
  32 +
  33 + public static void setWaveController(WaveController waveController) {
  34 + ControllerModel.waveController = waveController;
  35 + }
  36 +
  37 + public static NetworkToolController getNetworkToolController() {
  38 + return networkToolController;
  39 + }
  40 +
  41 + public static void setNetworkToolController(NetworkToolController networkToolController) {
  42 + ControllerModel.networkToolController = networkToolController;
  43 + }
  44 +
  45 + public static CharsetConverterController getCharsetConverterController() {
  46 + return charsetConverterController;
  47 + }
  48 +
  49 + public static void setCharsetConverterController(CharsetConverterController charsetConverterController) {
  50 + ControllerModel.charsetConverterController = charsetConverterController;
  51 + }
  52 +
  53 + public static QrCodeGeneratorController getQrCodeGeneratorController() {
  54 + return qrCodeGeneratorController;
  55 + }
  56 +
  57 + public static void setQrCodeGeneratorController(QrCodeGeneratorController qrCodeGeneratorController) {
  58 + ControllerModel.qrCodeGeneratorController = qrCodeGeneratorController;
  59 + }
  60 +
  61 + public static MainController getMainController() {
  62 + return mainController;
  63 + }
  64 +
  65 + public static void setMainController(MainController mainController) {
  66 + ControllerModel.mainController = mainController;
  67 + }
  68 +
  69 + public static ClipboardHistoryController getClipboardHistoryController() {
  70 + return clipboardHistoryController;
  71 + }
  72 +
  73 + public static void setClipboardHistoryController(ClipboardHistoryController clipboardHistoryController) {
  74 + ControllerModel.clipboardHistoryController = clipboardHistoryController;
  75 + }
  76 +
  77 + public static FileManagerController getFileManagerController() {
  78 + return fileManagerController;
  79 + }
  80 +
  81 + public static void setFileManagerController(FileManagerController fileManagerController) {
  82 + ControllerModel.fileManagerController = fileManagerController;
  83 + }
  84 +
  85 + public static JsonParserController getJsonParserController() {
  86 + return jsonParserController;
  87 +
  88 + }
  89 +
  90 + public static void setJsonParserController(JsonParserController jsonParserController) {
  91 + ControllerModel.jsonParserController = jsonParserController;
  92 + }
  93 +}
  1 +package com.zhazhapan.util.visual.model;
  2 +
  3 +/**
  4 + * @author pantao
  5 + * @since 2018/4/19
  6 + */
  7 +public class WaverModel {
  8 +
  9 + private String title;
  10 +
  11 + private String tableName;
  12 +
  13 + private String dataField;
  14 +
  15 + private String dateField;
  16 +
  17 + private int firstResultSize;
  18 +
  19 + public String getTitle() {
  20 + return title;
  21 + }
  22 +
  23 + public void setTitle(String title) {
  24 + this.title = title;
  25 + }
  26 +
  27 + public String getTableName() {
  28 + return tableName;
  29 + }
  30 +
  31 + public void setTableName(String tableName) {
  32 + this.tableName = tableName;
  33 + }
  34 +
  35 + public String getDataField() {
  36 + return dataField;
  37 + }
  38 +
  39 + public void setDataField(String dataField) {
  40 + this.dataField = dataField;
  41 + }
  42 +
  43 + public String getDateField() {
  44 + return dateField;
  45 + }
  46 +
  47 + public void setDateField(String dateField) {
  48 + this.dateField = dateField;
  49 + }
  50 +
  51 + public int getFirstResultSize() {
  52 + return firstResultSize;
  53 + }
  54 +
  55 + public void setFirstResultSize(int firstResultSize) {
  56 + this.firstResultSize = firstResultSize;
  57 + }
  58 +}
  1 +{
  2 + "initialize": {
  3 + "width": 1000,
  4 + "height": 700,
  5 + "fullscreen": false,
  6 + "tabs": {
  7 + "load": [
  8 + "ClipboardHistory"
  9 + ],
  10 + "support": [
  11 + "FileManager",
  12 + "JsonParser",
  13 + "RandomGenerator",
  14 + "ClipboardHistory",
  15 + "QrCodeGenerator",
  16 + "CharsetConverter",
  17 + "NetworkTool",
  18 + "QiniuTool",
  19 + "WaveViewer"
  20 + ]
  21 + }
  22 + },
  23 + "fileFilter": {
  24 + "regex": "^[^.].*$",
  25 + "showTip": true,
  26 + "description": "只获取匹配的文件,当文件不匹配时根据 `showTip` 设置是否显示提示"
  27 + },
  28 + "clipboardSize": 20,
  29 + "autoWrap": false,
  30 + "mysql": {
  31 + "host": "192.168.1.233:3306",
  32 + "database": "efo",
  33 + "condition": "useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC",
  34 + "username": "root",
  35 + "password": "root"
  36 + },
  37 + "waveViewer": [
  38 + {
  39 + "title": "频率计算器",
  40 + "tableName": "frequency",
  41 + "dataField": "fre_data",
  42 + "dateField": "fre_date",
  43 + "firstResultSize": 30
  44 + },
  45 + {
  46 + "title": "晚睡时间",
  47 + "tableName": "dismiss",
  48 + "dataField": "dis_data",
  49 + "dateField": "dis_date",
  50 + "firstResultSize": 30
  51 + }
  52 + ]
  53 +}
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +<?import javafx.geometry.Insets?>
  4 +<?import javafx.scene.control.*?>
  5 +<?import javafx.scene.layout.*?>
  6 +<?import javafx.scene.text.Font?>
  7 +<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="400.0" prefWidth="600.0"
  8 + xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
  9 + fx:controller="com.zhazhapan.util.visual.controller.CharsetConverterController">
  10 + <padding>
  11 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  12 + </padding>
  13 + <TextArea fx:id="originalContent" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
  14 + onDragDropped="#dragFileDropped" onDragOver="#dragFileOver" prefHeight="82.0" prefWidth="580.0"
  15 + promptText="原字符集" VBox.vgrow="ALWAYS">
  16 + <tooltip>
  17 + <Tooltip autoHide="true" text="拖曳文件至此"/>
  18 + </tooltip>
  19 + </TextArea>
  20 + <HBox prefHeight="24.0" prefWidth="580.0" VBox.vgrow="NEVER">
  21 + <VBox.margin>
  22 + <Insets bottom="10.0" top="10.0"/>
  23 + </VBox.margin>
  24 + <ComboBox fx:id="originalCharset" prefWidth="150.0" HBox.hgrow="NEVER"/>
  25 + <Label text="转" HBox.hgrow="NEVER">
  26 + <HBox.margin>
  27 + <Insets left="10.0" top="5.0"/>
  28 + </HBox.margin>
  29 + <font>
  30 + <Font size="14.0"/>
  31 + </font>
  32 + </Label>
  33 + <ComboBox fx:id="convertCharset" prefWidth="150.0" HBox.hgrow="NEVER">
  34 + <HBox.margin>
  35 + <Insets left="10.0"/>
  36 + </HBox.margin>
  37 + </ComboBox>
  38 + </HBox>
  39 + <TextArea fx:id="convertedContent" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
  40 + prefHeight="200.0" prefWidth="200.0" promptText="转换后的字符集" VBox.vgrow="ALWAYS"/>
  41 +</VBox>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +
  4 +<?import javafx.geometry.Insets?>
  5 +<?import javafx.scene.control.TextArea?>
  6 +<?import javafx.scene.layout.VBox?>
  7 +<VBox prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
  8 + fx:controller="com.zhazhapan.util.visual.controller.ClipboardHistoryController">
  9 + <padding>
  10 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  11 + </padding>
  12 + <TextArea fx:id="clipboardHistory" prefHeight="200.0" prefWidth="200.0" promptText="剪贴历史" VBox.vgrow="ALWAYS"/>
  13 +</VBox>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +<?import java.lang.*?>
  4 +<?import javafx.geometry.*?>
  5 +<?import javafx.scene.control.*?>
  6 +<?import javafx.scene.layout.*?>
  7 +
  8 +<VBox prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
  9 + fx:controller="com.zhazhapan.util.visual.controller.FileManagerController">
  10 + <TabPane fx:id="fileManagerTab" prefHeight="272.0" prefWidth="600.0" side="BOTTOM" tabClosingPolicy="UNAVAILABLE"
  11 + VBox.vgrow="ALWAYS">
  12 + <Tab closable="false" text="重命名文件">
  13 + <SplitPane dividerPositions="0.4816666666666667" prefHeight="160.0" prefWidth="200.0">
  14 + <padding>
  15 + <Insets bottom="10.0" top="10.0"/>
  16 + </padding>
  17 + <VBox>
  18 + <padding>
  19 + <Insets left="10.0" right="10.0"/>
  20 + </padding>
  21 + <ListView fx:id="selectedFilesOfRenameTab" editable="true"
  22 + onDragDropped="#dragFileDropped" onDragOver="#dragFileOver"
  23 + prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
  24 + <contextMenu>
  25 + <ContextMenu>
  26 + <items>
  27 + <MenuItem mnemonicParsing="false"
  28 + onAction="#removeFilesFromRenameTab" text="删除"/>
  29 + </items>
  30 + </ContextMenu>
  31 + </contextMenu>
  32 + <tooltip>
  33 + <Tooltip autoHide="true" text="拖曳文件至此"/>
  34 + </tooltip>
  35 + </ListView>
  36 + </VBox>
  37 + <VBox>
  38 + <padding>
  39 + <Insets left="10.0" right="10.0"/>
  40 + </padding>
  41 + <TabPane prefHeight="119.0" prefWidth="287.0" tabClosingPolicy="UNAVAILABLE"
  42 + VBox.vgrow="NEVER">
  43 + <Tab closable="false" text="格式化">
  44 + <VBox maxHeight="1.7976931348623157E308" prefHeight="72.0"
  45 + prefWidth="287.0">
  46 + <padding>
  47 + <Insets top="10.0"/>
  48 + </padding>
  49 + <TextField fx:id="filePrefixOfRenameTab"
  50 + onKeyReleased="#generateRenameDestFilesOfFormat"
  51 + promptText="文件前缀" VBox.vgrow="NEVER">
  52 + <tooltip>
  53 + <Tooltip autoHide="true"
  54 + text="支持变量:%DATE%, %TIME%"/>
  55 + </tooltip>
  56 + </TextField>
  57 + <HBox prefHeight="100.0" prefWidth="287.0">
  58 + <VBox.margin>
  59 + <Insets top="10.0"/>
  60 + </VBox.margin>
  61 + <TextField fx:id="filePostfixOfRenameTab"
  62 + onKeyReleased="#generateRenameDestFilesOfFormat"
  63 + prefHeight="27.0" prefWidth="193.0"
  64 + promptText="文件后缀" HBox.hgrow="ALWAYS">
  65 + <tooltip>
  66 + <Tooltip autoHide="true"
  67 + text="支持变量:%DATE%, %TIME%"/>
  68 + </tooltip>
  69 + </TextField>
  70 + <TextField fx:id="startNumberOfRenameTab"
  71 + onKeyReleased="#generateRenameDestFilesOfFormat"
  72 + prefHeight="27.0" prefWidth="107.0"
  73 + promptText="开始数字" text="1"
  74 + HBox.hgrow="ALWAYS">
  75 + <HBox.margin>
  76 + <Insets left="10.0"/>
  77 + </HBox.margin>
  78 + <tooltip>
  79 + <Tooltip autoHide="true"
  80 + text="支持变量:%DATE%, %TIME%"/>
  81 + </tooltip>
  82 + </TextField>
  83 + </HBox>
  84 + </VBox>
  85 + </Tab>
  86 + <Tab closable="false" text="替换文本">
  87 + <VBox>
  88 + <padding>
  89 + <Insets top="10.0"/>
  90 + </padding>
  91 + <TextField fx:id="fileQueryStringOfRenameTab"
  92 + onKeyReleased="#generateRenameDestFilesOfReplace"
  93 + promptText="查找" VBox.vgrow="NEVER"/>
  94 + <TextField fx:id="fileReplaceStringOfRenameTab"
  95 + onKeyReleased="#generateRenameDestFilesOfReplace"
  96 + promptText="替换成" VBox.vgrow="NEVER">
  97 + <VBox.margin>
  98 + <Insets top="10.0"/>
  99 + </VBox.margin>
  100 + <tooltip>
  101 + <Tooltip autoHide="true"
  102 + text="支持变量:%DATE%, %TIME%"/>
  103 + </tooltip>
  104 + </TextField>
  105 + </VBox>
  106 + </Tab>
  107 + <Tab closable="false" text="添加文本">
  108 + <VBox>
  109 + <padding>
  110 + <Insets top="10.0"/>
  111 + </padding>
  112 + <TextField fx:id="fileAddableText"
  113 + onKeyReleased="#generateRenameDestFilesOfAddable"
  114 + promptText="文本内容" VBox.vgrow="NEVER">
  115 + <tooltip>
  116 + <Tooltip autoHide="true"
  117 + text="支持变量:%DATE%, %TIME%"/>
  118 + </tooltip>
  119 + </TextField>
  120 + <ComboBox fx:id="fileAddableCombo"
  121 + maxWidth="1.7976931348623157E308"
  122 + prefHeight="27.0" prefWidth="293.0"
  123 + VBox.vgrow="NEVER">
  124 + <VBox.margin>
  125 + <Insets top="10.0"/>
  126 + </VBox.margin>
  127 + </ComboBox>
  128 + </VBox>
  129 + </Tab>
  130 + </TabPane>
  131 + <ListView fx:id="destFilesOfRenameTab" prefHeight="200.0" prefWidth="200.0"
  132 + VBox.vgrow="ALWAYS">
  133 + <VBox.margin>
  134 + <Insets/>
  135 + </VBox.margin>
  136 + </ListView>
  137 + <Button maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
  138 + mnemonicParsing="false" onAction="#renameFiles" prefHeight="27.0"
  139 + prefWidth="293.0" text="批量重命名">
  140 + <VBox.margin>
  141 + <Insets top="10.0"/>
  142 + </VBox.margin>
  143 + </Button>
  144 + </VBox>
  145 + </SplitPane>
  146 + </Tab>
  147 + <Tab closable="false" text="复制文件">
  148 + <VBox prefHeight="200.0" prefWidth="100.0">
  149 + <padding>
  150 + <Insets left="10.0" right="10.0" top="10.0"/>
  151 + </padding>
  152 + <HBox VBox.vgrow="NEVER">
  153 + <TextField fx:id="destFolderOfCopyTab" onDragDropped="#dragFileDroppedOfCopyTab"
  154 + onDragOver="#dragFileOver" promptText="目标文件夹" HBox.hgrow="ALWAYS">
  155 + <tooltip>
  156 + <Tooltip autoHide="true" text="拖曳文件至此"/>
  157 + </tooltip>
  158 + </TextField>
  159 + <Button mnemonicParsing="false" onAction="#browseSrcFolder" text="浏览"
  160 + HBox.hgrow="NEVER">
  161 + <HBox.margin>
  162 + <Insets left="10.0"/>
  163 + </HBox.margin>
  164 + </Button>
  165 + </HBox>
  166 + <ListView fx:id="selectedFilesOfCopyTab" onDragDropped="#dragFileDroppedOfCopyTab"
  167 + onDragOver="#dragFileOver" prefHeight="200.0" prefWidth="200.0"
  168 + VBox.vgrow="ALWAYS">
  169 + <tooltip>
  170 + <Tooltip autoHide="true" text="拖曳文件至此"/>
  171 + </tooltip>
  172 + <VBox.margin>
  173 + <Insets top="10.0"/>
  174 + </VBox.margin>
  175 + <contextMenu>
  176 + <ContextMenu>
  177 + <items>
  178 + <MenuItem mnemonicParsing="false" onAction="#removeFilesOfCopyTab"
  179 + text="删除"/>
  180 + </items>
  181 + </ContextMenu>
  182 + </contextMenu>
  183 + </ListView>
  184 + <HBox prefHeight="31.0" prefWidth="580.0" VBox.vgrow="NEVER">
  185 + <padding>
  186 + <Insets bottom="10.0" top="10.0"/>
  187 + </padding>
  188 + <CheckBox fx:id="isDeleteSrcOfCopyTab" mnemonicParsing="false" text="删除源文件">
  189 + <HBox.margin>
  190 + <Insets top="5.0"/>
  191 + </HBox.margin>
  192 + </CheckBox>
  193 + <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false"
  194 + onAction="#copyFiles" prefHeight="27.0" prefWidth="368.0" text="批量复制文件"
  195 + HBox.hgrow="ALWAYS">
  196 + <HBox.margin>
  197 + <Insets left="10.0"/>
  198 + </HBox.margin>
  199 + </Button>
  200 + </HBox>
  201 + </VBox>
  202 + </Tab>
  203 + <Tab closable="false" text="拆分文件">
  204 + <VBox prefHeight="200.0" prefWidth="100.0">
  205 + <padding>
  206 + <Insets left="10.0" right="10.0" top="10.0"/>
  207 + </padding>
  208 + <HBox prefHeight="24.0" prefWidth="580.0" VBox.vgrow="NEVER">
  209 + <TextField fx:id="destFolderOfSplitTab" onDragDropped="#dragFileDroppedOfSplitTab"
  210 + onDragOver="#dragFileOver" promptText="目标文件夹" HBox.hgrow="ALWAYS">
  211 + <tooltip>
  212 + <Tooltip autoHide="true" text="拖曳文件至此"/>
  213 + </tooltip>
  214 + </TextField>
  215 + <Button mnemonicParsing="false" onAction="#browseSrcFolder" text="浏览"
  216 + HBox.hgrow="NEVER">
  217 + <HBox.margin>
  218 + <Insets left="10.0"/>
  219 + </HBox.margin>
  220 + </Button>
  221 + </HBox>
  222 + <TextArea fx:id="fileContent" onDragDropped="#dragFileDroppedOfSplitTab"
  223 + onDragOver="#dragFileOver" onMouseClicked="#generateSplitPoint" prefHeight="200.0"
  224 + prefWidth="200.0" promptText="文件内容, 可拖曳文件至此" VBox.vgrow="ALWAYS">
  225 + <tooltip>
  226 + <Tooltip autoHide="true" text="拖曳文件至此"/>
  227 + </tooltip>
  228 + <VBox.margin>
  229 + <Insets top="10.0"/>
  230 + </VBox.margin>
  231 + </TextArea>
  232 + <TextField fx:id="splitPoint" onMouseClicked="#scrollTo" promptText="拆分点"
  233 + VBox.vgrow="NEVER">
  234 + <VBox.margin>
  235 + <Insets top="10.0"/>
  236 + </VBox.margin>
  237 + </TextField>
  238 + <HBox prefHeight="31.0" prefWidth="580.0">
  239 + <padding>
  240 + <Insets bottom="10.0" top="10.0"/>
  241 + </padding>
  242 + <CheckBox fx:id="isDeleteSrcOfSplitTab" mnemonicParsing="false" text="删除源文件">
  243 + <HBox.margin>
  244 + <Insets top="5.0"/>
  245 + </HBox.margin>
  246 + </CheckBox>
  247 + <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false"
  248 + onAction="#splitFile" prefHeight="27.0" prefWidth="368.0" text="拆分文件"
  249 + HBox.hgrow="ALWAYS">
  250 + <HBox.margin>
  251 + <Insets left="10.0"/>
  252 + </HBox.margin>
  253 + </Button>
  254 + </HBox>
  255 + </VBox>
  256 + </Tab>
  257 + <Tab closable="false" text="合并文件">
  258 + <VBox prefHeight="200.0" prefWidth="100.0">
  259 + <padding>
  260 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  261 + </padding>
  262 + <ListView fx:id="selectedFilesOfMergeTab" onDragDropped="#dragFileDropped"
  263 + onDragOver="#dragFileOver" prefHeight="200.0" prefWidth="200.0"
  264 + VBox.vgrow="ALWAYS">
  265 + <tooltip>
  266 + <Tooltip autoHide="true" text="拖曳文件至此"/>
  267 + </tooltip>
  268 + <contextMenu>
  269 + <ContextMenu>
  270 + <items>
  271 + <MenuItem mnemonicParsing="false" onAction="#goForward" text="上移"/>
  272 + <MenuItem mnemonicParsing="false" onAction="#goBack" text="下移"/>
  273 + <MenuItem mnemonicParsing="false" onAction="#removeFilesOfMergeTab"
  274 + text="删除"/>
  275 + </items>
  276 + </ContextMenu>
  277 + </contextMenu>
  278 + </ListView>
  279 + <HBox prefHeight="23.0" prefWidth="580.0">
  280 + <VBox.margin>
  281 + <Insets top="10.0"/>
  282 + </VBox.margin>
  283 + <TextField fx:id="contentFilter" promptText="文本过滤,过滤掉(正则表达式)匹配的字符串"
  284 + HBox.hgrow="ALWAYS"/>
  285 + <CheckBox fx:id="deleteSrcOfMergeTab" mnemonicParsing="false" text="删除源文件"
  286 + HBox.hgrow="NEVER">
  287 + <HBox.margin>
  288 + <Insets left="10.0" top="5.0"/>
  289 + </HBox.margin>
  290 + </CheckBox>
  291 + <Button mnemonicParsing="false" onAction="#mergeFiles" text="合并文件"
  292 + HBox.hgrow="NEVER">
  293 + <HBox.margin>
  294 + <Insets left="10.0"/>
  295 + </HBox.margin>
  296 + </Button>
  297 + </HBox>
  298 + </VBox>
  299 + </Tab>
  300 + <Tab text="删除文件">
  301 + <VBox>
  302 + <padding>
  303 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  304 + </padding>
  305 + <TextField fx:id="srcFolderOfDeleteTab" promptText="源文件夹(支持拖曳)" VBox.vgrow="NEVER"
  306 + onDragDropped="#dragFileDroppedOfDeleteTab"
  307 + onDragOver="#dragFileOver">
  308 + <tooltip>
  309 + <Tooltip autoHide="true" text="拖曳文件至此"/>
  310 + </tooltip>
  311 + </TextField>
  312 + <TextArea fx:id="filenameOfDeleteTab" prefHeight="200.0" prefWidth="200.0"
  313 + promptText="待删除的文件名,用英文逗号分隔" VBox.vgrow="ALWAYS" onDragDropped="#dragFilesDroppedOfDeleteTab"
  314 + onDragOver="#dragFileOver">
  315 + <VBox.margin>
  316 + <Insets top="10.0"/>
  317 + </VBox.margin>
  318 + <tooltip>
  319 + <Tooltip autoHide="true" text="拖曳文件至此"/>
  320 + </tooltip>
  321 + </TextArea>
  322 + <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#deleteFiles"
  323 + text="删除文件夹下所有列出的文件" VBox.vgrow="NEVER">
  324 + <VBox.margin>
  325 + <Insets top="10.0"/>
  326 + </VBox.margin>
  327 + </Button>
  328 + </VBox>
  329 + </Tab>
  330 + </TabPane>
  331 +</VBox>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +<?import javafx.geometry.*?>
  4 +<?import javafx.scene.control.*?>
  5 +<?import javafx.scene.layout.*?>
  6 +<VBox prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1"
  7 + fx:controller="com.zhazhapan.util.visual.controller.JsonParserController">
  8 + <HBox VBox.vgrow="NEVER">
  9 + <TextField fx:id="jsonPath" onKeyReleased="#jsonPathEnter" prefHeight="27.0" prefWidth="251.0"
  10 + promptText="JSON路径" HBox.hgrow="ALWAYS"/>
  11 + <Button mnemonicParsing="false" onAction="#parseJson" text="解析" HBox.hgrow="NEVER">
  12 + <HBox.margin>
  13 + <Insets left="10.0"/>
  14 + </HBox.margin>
  15 + </Button>
  16 + <Hyperlink onAction="#seeJsonPathGrammar" text="路径语法" HBox.hgrow="NEVER">
  17 + <HBox.margin>
  18 + <Insets left="10.0"/>
  19 + </HBox.margin>
  20 + </Hyperlink>
  21 + <padding>
  22 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  23 + </padding>
  24 + </HBox>
  25 + <SplitPane dividerPositions="0.459866220735786" prefHeight="160.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
  26 + <VBox>
  27 + <padding>
  28 + <Insets left="10.0" right="10.0"/>
  29 + </padding>
  30 + <TextArea fx:id="jsonContent" onDragDropped="#dragFileDropped" onDragOver="#dragFileOver" prefHeight="200.0"
  31 + prefWidth="200.0" promptText="可拖曳文件至此" VBox.vgrow="ALWAYS">
  32 + <tooltip>
  33 + <Tooltip autoHide="true" text="拖曳文件至此"/>
  34 + </tooltip>
  35 + </TextArea>
  36 + </VBox>
  37 + <VBox>
  38 + <padding>
  39 + <Insets left="10.0" right="10.0"/>
  40 + </padding>
  41 + <TextArea fx:id="parsedJsonContent" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS"/>
  42 + </VBox>
  43 + <padding>
  44 + <Insets bottom="10.0" top="10.0"/>
  45 + </padding>
  46 + </SplitPane>
  47 +</VBox>
  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.Label?>
  6 +<?import javafx.scene.control.TextArea?>
  7 +<?import javafx.scene.control.TextField?>
  8 +<?import javafx.scene.layout.HBox?>
  9 +<?import javafx.scene.layout.VBox?>
  10 +
  11 +<VBox prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhazhapan.util.visual.controller.NetworkToolController">
  12 + <!--<Accordion fx:id="accordion" VBox.vgrow="ALWAYS">-->
  13 + <!--<panes>-->
  14 + <!--<TitledPane fx:id="firstTitledPane" animated="false" text="本机网络">-->
  15 + <!--<VBox>-->
  16 + <padding>
  17 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
  18 + </padding>
  19 + <HBox VBox.vgrow="NEVER">
  20 + <Label text="内网IP:" HBox.hgrow="NEVER">
  21 + <HBox.margin>
  22 + <Insets top="5.0" />
  23 + </HBox.margin>
  24 + </Label>
  25 + <TextField fx:id="privateIpv4" editable="false" maxWidth="200.0" HBox.hgrow="ALWAYS">
  26 + <HBox.margin>
  27 + <Insets left="10.0" />
  28 + </HBox.margin>
  29 + </TextField>
  30 + <Label text="IPV6:" visible="false" HBox.hgrow="NEVER">
  31 + <HBox.margin>
  32 + <Insets left="10.0" top="5.0" />
  33 + </HBox.margin>
  34 + </Label>
  35 + <TextField fx:id="privateIpv6" editable="false" maxWidth="300.0" visible="false" HBox.hgrow="ALWAYS">
  36 + <HBox.margin>
  37 + <Insets left="10.0" />
  38 + </HBox.margin>
  39 + </TextField>
  40 + </HBox>
  41 + <HBox VBox.vgrow="NEVER">
  42 + <VBox.margin>
  43 + <Insets top="10.0" />
  44 + </VBox.margin>
  45 + <Label text="公网IP:" HBox.hgrow="NEVER">
  46 + <HBox.margin>
  47 + <Insets top="5.0" />
  48 + </HBox.margin>
  49 + </Label>
  50 + <TextField fx:id="publicIp" editable="false" maxWidth="200.0" HBox.hgrow="ALWAYS">
  51 + <HBox.margin>
  52 + <Insets left="10.0" />
  53 + </HBox.margin>
  54 + </TextField>
  55 + <Label text="地址:" HBox.hgrow="NEVER">
  56 + <HBox.margin>
  57 + <Insets left="10.0" top="5.0" />
  58 + </HBox.margin>
  59 + </Label>
  60 + <TextField fx:id="publicAddress" editable="false" maxWidth="300.0" HBox.hgrow="ALWAYS">
  61 + <HBox.margin>
  62 + <Insets left="10.0" />
  63 + </HBox.margin>
  64 + </TextField>
  65 + </HBox>
  66 + <HBox VBox.vgrow="NEVER">
  67 + <VBox.margin>
  68 + <Insets top="10.0" />
  69 + </VBox.margin>
  70 + <Label text=" MAC:" HBox.hgrow="NEVER">
  71 + <HBox.margin>
  72 + <Insets top="5.0" />
  73 + </HBox.margin>
  74 + </Label>
  75 + <TextField fx:id="macAddress" editable="false" maxWidth="300.0" HBox.hgrow="ALWAYS">
  76 + <HBox.margin>
  77 + <Insets left="10.0" />
  78 + </HBox.margin>
  79 + </TextField>
  80 + </HBox>
  81 + <HBox VBox.vgrow="NEVER">
  82 + <VBox.margin>
  83 + <Insets top="10.0" />
  84 + </VBox.margin>
  85 + <Label text="系统名:" HBox.hgrow="NEVER">
  86 + <HBox.margin>
  87 + <Insets top="5.0" />
  88 + </HBox.margin>
  89 + </Label>
  90 + <TextField fx:id="systemInfo" editable="false" maxWidth="300.0" HBox.hgrow="ALWAYS">
  91 + <HBox.margin>
  92 + <Insets left="10.0" />
  93 + </HBox.margin>
  94 + </TextField>
  95 + </HBox>
  96 + <HBox VBox.vgrow="NEVER">
  97 + <VBox.margin>
  98 + <Insets top="10.0" />
  99 + </VBox.margin>
  100 + <Label text="IP归属地查询:" HBox.hgrow="NEVER">
  101 + <HBox.margin>
  102 + <Insets top="5.0" />
  103 + </HBox.margin>
  104 + </Label>
  105 + <TextField fx:id="ipAddress" maxWidth="200.0" promptText="IP地址" HBox.hgrow="ALWAYS">
  106 + <HBox.margin>
  107 + <Insets left="10.0" />
  108 + </HBox.margin>
  109 + </TextField>
  110 + <Button mnemonicParsing="false" onAction="#queryIpLocation" text="查询" HBox.hgrow="NEVER">
  111 + <HBox.margin>
  112 + <Insets left="10.0" />
  113 + </HBox.margin>
  114 + </Button>
  115 + <TextField fx:id="ipLocation" editable="false" maxWidth="300.0" promptText="归属地" HBox.hgrow="ALWAYS">
  116 + <HBox.margin>
  117 + <Insets left="10.0" />
  118 + </HBox.margin>
  119 + </TextField>
  120 + </HBox>
  121 + <VBox VBox.vgrow="ALWAYS">
  122 + <VBox.margin>
  123 + <Insets top="10.0" />
  124 + </VBox.margin>
  125 + <children>
  126 + <HBox prefHeight="34.0" prefWidth="580.0" VBox.vgrow="NEVER">
  127 + <children>
  128 + <Label text="WHOIS查询:" HBox.hgrow="NEVER">
  129 + <HBox.margin>
  130 + <Insets top="5.0" />
  131 + </HBox.margin>
  132 + </Label>
  133 + <TextField fx:id="domain" maxWidth="500.0" prefWidth="300.0" promptText="域名" HBox.hgrow="ALWAYS">
  134 + <HBox.margin>
  135 + <Insets left="10.0" />
  136 + </HBox.margin>
  137 + </TextField>
  138 + <Button mnemonicParsing="false" onAction="#queryWhois" text="查询" HBox.hgrow="NEVER">
  139 + <HBox.margin>
  140 + <Insets left="10.0" />
  141 + </HBox.margin>
  142 + </Button>
  143 + </children>
  144 + </HBox>
  145 + <TextArea fx:id="whoisResult" prefHeight="200.0" prefWidth="200.0" promptText="whois查询结果" VBox.vgrow="ALWAYS">
  146 + <VBox.margin>
  147 + <Insets top="10.0" />
  148 + </VBox.margin>
  149 + </TextArea>
  150 + </children>
  151 + </VBox>
  152 + <!--</VBox>-->
  153 + <!--</TitledPane>-->
  154 + <!--<TitledPane animated="false" text="端口扫描">-->
  155 + <!--<VBox/>-->
  156 + <!--</TitledPane>-->
  157 + <!--<TitledPane animated="false" text="网络抓包">-->
  158 + <!--<VBox/>-->
  159 + <!--</TitledPane>-->
  160 + <!--<TitledPane animated="false" text="接口测试">-->
  161 + <!--<VBox/>-->
  162 + <!--</TitledPane>-->
  163 + <!--<TitledPane animated="false" text="网络文件下载">-->
  164 + <!--<VBox/>-->
  165 + <!--</TitledPane>-->
  166 + <!--<TitledPane animated="false" text="WHOIS查询">-->
  167 + <!--<VBox/>-->
  168 + <!--</TitledPane>-->
  169 + <!--</panes>-->
  170 + <!--</Accordion>-->
  171 + <padding>
  172 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
  173 + </padding>
  174 +</VBox>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +<?import javafx.geometry.Insets?>
  4 +<?import javafx.scene.control.*?>
  5 +<?import javafx.scene.image.ImageView?>
  6 +<?import javafx.scene.layout.*?>
  7 +<?import javafx.scene.text.Font?>
  8 +<VBox alignment="TOP_CENTER" prefHeight="600.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/9"
  9 + xmlns:fx="http://javafx.com/fxml/1"
  10 + fx:controller="com.zhazhapan.util.visual.controller.QrCodeGeneratorController">
  11 + <SplitPane dividerPositions="0.11538461538461539" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0"
  12 + VBox.vgrow="ALWAYS">
  13 + <HBox prefHeight="148.0" prefWidth="598.0">
  14 + <TextArea fx:id="content" onDragDropped="#dragFileDropped" onDragOver="#dragFileOver" prefHeight="134.0"
  15 + prefWidth="449.0" promptText="文本" HBox.hgrow="ALWAYS">
  16 + <tooltip>
  17 + <Tooltip autoHide="true" text="拖曳文件至此"/>
  18 + </tooltip>
  19 + </TextArea>
  20 + <Button maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false"
  21 + onAction="#generateQrCode" prefHeight="134.0" prefWidth="91.0" text="生成" HBox.hgrow="NEVER">
  22 + <HBox.margin>
  23 + <Insets left="10.0"/>
  24 + </HBox.margin>
  25 + <font>
  26 + <Font size="24.0"/>
  27 + </font>
  28 + </Button>
  29 + <padding>
  30 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  31 + </padding>
  32 + </HBox>
  33 + <ScrollPane fitToHeight="true" fitToWidth="true" maxHeight="1.7976931348623157E308"
  34 + maxWidth="1.7976931348623157E308">
  35 + <HBox alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
  36 + <ImageView fx:id="qrCode" fitHeight="555.0" fitWidth="555.0" pickOnBounds="true" preserveRatio="true"
  37 + HBox.hgrow="ALWAYS"/>
  38 + </HBox>
  39 + </ScrollPane>
  40 + </SplitPane>
  41 +</VBox>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +<?import javafx.geometry.*?>
  4 +<?import javafx.scene.control.*?>
  5 +<?import javafx.scene.layout.*?>
  6 +<VBox prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1"
  7 + fx:controller="com.zhazhapan.util.visual.controller.RandomGeneratorController">
  8 + <HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="47.0" prefWidth="599.0"
  9 + VBox.vgrow="NEVER">
  10 + <padding>
  11 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  12 + </padding>
  13 + <Label text="UUID" HBox.hgrow="NEVER">
  14 + <HBox.margin>
  15 + <Insets top="5.0"/>
  16 + </HBox.margin>
  17 + </Label>
  18 + <Button mnemonicParsing="false" onAction="#generateUUID" text="生成" HBox.hgrow="NEVER">
  19 + <HBox.margin>
  20 + <Insets left="10.0"/>
  21 + </HBox.margin>
  22 + </Button>
  23 + <TextField fx:id="uuidResult" editable="false" promptText="结果" HBox.hgrow="ALWAYS">
  24 + <HBox.margin>
  25 + <Insets left="10.0"/>
  26 + </HBox.margin>
  27 + </TextField>
  28 + </HBox>
  29 + <HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="47.0" prefWidth="599.0"
  30 + VBox.vgrow="NEVER">
  31 + <padding>
  32 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  33 + </padding>
  34 + <Label text="数字" HBox.hgrow="NEVER">
  35 + <HBox.margin>
  36 + <Insets top="5.0"/>
  37 + </HBox.margin>
  38 + </Label>
  39 + <TextField fx:id="floor" prefHeight="27.0" prefWidth="62.0" promptText="下限" HBox.hgrow="NEVER">
  40 + <HBox.margin>
  41 + <Insets left="10.0"/>
  42 + </HBox.margin>
  43 + <tooltip>
  44 + <Tooltip text="正数" autoHide="true"/>
  45 + </tooltip>
  46 + </TextField>
  47 + <TextField fx:id="ceil" prefHeight="27.0" prefWidth="63.0" promptText="上限" HBox.hgrow="NEVER">
  48 + <HBox.margin>
  49 + <Insets left="10.0"/>
  50 + </HBox.margin>
  51 + </TextField>
  52 + <TextField fx:id="ignoreRange" prefHeight="27.0" prefWidth="158.0" promptText="忽略区间, 格式: 0-3,5-7"
  53 + HBox.hgrow="NEVER">
  54 + <HBox.margin>
  55 + <Insets left="10.0"/>
  56 + </HBox.margin>
  57 + <tooltip>
  58 + <Tooltip text="仅针对整数" autoHide="true"/>
  59 + </tooltip>
  60 + </TextField>
  61 + <TextField fx:id="precision" prefHeight="27.0" prefWidth="47.0" promptText="精度" HBox.hgrow="NEVER">
  62 + <HBox.margin>
  63 + <Insets left="10.0"/>
  64 + </HBox.margin>
  65 + </TextField>
  66 + <Button mnemonicParsing="false" onAction="#generateNumber" text="生成" HBox.hgrow="NEVER">
  67 + <HBox.margin>
  68 + <Insets left="10.0"/>
  69 + </HBox.margin>
  70 + </Button>
  71 + <TextField fx:id="numberResult" editable="false" prefHeight="27.0" prefWidth="108.0" promptText="结果"
  72 + HBox.hgrow="ALWAYS">
  73 + <HBox.margin>
  74 + <Insets left="10.0"/>
  75 + </HBox.margin>
  76 + </TextField>
  77 + </HBox>
  78 + <HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="47.0" prefWidth="599.0"
  79 + VBox.vgrow="NEVER">
  80 + <padding>
  81 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  82 + </padding>
  83 + <Label text="邮箱" HBox.hgrow="NEVER">
  84 + <HBox.margin>
  85 + <Insets top="5.0"/>
  86 + </HBox.margin>
  87 + </Label>
  88 + <Button mnemonicParsing="false" onAction="#generateEmail" text="生成" HBox.hgrow="NEVER">
  89 + <HBox.margin>
  90 + <Insets left="10.0"/>
  91 + </HBox.margin>
  92 + </Button>
  93 + <TextField fx:id="emailResult" editable="false" promptText="结果" HBox.hgrow="ALWAYS">
  94 + <HBox.margin>
  95 + <Insets left="10.0"/>
  96 + </HBox.margin>
  97 + </TextField>
  98 + </HBox>
  99 + <HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="47.0" prefWidth="599.0"
  100 + VBox.vgrow="NEVER">
  101 + <padding>
  102 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  103 + </padding>
  104 + <Label text="小写字母" HBox.hgrow="NEVER">
  105 + <HBox.margin>
  106 + <Insets top="5.0"/>
  107 + </HBox.margin>
  108 + </Label>
  109 + <TextField fx:id="lowerCaseLength" prefHeight="27.0" prefWidth="82.0" promptText="长度" HBox.hgrow="NEVER">
  110 + <HBox.margin>
  111 + <Insets left="10.0"/>
  112 + </HBox.margin>
  113 + </TextField>
  114 + <Button mnemonicParsing="false" onAction="#generateLowerCase" text="生成" HBox.hgrow="NEVER">
  115 + <HBox.margin>
  116 + <Insets left="10.0"/>
  117 + </HBox.margin>
  118 + </Button>
  119 + <TextField fx:id="lowerCaseResult" editable="false" promptText="结果" HBox.hgrow="ALWAYS">
  120 + <HBox.margin>
  121 + <Insets left="10.0"/>
  122 + </HBox.margin>
  123 + </TextField>
  124 + </HBox>
  125 + <HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="47.0" prefWidth="599.0"
  126 + VBox.vgrow="NEVER">
  127 + <padding>
  128 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  129 + </padding>
  130 + <Label text="大写字母" HBox.hgrow="NEVER">
  131 + <HBox.margin>
  132 + <Insets top="5.0"/>
  133 + </HBox.margin>
  134 + </Label>
  135 + <TextField fx:id="upperCaseLength" prefHeight="27.0" prefWidth="82.0" promptText="长度" HBox.hgrow="NEVER">
  136 + <HBox.margin>
  137 + <Insets left="10.0"/>
  138 + </HBox.margin>
  139 + </TextField>
  140 + <Button mnemonicParsing="false" onAction="#generateUpperCase" text="生成" HBox.hgrow="NEVER">
  141 + <HBox.margin>
  142 + <Insets left="10.0"/>
  143 + </HBox.margin>
  144 + </Button>
  145 + <TextField fx:id="upperCaseResult" editable="false" promptText="结果" HBox.hgrow="ALWAYS">
  146 + <HBox.margin>
  147 + <Insets left="10.0"/>
  148 + </HBox.margin>
  149 + </TextField>
  150 + </HBox>
  151 + <HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="47.0" prefWidth="599.0"
  152 + VBox.vgrow="NEVER">
  153 + <padding>
  154 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  155 + </padding>
  156 + <Label text="字母(包含大小写)" HBox.hgrow="NEVER">
  157 + <HBox.margin>
  158 + <Insets top="5.0"/>
  159 + </HBox.margin>
  160 + </Label>
  161 + <TextField fx:id="letterLength" prefHeight="27.0" prefWidth="82.0" promptText="长度" HBox.hgrow="NEVER">
  162 + <HBox.margin>
  163 + <Insets left="10.0"/>
  164 + </HBox.margin>
  165 + </TextField>
  166 + <Button mnemonicParsing="false" onAction="#generateLetter" text="生成" HBox.hgrow="NEVER">
  167 + <HBox.margin>
  168 + <Insets left="10.0"/>
  169 + </HBox.margin>
  170 + </Button>
  171 + <TextField fx:id="letterResult" editable="false" promptText="结果" HBox.hgrow="ALWAYS">
  172 + <HBox.margin>
  173 + <Insets left="10.0"/>
  174 + </HBox.margin>
  175 + </TextField>
  176 + </HBox>
  177 + <HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="47.0" prefWidth="599.0">
  178 + <padding>
  179 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  180 + </padding>
  181 + <Label text="无符号字符(只有字母和数字)" HBox.hgrow="NEVER">
  182 + <HBox.margin>
  183 + <Insets top="5.0"/>
  184 + </HBox.margin>
  185 + </Label>
  186 + <TextField fx:id="stringLength" prefHeight="27.0" prefWidth="82.0" promptText="长度" HBox.hgrow="NEVER">
  187 + <HBox.margin>
  188 + <Insets left="10.0"/>
  189 + </HBox.margin>
  190 + </TextField>
  191 + <Button mnemonicParsing="false" onAction="#generateString" text="生成" HBox.hgrow="NEVER">
  192 + <HBox.margin>
  193 + <Insets left="10.0"/>
  194 + </HBox.margin>
  195 + </Button>
  196 + <TextField fx:id="stringResult" editable="false" promptText="结果" HBox.hgrow="ALWAYS">
  197 + <HBox.margin>
  198 + <Insets left="10.0"/>
  199 + </HBox.margin>
  200 + </TextField>
  201 + </HBox>
  202 + <HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="47.0" prefWidth="599.0">
  203 + <padding>
  204 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  205 + </padding>
  206 + <Label text="字符(包含字母/数字/符号)" HBox.hgrow="NEVER">
  207 + <HBox.margin>
  208 + <Insets top="5.0"/>
  209 + </HBox.margin>
  210 + </Label>
  211 + <TextField fx:id="textLength" prefHeight="27.0" prefWidth="82.0" promptText="长度" HBox.hgrow="NEVER">
  212 + <HBox.margin>
  213 + <Insets left="10.0"/>
  214 + </HBox.margin>
  215 + </TextField>
  216 + <Button mnemonicParsing="false" onAction="#generateText" text="生成" HBox.hgrow="NEVER">
  217 + <HBox.margin>
  218 + <Insets left="10.0"/>
  219 + </HBox.margin>
  220 + </Button>
  221 + <TextField fx:id="textResult" editable="false" promptText="结果" HBox.hgrow="ALWAYS">
  222 + <HBox.margin>
  223 + <Insets left="10.0"/>
  224 + </HBox.margin>
  225 + </TextField>
  226 + </HBox>
  227 +</VBox>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +
  4 +<?import javafx.geometry.*?>
  5 +<?import javafx.scene.chart.AreaChart?>
  6 +<?import javafx.scene.chart.CategoryAxis?>
  7 +<?import javafx.scene.chart.NumberAxis?>
  8 +<?import javafx.scene.control.*?>
  9 +<?import javafx.scene.layout.*?>
  10 +<VBox prefHeight="500.0" prefWidth="750.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1"
  11 + fx:controller="com.zhazhapan.util.visual.controller.WaveController">
  12 + <HBox prefHeight="37.0" prefWidth="600.0" VBox.vgrow="NEVER">
  13 + <VBox.margin>
  14 + <Insets/>
  15 + </VBox.margin>
  16 + <padding>
  17 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  18 + </padding>
  19 + <ComboBox fx:id="tableCombo" maxWidth="200.0" prefWidth="150.0" HBox.hgrow="ALWAYS"/>
  20 + <Label text="开始日期" HBox.hgrow="NEVER">
  21 + <HBox.margin>
  22 + <Insets left="10.0" top="5.0"/>
  23 + </HBox.margin>
  24 + </Label>
  25 + <DatePicker fx:id="startDate" onAction="#getWaveDataToLineChart" HBox.hgrow="NEVER"
  26 + onKeyReleased="#getWaveDataToLineChart">
  27 + <HBox.margin>
  28 + <Insets left="10.0"/>
  29 + </HBox.margin>
  30 + </DatePicker>
  31 + <Label text="截止日期" HBox.hgrow="NEVER">
  32 + <HBox.margin>
  33 + <Insets left="10.0" top="5.0"/>
  34 + </HBox.margin>
  35 + </Label>
  36 + <DatePicker fx:id="endDate" onAction="#getWaveDataToLineChart" HBox.hgrow="NEVER"
  37 + onKeyReleased="#getWaveDataToLineChart">
  38 + <HBox.margin>
  39 + <Insets left="10.0"/>
  40 + </HBox.margin>
  41 + </DatePicker>
  42 + <Button mnemonicParsing="false" onAction="#getWaveDataToLineChart" text="刷新" HBox.hgrow="NEVER">
  43 + <HBox.margin>
  44 + <Insets left="10.0"/>
  45 + </HBox.margin>
  46 + </Button>
  47 + </HBox>
  48 + <AreaChart fx:id="chart" maxHeight="600.0" maxWidth="1.7976931348623157E308" VBox.vgrow="ALWAYS">
  49 + <xAxis>
  50 + <CategoryAxis side="BOTTOM"/>
  51 + </xAxis>
  52 + <yAxis>
  53 + <NumberAxis side="LEFT"/>
  54 + </yAxis>
  55 + <VBox.margin>
  56 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  57 + </VBox.margin>
  58 + </AreaChart>
  59 + <HBox prefHeight="32.0" prefWidth="750.0">
  60 + <padding>
  61 + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
  62 + </padding>
  63 + <ComboBox fx:id="crudMethod" prefWidth="150.0" HBox.hgrow="NEVER"/>
  64 + <DatePicker fx:id="sqlDate" onAction="#generateSql" HBox.hgrow="NEVER" onKeyReleased="#generateSql">
  65 + <HBox.margin>
  66 + <Insets left="10.0"/>
  67 + </HBox.margin>
  68 + </DatePicker>
  69 + <TextField fx:id="sqlNumber" onKeyReleased="#generateSql" prefHeight="27.0" prefWidth="78.0"
  70 + promptText="波动数" text="0" HBox.hgrow="NEVER">
  71 + <HBox.margin>
  72 + <Insets left="10.0"/>
  73 + </HBox.margin>
  74 + </TextField>
  75 + <TextField fx:id="sql" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
  76 + promptText="SQL, 支持变量" HBox.hgrow="ALWAYS">
  77 + <HBox.margin>
  78 + <Insets left="10.0"/>
  79 + </HBox.margin>
  80 + </TextField>
  81 + <Button mnemonicParsing="false" onAction="#executeSql" text="执行" HBox.hgrow="NEVER">
  82 + <HBox.margin>
  83 + <Insets left="10.0"/>
  84 + </HBox.margin>
  85 + </Button>
  86 + </HBox>
  87 +</VBox>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +<?import javafx.geometry.Insets?>
  4 +<?import javafx.scene.control.*?>
  5 +<?import javafx.scene.layout.*?>
  6 +<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="500.0" minWidth="600.0"
  7 + xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1"
  8 + fx:controller="com.zhazhapan.util.visual.controller.MainController">
  9 + <MenuBar VBox.vgrow="NEVER">
  10 + <Menu mnemonicParsing="false" text="文件">
  11 + <MenuItem mnemonicParsing="false" onAction="#openFile" text="打开"/>
  12 + <MenuItem mnemonicParsing="false" onAction="#openMultiFile" text="批量打开"/>
  13 + <MenuItem mnemonicParsing="false" onAction="#saveFile" text="保存"/>
  14 + <!--<MenuItem mnemonicParsing="false" text="设置"/>-->
  15 + <MenuItem mnemonicParsing="false" onAction="#openAllTab" text="打开所有标签"/>
  16 + <MenuItem mnemonicParsing="false" onAction="#closeAllTab" text="关闭所有标签"/>
  17 + <MenuItem mnemonicParsing="false" onAction="#quit" text="退出"/>
  18 + </Menu>
  19 + <Menu mnemonicParsing="false" text="工具">
  20 + <MenuItem mnemonicParsing="false" onAction="#openJsonParserTab" text="JSON解析"/>
  21 + <MenuItem mnemonicParsing="false" onAction="#openFileManagerTab" text="文件批处理"/>
  22 + <MenuItem mnemonicParsing="false" onAction="#openRandomGeneratorTab" text="随机生成器"/>
  23 + <MenuItem mnemonicParsing="false" onAction="#openClipboardHistoryTab" text="剪贴板历史"/>
  24 + <MenuItem mnemonicParsing="false" onAction="#openQrCodeGeneratorTab" text="二维码生成器"/>
  25 + <MenuItem mnemonicParsing="false" onAction="#openCharsetConverterTab" text="编码转换器"/>
  26 + <MenuItem mnemonicParsing="false" onAction="#openNetworkToolTab" text="网络工具"/>
  27 + <MenuItem mnemonicParsing="false" onAction="#openQiniuToolTab" text="七牛云对象存储"/>
  28 + <MenuItem mnemonicParsing="false" onAction="#openWaveViewerTab" text="波动图表"/>
  29 + <Menu mnemonicParsing="false" text="外部工具">
  30 + <MenuItem mnemonicParsing="false" onAction="#openColorPicker" text="取色器"/>
  31 + <MenuItem mnemonicParsing="false" onAction="#openWox" text="效率工具"/>
  32 + </Menu>
  33 + </Menu>
  34 + <Menu mnemonicParsing="false" text="帮助">
  35 + <MenuItem mnemonicParsing="false" onAction="#about" text="关于"/>
  36 + </Menu>
  37 + </MenuBar>
  38 + <TabPane fx:id="tabPane" VBox.vgrow="ALWAYS"/>
  39 + <HBox prefHeight="32.0" prefWidth="600.0" VBox.vgrow="NEVER">
  40 + <padding>
  41 + <Insets left="10.0" right="10.0" top="10.0" bottom="5.0"/>
  42 + </padding>
  43 + <Label text="USED JVM MEMORY: " HBox.hgrow="NEVER"/>
  44 + <ProgressBar fx:id="jvm" maxWidth="1.7976931348623157E308" prefWidth="200.0" progress="0.0"
  45 + HBox.hgrow="ALWAYS"/>
  46 + </HBox>
  47 +</VBox>