|
|
|
@ -10,6 +10,7 @@ import com.fr.design.mainframe.BaseJForm;
|
|
|
|
|
import com.fr.design.mainframe.DecodeDialog; |
|
|
|
|
import com.fr.design.mainframe.JForm; |
|
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
|
import com.fr.design.mainframe.TemplateLockedHandler; |
|
|
|
|
import com.fr.design.worker.open.OpenResult; |
|
|
|
|
import com.fr.design.worker.open.OpenWorker; |
|
|
|
|
import com.fr.exception.DecryptTemplateException; |
|
|
|
@ -18,6 +19,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 +59,33 @@ class FormApp extends AbstractAppProvider {
|
|
|
|
|
@Override |
|
|
|
|
public JTemplate<?, ?> call() throws Exception { |
|
|
|
|
OpenResult<Form, Parameter[]> result = worker.getResult(); |
|
|
|
|
return (JTemplate<Form, ?>) 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<Form, Parameter[]> result = worker.getResult(); |
|
|
|
|
if (result != null) { |
|
|
|
|
return (JTemplate<Form, ?>) 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<Form, ?> compatibleForm(Form form, Parameter[] parameters, FILE tplFile, HashMap<String, Class> classType) { |
|
|
|
|
if (ComparatorUtils.equals(StableFactory.getRegisteredClass(BaseJForm.XML_TAG).getName(), JForm.class)) { |
|
|
|
|
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, |
|
|
|
|
new Object[]{form, tplFile, parameters}, classType, BaseJForm.class); |
|
|
|
|
} else { |
|
|
|
|
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, |
|
|
|
|
new Object[]{form, tplFile}, classType, BaseJForm.class); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Form asIOFile(FILE file) { |
|
|
|
|
|
|
|
|
@ -92,6 +107,7 @@ class FormApp extends AbstractAppProvider {
|
|
|
|
|
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp); |
|
|
|
|
} catch (TplLockedException exp) { |
|
|
|
|
FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); |
|
|
|
|
TemplateLockedHandler.generateTipAndRefresh(); |
|
|
|
|
} catch (Exception exp) { |
|
|
|
|
FineLoggerFactory.getLogger().error("Failed to generate frm from " + file, exp); |
|
|
|
|
return null; |
|
|
|
|