Search in sources :

Example 1 with DefaultScope

use of com.servoy.j2db.scripting.DefaultScope in project servoy-client by Servoy.

the class BasicFormController method getElements.

public IRuntimeComponent[] getElements() {
    Object elementScope = formScope == null ? null : formScope.get("elements");
    if (elementScope instanceof DefaultScope) {
        Object[] values = ((DefaultScope) elementScope).getValues();
        List<IRuntimeComponent> elements = new ArrayList<IRuntimeComponent>(values.length);
        for (Object value : values) {
            if (value instanceof Wrapper) {
                value = ((Wrapper) value).unwrap();
            }
            if (value instanceof IRuntimeComponent) {
                elements.add((IRuntimeComponent) value);
            }
        }
        return elements.toArray(new IRuntimeComponent[elements.size()]);
    }
    return new IRuntimeComponent[0];
}
Also used : Wrapper(org.mozilla.javascript.Wrapper) ArrayList(java.util.ArrayList) NativeJavaObject(org.mozilla.javascript.NativeJavaObject) ITwoNativeJavaObject(com.servoy.j2db.scripting.ITwoNativeJavaObject) IRuntimeComponent(com.servoy.j2db.ui.runtime.IRuntimeComponent) DefaultScope(com.servoy.j2db.scripting.DefaultScope)

Aggregations

DefaultScope (com.servoy.j2db.scripting.DefaultScope)1 ITwoNativeJavaObject (com.servoy.j2db.scripting.ITwoNativeJavaObject)1 IRuntimeComponent (com.servoy.j2db.ui.runtime.IRuntimeComponent)1 ArrayList (java.util.ArrayList)1 NativeJavaObject (org.mozilla.javascript.NativeJavaObject)1 Wrapper (org.mozilla.javascript.Wrapper)1