Package io.jmix.flowui.model
Interface InstanceLoader<E>
- All Superinterfaces:
DataLoader
- All Known Implementing Classes:
InstanceLoaderImpl
Loader of a single entity instance.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Event sent after successful loading of an entity instance, merging it intoDataContext
and setting to the container.static class
Event sent before loading an entity instance. -
Method Summary
Modifier and TypeMethodDescriptionaddPostLoadListener
(Consumer<InstanceLoader.PostLoadEvent<E>> listener) Adds a listener toInstanceLoader.PostLoadEvent
.addPreLoadListener
(Consumer<InstanceLoader.PreLoadEvent<E>> listener) Adds a listener toInstanceLoader.PreLoadEvent
.Returns the container which accepts the loaded entity.Returns id of the entity to load.Returns the fetch plan used for loading the entity.Returns a function which will be used to load data instead of standard implementation.void
setContainer
(InstanceContainer<E> container) Sets the container which accepts the loaded entity.void
setEntityId
(Object entityId) Sets the id of the entity to load.void
setFetchPlan
(FetchPlan fetchPlan) Sets the fetch plan to use for loading the entity.void
setFetchPlan
(String fetchPlanName) Sets the name of the fetch plan to use for loading the entity.void
setLoadDelegate
(Function<LoadContext<E>, E> delegate) Sets a function which will be used to load data instead of standard implementation.Methods 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
InstanceContainer<E> getContainer()Returns the container which accepts the loaded entity.- Specified by:
getContainer
in interfaceDataLoader
-
setContainer
Sets the container which accepts the loaded entity. -
getEntityId
Returns id of the entity to load. -
setEntityId
Sets the id of the entity to load. -
getFetchPlan
FetchPlan getFetchPlan()Returns the fetch plan used for loading the entity. -
setFetchPlan
Sets the fetch plan to use for loading the entity. -
setFetchPlan
Sets the name of the fetch plan to use for loading the entity.- Throws:
IllegalStateException
- if the fetch plan has already been set bysetFetchPlan(FetchPlan)
-
getLoadDelegate
Function<LoadContext<E>,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 toInstanceLoader.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(InstanceLoader.PreLoadEvent<Foo> event) { // handle event here }
- Parameters:
listener
- listener- Returns:
- subscription
-
addPostLoadListener
Adds a listener toInstanceLoader.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(InstanceLoader.PostLoadEvent<Foo> event) { // handle event here }
- Parameters:
listener
- listener- Returns:
- subscription
-