Search in sources :

Example 6 with IFormComponentType

use of com.servoy.j2db.util.IFormComponentType in project servoy-client by Servoy.

the class JSNGWebComponent method resetHandler.

@Override
public void resetHandler(String handlerName) {
    WebComponent webComponent = getBaseComponent(false);
    WebObjectSpecification spec = WebComponentSpecProvider.getSpecProviderState().getWebComponentSpecification(webComponent.getTypeName());
    if (spec != null) {
        String name = handlerName;
        if (spec.getHandler(name) == null) {
            name = name + "MethodID";
        }
        if (spec.getHandler(name) != null) {
            webComponent.clearProperty(name);
            getBaseComponent(true).putMethodParameters(name, null, null);
        } else {
            int i = name.indexOf('.');
            if (i > 0) {
                String firstPart = name.substring(0, i);
                PropertyDescription property = spec.getProperty(firstPart);
                if (property != null && property.getType() instanceof IFormComponentType) {
                    // undefined means remove the property
                    Object convertedValue = fromRhinoToDesignValue(Context.getUndefinedValue(), property, application, this, handlerName);
                    webComponent.setProperty(firstPart, convertedValue);
                    return;
                }
            }
            Debug.log("Error: component " + webComponent.getTypeName() + " does not declare a handler named " + handlerName + ".");
        }
    }
}
Also used : PropertyDescription(org.sablo.specification.PropertyDescription) WebComponent(com.servoy.j2db.persistence.WebComponent) WebObjectSpecification(org.sablo.specification.WebObjectSpecification) JSONObject(org.json.JSONObject) ServoyJSONObject(com.servoy.j2db.util.ServoyJSONObject) IFormComponentType(com.servoy.j2db.util.IFormComponentType)

Aggregations

IFormComponentType (com.servoy.j2db.util.IFormComponentType)6 ServoyJSONObject (com.servoy.j2db.util.ServoyJSONObject)5 JSONObject (org.json.JSONObject)5 PropertyDescription (org.sablo.specification.PropertyDescription)4 WebComponent (com.servoy.j2db.persistence.WebComponent)3 IFormComponentRhinoConverter (com.servoy.j2db.util.IFormComponentRhinoConverter)3 WebObjectSpecification (org.sablo.specification.WebObjectSpecification)3 IRhinoDesignConverter (com.servoy.j2db.util.IRhinoDesignConverter)2 Pair (com.servoy.j2db.util.Pair)1 ArrayList (java.util.ArrayList)1 JSONException (org.json.JSONException)1