Browse Source

Pull request #5465: REPORT-56047 设计器11.0适配内容处理

Merge in DESIGN/design from ~HADES/design:feature/x to feature/x

* commit 'f02d2387592cbf6010681a8b84db6ea1343d1d87':
  无jira 回退调试信息
  REPORT-56047 设计器11.0适配内容处理
research/11.0
Hades 3 years ago
parent
commit
159b3eaec6
  1. 21
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 6
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 26
      designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  4. 4
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  5. 25
      designer-base/src/main/java/com/fr/env/handler/WorkspaceExceptionHandler.java
  6. 1
      designer-base/src/main/resources/com/fr/env/jarVersion.properties
  7. 1
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

21
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -87,6 +87,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static final int MAX_SHOW_NUM = 10; private static final int MAX_SHOW_NUM = 10;
private static final String VERSION_80 = "80"; private static final String VERSION_80 = "80";
private static final String VERSION_90 = "90";
private static final String VERSION100 = "100";
private static final int CACHINGTEMPLATE_LIMIT = 5; private static final int CACHINGTEMPLATE_LIMIT = 5;
private static final String WEB_NAME = "webapps"; private static final String WEB_NAME = "webapps";
/** /**
@ -354,14 +356,21 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
try { try {
fileWriter = new FileWriter(envFile); fileWriter = new FileWriter(envFile);
File oldEnvFile = new File(ProductConstants.getEnvHome() + File.separator + ProductConstants.APP_NAME + "6-1" + "Env.xml"); File oldEnvFile = new File(ProductConstants.getEnvHome() + File.separator + ProductConstants.APP_NAME + "6-1" + "Env.xml");
File envFile80 = new File(getEnvHome(VERSION_80) + File.separator + getEnvFile().getName()); File envFile80 = getOldEnvFile(VERSION_80);
if (oldEnvFile.exists()) { File envFile90 = getOldEnvFile(VERSION_90);
File envFile100 = getOldEnvFile(VERSION100);
// 从10.0往前递进是否存在更老版本的配置文件
if (envFile100.exists()) {
compatibilityPrevVersion(envFile90);
} else if (envFile90.exists()) {
compatibilityPrevVersion(envFile90);
} else if (envFile80.exists()) {
compatibilityPrevVersion(envFile80);
} else if (oldEnvFile.exists()) {
// marks:兼容DesignerEnv6-1.xml // marks:兼容DesignerEnv6-1.xml
FileReader fileReader = new FileReader(oldEnvFile); FileReader fileReader = new FileReader(oldEnvFile);
Utils.copyCharTo(fileReader, fileWriter); Utils.copyCharTo(fileReader, fileWriter);
fileReader.close(); fileReader.close();
} else if (envFile80.exists()) {
compatibilityPrevVersion(envFile80);
} else { } else {
// marks:生成一个新的xml文件 // marks:生成一个新的xml文件
StringReader stringReader = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\" ?><Env></Env>"); StringReader stringReader = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\" ?><Env></Env>");
@ -383,6 +392,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
} }
private File getOldEnvFile(String version) {
return new File(getEnvHome(version) + File.separator + getEnvFile().getName());
}
private static String getEnvHome(String version) { private static String getEnvHome(String version) {
String userHome = System.getProperty("user.home"); String userHome = System.getProperty("user.home");
if (userHome == null) { if (userHome == null) {

6
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -20,7 +20,7 @@ import com.fr.design.notification.NotificationCenter;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.versioncheck.VersionCheckUtils; import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.env.EnvListPane; import com.fr.env.EnvListPane;
import com.fr.env.handler.RemoteDesignExceptionHandler; import com.fr.env.handler.WorkspaceExceptionHandler;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
@ -139,7 +139,7 @@ public class EnvChangeEntrance {
pluginErrorRemind(); pluginErrorRemind();
} catch (Exception exception) { } catch (Exception exception) {
// 失败的处理 // 失败的处理
RemoteDesignExceptionHandler.getInstance().handleInSwitch(exception, selectedEnv); WorkspaceExceptionHandler.getInstance().handleInSwitch(exception, selectedEnv);
return false; return false;
} }
TemplateTreePane.getInstance().refreshDockingView(); TemplateTreePane.getInstance().refreshDockingView();
@ -436,7 +436,7 @@ public class EnvChangeEntrance {
} }
}); });
if (e != null) { if (e != null) {
RemoteDesignExceptionHandler.getInstance().handleInStart(e, workspaceInfo); WorkspaceExceptionHandler.getInstance().handleInStart(e, workspaceInfo);
} }
envListDialog.setVisible(true); envListDialog.setVisible(true);
} }

26
designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java vendored

@ -1,18 +1,36 @@
package com.fr.design.env; package com.fr.design.env;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.exception.MainVersionNotMatchException;
import java.io.File; import java.io.File;
import java.util.Properties;
/** /**
* Created by juhaoyu on 2018/6/15. * Created by juhaoyu on 2018/6/15.
*/ */
public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo { public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
private static final String REPORT_ENGINE_KEY = "report-engine-key";
private static final String REPORT_ENGINE_JAR;
static {
Properties properties = new Properties();
try {
properties.load(LocalDesignerWorkspaceInfo.class.getResourceAsStream(""));
} catch (Exception ignored) {
}
REPORT_ENGINE_JAR = properties.getProperty(REPORT_ENGINE_KEY, "default.jar");
}
private String name; private String name;
private String path; private String path;
@ -86,7 +104,13 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
return false; return false;
} }
File engineLib = new File(StableUtils.pathJoin(ProjectConstants.LIB_NAME, REPORT_ENGINE_JAR));
// 非安装版本允许自由切换
boolean notExistLib = !ComparatorUtils.equals(GeneralUtils.readFullBuildNO(), InterProviderFactory.getProvider().getLocText("Fine-Core_Basic_About_No_Build"))
&& !engineLib.exists();
if (notExistLib) {
throw new MainVersionNotMatchException();
}
return true; return true;
} }

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

@ -21,7 +21,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.scrollruler.ModLineBorder;
import com.fr.env.handler.RemoteDesignExceptionHandler; import com.fr.env.handler.WorkspaceExceptionHandler;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.guava.base.Strings; import com.fr.third.guava.base.Strings;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -596,7 +596,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
} }
} catch (Exception e) { } catch (Exception e) {
dialog.dispose(); dialog.dispose();
RemoteDesignExceptionHandler.getInstance().handleInTest(e, remoteEnv); WorkspaceExceptionHandler.getInstance().handleInTest(e, remoteEnv);
} }
dialogDownPane.remove(cancelButton); dialogDownPane.remove(cancelButton);
dialogDownPane.revalidate(); dialogDownPane.revalidate();

25
designer-base/src/main/java/com/fr/env/handler/RemoteDesignExceptionHandler.java → designer-base/src/main/java/com/fr/env/handler/WorkspaceExceptionHandler.java vendored

@ -1,5 +1,6 @@
package com.fr.env.handler; package com.fr.env.handler;
import com.fr.base.exception.ExceptionDescriptor;
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.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
@ -11,6 +12,7 @@ import com.fr.env.handler.impl.CommonHandler;
import com.fr.env.handler.impl.ExecutionHandler; import com.fr.env.handler.impl.ExecutionHandler;
import com.fr.env.handler.impl.UnexpectedHandler; import com.fr.env.handler.impl.UnexpectedHandler;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.UIManager; import javax.swing.UIManager;
@ -23,11 +25,11 @@ import static javax.swing.JOptionPane.ERROR_MESSAGE;
* @version 10.0 * @version 10.0
* Created by hades on 2021/8/5 * Created by hades on 2021/8/5
*/ */
public class RemoteDesignExceptionHandler { public class WorkspaceExceptionHandler {
private static final RemoteDesignExceptionHandler INSTANCE = new RemoteDesignExceptionHandler(); private static final WorkspaceExceptionHandler INSTANCE = new WorkspaceExceptionHandler();
public static RemoteDesignExceptionHandler getInstance() { public static WorkspaceExceptionHandler getInstance() {
return INSTANCE; return INSTANCE;
} }
@ -35,7 +37,7 @@ public class RemoteDesignExceptionHandler {
private final List<Handler<RefWrapper, ResultWrapper>> switchList = new ArrayList<>(); private final List<Handler<RefWrapper, ResultWrapper>> switchList = new ArrayList<>();
private RemoteDesignExceptionHandler() { private WorkspaceExceptionHandler() {
// 要保证顺序 // 要保证顺序
testList.add(new CancelHandler()); testList.add(new CancelHandler());
testList.add(new ExecutionHandler()); testList.add(new ExecutionHandler());
@ -65,11 +67,15 @@ public class RemoteDesignExceptionHandler {
public void handleInSwitch(Throwable e, DesignerWorkspaceInfo workspaceInfo) { public void handleInSwitch(Throwable e, DesignerWorkspaceInfo workspaceInfo) {
if (workspaceInfo == null || workspaceInfo.getType() == DesignerWorkspaceType.Local) { if (workspaceInfo == null || workspaceInfo.getType() == DesignerWorkspaceType.Local) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(EnvChangeEntrance.getInstance().getDialog(), if (e instanceof ExceptionDescriptor) {
Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), new CommonHandler(true).handle(new RefWrapper(e, StringUtils.EMPTY));
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), } else {
ERROR_MESSAGE, FineJOptionPane.showMessageDialog(EnvChangeEntrance.getInstance().getDialog(),
UIManager.getIcon("OptionPane.errorIcon")); Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon"));
}
return; return;
} }
handle(e, switchList, workspaceInfo); handle(e, switchList, workspaceInfo);
@ -78,6 +84,7 @@ public class RemoteDesignExceptionHandler {
public void handleInStart(Throwable e, DesignerWorkspaceInfo workspaceInfo) { public void handleInStart(Throwable e, DesignerWorkspaceInfo workspaceInfo) {
if (workspaceInfo == null || workspaceInfo.getType() == DesignerWorkspaceType.Local) { if (workspaceInfo == null || workspaceInfo.getType() == DesignerWorkspaceType.Local) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
new CommonHandler(false).handle(new RefWrapper(e, StringUtils.EMPTY));
return; return;
} }
handle(e, testList, workspaceInfo); handle(e, testList, workspaceInfo);

1
designer-base/src/main/resources/com/fr/env/jarVersion.properties vendored

@ -0,0 +1 @@
report-engine-key=fine-report-engine-11.0.jar

1
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

@ -9,7 +9,6 @@ import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.versioncheck.VersionCheckUtils; import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.env.handler.RemoteDesignExceptionHandler;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;

Loading…
Cancel
Save