Package com.storedobject.ui
Class ObjectListProvider<T extends StoredObject>
java.lang.Object
com.vaadin.flow.data.provider.AbstractDataProvider<T,com.vaadin.flow.function.SerializablePredicate<T>>
com.vaadin.flow.data.provider.ListDataProvider<T>
com.storedobject.ui.AbstractListProvider<T>
com.storedobject.ui.ObjectListProvider<T>
- All Implemented Interfaces:
ResourceOwner
,FilterMethods<T>
,ObjectLoader<T>
,ObjectLoader<T>
,ViewFilterSupport<T>
,com.vaadin.flow.data.provider.ConfigurableFilterDataProvider<T,
,com.vaadin.flow.function.SerializablePredicate<T>, com.vaadin.flow.function.SerializablePredicate<T>> com.vaadin.flow.data.provider.DataProvider<T,
,com.vaadin.flow.function.SerializablePredicate<T>> com.vaadin.flow.data.provider.InMemoryDataProvider<T>
,Serializable
,AutoCloseable
- Direct Known Subclasses:
EditableObjectListProvider
,ReferenceLinkListProvider
public class ObjectListProvider<T extends StoredObject>
extends AbstractListProvider<T>
implements ObjectLoader<T>, AutoCloseable, ResourceOwner
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionObjectListProvider
(ObjectList<T> cache) ObjectListProvider
(Class<T> objectClass, DataList<T> data) -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is called whenever a filter predicate is changed.void
clear()
Clear - remove all entries.final void
close()
boolean
get
(int index) int
getData()
getEffectiveCondition
(String condition) Get the "effective" filter condition that must be applied for loading.Get the load filter.int
Get the "resource" owned by this "resource owner".int
void
load
(int linkType, StoredObject master, String condition, String orderBy, boolean any) Load the links of the given "master" instance.void
load
(ObjectIterator<T> objects) Load the given instances.void
Load the instances.void
reload()
Reload all entries.void
setLoadFilter
(Predicate<T> loadFilter) Set the load filter.Methods inherited from class com.storedobject.ui.AbstractListProvider
addDataLoadedListener, fetch, filterView, getDataProvider, getItems, getObjectClass, getViewFilter, refreshAll, setFilter, setSortComparator, size
Methods inherited from class com.vaadin.flow.data.provider.ListDataProvider
getFilter, getSortComparator
Methods inherited from class com.vaadin.flow.data.provider.AbstractDataProvider
addDataProviderListener, addListener, fireEvent, refreshItem, refreshItem
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.data.provider.DataProvider
addDataProviderListener, refreshItem, refreshItem, withConfigurableFilter, withConfigurableFilter, withConvertedFilter
Methods inherited from interface com.storedobject.core.FilterMethods
getFilterCondition, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setLoadFilter, setViewFilter, setViewFilter
Methods inherited from interface com.vaadin.flow.data.provider.InMemoryDataProvider
addFilter, addFilter, addFilterByValue, addSortComparator, addSortOrder, clearFilters, filteringBy, filteringBy, filteringByEquals, filteringByPrefix, filteringByPrefix, filteringBySubstring, filteringBySubstring, isInMemory, setFilter, setFilterByValue, setSortOrder
Methods inherited from interface com.storedobject.core.ObjectLoader
applyFilter, canContain, getAllowAny, getLinkType, getMaster, getObjectClass, getOrderBy, isAllowAny, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, setLinkType, setLinkType, setMaster, setMaster, setOrderBy, setOrderBy
Methods inherited from interface com.storedobject.ui.ObjectLoader
addDataLoadedListener, clear, getDelegatedLoader, setExtraFilter, setExtraFilter, setFilter, setFilter, setFixedFilter, setFixedFilter, setFixedFilter, setFixedFilter, size
Methods inherited from interface com.storedobject.ui.util.ViewFilterSupport
configure, configure, configure, configureMatch
-
Constructor Details
-
ObjectListProvider
-
ObjectListProvider
-
-
Method Details
-
getFixedFilter
- Specified by:
getFixedFilter
in interfaceObjectLoader<T extends StoredObject>
-
getData
- Overrides:
getData
in classAbstractListProvider<T extends StoredObject>
-
getId
- Specified by:
getId
in interfacecom.vaadin.flow.data.provider.DataProvider<T extends StoredObject,
com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>>
-
contains
-
getEffectiveCondition
Description copied from interface:FilterMethods
Get the "effective" filter condition that must be applied for loading. The result fromFilterMethods.getFilterCondition()
will be passed as a parameter to this method to get a modified "condition" if required.- Specified by:
getEffectiveCondition
in interfaceFilterMethods<T extends StoredObject>
- Specified by:
getEffectiveCondition
in interfaceObjectLoader<T extends StoredObject>
- Parameters:
condition
- Condition obtained fromFilterMethods.getFilterCondition()
.- Returns:
- Modified condition or the same if no modification required.
-
load
Description copied from interface:ObjectLoader
Load the instances. Current "load filter" if set will be applied. If "master" is already set, "links" of the "master" will be loaded.- Specified by:
load
in interfaceObjectLoader<T extends StoredObject>
- Parameters:
condition
- Filtering condition to be applied.orderBy
- "ORDER BY" clause to use while loading.any
- Whether instanced of the subclasses to be retrieved or not.
-
load
Description copied from interface:ObjectLoader
Load the links of the given "master" instance. Current "load filter" if set will be applied.- Specified by:
load
in interfaceObjectLoader<T extends StoredObject>
- Parameters:
linkType
- Link type.master
- Master instance.condition
- Filtering condition to be applied.orderBy
- "ORDER BY" clause to use while loading.any
- Whether instanced of the subclasses to be retrieved or not.
-
load
Description copied from interface:ObjectLoader
Load the given instances. Current "load filter" if set will be applied. However,ObjectLoader.getOrderBy()
result will be ignored. Also, the value returned byObjectLoader.getAllowAny()
will determine whether instanced of the subclasses to be restricted or not.- Specified by:
load
in interfaceObjectLoader<T extends StoredObject>
- Specified by:
load
in interfaceObjectLoader<T extends StoredObject>
- Parameters:
objects
- Objects to be loaded.
-
reload
public void reload()Description copied from interface:ObjectLoader
Reload all entries.- Specified by:
reload
in interfaceObjectLoader<T extends StoredObject>
-
applyFilterPredicate
public void applyFilterPredicate()Description copied from interface:FilterMethods
This method is called whenever a filter predicate is changed. Methods with default implementation already invoke this method. If any of those methods are overridden, make sure that it invokes this method so that logic to handle filter changes can be coded here.Note: This method is used to show the filtered result of the existing entries
- Specified by:
applyFilterPredicate
in interfaceFilterMethods<T extends StoredObject>
- Specified by:
applyFilterPredicate
in interfaceObjectLoader<T extends StoredObject>
-
getObjectCount
public int getObjectCount()- Specified by:
getObjectCount
in interfaceObjectLoader<T extends StoredObject>
- Overrides:
getObjectCount
in classAbstractListProvider<T extends StoredObject>
-
get
- Specified by:
get
in interfaceObjectLoader<T extends StoredObject>
- Overrides:
get
in classAbstractListProvider<T extends StoredObject>
-
indexOf
- Specified by:
indexOf
in interfaceObjectLoader<T extends StoredObject>
- Overrides:
indexOf
in classAbstractListProvider<T extends StoredObject>
-
streamAll
- Specified by:
streamAll
in interfaceObjectLoader<T extends StoredObject>
- Overrides:
streamAll
in classAbstractListProvider<T extends StoredObject>
-
streamFiltered
- Specified by:
streamFiltered
in interfaceObjectLoader<T extends StoredObject>
- Overrides:
streamFiltered
in classAbstractListProvider<T extends StoredObject>
-
getCacheLevel
public int getCacheLevel()- Specified by:
getCacheLevel
in interfaceObjectLoader<T extends StoredObject>
-
clear
public void clear()Description copied from interface:ObjectLoader
Clear - remove all entries.- Specified by:
clear
in interfaceObjectLoader<T extends StoredObject>
- Overrides:
clear
in classAbstractListProvider<T extends StoredObject>
-
close
public final void close()- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classAbstractListProvider<T extends StoredObject>
-
getResource
Description copied from interface:ResourceOwner
Get the "resource" owned by this "resource owner".- Specified by:
getResource
in interfaceResourceOwner
- Returns:
- The "resource" owned by this "resource owner".
-
getLoadFilter
Description copied from interface:FilterMethods
Get the load filter.- Specified by:
getLoadFilter
in interfaceFilterMethods<T extends StoredObject>
- Specified by:
getLoadFilter
in interfaceObjectLoader<T extends StoredObject>
- Returns:
- Current load filter.
-
setLoadFilter
Description copied from interface:FilterMethods
Set the load filter. This will be applied whenever loading takes place.- Specified by:
setLoadFilter
in interfaceFilterMethods<T extends StoredObject>
- Parameters:
loadFilter
- Load filter to be applied while loading.
-