use of io.jmix.ui.model.CollectionContainer in project jmix by jmix-framework.
the class AbstractChartLoader method loadDataContainer.
protected void loadDataContainer(Chart chart, Element element) {
String dataContainerId = element.attributeValue("dataContainer");
if (StringUtils.isNotEmpty(dataContainerId)) {
FrameOwner frameOwner = getComponentContext().getFrame().getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
CollectionContainer dataContainer;
InstanceContainer container = screenData.getContainer(dataContainerId);
if (container instanceof CollectionContainer) {
dataContainer = (CollectionContainer) container;
} else {
throw new GuiDevelopmentException("Not a CollectionContainer: " + dataContainerId, context);
}
chart.setDataProvider(new ContainerDataProvider(dataContainer));
}
}
use of io.jmix.ui.model.CollectionContainer in project jmix by jmix-framework.
the class ShowPivotAction method showPivotTable.
@SuppressWarnings("unchecked")
protected void showPivotTable(ShowPivotMode mode) {
Frame frame = target.getFrame();
if (frame == null) {
throw new IllegalStateException(String.format("ShowPivotAction cannot be used by component '%s' which is not added to frame", target.getId()));
}
Collection items;
if (ShowPivotMode.ALL_ROWS.equals(mode)) {
if (target.getItems() instanceof ContainerDataUnit) {
CollectionContainer container = ((ContainerDataUnit) target.getItems()).getContainer();
items = container.getItems();
} else {
items = Collections.emptyList();
}
} else {
items = target.getSelected();
}
PivotScreenBuilder showPivotManager = applicationContext.getBean(PivotScreenBuilder.class, target);
showPivotManager.withItems(items).withIncludedProperties(parseProperties(includedProperties)).withExcludedProperties(parseProperties(excludedProperties)).build().show();
}
use of io.jmix.ui.model.CollectionContainer in project jmix by jmix-framework.
the class EntityFieldCreationSupport method createCollectionContainer.
public CollectionContainer createCollectionContainer(MetaClass metaClass) {
CollectionContainer container = dataComponents.createCollectionContainer(metaClass.getJavaClass());
List list = dataManager.load(metaClass.getJavaClass()).all().fetchPlan(FetchPlan.INSTANCE_NAME).sort(Sort.by(getInstanceNameSortOrders(metaClass))).list();
container.setItems(list);
return container;
}
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 TestCommentaryPanelLoader method loadDataContainer.
private void loadDataContainer(TestCommentaryPanel resultComponent, Element element) {
String containerId = this.element.attributeValue("dataContainer");
if (Strings.isNullOrEmpty(containerId)) {
throw new GuiDevelopmentException("CommentaryPanel element doesn't have 'dataContainer' attribute", context, "CommentaryPanel ID", element.attributeValue("id"));
}
FrameOwner frameOwner = getComponentContext().getFrame().getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
InstanceContainer container = screenData.getContainer(containerId);
if (container instanceof CollectionContainer) {
resultComponent.setDataContainer((CollectionContainer) container);
} else {
throw new GuiDevelopmentException("Not a CollectionContainer: " + containerId, context);
}
}
Aggregations