2023年12月7日17:46:29
parent
89832d06a9
commit
dff5d100ee
|
|
@ -0,0 +1,633 @@
|
||||||
|
package com.zhangmeng.tools.controller;
|
||||||
|
|
||||||
|
import com.zhangmeng.tools.utils.ImagePath;
|
||||||
|
import com.zhangmeng.tools.utils.ResourcesUtils;
|
||||||
|
import javafx.beans.property.SimpleDoubleProperty;
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.ListCell;
|
||||||
|
import javafx.scene.control.ListView;
|
||||||
|
import javafx.scene.control.SplitPane;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import javafx.scene.paint.Paint;
|
||||||
|
import javafx.scene.text.Font;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import javafx.util.Callback;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class ChatAppController {
|
||||||
|
|
||||||
|
private SimpleDoubleProperty width = new SimpleDoubleProperty(0.0);
|
||||||
|
private SimpleDoubleProperty height = new SimpleDoubleProperty(0.0);
|
||||||
|
private AnchorPane root;
|
||||||
|
private AnchorPane chat_app;
|
||||||
|
|
||||||
|
public static final String color_cell = "#f4f4f4";
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ListView<ResourcesUtils.ChatTools> listView;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private SplitPane splitPane;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void date_query_menu_item(){
|
||||||
|
load_small_tools(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void cron_menu_item(){
|
||||||
|
load_small_tools(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void video_menu_item() {
|
||||||
|
load_player(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void music_menu_item() {
|
||||||
|
load_player(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void vip_parser_menu_item() {
|
||||||
|
load_player(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void hex_16(){
|
||||||
|
load_small_tools(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void hex_16_menu_item(){
|
||||||
|
load_small_tools(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void unicode_menu_item(){
|
||||||
|
load_small_tools(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void jwt_menu_item(){
|
||||||
|
load_small_tools(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void color_choose_menu_item(){
|
||||||
|
load_small_tools(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void qr_code_menu_item(){
|
||||||
|
load_small_tools(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void base_62_menu_item(){
|
||||||
|
load_codec_tools(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void base_64_menu_item(){
|
||||||
|
load_codec_tools(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void base_32_menu_item(){
|
||||||
|
load_codec_tools(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void morse_coder_menu_item(){
|
||||||
|
load_codec_tools(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void sql_code_gen_menu_item(){
|
||||||
|
load_sql_tools(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void netty_client_menu_item(){
|
||||||
|
load_network_tools(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load_network_tools(int index){
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("network-tools"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||||
|
listView.getSelectionModel().select(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load_sql_tools(int index){
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("sql-tools"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||||
|
listView.getSelectionModel().select(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load_codec_tools(int index){
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("codec-tools"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||||
|
listView.getSelectionModel().select(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load_small_tools(int index){
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("small-tools"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||||
|
listView.getSelectionModel().select(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load_player(int index) {
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("player"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||||
|
listView.getSelectionModel().select(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void initialize() {
|
||||||
|
init();
|
||||||
|
listView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
if (newValue != null) {
|
||||||
|
boolean flag = false;
|
||||||
|
|
||||||
|
if (newValue.getIndex() == 0) {
|
||||||
|
if (chat_app != null){
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
chat_app(flag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void chat_app(boolean flag) {
|
||||||
|
listView.getSelectionModel().select(0);
|
||||||
|
if (!flag){
|
||||||
|
try {
|
||||||
|
root = FXMLLoader.load(ResourcesUtils.getResource("chat-app-impl"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
chat_app = root;
|
||||||
|
}else {
|
||||||
|
root = chat_app;
|
||||||
|
}
|
||||||
|
common_method();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image getImage(ResourcesUtils.ChatTools player){
|
||||||
|
return switch (player){
|
||||||
|
case Chat_App -> new Image(ImagePath.path(ImagePath.ImagePathType.MD5));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
ResourcesUtils.ChatTools[] values = ResourcesUtils.ChatTools.values();
|
||||||
|
ObservableList<ResourcesUtils.ChatTools> list = FXCollections.observableArrayList();
|
||||||
|
list.addAll(Arrays.asList(values));
|
||||||
|
listView.setItems(list);
|
||||||
|
listView.setFixedCellSize(40);
|
||||||
|
listView.setCellFactory(new Callback<>() {
|
||||||
|
private int position;
|
||||||
|
@Override
|
||||||
|
public ListCell<ResourcesUtils.ChatTools> call(ListView<ResourcesUtils.ChatTools> playerListView) {
|
||||||
|
Label label = new Label();
|
||||||
|
label.setPrefWidth(200);
|
||||||
|
ListCell<ResourcesUtils.ChatTools> listCell = new ListCell<>() {
|
||||||
|
@Override
|
||||||
|
protected void updateItem(ResourcesUtils.ChatTools player, boolean b) {
|
||||||
|
super.updateItem(player, b);
|
||||||
|
if (!b) {
|
||||||
|
HBox hBox = new HBox(25);
|
||||||
|
hBox.setAlignment(Pos.CENTER);
|
||||||
|
label.setText(player.getTitle());
|
||||||
|
label.setTextFill(Paint.valueOf("#000000"));
|
||||||
|
Image im = getImage(player);
|
||||||
|
ImageView iv = new ImageView(im);
|
||||||
|
iv.setPreserveRatio(true);
|
||||||
|
iv.setFitWidth(15);
|
||||||
|
hBox.getChildren().add(iv);
|
||||||
|
|
||||||
|
hBox.getChildren().add(label);
|
||||||
|
this.setGraphic(hBox);
|
||||||
|
}
|
||||||
|
this.setStyle("-fx-background-color: " + color_cell);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
listCell.hoverProperty().addListener((observableValue, aBoolean, t1) -> {
|
||||||
|
if (t1 && !label.getText().equals("")) {
|
||||||
|
position = playerListView.getItems().indexOf(label.getText());
|
||||||
|
label.setFont(new Font(16));
|
||||||
|
playerListView.getFocusModel().focus(position);
|
||||||
|
listCell.setStyle("-fx-background-color: #369e7d");
|
||||||
|
} else {
|
||||||
|
label.setPrefHeight(20);
|
||||||
|
label.setFont(new Font(13));
|
||||||
|
listCell.setStyle("-fx-background-color: " + color_cell);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return listCell;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
chat_app(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void common_method() {
|
||||||
|
splitPane.getItems().remove(1);
|
||||||
|
splitPane.getItems().add(1, root);
|
||||||
|
root.widthProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
if (newValue != null) {
|
||||||
|
double width = splitPane.getWidth();
|
||||||
|
ChatAppController.this.width.set(width);
|
||||||
|
log.info("home:--->width:{}", width);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
root.heightProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
if (newValue != null) {
|
||||||
|
double height = splitPane.getHeight();
|
||||||
|
ChatAppController.this.height.set(height);
|
||||||
|
log.info("home:--->height:{}", height);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.width.addListener((observable, oldValue, newValue) -> {
|
||||||
|
ChatAppController.this.root.setPrefWidth(newValue.doubleValue() - listView.getWidth());
|
||||||
|
});
|
||||||
|
|
||||||
|
this.height.addListener((observable, oldValue, newValue) -> {
|
||||||
|
ChatAppController.this.root.setPrefHeight(newValue.doubleValue() - listView.getHeight());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void http_request_menu_item(ActionEvent event) {
|
||||||
|
load_http_tools(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void http_upload_menu_item(ActionEvent event) {
|
||||||
|
load_http_tools(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void http_download_menu_item(ActionEvent event) {
|
||||||
|
load_http_tools(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load_http_tools(int index) {
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("http-tools"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||||
|
listView.getSelectionModel().select(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void mail_menu_item(ActionEvent event) {
|
||||||
|
load_small_tools(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void http_server_menu_item(ActionEvent event) {
|
||||||
|
load_server_tools(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ftp_server_menu_item(ActionEvent event) {
|
||||||
|
load_server_tools(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load_server_tools(int index) {
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("server-tools"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||||
|
listView.getSelectionModel().select(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ssh_client_menu_item(ActionEvent event) {
|
||||||
|
load_server_tools(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void socket_server_menu_item(ActionEvent event) {
|
||||||
|
load_server_tools(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void telephone_menu_item(ActionEvent event) {
|
||||||
|
load_small_tools(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mybatis_plus_gen_menu_item(ActionEvent event) {
|
||||||
|
load_sql_tools(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void JsonView_menu_item(ActionEvent event) {
|
||||||
|
|
||||||
|
load_small_tools(9);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void maven_jar_install_menu_item(ActionEvent event) {
|
||||||
|
load_small_tools(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void word_ocr_menu_item(ActionEvent event) {
|
||||||
|
load_small_tools(11);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bar_code_menu_item(ActionEvent event) {
|
||||||
|
load_small_tools(12);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pdf_menu_item(ActionEvent event) {
|
||||||
|
load_small_tools(13);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void json_javabean_gen_menu_item(ActionEvent event) {
|
||||||
|
load_sql_tools(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void music_parser_menu_item(ActionEvent event) {
|
||||||
|
load_player(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void batch_update_file_name_menu_item(ActionEvent event) {
|
||||||
|
load_small_tools(14);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void socket_client_aio_menu_item(ActionEvent event) {
|
||||||
|
load_server_tools(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void socket_server_aio_menu_item(ActionEvent event) {
|
||||||
|
load_server_tools(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void socket_server_nio_menu_item(ActionEvent event) {
|
||||||
|
load_server_tools(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void socket_client_nio_menu_item(ActionEvent event) {
|
||||||
|
load_server_tools(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void capter_screen_menu_item(ActionEvent event) {
|
||||||
|
load_small_tools(15);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sql_query_gen_menu_item(ActionEvent event) {
|
||||||
|
load_sql_tools(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void video_transcoder_menu_item(ActionEvent event) {
|
||||||
|
load_player(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void json_to_struct_menu_item(ActionEvent event) {
|
||||||
|
load_go_tools(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load_go_tools(int index){
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("go-tools"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||||
|
listView.getSelectionModel().select(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void file_edit_menu_item(ActionEvent event) {
|
||||||
|
load_small_tools(16);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void web_socket_client_menu_item(ActionEvent event) {
|
||||||
|
load_server_tools(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void layui_form_gen_menu_item(ActionEvent actionEvent) {
|
||||||
|
load_small_tools(17);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void log_console_menu_item(ActionEvent actionEvent) {
|
||||||
|
load_small_tools(18);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void edit_plus_code_menu_item(ActionEvent actionEvent) {
|
||||||
|
load_small_tools(19);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void minio_upload_menu_item(ActionEvent actionEvent) {
|
||||||
|
load_small_tools(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ace_js_menu_item(ActionEvent actionEvent) {
|
||||||
|
|
||||||
|
js_edit_list(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void js_edit_list(int index){
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("editor-list"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||||
|
listView.getSelectionModel().select(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void monaco_js_menu_item(ActionEvent actionEvent) {
|
||||||
|
js_edit_list(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void codemirror_js_menu_item(ActionEvent actionEvent) {
|
||||||
|
js_edit_list(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ace_menu_item(ActionEvent actionEvent) {
|
||||||
|
js_edit_list_impl(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void monaco_menu_item(ActionEvent actionEvent) {
|
||||||
|
js_edit_list_impl(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void codemirror_menu_item(ActionEvent actionEvent) {
|
||||||
|
js_edit_list_impl(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void timeFx_menu_item(ActionEvent actionEvent) {
|
||||||
|
js_edit_list_impl(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void js_edit_list_impl(int index){
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("editor-list-impl"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
// ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||||
|
// listView.getSelectionModel().select(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void timeFx_fx_menu_item(ActionEvent actionEvent) {
|
||||||
|
js_edit_list(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void excel_read_menu_item(ActionEvent actionEvent) {
|
||||||
|
load_small_tools(21);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mysql_to_struct_menu_item(ActionEvent actionEvent) {
|
||||||
|
load_go_tools(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swing_menu_item(ActionEvent actionEvent) {
|
||||||
|
js_edit_list(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void chat_app_menu_item(ActionEvent actionEvent) {
|
||||||
|
load_chat_app();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load_chat_app(){
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("chat-app-impl"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
stage.setScene(scene);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void jks_file_menu_item(ActionEvent event) {
|
||||||
|
load_encrypt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void md5_menu_item(ActionEvent actionEvent) {
|
||||||
|
load_encrypt(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void spring_security_menu_item(ActionEvent actionEvent) {
|
||||||
|
load_encrypt(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load_encrypt(int index) {
|
||||||
|
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("home"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||||
|
listView.getSelectionModel().select(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.zhangmeng.tools.controller;
|
||||||
|
|
||||||
|
import com.zhangmeng.tools.utils.ImagePath;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class ChatAppImplController {
|
||||||
|
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public Button file_button;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void initialize() {
|
||||||
|
|
||||||
|
file_button.setText(null);
|
||||||
|
ImageView iv = new ImageView(new Image(ImagePath.path(ImagePath.ImagePathType.IMAGE_FILE)));
|
||||||
|
iv.setPreserveRatio(true);
|
||||||
|
iv.setFitWidth(18);
|
||||||
|
file_button.setGraphic(iv);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -694,4 +694,23 @@ public class HomeController implements Serializable {
|
||||||
js_edit_list(4);
|
js_edit_list(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void chat_app_menu_item(ActionEvent actionEvent) {
|
||||||
|
load_chat_app(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load_chat_app(int index){
|
||||||
|
AnchorPane fx = null;
|
||||||
|
try {
|
||||||
|
fx = FXMLLoader.load(ResourcesUtils.getResource("chat-app"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(fx);
|
||||||
|
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||||
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||||
|
listView.getSelectionModel().select(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -394,4 +394,35 @@ public class ResourcesUtils {
|
||||||
private String title;
|
private String title;
|
||||||
private int index;
|
private int index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public enum ChatTools {
|
||||||
|
|
||||||
|
Chat_App("聊天应用", 0),
|
||||||
|
;
|
||||||
|
|
||||||
|
ChatTools(String title, int index) {
|
||||||
|
this.title = title;
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndex() {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndex(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
private int index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.Button?>
|
||||||
|
<?import javafx.scene.control.ListView?>
|
||||||
|
<?import javafx.scene.control.SplitPane?>
|
||||||
|
<?import javafx.scene.control.TextArea?>
|
||||||
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
|
||||||
|
<AnchorPane fx:controller="com.zhangmeng.tools.controller.ChatAppImplController" prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19"
|
||||||
|
xmlns:fx="http://javafx.com/fxml/1">
|
||||||
|
|
||||||
|
<SplitPane dividerPositions="0.25" layoutX="35.0" layoutY="42.0" prefHeight="160.0" prefWidth="200.0"
|
||||||
|
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||||
|
AnchorPane.topAnchor="0.0">
|
||||||
|
<items>
|
||||||
|
<ListView prefHeight="200.0" prefWidth="200.0"/>
|
||||||
|
<AnchorPane minHeight="0.0" minWidth="0.0" opacity="1" prefHeight="160.0" prefWidth="100.0">
|
||||||
|
<children>
|
||||||
|
<VBox prefHeight="447.0" prefWidth="895.0" AnchorPane.bottomAnchor="200.0"
|
||||||
|
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/>
|
||||||
|
<AnchorPane layoutY="447.0" prefHeight="200.0" prefWidth="895.0"
|
||||||
|
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||||
|
<children>
|
||||||
|
<TextArea layoutX="14.0" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0"
|
||||||
|
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||||
|
AnchorPane.topAnchor="25.0" style="-fx-border-width: 0;-fx-border-style: none;"/>
|
||||||
|
<HBox prefHeight="100.0" prefWidth="200.0" AnchorPane.bottomAnchor="173.0"
|
||||||
|
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<children>
|
||||||
|
<Button mnemonicParsing="false" text="文件" fx:id="file_button" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
</items>
|
||||||
|
</SplitPane>
|
||||||
|
|
||||||
|
</AnchorPane>
|
||||||
|
|
@ -0,0 +1,141 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.ListView?>
|
||||||
|
<?import javafx.scene.control.SplitPane?>
|
||||||
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<?import javafx.scene.control.Menu?>
|
||||||
|
<?import javafx.scene.control.MenuBar?>
|
||||||
|
<?import javafx.scene.control.MenuItem?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
|
||||||
|
<AnchorPane fx:controller="com.zhangmeng.tools.controller.ChatAppController" prefHeight="800.0" prefWidth="1661.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
|
<children>
|
||||||
|
<MenuBar layoutX="14.0" layoutY="27.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||||
|
AnchorPane.topAnchor="0.0">
|
||||||
|
<menus>
|
||||||
|
<Menu mnemonicParsing="false" text="加密工具">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" onAction="#md5_menu_item" text="md5 加密"/>
|
||||||
|
<MenuItem mnemonicParsing="false" onAction="#spring_security_menu_item" text="spring security 加密"/>
|
||||||
|
<MenuItem mnemonicParsing="false" onAction="#jks_file_menu_item" text="jkd 文件生成"/>
|
||||||
|
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
<Menu mnemonicParsing="false" text="影音工具">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="视频播放" onAction="#video_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="音乐播放" onAction="#music_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="vip 视频解析" onAction="#vip_parser_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="音乐解析" onAction="#music_parser_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="视频转码" onAction="#video_transcoder_menu_item"/>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
<Menu mnemonicParsing="false" text="常用小工具">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="16进制(Hex)" onAction="#hex_16_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="Unicode和字符串转换" onAction="#unicode_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="jwt工具" onAction="#jwt_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="颜色选择工具" onAction="#color_choose_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="二维码生成" onAction="#qr_code_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="时间工具" onAction="#date_query_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="cron表达式" onAction="#cron_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="邮件发送" onAction="#mail_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="手机号工具" onAction="#telephone_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="JsonView" onAction="#JsonView_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="maven-jar-install" onAction="#maven_jar_install_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="word-ocr" onAction="#word_ocr_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="条形码识别" onAction="#bar_code_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="pdf识别" onAction="#pdf_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="批量修改文件名" onAction="#batch_update_file_name_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="截图工具" onAction="#capter_screen_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="文件编辑器" onAction="#file_edit_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="LayUI表单代码生成" onAction="#layui_form_gen_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="日志输出" onAction="#log_console_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="EditPlus注册码生成" onAction="#edit_plus_code_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="minio文件上传" onAction="#minio_upload_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="excel文件读取" onAction="#excel_read_menu_item"/>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
<Menu mnemonicParsing="false" text="编解码工具">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="Base62编码解码" onAction="#base_62_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="Base64编码解码" onAction="#base_64_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="Base32编码解码" onAction="#base_32_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="摩尔斯电码" onAction="#morse_coder_menu_item"/>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
<Menu mnemonicParsing="false" text="代码工具">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="mysql代码生成" onAction="#sql_code_gen_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="mybatis-plus 代码生成" onAction="#mybatis_plus_gen_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="json转javaBean 代码生成" onAction="#json_javabean_gen_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="sql 查询" onAction="#sql_query_gen_menu_item"/>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
<Menu mnemonicParsing="false" text="http工具">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="http请求工具" onAction="#http_request_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="http上传工具" onAction="#http_upload_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="http下载工具" onAction="#http_download_menu_item"/>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
<Menu mnemonicParsing="false" text="server 工具">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="http-server 请求工具" onAction="#http_server_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="ftp-server 请求工具" onAction="#ftp_server_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="ssh-client 请求工具" onAction="#ssh_client_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="socket-server 服务工具" onAction="#socket_server_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="socket-client-aio 客户端工具" onAction="#socket_client_aio_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="socket-server-aio 服务端工具" onAction="#socket_server_aio_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="socket-server-nio 服务端工具" onAction="#socket_server_nio_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="socket-client-nio 客户端工具" onAction="#socket_client_nio_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="web-socket-client 客户端工具" onAction="#web_socket_client_menu_item"/>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
<Menu mnemonicParsing="false" text="go语言工具">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="json生成结构体" onAction="#json_to_struct_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="mysql生成结构体" onAction="#mysql_to_struct_menu_item"/>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
<Menu mnemonicParsing="false" text="编辑器工具">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="ace.js 编辑器" onAction="#ace_js_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="monaco.js 编辑器" onAction="#monaco_js_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="codemirror.js 编辑器" onAction="#codemirror_js_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="timefx 编辑器" onAction="#timeFx_fx_menu_item"/>
|
||||||
|
<MenuItem mnemonicParsing="false" text="swing编辑器" onAction="#swing_menu_item"/>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
<Menu mnemonicParsing="false" text="编辑器">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="ace.js 编辑器" onAction="#ace_menu_item"/>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
<Menu mnemonicParsing="false" text="聊天">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="聊天应用" onAction="#chat_app_menu_item"/>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
</menus>
|
||||||
|
</MenuBar>
|
||||||
|
|
||||||
|
<SplitPane fx:id="splitPane" dividerPositions="0.5" layoutY="25.0" prefHeight="575.0" prefWidth="1200.0"
|
||||||
|
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||||
|
AnchorPane.topAnchor="25.0">
|
||||||
|
<items>
|
||||||
|
<ListView fx:id="listView" maxWidth="300.0" minWidth="200.0" prefHeight="200.0" prefWidth="200.0"/>
|
||||||
|
<AnchorPane prefHeight="200.0" prefWidth="200.0"/>
|
||||||
|
</items>
|
||||||
|
</SplitPane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
|
@ -121,6 +121,12 @@
|
||||||
</items>
|
</items>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|
||||||
|
<Menu mnemonicParsing="false" text="聊天">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" text="聊天应用" onAction="#chat_app_menu_item"/>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
</menus>
|
</menus>
|
||||||
</MenuBar>
|
</MenuBar>
|
||||||
<SplitPane fx:id="splitPane" dividerPositions="0.5" layoutY="25.0" prefHeight="575.0" prefWidth="1200.0"
|
<SplitPane fx:id="splitPane" dividerPositions="0.5" layoutY="25.0" prefHeight="575.0" prefWidth="1200.0"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue