Browse Source

Pull request #6412: REPORT-57521 远程设计时websocket断开情况下的提示优化

Merge in DESIGN/design from ~FANGLEI/design10.0:release/11.0 to release/11.0

* commit '340700014bc3c7f5bf8f7837c51a703e97f75316':
  REPORT-57521 突然发现已经有关于websocket帮助文档的地址了
  REPORT-60538 还原改动
  REPORT-60538 还原改动
  REPORT-60538 还原改动
  REPORT-57521 远程设计时websocket断开情况下的提示优化
  REPORT-60538
  REPORT-60538 英日韩环境未屏蔽在线组件库
bugfix/11.0
fanglei 3 years ago
parent
commit
75e0e258ed
  1. 20
      designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java
  2. 9
      designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java
  3. 58
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

20
designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java

@ -6,17 +6,17 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.stable.Constants;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JEditorPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Window;
/**
* Created by kerry on 5/6/21
@ -31,6 +31,13 @@ public class DesignerToastMsgUtil {
}
public static ToastMsgDialog createPromptDialog(String text) {
return createDialog(PROMPT_ICON, toastPane(text), DesignerContext.getDesignerFrame());
}
public static ToastMsgDialog createPromptDialog(JPanel contentPane) {
return createDialog(PROMPT_ICON, contentPane, DesignerContext.getDesignerFrame());
}
public static void toastPrompt(JPanel contendPane) {
toastPane(PROMPT_ICON, contendPane, DesignerContext.getDesignerFrame());
@ -69,6 +76,11 @@ public class DesignerToastMsgUtil {
}
private static void toastPane(Icon icon, JPanel contendPane, Window parent) {
ToastMsgDialog dialog = createDialog(icon, contendPane, parent);
dialog.setVisible(true);
}
private static ToastMsgDialog createDialog(Icon icon, JPanel contendPane, Window parent) {
JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel uiLabel = new UILabel(icon);
uiLabel.setVerticalAlignment(SwingConstants.TOP);
@ -83,7 +95,7 @@ public class DesignerToastMsgUtil {
} else {
dialog = new ToastMsgDialog((Frame) parent, pane);
}
dialog.setVisible(true);
return dialog;
}

9
designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java

@ -5,8 +5,8 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.mainframe.DesignerContext;
import com.fr.module.ModuleContext;
import java.awt.Dialog;
import javax.swing.JPanel;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Point;
@ -24,6 +24,7 @@ public class ToastMsgDialog extends UIDialog {
private ScheduledExecutorService TIMER;
private int hide_height = 0;
private JPanel contentPane;
private boolean show = false;
public ToastMsgDialog(Frame parent, JPanel panel) {
super(parent);
@ -65,6 +66,7 @@ public class ToastMsgDialog extends UIDialog {
public void display(JPanel outerJPanel) {
show = true;
outerJPanel.setLocation(0, -hide_height);
ScheduledExecutorService TIP_TOOL_TIMER = createToastScheduleExecutorService();
TIP_TOOL_TIMER.scheduleAtFixedRate(new Runnable() {
@ -98,6 +100,7 @@ public class ToastMsgDialog extends UIDialog {
TIP_TOOL_TIMER.shutdown();
ToastMsgDialog.this.setVisible(false);
ToastMsgDialog.this.dispose();
ToastMsgDialog.this.show = false;
}
outerJPanel.setLocation(point.x, point.y - 5);
Dimension dimension = ToastMsgDialog.this.getSize();
@ -159,5 +162,7 @@ public class ToastMsgDialog extends UIDialog {
super.dispose();
}
public boolean isShow() {
return show;
}
}

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

@ -3,15 +3,19 @@ package com.fr.design.mainframe.socketio;
import com.fr.config.RemoteConfigEvent;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.DesignerEnvManager;
import com.fr.design.EnvChangeEntrance;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceInfoContext;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.loghandler.DesignerLogger;
import com.fr.design.mainframe.share.ui.base.MouseClickListener;
import com.fr.design.mainframe.toast.DesignerToastMsgUtil;
import com.fr.design.mainframe.toast.ToastMsgDialog;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.BrowseUtils;
import com.fr.event.EventDispatcher;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.report.RemoteDesignConstants;
@ -29,20 +33,24 @@ import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceConstants;
import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.server.socket.SocketInfoOperator;
import io.socket.client.IO;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
import javax.net.ssl.SSLContext;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileInputStream;
import java.security.KeyStore;
import java.util.Arrays;
import javax.net.ssl.SSLContext;
import javax.swing.*;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.security.KeyStore;
import java.util.Arrays;
import java.util.Timer;
import java.util.TimerTask;
@ -54,6 +62,7 @@ public class DesignerSocketIO {
Disconnecting
}
private static final String WEBSOCKET_HELP_DOC = CloudCenter.getInstance().acquireUrlByKind("websocketConnect", "https://help.fanruan.com/finereport/doc-view-2512.html");
private static final String HTTPS = "https";
private static final String HTTP = "http";
private static Socket socket = null;
@ -66,6 +75,7 @@ public class DesignerSocketIO {
private static int count;
// 当前webSocket选择的协议
private static String currentProtocol;
private static ToastMsgDialog dialog = null;
public static void close() {
@ -185,6 +195,7 @@ public class DesignerSocketIO {
private static final Emitter.Listener failRetry = new Emitter.Listener() {
@Override
public void call(Object... args) {
showConnectionLostDialog();
printLog(args, PrintEventLogImpl.WARN, "failed args: {}");
status = Status.Disconnecting;
socket.close();
@ -251,13 +262,13 @@ public class DesignerSocketIO {
UIUtil.invokeLaterIfNeeded(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();
if (dialog == null) {
dialog = DesignerToastMsgUtil.createPromptDialog(createDialogContent());
}
if (!dialog.isShow()) {
dialog.setVisible(true);
}
}
});
} catch (Exception e) {
@ -265,6 +276,23 @@ public class DesignerSocketIO {
}
}
private static JPanel createDialogContent() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_WebSocket_Lost_Tip")), BorderLayout.WEST);
UILabel hyperLinkLabel = new UILabel(Toolkit.i18nText("Fine-Design_WebSocket_Lost_Tip_HyperLink_Text"));
hyperLinkLabel.addMouseListener(new MouseClickListener() {
@Override
public void mouseClicked(MouseEvent e) {
BrowseUtils.browser(WEBSOCKET_HELP_DOC);
}
});
hyperLinkLabel.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0));
hyperLinkLabel.setForeground(Color.BLUE);
hyperLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
jPanel.add(hyperLinkLabel, BorderLayout.CENTER);
return jPanel;
}
//配置变更监听器
private static final Emitter.Listener modifyConfig = new Emitter.Listener() {
@Override

Loading…
Cancel
Save