Search in sources :

Example 1 with IPropertyHolder

use of org.eclipse.scout.rt.shared.data.form.IPropertyHolder in project scout.rt by eclipse.

the class AbstractForm method importProperties.

private void importProperties(IPropertyHolder source, Object target, Class<?> stopClass, IPropertyFilter filter) {
    // local properties
    Map<String, Object> properties = BeanUtility.getProperties(source, stopClass, filter);
    if (!properties.isEmpty()) {
        removeNotSetProperties(source, properties);
        BeanUtility.setProperties(target, properties, false, null);
    }
    // properties of the extensions
    List<Object> allContributions = source.getAllContributions();
    if (!allContributions.isEmpty()) {
        for (Object con : allContributions) {
            if (con instanceof IPropertyHolder) {
                IPropertyHolder data = (IPropertyHolder) con;
                Map<String, Object> extensionProperties = BeanUtility.getProperties(data, stopClass, filter);
                if (!extensionProperties.isEmpty()) {
                    Object clientPart = getClientPartOfExtensionOrContributionRec(data, target);
                    if (clientPart != null) {
                        removeNotSetProperties(data, extensionProperties);
                        BeanUtility.setProperties(clientPart, extensionProperties, false, null);
                    } else {
                        LOG.warn("cannot find extension for property data '{}' in form '{}'.", data.getClass().getName(), this.getClass().getName());
                    }
                }
            }
        }
    }
}
Also used : IExtensibleObject(org.eclipse.scout.rt.shared.extension.IExtensibleObject) IPropertyHolder(org.eclipse.scout.rt.shared.data.form.IPropertyHolder)

Aggregations

IPropertyHolder (org.eclipse.scout.rt.shared.data.form.IPropertyHolder)1 IExtensibleObject (org.eclipse.scout.rt.shared.extension.IExtensibleObject)1