Search in sources :

Example 1 with ContainerDataProvider

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");
}
Also used : ContainerDataProvider(io.jmix.ui.data.impl.ContainerDataProvider) Subscribe(io.jmix.ui.screen.Subscribe)

Example 2 with ContainerDataProvider

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));
    }
}
Also used : FrameOwner(io.jmix.ui.screen.FrameOwner) GuiDevelopmentException(io.jmix.ui.GuiDevelopmentException) CollectionContainer(io.jmix.ui.model.CollectionContainer) InstanceContainer(io.jmix.ui.model.InstanceContainer) ContainerDataProvider(io.jmix.ui.data.impl.ContainerDataProvider) ScreenData(io.jmix.ui.model.ScreenData)

Example 3 with ContainerDataProvider

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);
    }
}
Also used : FrameOwner(io.jmix.ui.screen.FrameOwner) GuiDevelopmentException(io.jmix.ui.GuiDevelopmentException) CollectionContainer(io.jmix.ui.model.CollectionContainer) InstanceContainer(io.jmix.ui.model.InstanceContainer) ContainerDataProvider(io.jmix.ui.data.impl.ContainerDataProvider) ScreenData(io.jmix.ui.model.ScreenData)

Example 4 with ContainerDataProvider

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));
    }
}
Also used : FrameOwner(io.jmix.ui.screen.FrameOwner) GuiDevelopmentException(io.jmix.ui.GuiDevelopmentException) CollectionContainer(io.jmix.ui.model.CollectionContainer) InstanceContainer(io.jmix.ui.model.InstanceContainer) ContainerDataProvider(io.jmix.ui.data.impl.ContainerDataProvider) ScreenData(io.jmix.ui.model.ScreenData)

Aggregations

ContainerDataProvider (io.jmix.ui.data.impl.ContainerDataProvider)4 GuiDevelopmentException (io.jmix.ui.GuiDevelopmentException)3 CollectionContainer (io.jmix.ui.model.CollectionContainer)3 InstanceContainer (io.jmix.ui.model.InstanceContainer)3 ScreenData (io.jmix.ui.model.ScreenData)3 FrameOwner (io.jmix.ui.screen.FrameOwner)3 Subscribe (io.jmix.ui.screen.Subscribe)1