use of com.haulmont.cuba.gui.data.RuntimePropsDatasource in project cuba by cuba-platform.
the class DatasourceValueSource method setBeanLocator.
@Override
public void setBeanLocator(BeanLocator beanLocator) {
MetaClass metaClass = datasource instanceof RuntimePropsDatasource ? ((RuntimePropsDatasource<E>) datasource).resolveCategorizedEntityClass() : datasource.getMetaClass();
MetadataTools metadataTools = beanLocator.get(MetadataTools.NAME);
MetaPropertyPath metaPropertyPath = metadataTools.resolveMetaPropertyPath(metaClass, property);
checkNotNullArgument(metaPropertyPath, "Could not resolve property path '%s' in '%s'", property, metaClass);
this.metaPropertyPath = metaPropertyPath;
this.datasource.addStateChangeListener(this::datasourceStateChanged);
this.datasource.addItemChangeListener(this::datasourceItemChanged);
this.datasource.addItemPropertyChangeListener(this::datasourceItemPropertyChanged);
if (datasource.getState() == Datasource.State.VALID) {
setState(BindingState.ACTIVE);
}
}
use of com.haulmont.cuba.gui.data.RuntimePropsDatasource in project jmix by jmix-framework.
the class DatasourceValueSource method setApplicationContext.
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
MetaClass metaClass = datasource instanceof RuntimePropsDatasource ? ((RuntimePropsDatasource<E>) datasource).resolveCategorizedEntityClass() : datasource.getMetaClass();
MetadataTools metadataTools = applicationContext.getBean(MetadataTools.class);
this.metaPropertyPath = metadataTools.resolveMetaPropertyPath(metaClass, property);
this.datasource.addStateChangeListener(this::datasourceStateChanged);
this.datasource.addItemChangeListener(this::datasourceItemChanged);
this.datasource.addItemPropertyChangeListener(this::datasourceItemPropertyChanged);
if (datasource.getState() == Datasource.State.VALID) {
setState(BindingState.ACTIVE);
}
}
Aggregations