use of io.jmix.ui.data.impl.ContainerDataProvider in project jmix-docs by Haulmont.
the class ContainerDataProviderScreen method onInit.
@Subscribe
private void onInit(InitEvent event) {
stackedArea.setDataProvider(new ContainerDataProvider(transportCountsDc));
stackedArea.setCategoryField("year");
}
use of io.jmix.ui.data.impl.ContainerDataProvider in project jmix by jmix-framework.
the class PivotTableLoader method loadDataContainer.
protected void loadDataContainer(PivotTable pivotTable, 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);
}
pivotTable.setDataProvider(new ContainerDataProvider(dataContainer));
}
}
use of io.jmix.ui.data.impl.ContainerDataProvider in project jmix by jmix-framework.
the class StockChartLoader method loadDataSet.
protected void loadDataSet(DataSet dataSet, Element dataSetElement) {
loadFieldMappings(dataSet, dataSetElement);
loadStockEvents(dataSet, dataSetElement);
String id = dataSetElement.attributeValue("id");
if (StringUtils.isNotEmpty(id)) {
dataSet.setId(id);
}
checkMultipleDatasources(dataSetElement);
String categoryField = dataSetElement.attributeValue("categoryField");
if (StringUtils.isNotEmpty(categoryField)) {
dataSet.setCategoryField(categoryField);
}
String color = dataSetElement.attributeValue("color");
if (StringUtils.isNotEmpty(color)) {
dataSet.setColor(Color.valueOf(color));
}
String compared = dataSetElement.attributeValue("compared");
if (StringUtils.isNotEmpty(compared)) {
dataSet.setCompared(Boolean.valueOf(compared));
}
String dataContainerId = dataSetElement.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);
}
dataSet.setDataProvider(new ContainerDataProvider(dataContainer));
}
String showInCompare = dataSetElement.attributeValue("showInCompare");
if (StringUtils.isNotEmpty(showInCompare)) {
dataSet.setShowInCompare(Boolean.valueOf(showInCompare));
}
String showInSelect = dataSetElement.attributeValue("showInSelect");
if (StringUtils.isNotEmpty(showInSelect)) {
dataSet.setShowInSelect(Boolean.valueOf(showInSelect));
}
String title = dataSetElement.attributeValue("title");
if (StringUtils.isNotEmpty(title)) {
dataSet.setTitle(title);
}
}
use of io.jmix.ui.data.impl.ContainerDataProvider 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));
}
}
Aggregations