use of com.servoy.j2db.FormController.RuntimeSupportScriptProviders in project servoy-client by Servoy.
the class FormScope method updateProviderswithCopy.
public void updateProviderswithCopy(Form originalForm, Form copyForm) {
RuntimeSupportScriptProviders thisScope = (RuntimeSupportScriptProviders) getScriptLookup();
thisScope.updateProviderwithCopy(originalForm, copyForm);
for (LazyCompilationScope scope : extendScopes) {
RuntimeSupportScriptProviders runtimeScriptProvider = (RuntimeSupportScriptProviders) scope.getScriptLookup();
runtimeScriptProvider.updateProviderwithCopy(originalForm, copyForm);
}
}
use of com.servoy.j2db.FormController.RuntimeSupportScriptProviders in project servoy-client by Servoy.
the class BasicFormController method initForJSUsage.
/**
* Initialize this FormController(or related classes/methods) to be used in javascript
*/
public synchronized JSForm initForJSUsage(CreationalPrototype creationalPrototype) {
if (formScope == null) {
try {
// make scope for state delegation via prototype mechanism
List<Form> forms = application.getFlattenedSolution().getFormHierarchy(form);
List<ISupportScriptProviders> scriptProviders = new ArrayList<ISupportScriptProviders>();
for (Form frm : forms) {
scriptProviders.add(new RuntimeSupportScriptProviders(application, frm));
}
formScope = new FormScope(this, scriptProviders.toArray(new ISupportScriptProviders[scriptProviders.size()]));
if (formModel != null) {
ITable formTable = application.getFoundSetManager().getTable(form.getDataSource());
formScope.setPrototype(new SelectedRecordScope(this, formTable == null ? null : application.getScriptEngine().getTableScope(formTable)));
// $NON-NLS-1$
formScope.putWithoutFireChange("foundset", formModel);
}
// create JS place holder for this object
scriptableForm = new BasicFormController.JSForm(this);
// set parent scope
NativeJavaObject formObject = new NativeJavaObject(formScope, scriptableForm, ScriptObjectRegistry.getJavaMembers(FormController.JSForm.class, formScope));
// $NON-NLS-1$
formScope.putWithoutFireChange("controller", formObject);
// register the place holder 'scriptableForm' in CreationalPrototype scope
creationalPrototype.setLocked(false);
// $NON-NLS-1$
creationalPrototype.put(((Integer) creationalPrototype.get("length", creationalPrototype)).intValue(), creationalPrototype, formScope);
creationalPrototype.put(getName(), creationalPrototype, formScope);
creationalPrototype.setLocked(true);
formScope.createVars();
} catch (Exception ex) {
// $NON-NLS-1$
application.reportError(application.getI18NMessage("servoy.formPanel.error.initFormScope") + ": " + getName(), ex);
return null;
}
}
return scriptableForm;
}
Aggregations