Search in sources :

Example 31 with WebFormComponent

use of com.servoy.j2db.server.ngclient.WebFormComponent in project servoy-client by Servoy.

the class WebFormController method setTabSequence.

@Override
public void setTabSequence(Object[] arrayOfElements) {
    if (arrayOfElements == null) {
        return;
    }
    Object[] elements = arrayOfElements;
    if (elements.length == 1) {
        if (elements[0] instanceof Object[]) {
            elements = (Object[]) elements[0];
        } else if (elements[0] == null) {
            elements = null;
            return;
        }
    }
    tabSequence = new String[elements.length];
    for (int i = 0; i < elements.length; i++) {
        if (elements[i] instanceof RuntimeWebComponent) {
            WebFormComponent component = ((RuntimeWebComponent) elements[i]).getComponent();
            WebObjectSpecification spec = component.getSpecification();
            Collection<PropertyDescription> properties = spec.getProperties(NGTabSeqPropertyType.NG_INSTANCE);
            if (properties.size() == 1) {
                PropertyDescription pd = properties.iterator().next();
                Integer val = Integer.valueOf(i + 1);
                if (!val.equals(component.getProperty(pd.getName())))
                    component.setProperty(pd.getName(), val);
            }
            tabSequence[i] = component.getName();
        } else {
            Debug.error("Could not set the tab sequence property for element " + elements[i]);
        }
    }
}
Also used : PropertyDescription(org.sablo.specification.PropertyDescription) WebObjectSpecification(org.sablo.specification.WebObjectSpecification) WebFormComponent(com.servoy.j2db.server.ngclient.WebFormComponent) Point(java.awt.Point)

Aggregations

WebFormComponent (com.servoy.j2db.server.ngclient.WebFormComponent)31 Test (org.junit.Test)14 Form (com.servoy.j2db.persistence.Form)12 FormElement (com.servoy.j2db.server.ngclient.FormElement)10 IWebFormController (com.servoy.j2db.server.ngclient.IWebFormController)10 ServoyJSONObject (com.servoy.j2db.util.ServoyJSONObject)10 JSONObject (org.json.JSONObject)10 BrowserConverterContext (org.sablo.specification.property.BrowserConverterContext)10 StringWriter (java.io.StringWriter)7 JSONWriter (org.json.JSONWriter)7 DataConversion (org.sablo.websocket.utils.DataConversion)7 IDataAdapterList (com.servoy.j2db.server.ngclient.IDataAdapterList)6 Point (java.awt.Point)6 DataAdapterList (com.servoy.j2db.server.ngclient.DataAdapterList)5 ServoyDataConverterContext (com.servoy.j2db.server.ngclient.ServoyDataConverterContext)5 Map (java.util.Map)5 IContextProvider (com.servoy.j2db.server.ngclient.IContextProvider)4 IWebFormUI (com.servoy.j2db.server.ngclient.IWebFormUI)4 HashMap (java.util.HashMap)4 FlattenedSolution (com.servoy.j2db.FlattenedSolution)3