diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java index 05454fcbe8..02692c991c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java @@ -18,6 +18,7 @@ import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.form.main.Form; import com.fr.form.ui.container.WBorderLayout; +import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.bridge.StableFactory; @@ -57,20 +58,33 @@ class FormApp extends AbstractAppProvider { @Override public JTemplate call() throws Exception { OpenResult result = worker.getResult(); - return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, - new Object[]{result.getBaseBook(), tplFile, result.getRef()}, classType, BaseJForm.class); + return compatibleForm(result.getBaseBook(), result.getRef(), tplFile, classType); } }); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", tplFile.getName()) + "..."); worker.start(tplFile.getPath()); OpenResult result = worker.getResult(); if (result != null) { - return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, - new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class); + return compatibleForm(result.getBaseBook(), new Parameter[0], tplFile, classType); } return emptyForm; } + /** + * 兼容外部注册的frm类型 + * + * @return + */ + private JTemplate compatibleForm(Form form, Parameter[] parameters, FILE tplFile, HashMap classType) { + if (ComparatorUtils.equals(StableFactory.getRegisteredClass(BaseJForm.XML_TAG).getName(), JForm.class)) { + return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, + new Object[]{form, tplFile, parameters}, classType, BaseJForm.class); + } else { + return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, + new Object[]{form, tplFile}, classType, BaseJForm.class); + } + } + @Override public Form asIOFile(FILE file) {