diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 785f3b92b8..606013ed1e 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -20,6 +20,7 @@ import com.fr.design.notification.NotificationCenter; import com.fr.design.utils.DesignUtils; import com.fr.design.versioncheck.VersionCheckUtils; import com.fr.env.EnvListPane; +import com.fr.env.HelpLink; import com.fr.env.handler.RemoteDesignExceptionHandler; import com.fr.exit.DesignerExiter; import com.fr.general.GeneralUtils; @@ -139,6 +140,7 @@ public class EnvChangeEntrance { pluginErrorRemind(); } catch (Exception exception) { // 失败的处理 + HelpLink.setConnectionInfo(connectionInfo); RemoteDesignExceptionHandler.getInstance().handleInSwitch(exception, selectedEnv); return false; } diff --git a/designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java b/designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java index b487714f91..b9854c6bcd 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java +++ b/designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java @@ -44,6 +44,7 @@ public class UIDetailErrorLinkDialog extends UIDialog { private static final int GAP_10 = 10; private static final String TAG_A_START = ""; private static final String TAG_A_END = ""; + private static final double SCALE = 1.2; private final Dimension dimension = new Dimension(300, 180); @@ -99,6 +100,7 @@ public class UIDetailErrorLinkDialog extends UIDialog { this.getContentPane().add(actionPane, BorderLayout.SOUTH); this.setSize(dimension); this.setResizable(false); + this.setModal(true); GUICoreUtils.centerWindow(this); } @@ -139,11 +141,21 @@ public class UIDetailErrorLinkDialog extends UIDialog { UILabel solutionLabel = new UILabel(solution); panel.add(solutionLabel, BorderLayout.CENTER); } - dimension.width = Math.max(maxWidth, GraphHelper.getWidth(solution, DesignUtils.getDefaultGUIFont())); + dimension.width = getMaxDimensionWidth(maxWidth, solution); return panel; } + private int getMaxDimensionWidth(int width, String solution) { + int maxWidth = GraphHelper.getWidth(solution, DesignUtils.getDefaultGUIFont()); + if (maxWidth >= width) { + maxWidth = (int) (SCALE * maxWidth); + } else { + maxWidth = width; + } + return maxWidth; + } + @Override public void checkValid() throws Exception { // do nothing diff --git a/designer-base/src/main/java/com/fr/env/HelpLink.java b/designer-base/src/main/java/com/fr/env/HelpLink.java index 87975761f9..dda75a9247 100644 --- a/designer-base/src/main/java/com/fr/env/HelpLink.java +++ b/designer-base/src/main/java/com/fr/env/HelpLink.java @@ -5,28 +5,36 @@ import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleMark; import com.fr.locale.InterProviderFactory; +import com.fr.workspace.connect.WorkspaceConnectionInfo; import java.util.HashMap; import java.util.Map; /** + * 错误提示中的跳转链接管理 + * * @author hades * @version 10.0 * Created by hades on 2021/8/9 */ public class HelpLink { + private static WorkspaceConnectionInfo connectionInfo; + public static String getLink(String solution) { Map map = new HashMap<>(); String currentName = DesignerEnvManager.getEnvManager().getCurEnvName(); DesignerWorkspaceInfo workspaceInfo = DesignerEnvManager.getEnvManager().getWorkspaceInfo(currentName); LocaleMark linkMark = LocaleCenter.getMark(RemoteDesignLocaleMark.class); String link = linkMark.getValue(); - map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Change_PassWord"), workspaceInfo.getConnection().getUrl() + RemoteWorkspaceURL.SYSTEM_LOGIN_PATH); + String url = connectionInfo == null ? workspaceInfo.getConnection().getUrl() : connectionInfo.getUrl(); + map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Change_PassWord"), url + RemoteWorkspaceURL.SYSTEM_LOGIN_PATH); map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Cert_Error_Solution"), link); map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Connection_Unknown_Error_Solution"), link); map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_NetWork_Connection_Error_Solution"), link); return map.get(solution); } - + public static void setConnectionInfo(WorkspaceConnectionInfo connectionInfo) { + HelpLink.connectionInfo = connectionInfo; + } } diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 1ea909ccca..6d34cd7c07 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -596,6 +596,7 @@ public class RemoteEnvPane extends BasicBeanPane { } } catch (Exception e) { dialog.dispose(); + HelpLink.setConnectionInfo(connection); RemoteDesignExceptionHandler.getInstance().handleInTest(e); } dialogDownPane.remove(cancelButton); diff --git a/designer-base/src/main/java/com/fr/env/handler/impl/CancelHandler.java b/designer-base/src/main/java/com/fr/env/handler/impl/CancelHandler.java index 28b324def0..dc36cb4db9 100644 --- a/designer-base/src/main/java/com/fr/env/handler/impl/CancelHandler.java +++ b/designer-base/src/main/java/com/fr/env/handler/impl/CancelHandler.java @@ -5,6 +5,8 @@ import com.fr.env.handler.ResultWrapper; import java.util.concurrent.CancellationException; /** + * 取消测试连接时的处理器 + * * @author hades * @version 10.0 * Created by hades on 2021/8/5 diff --git a/designer-base/src/main/java/com/fr/env/handler/impl/CommonHandler.java b/designer-base/src/main/java/com/fr/env/handler/impl/CommonHandler.java index 9449ba11ef..dd6a1e52e4 100644 --- a/designer-base/src/main/java/com/fr/env/handler/impl/CommonHandler.java +++ b/designer-base/src/main/java/com/fr/env/handler/impl/CommonHandler.java @@ -40,6 +40,7 @@ public class CommonHandler implements Handler { setLink(HelpLink.getLink(exceptionDescriptor.solution())). setThrowable(e).build(); detailErrorLinkDialog.setVisible(true); + HelpLink.setConnectionInfo(null); } }); }