Package org.joget.apps.form.model

Examples of org.joget.apps.form.model.FormBinder


     * @param binderType The JSON property for the binder.
     * @return
     * @throws Exception
     */
    public static FormBinder parseBinderFromJsonObject(JSONObject obj, String binderType) throws Exception {
        FormBinder binder = null;
        PluginManager pluginManager = (PluginManager) appContext.getBean("pluginManager");
        if (!obj.isNull(FormUtil.PROPERTY_PROPERTIES)) {
            JSONObject objProperty = obj.getJSONObject(FormUtil.PROPERTY_PROPERTIES);
            if (!objProperty.isNull(binderType)) {
                String binderStr = objProperty.getString(binderType);
                JSONObject binderObj = new JSONObject(binderStr);

                // create binder object
                if (!binderObj.isNull(FormUtil.PROPERTY_CLASS_NAME)) {
                    String className = binderObj.getString(FormUtil.PROPERTY_CLASS_NAME);
                    if (className != null && className.trim().length() > 0) {
                        binder = (FormBinder) pluginManager.getPlugin(className);
                        if (binder != null) {
                            // set child properties
                            Map<String, Object> properties = FormUtil.parsePropertyFromJsonObject(binderObj);
                            binder.setProperties(properties);
                        }
                    }
                }
            }
        }
View Full Code Here


            jsonValidator.put(FormUtil.PROPERTY_PROPERTIES, jsonValidatorProps);
            jsonProps.put(FormUtil.PROPERTY_VALIDATOR, jsonValidator);
        }

        // set load binder
        FormBinder loadBinder = (FormBinder) element.getLoadBinder();
        if (loadBinder != null) {
            JSONObject jsonLoadBinderProps = FormUtil.generatePropertyJsonObject(loadBinder.getProperties());
            JSONObject jsonLoadBinder = new JSONObject();
            jsonLoadBinder.put(FormUtil.PROPERTY_CLASS_NAME, loadBinder.getClassName());
            jsonLoadBinder.put(FormUtil.PROPERTY_PROPERTIES, jsonLoadBinderProps);
            jsonProps.put(FormBinder.FORM_LOAD_BINDER, jsonLoadBinder);
        }

        // set store binder
        FormBinder storeBinder = (FormBinder) element.getStoreBinder();
        if (storeBinder != null) {
            JSONObject jsonStoreBinderProps = FormUtil.generatePropertyJsonObject(storeBinder.getProperties());
            JSONObject jsonStoreBinder = new JSONObject();
            jsonStoreBinder.put(FormUtil.PROPERTY_CLASS_NAME, storeBinder.getClassName());
            jsonStoreBinder.put(FormUtil.PROPERTY_PROPERTIES, jsonStoreBinderProps);
            jsonProps.put(FormBinder.FORM_STORE_BINDER, jsonStoreBinder);
        }

        // set options binder
        FormBinder optionsBinder = (FormBinder) element.getOptionsBinder();
        if (optionsBinder != null) {
            JSONObject jsonOptionsBinderProps = FormUtil.generatePropertyJsonObject(optionsBinder.getProperties());
            JSONObject jsonOptionsBinder = new JSONObject();
            jsonOptionsBinder.put(FormUtil.PROPERTY_CLASS_NAME, optionsBinder.getClassName());
            jsonOptionsBinder.put(FormUtil.PROPERTY_PROPERTIES, jsonOptionsBinderProps);
            jsonProps.put(FormBinder.FORM_OPTIONS_BINDER, jsonOptionsBinder);
        }

View Full Code Here

        return supported;
    }
   
    public static void setAjaxOptionsElementProperties(Element element, FormData formData) {
        if (isAjaxOptionsSupported(element, formData)) {
            FormBinder binder = (FormBinder) element.getOptionsBinder();
           
            String s = null;
            try {
                JSONObject jo = new JSONObject();
                jo.accumulate(FormUtil.PROPERTY_CLASS_NAME, binder.getClassName());
                jo.accumulate(FormUtil.PROPERTY_PROPERTIES, FormUtil.generatePropertyJsonObject(binder.getProperties()));
               
                s = jo.toString();
            } catch (Exception e) {}
            if (s != null) {
                AppDefinition appDef = AppUtil.getCurrentAppDefinition();
View Full Code Here

            try {
                binderData = URLDecoder.decode(binderData, "UTF-8");
                binderData = SecurityUtil.decrypt(binderData);
               
                if (SecurityUtil.verifyNonce(nonce, new String[] {"AjaxOptions", appDef.getAppId(), binderData.substring(binderData.length() - 20)})) {
                    FormBinder binder = null;
                   
                    JSONObject jo = new JSONObject(binderData);
                    // create binder object
                    if (!jo.isNull(FormUtil.PROPERTY_CLASS_NAME)) {
                        PluginManager pluginManager = (PluginManager) appContext.getBean("pluginManager");
                       
                        String className = jo.getString(FormUtil.PROPERTY_CLASS_NAME);
                        if (className != null && className.trim().length() > 0) {
                            binder = (FormBinder) pluginManager.getPlugin(className);
                            if (binder != null) {
                                // set child properties
                                Map<String, Object> properties = FormUtil.parsePropertyFromJsonObject(jo);
                                binder.setProperties(properties);
                            }
                        }
                    }
                   
                    if (binder != null) {
View Full Code Here

TOP

Related Classes of org.joget.apps.form.model.FormBinder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.