|
|
@ -2,13 +2,16 @@ package com.fr.design.mainframe.socketio; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.config.RemoteConfigEvent; |
|
|
|
import com.fr.config.RemoteConfigEvent; |
|
|
|
import com.fr.decision.webservice.utils.DecisionServiceConstants; |
|
|
|
import com.fr.decision.webservice.utils.DecisionServiceConstants; |
|
|
|
|
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.EnvChangeEntrance; |
|
|
|
import com.fr.design.EnvChangeEntrance; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.loghandler.DesignerLogger; |
|
|
|
import com.fr.design.mainframe.loghandler.DesignerLogger; |
|
|
|
import com.fr.design.ui.util.UIUtil; |
|
|
|
import com.fr.design.ui.util.UIUtil; |
|
|
|
|
|
|
|
import com.fr.event.Event; |
|
|
|
import com.fr.event.EventDispatcher; |
|
|
|
import com.fr.event.EventDispatcher; |
|
|
|
|
|
|
|
import com.fr.event.Listener; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.report.RemoteDesignConstants; |
|
|
|
import com.fr.report.RemoteDesignConstants; |
|
|
|
import com.fr.serialization.SerializerHelper; |
|
|
|
import com.fr.serialization.SerializerHelper; |
|
|
@ -16,6 +19,7 @@ import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.third.apache.log4j.spi.LoggingEvent; |
|
|
|
import com.fr.third.apache.log4j.spi.LoggingEvent; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.Workspace; |
|
|
|
import com.fr.workspace.Workspace; |
|
|
|
|
|
|
|
import com.fr.workspace.WorkspaceEvent; |
|
|
|
import com.fr.workspace.base.WorkspaceConstants; |
|
|
|
import com.fr.workspace.base.WorkspaceConstants; |
|
|
|
import com.fr.workspace.connect.WorkspaceConnection; |
|
|
|
import com.fr.workspace.connect.WorkspaceConnection; |
|
|
|
import com.fr.workspace.server.socket.SocketInfoOperator; |
|
|
|
import com.fr.workspace.server.socket.SocketInfoOperator; |
|
|
@ -30,6 +34,20 @@ import java.net.URL; |
|
|
|
|
|
|
|
|
|
|
|
public class DesignerSocketIO { |
|
|
|
public class DesignerSocketIO { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static { |
|
|
|
|
|
|
|
EventDispatcher.listen(WorkspaceEvent.LostConnect, new Listener<Workspace>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void on(Event event, Workspace param) { |
|
|
|
|
|
|
|
// 远程设计websocket不支持wss 所以断开无法提醒
|
|
|
|
|
|
|
|
// 使用远程设计的心跳断开来提醒断开
|
|
|
|
|
|
|
|
if (DesignerEnvManager.getEnvManager().isHttps()) { |
|
|
|
|
|
|
|
showConnectionLostDialog(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
enum Status { |
|
|
|
enum Status { |
|
|
|
Connected, |
|
|
|
Connected, |
|
|
|
Disconnected, |
|
|
|
Disconnected, |
|
|
@ -143,27 +161,31 @@ public class DesignerSocketIO { |
|
|
|
* socket 只用推日志和通知配置变更 |
|
|
|
* socket 只用推日志和通知配置变更 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
if (status != Status.Disconnecting) { |
|
|
|
if (status != Status.Disconnecting) { |
|
|
|
try { |
|
|
|
showConnectionLostDialog(); |
|
|
|
UIUtil.invokeAndWaitIfNeeded(new Runnable() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void run() { |
|
|
|
|
|
|
|
FineJOptionPane.showMessageDialog( |
|
|
|
|
|
|
|
DesignerContext.getDesignerFrame(), |
|
|
|
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Remote_Disconnected"), |
|
|
|
|
|
|
|
UIManager.getString("OptionPane.messageDialogTitle"), |
|
|
|
|
|
|
|
JOptionPane.ERROR_MESSAGE, |
|
|
|
|
|
|
|
UIManager.getIcon("OptionPane.errorIcon")); |
|
|
|
|
|
|
|
EnvChangeEntrance.getInstance().chooseEnv(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
status = Status.Disconnected; |
|
|
|
status = Status.Disconnected; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void showConnectionLostDialog() { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
UIUtil.invokeAndWaitIfNeeded(new Runnable() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void run() { |
|
|
|
|
|
|
|
FineJOptionPane.showMessageDialog( |
|
|
|
|
|
|
|
DesignerContext.getDesignerFrame(), |
|
|
|
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Remote_Disconnected"), |
|
|
|
|
|
|
|
UIManager.getString("OptionPane.messageDialogTitle"), |
|
|
|
|
|
|
|
JOptionPane.ERROR_MESSAGE, |
|
|
|
|
|
|
|
UIManager.getIcon("OptionPane.errorIcon")); |
|
|
|
|
|
|
|
EnvChangeEntrance.getInstance().chooseEnv(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//配置变更监听器
|
|
|
|
//配置变更监听器
|
|
|
|
private static final Emitter.Listener modifyConfig = new Emitter.Listener() { |
|
|
|
private static final Emitter.Listener modifyConfig = new Emitter.Listener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|