use of com.haulmont.cuba.gui.model.ScreenData in project cuba by cuba-platform.
the class AbstractComponentLoader method loadOptionsContainer.
protected Optional<CollectionContainer> loadOptionsContainer(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);
}
return Optional.of((CollectionContainer) container);
}
return Optional.empty();
}
use of com.haulmont.cuba.gui.model.ScreenData in project cuba by cuba-platform.
the class AbstractComponentLoader method loadContainer.
protected Optional<InstanceContainer> loadContainer(Element element, String property) {
String containerId = element.attributeValue("dataContainer");
// For instance, a component is placed within the Form component
if (Strings.isNullOrEmpty(containerId) && property != null) {
containerId = getParentDataContainer(element);
}
if (!Strings.isNullOrEmpty(containerId)) {
if (property == null) {
throw new GuiDevelopmentException(String.format("Can't set container '%s' for component '%s' because 'property' " + "attribute is not defined", containerId, element.attributeValue("id")), context);
}
FrameOwner frameOwner = getComponentContext().getFrame().getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
return Optional.of(screenData.getContainer(containerId));
}
return Optional.empty();
}
Aggregations