Package io.jmix.flowui.data.pagination
Class PaginationDataLoaderImpl
java.lang.Object
io.jmix.flowui.data.pagination.PaginationDataLoaderImpl
- All Implemented Interfaces:
PaginationDataLoader
@Component("flowui_PaginationDataLoaderImpl")
@Scope("prototype")
public class PaginationDataLoaderImpl
extends Object
implements PaginationDataLoader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CollectionContainer<?>protected Consumer<CollectionContainer.CollectionChangeEvent<?>>protected DataManagerprotected BaseCollectionLoaderprotected Consumer<CollectionChangeType>protected Function<LoadContext,Integer> protected WeakCollectionChangeListener<?> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidintgetCount()intintvoidrefresh()Reloads instances.voidRemoves collection change listener.voidSets collection change listener.voidsetDataManager(DataManager dataManager) voidsetFirstResult(int startPosition) Sets the position of the first instance to load.voidsetMaxResults(int maxResults) Sets maximum number of instances to load.voidsetTotalCountDelegate(Function<LoadContext, Integer> totalCountDelegate) Sets delegate which is used to get the total count of items.intsize()
-
Field Details
-
dataManager
-
container
-
loader
-
refreshListener
-
weakContainerCollectionChangeListener
-
containerCollectionChangeListener
-
totalCountDelegate
-
-
Constructor Details
-
PaginationDataLoaderImpl
-
-
Method Details
-
attachCollectionChangeListener
protected void attachCollectionChangeListener() -
setDataManager
-
getFirstResult
public int getFirstResult()- Specified by:
getFirstResultin interfacePaginationDataLoader- Returns:
- first position to load
-
setFirstResult
public void setFirstResult(int startPosition) Description copied from interface:PaginationDataLoaderSets the position of the first instance to load.- Specified by:
setFirstResultin interfacePaginationDataLoader
-
getMaxResults
public int getMaxResults()- Specified by:
getMaxResultsin interfacePaginationDataLoader- Returns:
- maximum number of instances to load
-
setMaxResults
public void setMaxResults(int maxResults) Description copied from interface:PaginationDataLoaderSets maximum number of instances to load.- Specified by:
setMaxResultsin interfacePaginationDataLoader
-
getCount
public int getCount()- Specified by:
getCountin interfacePaginationDataLoader- Returns:
- number of instances in the data store
-
size
public int size()- Specified by:
sizein interfacePaginationDataLoader- Returns:
- number of instances are currently loaded
-
refresh
public void refresh()Description copied from interface:PaginationDataLoaderReloads instances.- Specified by:
refreshin interfacePaginationDataLoader
-
removeCollectionChangeListener
public void removeCollectionChangeListener()Description copied from interface:PaginationDataLoaderRemoves collection change listener.- Specified by:
removeCollectionChangeListenerin interfacePaginationDataLoader
-
setCollectionChangeListener
Description copied from interface:PaginationDataLoaderSets collection change listener.- Specified by:
setCollectionChangeListenerin interfacePaginationDataLoader
-
getEntityMetaClass
- Specified by:
getEntityMetaClassin interfacePaginationDataLoader- Returns:
- meta class of entity
-
getTotalCountDelegate
- Specified by:
getTotalCountDelegatein interfacePaginationDataLoader- Returns:
- total count delegate or
nullotherwise
-
setTotalCountDelegate
Description copied from interface:PaginationDataLoaderSets delegate which is used to get the total count of items.- Specified by:
setTotalCountDelegatein interfacePaginationDataLoader- Parameters:
totalCountDelegate- function that takes currentLoadContextof loader and return calculated total count
-