Package io.jmix.ui.model.impl
Class KeyValueCollectionLoaderImpl
java.lang.Object
io.jmix.ui.model.impl.KeyValueCollectionLoaderImpl
- All Implemented Interfaces:
BaseCollectionLoader,DataLoader,KeyValueCollectionLoader
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.model.KeyValueCollectionLoader
KeyValueCollectionLoader.PostLoadEvent, KeyValueCollectionLoader.PreLoadEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Conditionprotected KeyValueCollectionContainerprotected DataContextprotected DataManagerprotected Function<ValueLoadContext,List<KeyValueEntity>> protected EventHubprotected intprotected Map<String,Serializable> protected intprotected Stringprotected Sortprotected SorterFactoryprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a listener toKeyValueCollectionLoader.PostLoadEvent.Adds a listener toKeyValueCollectionLoader.PreLoadEvent.ReturnsValueLoadContextwhich is created by the parameters of this loader.Returns the root condition which is used together with the query when loading entities.Returns the container which accepts loaded entities.Returns data context.Returns a function which will be used to load data instead of standard implementation.intThe position of the first instance to load, numbered from 0.getHints()intThe maximum number of instances to load.getParameter(String name) Returns a query parameter by its name.Returns the map of query parameters.getQuery()Returns the query which is used for loading entities.getSort()Returns the sort object which is used when loading.Returns data store name.voidload()Loads data to the connected container.voidremoveParameter(String name) Removes a query parameter.protected voidsendPostLoadEvent(List<KeyValueEntity> entities) protected booleansendPreLoadEvent(ValueLoadContext loadContext) voidsetCondition(Condition condition) Sets the root condition which will be used together with the query when loading entities.voidsetContainer(KeyValueCollectionContainer container) Sets the container which accepts loaded entities.voidsetDataContext(DataContext dataContext) Sets the data context for the loader.voidsetFirstResult(int firstResult) Sets the position of the first instance to load, numbered from 0.voidsetHint(String hintName, Serializable value) Sets custom hint that should be used by the query for loading data.voidsetLoadDelegate(Function<ValueLoadContext, List<KeyValueEntity>> delegate) Sets a function which will be used to load data instead of standard implementation.voidsetMaxResults(int maxResults) Sets the maximum number of instances to load.voidsetParameter(String name, Object value) Sets a query parameter.voidsetParameters(Map<String, Object> parameters) Sets the map of query parameters.voidSets a query which will be used for loading entities.voidSets the sort object which is used when loading.voidsetStoreName(String name) Sets the data store name.
-
Field Details
-
dataManager
-
sorterFactory
-
dataContext
-
container
-
query
-
condition
-
parameters
-
firstResult
protected int firstResult -
maxResults
protected int maxResults -
sort
-
hints
-
storeName
-
delegate
-
events
-
-
Constructor Details
-
KeyValueCollectionLoaderImpl
public KeyValueCollectionLoaderImpl()
-
-
Method Details
-
getDataContext
Description copied from interface:DataLoaderReturns data context. If the data context is set, all loaded instance will be merged into it.- Specified by:
getDataContextin interfaceDataLoader
-
setDataContext
Description copied from interface:DataLoaderSets the data context for the loader. If the data context is set, all loaded instance will be merged into it.- Specified by:
setDataContextin interfaceDataLoader
-
load
public void load()Description copied from interface:DataLoaderLoads data to the connected container.- Specified by:
loadin interfaceDataLoader
-
createLoadContext
Description copied from interface:KeyValueCollectionLoaderReturnsValueLoadContextwhich is created by the parameters of this loader. TheValueLoadContextcan be used withDataManagerto load data by the same conditions.- Specified by:
createLoadContextin interfaceKeyValueCollectionLoader
-
sendPreLoadEvent
-
sendPostLoadEvent
-
getContainer
Description copied from interface:KeyValueCollectionLoaderReturns the container which accepts loaded entities.- Specified by:
getContainerin interfaceBaseCollectionLoader- Specified by:
getContainerin interfaceDataLoader- Specified by:
getContainerin interfaceKeyValueCollectionLoader
-
setContainer
Description copied from interface:KeyValueCollectionLoaderSets the container which accepts loaded entities.- Specified by:
setContainerin interfaceKeyValueCollectionLoader
-
getQuery
Description copied from interface:DataLoaderReturns the query which is used for loading entities.- Specified by:
getQueryin interfaceDataLoader
-
setQuery
Description copied from interface:DataLoaderSets a query which will be used for loading entities.- Specified by:
setQueryin interfaceDataLoader
-
getCondition
Description copied from interface:DataLoaderReturns the root condition which is used together with the query when loading entities.- Specified by:
getConditionin interfaceDataLoader
-
setCondition
Description copied from interface:DataLoaderSets the root condition which will be used together with the query when loading entities.- Specified by:
setConditionin interfaceDataLoader
-
getParameters
Description copied from interface:DataLoaderReturns the map of query parameters.- Specified by:
getParametersin interfaceDataLoader
-
setParameters
Description copied from interface:DataLoaderSets the map of query parameters.- Specified by:
setParametersin interfaceDataLoader
-
getParameter
Description copied from interface:DataLoaderReturns a query parameter by its name.- Specified by:
getParameterin interfaceDataLoader
-
setParameter
Description copied from interface:DataLoaderSets a query parameter.- Specified by:
setParameterin interfaceDataLoader
-
removeParameter
Description copied from interface:DataLoaderRemoves a query parameter.- Specified by:
removeParameterin interfaceDataLoader
-
getMaxResults
public int getMaxResults()Description copied from interface:BaseCollectionLoaderThe maximum number of instances to load. ReturnsInteger.MAX_VALUEifBaseCollectionLoader.setMaxResults(int)was not called.- Specified by:
getMaxResultsin interfaceBaseCollectionLoader
-
setMaxResults
public void setMaxResults(int maxResults) Description copied from interface:BaseCollectionLoaderSets the maximum number of instances to load.- Specified by:
setMaxResultsin interfaceBaseCollectionLoader
-
getSort
Description copied from interface:BaseCollectionLoaderReturns the sort object which is used when loading.- Specified by:
getSortin interfaceBaseCollectionLoader
-
setSort
Description copied from interface:BaseCollectionLoaderSets the sort object which is used when loading.- Specified by:
setSortin interfaceBaseCollectionLoader
-
setHint
Description copied from interface:DataLoaderSets custom hint that should be used by the query for loading data.- Specified by:
setHintin interfaceDataLoader
-
getHints
- Specified by:
getHintsin interfaceDataLoader- Returns:
- custom hints which are used by the query for loading data.
-
getDelegate
Description copied from interface:KeyValueCollectionLoaderReturns a function which will be used to load data instead of standard implementation.- Specified by:
getDelegatein interfaceKeyValueCollectionLoader
-
setLoadDelegate
Description copied from interface:KeyValueCollectionLoaderSets a function which will be used to load data instead of standard implementation.- Specified by:
setLoadDelegatein interfaceKeyValueCollectionLoader
-
addPreLoadListener
Description copied from interface:KeyValueCollectionLoaderAdds a listener toKeyValueCollectionLoader.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(KeyValueCollectionLoader.PreLoadEvent event) { // handle event here }- Specified by:
addPreLoadListenerin interfaceKeyValueCollectionLoader- Parameters:
listener- listener- Returns:
- subscription
-
addPostLoadListener
Description copied from interface:KeyValueCollectionLoaderAdds a listener toKeyValueCollectionLoader.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(KeyValueCollectionLoader.PostLoadEvent event) { // handle event here }- Specified by:
addPostLoadListenerin interfaceKeyValueCollectionLoader- Parameters:
listener- listener- Returns:
- subscription
-
getStoreName
Description copied from interface:KeyValueCollectionLoaderReturns data store name.- Specified by:
getStoreNamein interfaceKeyValueCollectionLoader
-
setStoreName
Description copied from interface:KeyValueCollectionLoaderSets the data store name. By default, the main data store is used.- Specified by:
setStoreNamein interfaceKeyValueCollectionLoader
-
getFirstResult
public int getFirstResult()Description copied from interface:BaseCollectionLoaderThe position of the first instance to load, numbered from 0. Returns 0 ifBaseCollectionLoader.setFirstResult(int)was not called.- Specified by:
getFirstResultin interfaceBaseCollectionLoader
-
setFirstResult
public void setFirstResult(int firstResult) Description copied from interface:BaseCollectionLoaderSets the position of the first instance to load, numbered from 0.- Specified by:
setFirstResultin interfaceBaseCollectionLoader
-