From 0f4e9ca654a5b6754540b1a25fe2cb4a21e2e1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 22 Oct 2021 17:28:09 +0800 Subject: [PATCH 1/7] =?UTF-8?q?REPORT-60538=20=E8=8B=B1=E6=97=A5=E9=9F=A9?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=9C=AA=E5=B1=8F=E8=94=BD=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/FormWidgetDetailPane.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index f2268c86cf..fd5b7305cb 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ilable.UILabel; @@ -10,6 +11,7 @@ import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; +import com.fr.general.GeneralContext; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -23,6 +25,7 @@ import java.awt.Dimension; import java.awt.FlowLayout; import java.util.ArrayList; import java.util.List; +import java.util.Locale; /** * Created with IntelliJ IDEA. @@ -173,7 +176,14 @@ public class FormWidgetDetailPane extends FormDockView{ private void initPaneList() { paneList = new ArrayList<>(); paneList.add(LocalWidgetRepoPane.getInstance()); - paneList.add(OnlineWidgetRepoPane.getInstance()); + if (isAddOnlineWidgetRepoPane()) { + paneList.add(OnlineWidgetRepoPane.getInstance()); + } + } + + private boolean isAddOnlineWidgetRepoPane() { + Locale locale = DesignerEnvManager.getEnvManager().getLanguage(); + return locale != null && GeneralContext.isChineseEnv(); } } From 02c5a3cacf9ab597cdc69606dfcf05d6eac466e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 22 Oct 2021 17:33:41 +0800 Subject: [PATCH 2/7] REPORT-60538 --- .../com/fr/design/mainframe/FormWidgetDetailPane.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index fd5b7305cb..da14659b66 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; -import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ilable.UILabel; @@ -25,7 +24,6 @@ import java.awt.Dimension; import java.awt.FlowLayout; import java.util.ArrayList; import java.util.List; -import java.util.Locale; /** * Created with IntelliJ IDEA. @@ -176,14 +174,8 @@ public class FormWidgetDetailPane extends FormDockView{ private void initPaneList() { paneList = new ArrayList<>(); paneList.add(LocalWidgetRepoPane.getInstance()); - if (isAddOnlineWidgetRepoPane()) { + if (GeneralContext.isChineseEnv()) { paneList.add(OnlineWidgetRepoPane.getInstance()); } } - - private boolean isAddOnlineWidgetRepoPane() { - Locale locale = DesignerEnvManager.getEnvManager().getLanguage(); - return locale != null && GeneralContext.isChineseEnv(); - } - } From f9d27e98452dd8470e9f49e2306d695b591abffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 28 Oct 2021 10:17:33 +0800 Subject: [PATCH 3/7] =?UTF-8?q?REPORT-57521=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E6=97=B6websocket=E6=96=AD=E5=BC=80=E6=83=85=E5=86=B5?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/toast/DesignerToastMsgUtil.java | 20 +++++-- .../mainframe/toast/ToastMsgDialog.java | 9 ++- .../mainframe/socketio/DesignerSocketIO.java | 58 ++++++++++++++----- 3 files changed, 66 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java b/designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java index 4e69c34c56..300f8537e2 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java +++ b/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; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java index 00f4f95ead..69865c7059 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java +++ b/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; + } } 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 fba15b0432..e6c3a24fe4 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 @@ -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("help.websocket", "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 From c8eafd75e8723d738795371a0f4ea4996ac98690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 28 Oct 2021 10:19:31 +0800 Subject: [PATCH 4/7] =?UTF-8?q?REPORT-60538=20=E8=BF=98=E5=8E=9F=E6=94=B9?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/FormWidgetDetailPane.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index da14659b66..be32dc922a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -10,7 +10,6 @@ import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; -import com.fr.general.GeneralContext; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -174,8 +173,6 @@ public class FormWidgetDetailPane extends FormDockView{ private void initPaneList() { paneList = new ArrayList<>(); paneList.add(LocalWidgetRepoPane.getInstance()); - if (GeneralContext.isChineseEnv()) { - paneList.add(OnlineWidgetRepoPane.getInstance()); - } + paneList.add(OnlineWidgetRepoPane.getInstance()); } } From e3eac1175c6ec3a79255901e2dbe12365210bb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 28 Oct 2021 10:20:07 +0800 Subject: [PATCH 5/7] =?UTF-8?q?REPORT-60538=20=E8=BF=98=E5=8E=9F=E6=94=B9?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/FormWidgetDetailPane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index be32dc922a..d17071f10a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -175,4 +175,5 @@ public class FormWidgetDetailPane extends FormDockView{ paneList.add(LocalWidgetRepoPane.getInstance()); paneList.add(OnlineWidgetRepoPane.getInstance()); } + } From 5db55bd0c726286ae572b4d739775b5bf1e0a03b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 28 Oct 2021 10:22:01 +0800 Subject: [PATCH 6/7] =?UTF-8?q?REPORT-60538=20=E8=BF=98=E5=8E=9F=E6=94=B9?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/FormWidgetDetailPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index d17071f10a..a82d6d74df 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -175,5 +175,5 @@ public class FormWidgetDetailPane extends FormDockView{ paneList.add(LocalWidgetRepoPane.getInstance()); paneList.add(OnlineWidgetRepoPane.getInstance()); } - -} + +} \ No newline at end of file From 340700014bc3c7f5bf8f7837c51a703e97f75316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 28 Oct 2021 10:27:15 +0800 Subject: [PATCH 7/7] =?UTF-8?q?REPORT-57521=20=E7=AA=81=E7=84=B6=E5=8F=91?= =?UTF-8?q?=E7=8E=B0=E5=B7=B2=E7=BB=8F=E6=9C=89=E5=85=B3=E4=BA=8Ewebsocket?= =?UTF-8?q?=E5=B8=AE=E5=8A=A9=E6=96=87=E6=A1=A3=E7=9A=84=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/socketio/DesignerSocketIO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e6c3a24fe4..a6edb04083 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 @@ -62,7 +62,7 @@ public class DesignerSocketIO { Disconnecting } - private static final String WEBSOCKET_HELP_DOC = CloudCenter.getInstance().acquireUrlByKind("help.websocket", "https://help.fanruan.com/finereport/doc-view-2512.html"); + 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;