|
|
@ -45,30 +45,8 @@ class FormApp extends AbstractAppProvider { |
|
|
|
HashMap<String, Class> classType = new HashMap<String, Class>(); |
|
|
|
HashMap<String, Class> classType = new HashMap<String, Class>(); |
|
|
|
classType.put(Constants.ARG_0, Form.class); |
|
|
|
classType.put(Constants.ARG_0, Form.class); |
|
|
|
classType.put(Constants.ARG_1, FILE.class); |
|
|
|
classType.put(Constants.ARG_1, FILE.class); |
|
|
|
classType.put(Constants.ARG_2, Parameter[].class); |
|
|
|
|
|
|
|
JForm emptyForm = new JForm(new Form(new WBorderLayout("form")), tplFile); |
|
|
|
|
|
|
|
OpenWorker<OpenResult<Form, Parameter[]>> worker = new OpenWorker<>( |
|
|
|
|
|
|
|
new Callable<OpenResult<Form, Parameter[]>>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public OpenResult<Form, Parameter[]> call() throws Exception { |
|
|
|
|
|
|
|
Form form = asIOFile(tplFile); |
|
|
|
|
|
|
|
return new OpenResult<>(form, form.getParameters()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, emptyForm); |
|
|
|
|
|
|
|
worker.addCallBack(new Callable<JTemplate<?, ?>>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public JTemplate<?, ?> call() throws Exception { |
|
|
|
|
|
|
|
OpenResult<Form, Parameter[]> result = worker.getResult(); |
|
|
|
|
|
|
|
return compatibleForm(result.getBaseBook(), result.getRef(), tplFile, classType); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", tplFile.getName()) + "..."); |
|
|
|
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", tplFile.getName()) + "..."); |
|
|
|
worker.start(tplFile.getPath()); |
|
|
|
return compatibleForm(tplFile, classType); |
|
|
|
OpenResult<Form, Parameter[]> result = worker.getResult(); |
|
|
|
|
|
|
|
if (result != null) { |
|
|
|
|
|
|
|
return compatibleForm(result.getBaseBook(), new Parameter[0], tplFile, classType); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return emptyForm; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -76,13 +54,36 @@ class FormApp extends AbstractAppProvider { |
|
|
|
* |
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private JTemplate<Form, ?> compatibleForm(Form form, Parameter[] parameters, FILE tplFile, HashMap<String, Class> classType) { |
|
|
|
private JTemplate<Form, ?> compatibleForm(FILE tplFile, HashMap<String, Class> classType) { |
|
|
|
if (ComparatorUtils.equals(StableFactory.getRegisteredClass(BaseJForm.XML_TAG).getName(), JForm.class)) { |
|
|
|
if (ComparatorUtils.equals(StableFactory.getRegisteredClass(BaseJForm.XML_TAG), JForm.class)) { |
|
|
|
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, |
|
|
|
classType.put(Constants.ARG_2, Parameter[].class); |
|
|
|
new Object[]{form, tplFile, parameters}, classType, BaseJForm.class); |
|
|
|
JForm emptyForm = new JForm(new Form(new WBorderLayout("form")), tplFile); |
|
|
|
|
|
|
|
OpenWorker<OpenResult<Form, Parameter[]>> worker = new OpenWorker<>( |
|
|
|
|
|
|
|
new Callable<OpenResult<Form, Parameter[]>>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public OpenResult<Form, Parameter[]> call() throws Exception { |
|
|
|
|
|
|
|
Form form = asIOFile(tplFile); |
|
|
|
|
|
|
|
return new OpenResult<>(form, form.getParameters()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, emptyForm); |
|
|
|
|
|
|
|
worker.addCallBack(new Callable<JTemplate<?, ?>>() { |
|
|
|
|
|
|
|
@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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
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 emptyForm; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, |
|
|
|
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, |
|
|
|
new Object[]{form, tplFile}, classType, BaseJForm.class); |
|
|
|
new Object[]{asIOFile(tplFile), tplFile}, classType, BaseJForm.class); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|