use of com.servoy.j2db.scripting.ElementScope in project servoy-client by Servoy.
the class WebFormUI method initElementScope.
private ElementScope initElementScope(IFormController controller) {
FormScope formScope = controller.getFormScope();
ElementScope elementsScope = new ElementScope(formScope);
// $NON-NLS-1$
formScope.putWithoutFireChange("elements", elementsScope);
return elementsScope;
}
use of com.servoy.j2db.scripting.ElementScope in project servoy-client by Servoy.
the class WebFormUI method init.
/**
* this is a full recreate ui.
*
* @param formController
* @param dal
* @return
* @throws RepositoryException
*/
public void init() {
clearComponents();
cachedElements.clear();
fcc = null;
groups = null;
IDataAdapterList previousDataAdapterList = dataAdapterList;
dataAdapterList = new DataAdapterList(formController);
initContainerScopeIfNeeded(formController);
ElementScope elementsScope = initElementScope(formController);
List<FormElement> formElements = getFormElements();
for (FormElement fe : formElements) {
// TODO do something similar for child elements (so properties of type 'components' which contain componentSpecs in them)
WebObjectSpecification componentSpec = fe.getWebComponentSpec(false);
if (componentSpec == null) {
getApplication().reportError("Didn't find a spec file for component " + fe + " when creating form: " + formController.getName(), null);
continue;
}
WebFormComponent component = ComponentFactory.createComponent(getApplication(), dataAdapterList, fe, this, getController().getForm());
contributeComponentToElementsScope(elementsScope, fe, componentSpec, component);
}
DefaultNavigatorWebComponent nav = (DefaultNavigatorWebComponent) getComponent(DefaultNavigator.NAME_PROP_VALUE);
if (nav != null) {
nav.newFoundset(null);
}
// special support for the default navigator
if (formController.getForm().getNavigatorID() == Form.NAVIGATOR_DEFAULT) {
add(new DefaultNavigatorWebComponent(dataAdapterList));
}
if (previousDataAdapterList != null) {
IRecordInternal record = ((DataAdapterList) previousDataAdapterList).getRecord();
if (record != null) {
dataAdapterList.setRecord(record, false);
previousDataAdapterList.setRecord(null, false);
nav = (DefaultNavigatorWebComponent) getComponent(DefaultNavigator.NAME_PROP_VALUE);
if (nav != null)
nav.newFoundset(record.getParentFoundSet());
}
previousDataAdapterList.destroy();
}
}
Aggregations