Package com.storedobject.ui
Class ObjectTreeProvider<T extends StoredObject>
java.lang.Object
com.vaadin.flow.data.provider.AbstractDataProvider<T,com.vaadin.flow.function.SerializablePredicate<T>>
com.vaadin.flow.data.provider.hierarchy.AbstractHierarchicalDataProvider<T,com.vaadin.flow.function.SerializablePredicate<T>>
com.storedobject.ui.AbstractTreeProvider<T,T>
com.storedobject.ui.ObjectTreeProvider<T>
- All Implemented Interfaces:
ResourceOwner
,FilterMethods<T>
,ObjectLoader<T>
,ObjectChangedListener<T>
,ObjectLoader<T>
,ViewFilterSupport<T>
,com.vaadin.flow.data.provider.DataProvider<T,
,com.vaadin.flow.function.SerializablePredicate<T>> com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T,
,com.vaadin.flow.function.SerializablePredicate<T>> Serializable
,AutoCloseable
public class ObjectTreeProvider<T extends StoredObject>
extends AbstractTreeProvider<T,T>
implements ObjectLoader<T>, ObjectChangedListener<T>, AutoCloseable, ResourceOwner, FilterMethods<T>
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is called whenever a filter predicate is changed.boolean
void
Fired when an object is deleted.fetchChildren
(com.vaadin.flow.data.provider.hierarchy.HierarchicalQuery<T, com.vaadin.flow.function.SerializablePredicate<T>> query) get
(int index) int
int
getChildCount
(com.vaadin.flow.data.provider.hierarchy.HierarchicalQuery<T, com.vaadin.flow.function.SerializablePredicate<T>> query) 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".getRoots()
getTree()
boolean
hasChildren
(T parent) int
void
Fired when a new object is inserted.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
void
refreshItem
(T item) void
refreshItem
(T item, boolean refreshChildren) void
setLoadFilter
(Predicate<T> loadFilter) Set the load filter.int
size()
Get the instances count.void
Fired when an object is updated.void
visitChildren
(T parent, Consumer<T> consumer, boolean includeGrandChildren) Visit the children of the parent item.Methods inherited from class com.storedobject.ui.AbstractTreeProvider
addDataLoadedListener, clear, close, filterView, getDataProvider, getItemLabelGenerator, getObjectClass, getViewFilter, isInMemory, setFilter, setItemLabelGenerator
Methods inherited from class com.vaadin.flow.data.provider.hierarchy.AbstractHierarchicalDataProvider
withConfigurableFilter, withConfigurableFilter, withConvertedFilter
Methods inherited from class com.vaadin.flow.data.provider.AbstractDataProvider
addDataProviderListener, addListener, fireEvent
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.AutoCloseable
close
Methods inherited from interface com.vaadin.flow.data.provider.DataProvider
addDataProviderListener
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.hierarchy.HierarchicalDataProvider
fetch, size
Methods inherited from interface com.storedobject.ui.ObjectChangedListener
saved, undeleted
Methods inherited from interface com.storedobject.core.ObjectLoader
applyFilter, canContain, clear, 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, reload, 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
Methods inherited from interface com.storedobject.ui.util.ViewFilterSupport
configure, configure, configure, configureMatch
-
Constructor Details
-
ObjectTreeProvider
-
-
Method Details
-
getTree
-
getRoots
- Specified by:
getRoots
in classAbstractTreeProvider<T extends StoredObject,
T extends StoredObject>
-
getData
- Specified by:
getData
in classAbstractTreeProvider<T extends StoredObject,
T extends StoredObject>
-
getFixedFilter
- Specified by:
getFixedFilter
in interfaceObjectLoader<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.
-
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 classAbstractTreeProvider<T extends StoredObject,
T extends StoredObject>
-
get
- Specified by:
get
in interfaceObjectLoader<T extends StoredObject>
- Overrides:
get
in classAbstractTreeProvider<T extends StoredObject,
T extends StoredObject>
-
indexOf
- Specified by:
indexOf
in interfaceObjectLoader<T extends StoredObject>
- Overrides:
indexOf
in classAbstractTreeProvider<T extends StoredObject,
T extends StoredObject>
-
streamAll
- Specified by:
streamAll
in interfaceObjectLoader<T extends StoredObject>
- Overrides:
streamAll
in classAbstractTreeProvider<T extends StoredObject,
T extends StoredObject>
-
streamFiltered
- Specified by:
streamFiltered
in interfaceObjectLoader<T extends StoredObject>
- Overrides:
streamFiltered
in classAbstractTreeProvider<T extends StoredObject,
T extends StoredObject>
-
getCacheLevel
public int getCacheLevel()- Specified by:
getCacheLevel
in interfaceObjectLoader<T extends StoredObject>
-
refreshAll
public void refreshAll()- Specified by:
refreshAll
in interfacecom.vaadin.flow.data.provider.DataProvider<T extends StoredObject,
com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>> - Overrides:
refreshAll
in classAbstractTreeProvider<T extends StoredObject,
T extends StoredObject>
-
refreshItem
- Specified by:
refreshItem
in interfacecom.vaadin.flow.data.provider.DataProvider<T extends StoredObject,
com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>> - Overrides:
refreshItem
in classcom.vaadin.flow.data.provider.AbstractDataProvider<T extends StoredObject,
com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>>
-
refreshItem
- Specified by:
refreshItem
in interfacecom.vaadin.flow.data.provider.DataProvider<T extends StoredObject,
com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>> - Overrides:
refreshItem
in classcom.vaadin.flow.data.provider.AbstractDataProvider<T extends StoredObject,
com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>>
-
inserted
Description copied from interface:ObjectChangedListener
Fired when a new object is inserted. The default implementation invokesObjectChangedListener.saved(StoredObject)
.- Specified by:
inserted
in interfaceObjectChangedListener<T extends StoredObject>
- Parameters:
object
- Object.
-
updated
Description copied from interface:ObjectChangedListener
Fired when an object is updated. The default implementation invokesObjectChangedListener.saved(StoredObject)
.- Specified by:
updated
in interfaceObjectChangedListener<T extends StoredObject>
- Parameters:
object
- Object.
-
deleted
Description copied from interface:ObjectChangedListener
Fired when an object is deleted. The default implementation does nothing.- Specified by:
deleted
in interfaceObjectChangedListener<T extends StoredObject>
- Parameters:
object
- Object.
-
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.
-
visitChildren
-
getChildCount
public int getChildCount(com.vaadin.flow.data.provider.hierarchy.HierarchicalQuery<T, com.vaadin.flow.function.SerializablePredicate<T>> query) - Specified by:
getChildCount
in interfacecom.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T extends StoredObject,
com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>>
-
fetchChildren
public Stream<T> fetchChildren(com.vaadin.flow.data.provider.hierarchy.HierarchicalQuery<T, com.vaadin.flow.function.SerializablePredicate<T>> query) - Specified by:
fetchChildren
in interfacecom.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T extends StoredObject,
com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>>
-
hasChildren
- Specified by:
hasChildren
in interfacecom.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T extends StoredObject,
com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>>
-
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.
-
size
public int size()Description copied from interface:ObjectLoader
Get the instances count.- Specified by:
size
in interfaceObjectLoader<T extends StoredObject>
- Specified by:
size
in interfaceObjectLoader<T extends StoredObject>
- Returns:
- Count.
-