Package io.jmix.ui.model
Interface KeyValueInstanceLoader
- All Superinterfaces:
DataLoader
- All Known Implementing Classes:
KeyValueInstanceLoaderImpl
Loads a single instance of
KeyValueEntity
.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Event sent after successful loading of a KeyValueEntity instance and setting it to the container.static class
Event sent before loading a KeyValueEntity instance. -
Method Summary
Modifier and TypeMethodDescriptionAdds a listener toKeyValueInstanceLoader.PostLoadEvent
.Adds a listener toKeyValueInstanceLoader.PreLoadEvent
.ReturnsValueLoadContext
which is created by the parameters of this loader.Returns the container which accepts loaded entities.Returns a function which will be used to load data instead of standard implementation.Returns data store name.void
setContainer
(KeyValueContainer container) Sets the container which accepts loaded entities.void
setLoadDelegate
(Function<ValueLoadContext, KeyValueEntity> delegate) Sets a function which will be used to load data instead of standard implementation.void
setStoreName
(String name) Sets the data store name.Methods inherited from interface io.jmix.ui.model.DataLoader
getCondition, getDataContext, getHints, getParameter, getParameters, getQuery, load, removeParameter, setCondition, setDataContext, setHint, setParameter, setParameters, setQuery
-
Method Details
-
getContainer
KeyValueContainer getContainer()Returns the container which accepts loaded entities.- Specified by:
getContainer
in interfaceDataLoader
-
setContainer
Sets the container which accepts loaded entities. -
createLoadContext
ValueLoadContext createLoadContext()ReturnsValueLoadContext
which is created by the parameters of this loader. TheValueLoadContext
can be used withDataManager
to load data by the same conditions. -
getStoreName
String getStoreName()Returns data store name. -
setStoreName
Sets the data store name. By default, the main data store is used. -
getLoadDelegate
Function<ValueLoadContext,KeyValueEntity> 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 toKeyValueInstanceLoader.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(KeyValueInstanceLoader.PreLoadEvent event) { // handle event here }
- Parameters:
listener
- listener- Returns:
- subscription
-
addPostLoadListener
Adds a listener toKeyValueInstanceLoader.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(KeyValueInstanceLoader.PostLoadEvent event) { // handle event here }
- Parameters:
listener
- listener- Returns:
- subscription
-