use of io.jmix.ui.screen.FrameOwner in project jmix by jmix-framework.
the class AbstractSingleFilterComponentLoader method loadDataLoader.
protected void loadDataLoader(C resultComponent, Element element) {
String dataLoaderId = element.attributeValue("dataLoader");
if (StringUtils.isNotBlank(dataLoaderId)) {
FrameOwner frameOwner = getComponentContext().getFrame().getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
DataLoader dataLoader = screenData.getLoader(dataLoaderId);
resultComponent.setDataLoader(dataLoader);
}
}
use of io.jmix.ui.screen.FrameOwner in project jmix by jmix-framework.
the class AbstractTableLoader method initTableDataHolder.
protected TableDataHolder initTableDataHolder() {
TableDataHolder holder = new TableDataHolder();
String containerId = element.attributeValue("dataContainer");
if (Strings.isNullOrEmpty(containerId)) {
loadMetaClass(element, holder::setMetaClass);
return holder;
}
FrameOwner frameOwner = getComponentContext().getFrame().getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
InstanceContainer container = screenData.getContainer(containerId);
CollectionContainer collectionContainer;
if (container instanceof CollectionContainer) {
collectionContainer = ((CollectionContainer) container);
} else {
throw new GuiDevelopmentException("Not a CollectionContainer: " + containerId, context);
}
if (container instanceof CollectionPropertyContainer) {
initMasterDataLoaderListener((CollectionPropertyContainer) container);
}
if (collectionContainer instanceof HasLoader) {
holder.setDataLoader(((HasLoader) collectionContainer).getLoader());
}
holder.setMetaClass(collectionContainer.getEntityMetaClass());
holder.setContainer(collectionContainer);
holder.setFetchPlan(collectionContainer.getFetchPlan());
return holder;
}
use of io.jmix.ui.screen.FrameOwner in project jmix by jmix-framework.
the class UiControllerPropertyInjector method findComponent.
@Nullable
protected Component findComponent(String componentId) {
Component component = null;
Window window = null;
if (sourceScreen != null) {
window = sourceScreen.getWindow();
} else if (frameOwner instanceof ScreenFragment) {
FrameOwner host = ((ScreenFragment) frameOwner).getHostController();
if (host instanceof Screen) {
window = ((Screen) host).getWindow();
}
} else if (frameOwner instanceof Screen) {
window = ((Screen) frameOwner).getWindow();
}
if (window != null) {
component = window.getComponent(componentId);
}
return component;
}
use of io.jmix.ui.screen.FrameOwner in project jmix by jmix-framework.
the class TestCommentaryPanelLoader method loadDataContainer.
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 io.jmix.ui.screen.FrameOwner in project jmix by jmix-framework.
the class FilterLoader method loadDataLoader.
protected void loadDataLoader(Filter component, Element element) {
loadString(element, "dataLoader", (dataLoaderId) -> {
FrameOwner frameOwner = getComponentContext().getFrame().getFrameOwner();
ScreenData screenData = UiControllerUtils.getScreenData(frameOwner);
DataLoader dataLoader = screenData.getLoader(dataLoaderId);
component.setDataLoader(dataLoader);
});
}
Aggregations