use of com.haulmont.cuba.gui.model.ScreenData in project cuba by cuba-platform.
the class TwinColumnLoader method loadOptionsContainer.
protected void loadOptionsContainer(TwinColumn 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));
}
}
use of com.haulmont.cuba.gui.model.ScreenData in project cuba by cuba-platform.
the class WebTableFieldFactory method findOptionsContainer.
@Nullable
protected CollectionContainer findOptionsContainer(Table.Column columnConf) {
String optDcName = columnConf.getXmlDescriptor() != null ? columnConf.getXmlDescriptor().attributeValue("optionsContainer") : null;
if (Strings.isNullOrEmpty(optDcName)) {
return null;
} else {
ScreenData screenData = UiControllerUtils.getScreenData(webTable.getFrame().getFrameOwner());
InstanceContainer container = screenData.getContainer(optDcName);
if (container instanceof CollectionContainer) {
return (CollectionContainer) container;
}
throw new IllegalStateException(String.format("'%s' is not an instance of CollectionContainer", optDcName));
}
}
use of com.haulmont.cuba.gui.model.ScreenData in project cuba by cuba-platform.
the class DynamicAttributesPanelLoader method loadDataContainer.
protected void loadDataContainer(DynamicAttributesPanel resultComponent, Element element) {
String containerId = element.attributeValue("dataContainer");
if (Strings.isNullOrEmpty(containerId)) {
throw new GuiDevelopmentException("DynamicAttributesPanel element doesn't have 'dataContainer' attribute", context, "DynamicAttributesPanel ID", element.attributeValue("id"));
}
FrameOwner frameOwner = getComponentContext().getFrame().getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
InstanceContainer container = screenData.getContainer(containerId);
// noinspection unchecked
resultComponent.setInstanceContainer(container);
}
use of com.haulmont.cuba.gui.model.ScreenData in project cuba by cuba-platform.
the class TestCommentaryPanelLoader method loadDataContainer.
@SuppressWarnings("unchecked")
private void loadDataContainer(TestCommentaryPanel resultComponent, Element element) {
String containerId = this.element.attributeValue("dataContainer");
if (Strings.isNullOrEmpty(containerId)) {
throw new GuiDevelopmentException("CommentaryPanel element doesn't have 'dataContainer' attribute", context, "CommentaryPanel ID", element.attributeValue("id"));
}
FrameOwner frameOwner = getComponentContext().getFrame().getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
InstanceContainer container = screenData.getContainer(containerId);
if (container instanceof CollectionContainer) {
resultComponent.setDataContainer((CollectionContainer) container);
} else {
throw new GuiDevelopmentException("Not a CollectionContainer: " + containerId, context);
}
}
use of com.haulmont.cuba.gui.model.ScreenData in project cuba by cuba-platform.
the class WebDataLoadCoordinator method configureAutomatically.
@Override
public void configureAutomatically() {
FrameOwner frameOwner = getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
getUnconfiguredLoaders(screenData).forEach(loader -> configureAutomatically(loader, frameOwner));
}
Aggregations