|
|
@ -1,8 +1,10 @@ |
|
|
|
package com.fr.design.mainframe.socketio; |
|
|
|
package com.fr.design.mainframe.socketio; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.decision.webservice.utils.DecisionServiceConstants; |
|
|
|
import com.fr.decision.webservice.utils.DecisionServiceConstants; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.loghandler.DesignerLogHandler; |
|
|
|
import com.fr.design.mainframe.loghandler.DesignerLogHandler; |
|
|
|
import com.fr.env.operator.socket.SocketInfoOperator; |
|
|
|
import com.fr.env.operator.socket.SocketInfoOperator; |
|
|
|
|
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.LogRecordTime; |
|
|
|
import com.fr.general.LogRecordTime; |
|
|
|
import com.fr.general.LogUtils; |
|
|
|
import com.fr.general.LogUtils; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
@ -15,6 +17,8 @@ import io.socket.client.IO; |
|
|
|
import io.socket.client.Socket; |
|
|
|
import io.socket.client.Socket; |
|
|
|
import io.socket.emitter.Emitter; |
|
|
|
import io.socket.emitter.Emitter; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
|
|
|
|
import javax.swing.UIManager; |
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.net.URI; |
|
|
|
import java.net.URI; |
|
|
@ -54,6 +58,13 @@ public class DesignerSocketIO { |
|
|
|
String uri = getSocketUri(current); |
|
|
|
String uri = getSocketUri(current); |
|
|
|
socketIO = Optional.of(IO.socket(new URI(uri))); |
|
|
|
socketIO = Optional.of(IO.socket(new URI(uri))); |
|
|
|
socketIO.get().on(WorkspaceConstants.WS_LOGRECORD, printLog); |
|
|
|
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(); |
|
|
|
socketIO.get().connect(); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|