Browse Source

REPORT-56047 设计器11.0适配内容处理 同步到10.0

zheng-1641779399395
hades 3 years ago
parent
commit
2607d356b9
  1. 6
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 27
      designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  3. 4
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  4. 25
      designer-base/src/main/java/com/fr/env/handler/WorkspaceExceptionHandler.java
  5. 1
      designer-base/src/main/resources/com/fr/env/jarVersion.properties
  6. 1
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

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.versioncheck.VersionCheckUtils;
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.general.GeneralUtils;
import com.fr.invoke.Reflect;
@ -139,7 +139,7 @@ public class EnvChangeEntrance {
pluginErrorRemind();
} catch (Exception exception) {
// 失败的处理
RemoteDesignExceptionHandler.getInstance().handleInSwitch(exception, selectedEnv);
WorkspaceExceptionHandler.getInstance().handleInSwitch(exception, selectedEnv);
return false;
}
TemplateTreePane.getInstance().refreshDockingView();
@ -436,7 +436,7 @@ public class EnvChangeEntrance {
}
});
if (e != null) {
RemoteDesignExceptionHandler.getInstance().handleInStart(e, workspaceInfo);
WorkspaceExceptionHandler.getInstance().handleInStart(e, workspaceInfo);
}
envListDialog.setVisible(true);
}

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

@ -1,18 +1,37 @@
package com.fr.design.env;
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.project.ProjectConstants;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.exception.MainVersionNotMatchException;
import java.io.File;
import java.util.Properties;
/**
* Created by juhaoyu on 2018/6/15.
*/
public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
private static final String REPORT_ENGINE_KEY = "report-engine-key";
private static final String REPORT_ENGINE_JAR;
private static final String PROP_PATH = "/com/fr/env/jarVersion.properties";
static {
Properties properties = new Properties();
try {
properties.load(LocalDesignerWorkspaceInfo.class.getResourceAsStream(PROP_PATH));
} catch (Exception ignored) {
}
REPORT_ENGINE_JAR = properties.getProperty(REPORT_ENGINE_KEY, "default.jar");
}
private String name;
private String path;
@ -86,6 +105,14 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
return false;
}
File engineLib = new File(StableUtils.pathJoin(this.path, 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;
}
}

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.TableLayoutHelper;
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.third.guava.base.Strings;
import com.fr.workspace.WorkContext;
@ -596,7 +596,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
}
} catch (Exception e) {
dialog.dispose();
RemoteDesignExceptionHandler.getInstance().handleInTest(e, remoteEnv);
WorkspaceExceptionHandler.getInstance().handleInTest(e, remoteEnv);
}
dialogDownPane.remove(cancelButton);
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;
import com.fr.base.exception.ExceptionDescriptor;
import com.fr.design.EnvChangeEntrance;
import com.fr.design.dialog.FineJOptionPane;
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.UnexpectedHandler;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import java.util.ArrayList;
import java.util.List;
import javax.swing.UIManager;
@ -23,11 +25,11 @@ import static javax.swing.JOptionPane.ERROR_MESSAGE;
* @version 10.0
* 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;
}
@ -35,7 +37,7 @@ public class RemoteDesignExceptionHandler {
private final List<Handler<RefWrapper, ResultWrapper>> switchList = new ArrayList<>();
private RemoteDesignExceptionHandler() {
private WorkspaceExceptionHandler() {
// 要保证顺序
testList.add(new CancelHandler());
testList.add(new ExecutionHandler());
@ -65,11 +67,15 @@ public class RemoteDesignExceptionHandler {
public void handleInSwitch(Throwable e, DesignerWorkspaceInfo workspaceInfo) {
if (workspaceInfo == null || workspaceInfo.getType() == DesignerWorkspaceType.Local) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(EnvChangeEntrance.getInstance().getDialog(),
Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon"));
if (e instanceof ExceptionDescriptor) {
new CommonHandler(true).handle(new RefWrapper(e, StringUtils.EMPTY));
} else {
FineJOptionPane.showMessageDialog(EnvChangeEntrance.getInstance().getDialog(),
Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon"));
}
return;
}
handle(e, switchList, workspaceInfo);
@ -78,6 +84,7 @@ public class RemoteDesignExceptionHandler {
public void handleInStart(Throwable e, DesignerWorkspaceInfo workspaceInfo) {
if (workspaceInfo == null || workspaceInfo.getType() == DesignerWorkspaceType.Local) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
new CommonHandler(false).handle(new RefWrapper(e, StringUtils.EMPTY));
return;
}
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-10.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.LocalDesignerWorkspaceInfo;
import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.env.handler.RemoteDesignExceptionHandler;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;

Loading…
Cancel
Save