readme 更新 2023年3月14日11:37:43

master
zhangmeng 2023-03-14 11:37:49 +08:00
parent 3a04e1c0de
commit 60da5a5fe8
4 changed files with 11 additions and 37 deletions

View File

@ -148,7 +148,7 @@
###### 8.3.1 javafx 实现 ###### 8.3.1 javafx 实现
![](./src/main/resources/static/redame/img_33.png)
###### 8.3.2 html 实现 ###### 8.3.2 html 实现

View File

@ -102,28 +102,15 @@ public class SSHConnectionController {
private WebSocketClient webSocketClient; private WebSocketClient webSocketClient;
private SSHService sshService; private SSHService sshService;
private SimpleObjectProperty<String> cmd = new SimpleObjectProperty<>();
private boolean isConnection = false; private boolean isConnection = false;
/**
* Javascript
*/
private JSObject javascriptConnector;
/**
* Javascript
*/
private JavaConnector javaConnector = new JavaConnector();
;
@FXML @FXML
public void initialize() { public void initialize() {
// username.setText("root"); username.setText("root");
// password.setText("root"); password.setText("root");
// host.setText("192.168.52.165"); host.setText("192.168.52.165");
// port.setText("22"); port.setText("22");
message_list.addListener((ListChangeListener<String>) c -> { message_list.addListener((ListChangeListener<String>) c -> {
while (c.next()) { while (c.next()) {
@ -213,7 +200,6 @@ public class SSHConnectionController {
@Override @Override
public void onOpen(WebSocket webSocket, ClientHandshake clientHandshake) { public void onOpen(WebSocket webSocket, ClientHandshake clientHandshake) {
add_msg("WebSocketServer:onOpen--------------------------------------------");
sshService.initConnection(webSocket, uuid.getValue()); sshService.initConnection(webSocket, uuid.getValue());
} }
@ -225,7 +211,6 @@ public class SSHConnectionController {
@Override @Override
public void onMessage(WebSocket webSocket, String s) { public void onMessage(WebSocket webSocket, String s) {
add_msg("WebSocketServer:onMessage---" + s);
sshService.recvHandle(s, webSocket, uuid.getValue()); sshService.recvHandle(s, webSocket, uuid.getValue());
} }
@ -241,14 +226,6 @@ public class SSHConnectionController {
}; };
} }
public class JavaConnector {
public void ssh_info() {
SSHData ssh_data = create_ssh_data("", SSHData.Type.connect);
javascriptConnector.call(JSON.toJSONString(ssh_data));
}
}
public void load_page_client() { public void load_page_client() {
WebEngine webEngine = webView.getEngine(); WebEngine webEngine = webView.getEngine();
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("templates", TemplateConfig.ResourceMode.CLASSPATH)); TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("templates", TemplateConfig.ResourceMode.CLASSPATH));
@ -305,10 +282,7 @@ public class SSHConnectionController {
//收到服务端消息时触发 //收到服务端消息时触发
@Override @Override
public void onMessage(String message) { public void onMessage(String message) {
String[] s = message.split(" "); add_msg(message);
for (String s1 : s) {
add_msg(s1);
}
} }
//和服务端断开连接时触发 //和服务端断开连接时触发
@ -330,9 +304,8 @@ public class SSHConnectionController {
} }
public static void add_msg(String msg) { public static void add_msg(String msg) {
// message_list.add(msg); message_list.add(msg);
// message_list.add("------------------------------------------------------------------->"); message_list.add(System.lineSeparator());
// message_list.add(System.lineSeparator());
} }
public void receive(String msg) { public void receive(String msg) {

View File

@ -5,6 +5,7 @@
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.web.WebView?> <?import javafx.scene.web.WebView?>
<?import javafx.scene.control.TextArea?>
<AnchorPane prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.SSHConnectionController"> <AnchorPane prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.SSHConnectionController">
<children> <children>

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB