Search in sources :

Example 6 with ElementScope

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;
}
Also used : ElementScope(com.servoy.j2db.scripting.ElementScope) FormScope(com.servoy.j2db.scripting.FormScope)

Example 7 with ElementScope

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();
    }
}
Also used : WebObjectSpecification(org.sablo.specification.WebObjectSpecification) IRecordInternal(com.servoy.j2db.dataprocessing.IRecordInternal) ElementScope(com.servoy.j2db.scripting.ElementScope) IFormElement(com.servoy.j2db.persistence.IFormElement)

Aggregations

ElementScope (com.servoy.j2db.scripting.ElementScope)7 Point (java.awt.Point)3 NativeJavaObject (org.mozilla.javascript.NativeJavaObject)3 ScriptableObject (org.mozilla.javascript.ScriptableObject)3 IFormElement (com.servoy.j2db.persistence.IFormElement)2 FormScope (com.servoy.j2db.scripting.FormScope)2 RuntimeWebComponent (com.servoy.j2db.server.ngclient.component.RuntimeWebComponent)2 IComponent (com.servoy.j2db.ui.IComponent)2 IDataRenderer (com.servoy.j2db.ui.IDataRenderer)2 Component (java.awt.Component)2 JComponent (javax.swing.JComponent)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 IRecordInternal (com.servoy.j2db.dataprocessing.IRecordInternal)1 PageList (com.servoy.j2db.printing.PageList)1 IScriptable (com.servoy.j2db.scripting.IScriptable)1 IScriptableProvider (com.servoy.j2db.scripting.IScriptableProvider)1 FormAndComponent (com.servoy.j2db.scripting.JSApplication.FormAndComponent)1 WebCellBasedView (com.servoy.j2db.server.headlessclient.dataui.WebCellBasedView)1 FormElement (com.servoy.j2db.server.ngclient.FormElement)1 INGApplication (com.servoy.j2db.server.ngclient.INGApplication)1