use of io.jmix.ui.model.ScreenData 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.model.ScreenData in project jmix by jmix-framework.
the class FormLoader method loadDataContainer.
protected void loadDataContainer(Form resultComponent, Element element) {
String containerId = element.attributeValue("dataContainer");
if (!Strings.isNullOrEmpty(containerId)) {
FrameOwner frameOwner = getComponentContext().getFrame().getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
InstanceContainer container = screenData.getContainer(containerId);
// noinspection unchecked
resultComponent.setValueSourceProvider(new ContainerValueSourceProvider(container));
}
}
use of io.jmix.ui.model.ScreenData in project jmix by jmix-framework.
the class FragmentLoader method loadDataElement.
protected void loadDataElement(Element element) {
Element dataEl = element.element("data");
if (dataEl == null) {
return;
}
ScreenData hostScreenData = null;
ComponentContext parent = getComponentContext().getParent();
while (hostScreenData == null && parent != null) {
hostScreenData = parent.getScreenData();
parent = parent.getParent();
}
ScreenDataXmlLoader screenDataXmlLoader = applicationContext.getBean(ScreenDataXmlLoader.class);
ScreenData screenData = UiControllerUtils.getScreenData(resultComponent.getFrameOwner());
screenDataXmlLoader.load(screenData, dataEl, hostScreenData);
((ComponentLoaderContext) context).setScreenData(screenData);
}
use of io.jmix.ui.model.ScreenData in project jmix by jmix-framework.
the class CalendarLoader method loadDataContainer.
@SuppressWarnings("unchecked")
protected void loadDataContainer(Calendar component, Element element) {
String containerId = element.attributeValue("dataContainer");
if (Strings.isNullOrEmpty(containerId)) {
return;
}
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);
}
component.setEventProvider(new ContainerCalendarEventProvider<>(((CollectionContainer) container)));
}
use of io.jmix.ui.model.ScreenData in project jmix by jmix-framework.
the class WindowLoader method loadScreenData.
protected void loadScreenData(Window window, Element element) {
Element dataEl = element.element("data");
if (dataEl != null) {
ScreenDataXmlLoader screenDataXmlLoader = applicationContext.getBean(ScreenDataXmlLoader.class);
ScreenData screenData = UiControllerUtils.getScreenData(window.getFrameOwner());
screenDataXmlLoader.load(screenData, dataEl, null);
((ComponentLoaderContext) context).setScreenData(screenData);
}
}
Aggregations