|
|
|
@ -58,36 +58,31 @@ class FormApp extends AbstractAppProvider {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private JTemplate<Form, ?> compatibleForm(FILE tplFile, HashMap<String, Class> classType) { |
|
|
|
|
if (ComparatorUtils.equals(StableFactory.getRegisteredClass(BaseJForm.XML_TAG), JForm.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 = getForm(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) { |
|
|
|
|
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 = getForm(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, new Parameter[0]}, classType, BaseJForm.class); |
|
|
|
|
new Object[]{result.getBaseBook(), tplFile, result.getRef()}, classType, BaseJForm.class); |
|
|
|
|
} |
|
|
|
|
return emptyForm; |
|
|
|
|
} else { |
|
|
|
|
}); |
|
|
|
|
worker.start(tplFile.getPath()); |
|
|
|
|
OpenResult<Form, Parameter[]> result = worker.getResult(); |
|
|
|
|
if (result != null) { |
|
|
|
|
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, |
|
|
|
|
new Object[]{getForm(tplFile), tplFile}, classType, BaseJForm.class); |
|
|
|
|
new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class); |
|
|
|
|
} |
|
|
|
|
return emptyForm; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
|