Browse Source

REPORT-33575 远程连接启用https的环境,服务器关掉之后没有跳出切换工作目录的弹窗 && REPORT-33454 切换远程目录成功,弹窗提示切换失败

feature/big-screen
hades 4 years ago
parent
commit
df64e6e5c9
  1. 54
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  2. 3
      designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java

54
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -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()) {
showConnectionLost();
}
}
});
}
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 { showConnectionLost();
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 showConnectionLost() {
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

3
designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java

@ -136,6 +136,9 @@ public class CellWidgetCardPane extends BasicPane {
//todo //todo
} }
}); });
if (rn == null) {
return;
}
DataModify<? extends Widget> definePane = rn.getDefinePane(); DataModify<? extends Widget> definePane = rn.getDefinePane();
attriCardPane.add(definePane.toSwingComponent(), rn.getCardName()); attriCardPane.add(definePane.toSwingComponent(), rn.getCardName());
attriCardLayout.show(attriCardPane, rn.getCardName()); attriCardLayout.show(attriCardPane, rn.getCardName());

Loading…
Cancel
Save