From 62dfc93919260599e44ddccbeff7b4af2f5125e8 Mon Sep 17 00:00:00 2001 From: hzzz Date: Thu, 12 Jul 2018 09:21:56 +0800 Subject: [PATCH] disconnecte --- .../design/mainframe/socketio/DesignerSocketIO.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index a44bdf8b20..8908fb9821 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -1,8 +1,10 @@ package com.fr.design.mainframe.socketio; import com.fr.decision.webservice.utils.DecisionServiceConstants; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.loghandler.DesignerLogHandler; import com.fr.env.operator.socket.SocketInfoOperator; +import com.fr.general.Inter; import com.fr.general.LogRecordTime; import com.fr.general.LogUtils; import com.fr.log.FineLoggerFactory; @@ -15,6 +17,8 @@ import io.socket.client.IO; import io.socket.client.Socket; import io.socket.emitter.Emitter; +import javax.swing.JOptionPane; +import javax.swing.UIManager; import java.io.ByteArrayInputStream; import java.io.IOException; import java.net.URI; @@ -54,6 +58,13 @@ public class DesignerSocketIO { String uri = getSocketUri(current); socketIO = Optional.of(IO.socket(new URI(uri))); socketIO.get().on(WorkspaceConstants.WS_LOGRECORD, printLog); + socketIO.get().on(Socket.EVENT_DISCONNECT, new Emitter.Listener() { + @Override + public void call(Object... objects) { + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Disconnected"}), + null, 0, UIManager.getIcon("OptionPane.errorIcon")); + } + }); socketIO.get().connect(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e);