Search in sources :

Example 1 with IColumnConverter

use of com.servoy.j2db.dataprocessing.IColumnConverter in project servoy-client by Servoy.

the class PluginManager method checkPluginForConvertersAndValidators.

protected void checkPluginForConvertersAndValidators(IClientPlugin plugin) {
    try {
        long now = System.currentTimeMillis();
        if (plugin instanceof IColumnConverterProvider && columnConverterManager != null) {
            IColumnConverter[] cons = ((IColumnConverterProvider) plugin).getColumnConverters();
            if (cons != null) {
                for (IColumnConverter element2 : cons) {
                    if (element2 != null) {
                        columnConverterManager.registerConvertor(element2);
                    }
                }
            }
        }
        if (plugin instanceof IUIConverterProvider && uiConverterManager != null) {
            IUIConverter[] cons = ((IUIConverterProvider) plugin).getUIConverters();
            if (cons != null) {
                for (IUIConverter element2 : cons) {
                    if (element2 != null) {
                        uiConverterManager.registerConvertor(element2);
                    }
                }
            }
        }
        if (plugin instanceof IColumnValidatorProvider && columnValidatorManager != null) {
            IColumnValidator[] vals = ((IColumnValidatorProvider) plugin).getColumnValidators();
            if (vals != null) {
                for (IColumnValidator element2 : vals) {
                    if (element2 != null) {
                        columnValidatorManager.registerValidator(element2);
                    }
                }
            }
        }
        // $NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
        Debug.trace("Plugin " + plugin.getName() + " checked for converter/validator in " + (System.currentTimeMillis() - now) + " ms.");
    } catch (Throwable th) {
        // $NON-NLS-1$
        Debug.error("Error ocured checking plugin: " + plugin.getName(), th);
    }
}
Also used : IUIConverter(com.servoy.j2db.dataprocessing.IUIConverter) IColumnValidator(com.servoy.j2db.dataprocessing.IColumnValidator) IColumnConverter(com.servoy.j2db.dataprocessing.IColumnConverter)

Example 2 with IColumnConverter

use of com.servoy.j2db.dataprocessing.IColumnConverter in project servoy-client by Servoy.

the class PluginManager method loadClientPlugins.

/**
 * Only load client plugins; do not initialize them.
 */
public void loadClientPlugins(IApplication application) {
    synchronized (initLock) {
        loadedClientPlugins = new HashMap<String, IClientPlugin>();
        if (// Servoy developer loading
        application == null || !application.isRunningRemote()) {
            Extension<IClientPlugin>[] exts = loadClientPluginDefs();
            if (exts != null) {
                for (Extension<IClientPlugin> element : exts) {
                    try {
                        loadClientPlugin(element.instanceClass);
                    } catch (Throwable th) {
                        // $NON-NLS-1$
                        Debug.error("Error occured loading client plugin class " + element.instanceClass.getName(), th);
                    }
                }
            }
        } else // Servoy client loading
        {
            int count = 0;
            Settings settings = Settings.getInstance();
            // $NON-NLS-1$
            String sCount = settings.getProperty("com.servoy.j2db.plugins.PluginManager.PluginCount");
            if (sCount != null) {
                count = new Integer(sCount).intValue();
            }
            // $NON-NLS-1$
            Debug.trace("plugin count " + count);
            for (int x = 0; x < count; x++) {
                // $NON-NLS-1$ //$NON-NLS-2$
                String clazzName = settings.getProperty("com.servoy.j2db.plugins.PluginManager.Plugin." + x + ".className");
                if (clazzName != null && clazzName.length() != 0) {
                    try {
                        loadClientPlugin((Class<IClientPlugin>) Class.forName(clazzName.trim()));
                    } catch (Throwable th) {
                        // $NON-NLS-1$
                        Debug.error("Error occured loading client plugin class " + clazzName, th);
                    }
                }
            }
        }
        columnConverterManager = new ConverterManager<IColumnConverter>();
        uiConverterManager = new ConverterManager<IUIConverter>();
        columnValidatorManager = new ColumnValidatorManager();
        checkAllPluginsForConvertersAndValidators();
    }
}
Also used : IUIConverter(com.servoy.j2db.dataprocessing.IUIConverter) IColumnConverter(com.servoy.j2db.dataprocessing.IColumnConverter) IColumnValidatorManager(com.servoy.j2db.dataprocessing.IColumnValidatorManager) Settings(com.servoy.j2db.util.Settings)

Aggregations

IColumnConverter (com.servoy.j2db.dataprocessing.IColumnConverter)2 IUIConverter (com.servoy.j2db.dataprocessing.IUIConverter)2 IColumnValidator (com.servoy.j2db.dataprocessing.IColumnValidator)1 IColumnValidatorManager (com.servoy.j2db.dataprocessing.IColumnValidatorManager)1 Settings (com.servoy.j2db.util.Settings)1