use of com.servoy.j2db.dataprocessing.IUIConverter in project servoy-client by Servoy.
the class ComponentFormat method getComponentFormat.
public static ComponentFormat getComponentFormat(String formatProperty, int dpType, IServiceProvider application) {
if (// $NON-NLS-1$
"converter".equals(formatProperty)) {
return new ComponentFormat(FormatParser.parseFormatProperty(null), IColumnTypes.TEXT, IColumnTypes.TEXT);
}
int uiType = dpType;
// parse format to see if it contains UI converter info
boolean hasUIConverter = false;
ParsedFormat parsedFormat = FormatParser.parseFormatProperty(formatProperty, null, application);
if (parsedFormat.getUIConverterName() != null) {
IUIConverter uiConverter = ((FoundSetManager) application.getFoundSetManager()).getUIConverterManager().getConverter(parsedFormat.getUIConverterName());
if (uiConverter != null) {
hasUIConverter = true;
int convType = uiConverter.getToObjectType(parsedFormat.getUIConverterProperties());
if (convType != Integer.MAX_VALUE) {
uiType = Column.mapToDefaultType(convType);
}
}
}
String defaultFormat = parsedFormat.isEmpty() ? TagResolver.getDefaultFormatForType(application, uiType) : null;
String formatString;
if (parsedFormat.isEmpty() && !hasUIConverter && !parsedFormat.useLocalDateTime()) {
formatString = defaultFormat;
} else {
formatString = application.getI18NMessageIfPrefixed(parsedFormat.getFormatString());
}
return new ComponentFormat(FormatParser.parseFormatProperty(formatString, defaultFormat), dpType, uiType);
}
use of com.servoy.j2db.dataprocessing.IUIConverter 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);
}
}
use of com.servoy.j2db.dataprocessing.IUIConverter 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();
}
}
Aggregations