use of com.haulmont.cuba.gui.data.impl.GenericDataSupplier in project cuba by cuba-platform.
the class FragmentLoader method loadDsContext.
protected void loadDsContext(@Nullable Element dsContextElement) {
DsContext dsContext = null;
if (resultComponent.getFrameOwner() instanceof LegacyFrame) {
DsContextLoader dsContextLoader;
DsContext parentDsContext = getComponentContext().getParent().getDsContext();
if (parentDsContext != null) {
dsContextLoader = new DsContextLoader(parentDsContext.getDataSupplier());
} else {
dsContextLoader = new DsContextLoader(new GenericDataSupplier());
}
dsContext = dsContextLoader.loadDatasources(dsContextElement, parentDsContext, getComponentContext().getAliasesMap());
((ComponentLoaderContext) context).setDsContext(dsContext);
}
if (dsContext != null) {
FrameOwner frameOwner = getComponentContext().getFrame().getFrameOwner();
if (frameOwner instanceof LegacyFrame) {
LegacyFrame frame = (LegacyFrame) frameOwner;
frame.setDsContext(dsContext);
for (Datasource ds : dsContext.getAll()) {
if (ds instanceof DatasourceImplementation) {
((DatasourceImplementation) ds).initialized();
}
}
dsContext.setFrameContext(resultComponent.getContext());
}
}
}
Aggregations