use of io.jmix.ui.model.CollectionContainer in project jmix by jmix-framework.
the class TableFieldFactoryImpl method getOptions.
@SuppressWarnings("unchecked")
@Nullable
protected Options getOptions(EntityValueSource valueSource, String property) {
MetaClass metaClass = valueSource.getEntityMetaClass();
MetaPropertyPath metaPropertyPath = metadataTools.resolveMetaPropertyPathOrNull(metaClass, property);
Table.Column columnConf = webTable.getColumnsInternal().get(metaPropertyPath);
CollectionContainer collectionContainer = findOptionsContainer(columnConf);
if (collectionContainer != null) {
return new ContainerOptions(collectionContainer);
}
return null;
}
use of io.jmix.ui.model.CollectionContainer in project jmix by jmix-framework.
the class TokenListLoader method loadOptionsContainer.
protected void loadOptionsContainer(TokenList component, Element element) {
String containerId = element.attributeValue("optionsContainer");
if (containerId != null) {
FrameOwner frameOwner = getComponentContext().getFrame().getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
InstanceContainer container = screenData.getContainer(containerId);
if (!(container instanceof CollectionContainer)) {
throw new GuiDevelopmentException("Not a CollectionContainer: " + containerId, context);
}
// noinspection unchecked
component.setOptions(new ContainerOptions((CollectionContainer) container));
}
if (component.getOptions() == null) {
DatasourceLoaderHelper.loadOptionsDatasource(element, (ComponentLoaderContext) getComponentContext()).ifPresent(component::setOptions);
}
}
Aggregations