Package io.jmix.flowui.model
Interface CollectionLoader<E>
- All Superinterfaces:
BaseCollectionLoader,DataLoader
- All Known Implementing Classes:
CollectionLoaderImpl
Loader of entity collections.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classEvent sent after successful loading of entities, merging them intoDataContextand setting to the container.static classEvent sent before loading entities. -
Method Summary
Modifier and TypeMethodDescriptionaddPostLoadListener(Consumer<CollectionLoader.PostLoadEvent<E>> listener) Adds a listener toCollectionLoader.PostLoadEvent.addPreLoadListener(Consumer<CollectionLoader.PreLoadEvent<E>> listener) Adds a listener toCollectionLoader.PreLoadEvent.ReturnsLoadContextwhich is created by the parameters of this loader.Returns the container which accepts loaded entities.Returns the fetch plan used for loading entities.Function<LoadContext<E>,List<E>> Returns a function which will be used to load data instead of standard implementation.booleanReturns true if the query for loading data is cacheable.voidsetCacheable(boolean cacheable) Sets the query for loading data cacheable.voidsetContainer(CollectionContainer<E> container) Sets the container which accepts loaded entities.voidsetFetchPlan(FetchPlan fetchPlan) Sets the fetch plan to use for loading entities.voidsetFetchPlan(String fetchPlanName) Sets the name of the fetch plan to use for loading entities.voidsetLoadDelegate(Function<LoadContext<E>, List<E>> delegate) Sets a function which will be used to load data instead of standard implementation.Methods inherited from interface io.jmix.flowui.model.BaseCollectionLoader
getFirstResult, getMaxResults, getSort, setFirstResult, setMaxResults, setSortMethods inherited from interface io.jmix.flowui.model.DataLoader
getCondition, getDataContext, getHints, getParameter, getParameters, getQuery, load, removeParameter, setCondition, setDataContext, setHint, setParameter, setParameters, setQuery
-
Method Details
-
getContainer
CollectionContainer<E> getContainer()Returns the container which accepts loaded entities.- Specified by:
getContainerin interfaceBaseCollectionLoader- Specified by:
getContainerin interfaceDataLoader
-
setContainer
Sets the container which accepts loaded entities. -
createLoadContext
LoadContext<E> createLoadContext()ReturnsLoadContextwhich is created by the parameters of this loader. TheLoadContextcan be used withDataManagerto load data by the same conditions. -
isCacheable
boolean isCacheable()Returns true if the query for loading data is cacheable. -
setCacheable
void setCacheable(boolean cacheable) Sets the query for loading data cacheable. -
getFetchPlan
FetchPlan getFetchPlan()Returns the fetch plan used for loading entities. -
setFetchPlan
Sets the fetch plan to use for loading entities. -
setFetchPlan
Sets the name of the fetch plan to use for loading entities.- Throws:
IllegalStateException- if the fetch plan has already been set bysetFetchPlan(FetchPlan)
-
getLoadDelegate
Function<LoadContext<E>,List<E>> getLoadDelegate()Returns a function which will be used to load data instead of standard implementation. -
setLoadDelegate
Sets a function which will be used to load data instead of standard implementation. -
addPreLoadListener
Adds a listener toCollectionLoader.PreLoadEvent.You can also add an event listener declaratively using a controller method annotated with
Subscribe:@Subscribe(id = "fooDl", target = Target.DATA_LOADER) private void onFooDlPreLoad(CollectionLoader.PreLoadEvent event) { // handle event here }- Parameters:
listener- listener- Returns:
- subscription
-
addPostLoadListener
Adds a listener toCollectionLoader.PostLoadEvent.You can also add an event listener declaratively using a controller method annotated with
Subscribe:@Subscribe(id = "fooDl", target = Target.DATA_LOADER) private void onFooDlPostLoad(CollectionLoader.PostLoadEvent event) { // handle event here }- Parameters:
listener- listener- Returns:
- subscription
-