Browse Source

REPORT-13074 远程设计向下兼容

1. 补充一些注释。
bugfix/10.0
Harrison 6 years ago
parent
commit
1380b31b64
  1. 4
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  2. 31
      designer-base/src/main/java/com/fr/env/TestConnectionResult.java

4
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -541,7 +541,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
if (result == TestConnectionResult.Partly_Sucess) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon"));
}
if (result == TestConnectionResult.Fully_Failed) {
@ -557,8 +557,6 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
FineLoggerFactory.getLogger().error(e, e.getMessage());
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
dialogDownPane.remove(cancelButton);
dialogDownPane.revalidate();

31
designer-base/src/main/java/com/fr/env/TestConnectionResult.java vendored

@ -1,41 +1,40 @@
package com.fr.env;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
/**
* 测试连接的结果
* 不改变原有逻辑的情况下加入一层转化
* 根据这里的转化结果判断需要提示哪些内容
*
* created by Harrison on 2018/12/20
**/
public enum TestConnectionResult {
/**
* 完全成功, 版本匹配测试连接成功
*/
Fully_Success(0),
Fully_Success,
/**
* 不完全成功版本不匹配但测试连接成功
*/
Partly_Sucess(1),
Partly_Sucess,
/**
* 完全失败直接没连上
*/
Fully_Failed(2),
Fully_Failed,
/**
* 验证 Token 失败
*/
Auth_Failed(3);
Auth_Failed;
private int sign;
TestConnectionResult(int i) {
this.sign = i;
}
public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) throws Exception {
public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) {
if (value == null) {
return Auth_Failed;
}
@ -43,13 +42,21 @@ public enum TestConnectionResult {
if (!value) {
return Fully_Failed;
}
try {
String serverVersion = new FunctionalHttpRequest(info).getServerVersion();
if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) {
return Fully_Success;
}
return Partly_Sucess;
} catch (Exception e) {
// 发生异常,说明没连接上。返回完全失败。
FineLoggerFactory.getLogger().error(e.getMessage());
return Fully_Failed;
}
}
}

Loading…
Cancel
Save