use of io.jmix.ui.model.ScreenData 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.ScreenData in project jmix by jmix-framework.
the class UiDataFilterSupport method registerConfigurationDc.
protected void registerConfigurationDc(FilterConfiguration configurationModel, FrameOwner owner) {
InstanceContainer<FilterConfiguration> configurationDc = dataComponents.createInstanceContainer(FilterConfiguration.class);
configurationDc.setItem(configurationModel);
ScreenData screenData = UiControllerUtils.getScreenData(owner);
screenData.registerContainer(CONFIGURATION_CONTAINER_ID, configurationDc);
}
use of io.jmix.ui.model.ScreenData in project jmix by jmix-framework.
the class UiDataFilterSupport method getFragmentFilterConfigurationModel.
protected FilterConfiguration getFragmentFilterConfigurationModel(Filter.Configuration configuration, ScreenFragment configurationFragment) {
Filter filter = configuration.getOwner();
FilterConfiguration configurationModel;
if (configurationFragment instanceof UiDataFilterConfigurationModelFragment) {
ScreenData screenData = UiControllerUtils.getScreenData(configurationFragment.getHostController());
InstanceContainer<FilterConfiguration> configurationDc = screenData.getContainer(CONFIGURATION_CONTAINER_ID);
configurationModel = configurationDc.getItem();
if (filter.getId() != null && filter.getFrame() != null && ((UiDataFilterConfigurationModelFragment) configurationFragment).getDefaultForMeFieldVisible()) {
ScreenSettingsFacet settingsFacet = UiControllerUtils.getFacet(filter.getFrame(), ScreenSettingsFacet.class);
if (settingsFacet != null) {
saveFilterSettings(settingsFacet, filter.getId(), configurationModel);
}
}
} else {
configurationModel = loadFilterConfigurationModel(filter, configuration.getId());
}
if (configurationModel == null) {
configurationModel = createFilterConfigurationModel(configuration);
}
return configurationModel;
}
use of io.jmix.ui.model.ScreenData in project jmix by jmix-framework.
the class DataLoadCoordinatorImpl method configureAutomatically.
@Override
public void configureAutomatically() {
FrameOwner frameOwner = getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
getUnconfiguredLoaders(screenData).forEach(loader -> configureAutomatically(loader, frameOwner));
}
use of io.jmix.ui.model.ScreenData 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