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>,ChildVisitor<T,,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>, ChildVisitor<T,T>
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is called whenever a filter predicate is changed.booleanvoidFired when an object is deleted.fetchChildren(com.vaadin.flow.data.provider.hierarchy.HierarchicalQuery<T, com.vaadin.flow.function.SerializablePredicate<T>> query) get(int index) intintgetChildCount(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.intGet the "resource" owned by this "resource owner".getRoots()getTree()booleanhasChildren(T parent) intvoidFired when a new object is inserted.Retrieves a list of root elements in the hierarchical structure.voidload(int linkType, StoredObject master, String condition, String orderBy, boolean any) Load the links of the given "master" instance.voidload(ObjectIterator<T> objects) Load the given instances.voidLoad the instances.voidvoidrefreshItem(T item) voidrefreshItem(T item, boolean refreshChildren) voidsetLoadFilter(Predicate<T> loadFilter) Set the load filter.intsize()Get the instances count.streamChildren(T parent) Produces a stream of child elements for the given parent element.voidFired when an object is updated.Methods inherited from class com.storedobject.ui.AbstractTreeProvider
addDataLoadedListener, clear, close, filterView, getDataProvider, getItemLabelGenerator, getObjectClass, getViewFilter, isInMemory, setFilter, setItemLabelGeneratorMethods inherited from class com.vaadin.flow.data.provider.hierarchy.AbstractHierarchicalDataProvider
withConfigurableFilter, withConfigurableFilter, withConvertedFilterMethods inherited from class com.vaadin.flow.data.provider.AbstractDataProvider
addDataProviderListener, addListener, fireEventMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
closeMethods inherited from interface com.storedobject.ui.util.ChildVisitor
listChildren, streamRoots, visitAll, visitAll, visitAll, visitAll, visitChildren, visitChildren, visitChildren, visitChildrenMethods inherited from interface com.vaadin.flow.data.provider.DataProvider
addDataProviderListenerMethods inherited from interface com.storedobject.core.FilterMethods
getFilterCondition, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setLoadFilter, setViewFilter, setViewFilterMethods inherited from interface com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider
fetch, sizeMethods inherited from interface com.storedobject.ui.ObjectChangedListener
saved, undeletedMethods 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, setOrderByMethods inherited from interface com.storedobject.ui.ObjectLoader
addDataLoadedListener, clear, getDelegatedLoader, setExtraFilter, setExtraFilter, setFilter, setFilter, setFixedFilter, setFixedFilter, setFixedFilter, setFixedFilterMethods inherited from interface com.storedobject.ui.util.ViewFilterSupport
configure, configure, configure, configureMatch
-
Constructor Details
-
ObjectTreeProvider
-
-
Method Details
-
getTree
-
getRoots
- Specified by:
getRootsin classAbstractTreeProvider<T extends StoredObject,T extends StoredObject>
-
listRoots
Description copied from interface:ChildVisitorRetrieves a list of root elements in the hierarchical structure. This method provides a collection of elements that serve as entry points or origins in the structure.- Specified by:
listRootsin interfaceChildVisitor<T extends StoredObject,T extends StoredObject> - Returns:
- a List of elements of type P representing the root elements
-
streamChildren
Description copied from interface:ChildVisitorProduces a stream of child elements for the given parent element. This allows traversal or processing of direct child elements in a hierarchical structure.- Specified by:
streamChildrenin interfaceChildVisitor<T extends StoredObject,T extends StoredObject> - Parameters:
parent- the parent element whose children are to be streamed- Returns:
- a stream of child elements directly associated with the specified parent
-
getData
- Specified by:
getDatain classAbstractTreeProvider<T extends StoredObject,T extends StoredObject>
-
getFixedFilter
- Specified by:
getFixedFilterin interfaceObjectLoader<T extends StoredObject>
-
getId
- Specified by:
getIdin interfacecom.vaadin.flow.data.provider.DataProvider<T extends StoredObject,com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>>
-
contains
-
getEffectiveCondition
Description copied from interface:FilterMethodsGet 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:
getEffectiveConditionin interfaceFilterMethods<T extends StoredObject>- Specified by:
getEffectiveConditionin 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:ObjectLoaderLoad the instances. Current "load filter" if set will be applied. If "master" is already set, "links" of the "master" will be loaded.- Specified by:
loadin 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:ObjectLoaderLoad the links of the given "master" instance. Current "load filter" if set will be applied.- Specified by:
loadin 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:ObjectLoaderLoad 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:
loadin interfaceObjectLoader<T extends StoredObject>- Specified by:
loadin interfaceObjectLoader<T extends StoredObject>- Parameters:
objects- Objects to be loaded.
-
applyFilterPredicate
public void applyFilterPredicate()Description copied from interface:FilterMethodsThis 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:
applyFilterPredicatein interfaceFilterMethods<T extends StoredObject>- Specified by:
applyFilterPredicatein interfaceObjectLoader<T extends StoredObject>
-
getObjectCount
public int getObjectCount()- Specified by:
getObjectCountin interfaceObjectLoader<T extends StoredObject>- Overrides:
getObjectCountin classAbstractTreeProvider<T extends StoredObject,T extends StoredObject>
-
get
- Specified by:
getin interfaceObjectLoader<T extends StoredObject>- Overrides:
getin classAbstractTreeProvider<T extends StoredObject,T extends StoredObject>
-
indexOf
- Specified by:
indexOfin interfaceObjectLoader<T extends StoredObject>- Overrides:
indexOfin classAbstractTreeProvider<T extends StoredObject,T extends StoredObject>
-
streamAll
- Specified by:
streamAllin interfaceObjectLoader<T extends StoredObject>- Overrides:
streamAllin classAbstractTreeProvider<T extends StoredObject,T extends StoredObject>
-
streamFiltered
- Specified by:
streamFilteredin interfaceObjectLoader<T extends StoredObject>- Overrides:
streamFilteredin classAbstractTreeProvider<T extends StoredObject,T extends StoredObject>
-
getCacheLevel
public int getCacheLevel()- Specified by:
getCacheLevelin interfaceObjectLoader<T extends StoredObject>
-
refreshAll
public void refreshAll()- Specified by:
refreshAllin interfacecom.vaadin.flow.data.provider.DataProvider<T extends StoredObject,com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>> - Overrides:
refreshAllin classAbstractTreeProvider<T extends StoredObject,T extends StoredObject>
-
refreshItem
- Specified by:
refreshItemin interfacecom.vaadin.flow.data.provider.DataProvider<T extends StoredObject,com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>> - Overrides:
refreshItemin classcom.vaadin.flow.data.provider.AbstractDataProvider<T extends StoredObject,com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>>
-
refreshItem
- Specified by:
refreshItemin interfacecom.vaadin.flow.data.provider.DataProvider<T extends StoredObject,com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>> - Overrides:
refreshItemin classcom.vaadin.flow.data.provider.AbstractDataProvider<T extends StoredObject,com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>>
-
inserted
Description copied from interface:ObjectChangedListenerFired when a new object is inserted. The default implementation invokesObjectChangedListener.saved(StoredObject).- Specified by:
insertedin interfaceObjectChangedListener<T extends StoredObject>- Parameters:
object- Object.
-
updated
Description copied from interface:ObjectChangedListenerFired when an object is updated. The default implementation invokesObjectChangedListener.saved(StoredObject).- Specified by:
updatedin interfaceObjectChangedListener<T extends StoredObject>- Parameters:
object- Object.
-
deleted
Description copied from interface:ObjectChangedListenerFired when an object is deleted. The default implementation does nothing.- Specified by:
deletedin interfaceObjectChangedListener<T extends StoredObject>- Parameters:
object- Object.
-
getResource
Description copied from interface:ResourceOwnerGet the "resource" owned by this "resource owner".- Specified by:
getResourcein interfaceResourceOwner- Returns:
- The "resource" owned by this "resource owner".
-
getLoadFilter
Description copied from interface:FilterMethodsGet the load filter.- Specified by:
getLoadFilterin interfaceFilterMethods<T extends StoredObject>- Specified by:
getLoadFilterin interfaceObjectLoader<T extends StoredObject>- Returns:
- Current load filter.
-
getChildCount
public int getChildCount(com.vaadin.flow.data.provider.hierarchy.HierarchicalQuery<T, com.vaadin.flow.function.SerializablePredicate<T>> query) - Specified by:
getChildCountin 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:
fetchChildrenin interfacecom.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T extends StoredObject,com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>>
-
hasChildren
- Specified by:
hasChildrenin interfacecom.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T extends StoredObject,com.vaadin.flow.function.SerializablePredicate<T extends StoredObject>>
-
setLoadFilter
Description copied from interface:FilterMethodsSet the load filter. This will be applied whenever loading takes place.- Specified by:
setLoadFilterin interfaceFilterMethods<T extends StoredObject>- Parameters:
loadFilter- Load filter to be applied while loading.
-
size
public int size()Description copied from interface:ObjectLoaderGet the instances count.- Specified by:
sizein interfaceObjectLoader<T extends StoredObject>- Specified by:
sizein interfaceObjectLoader<T extends StoredObject>- Returns:
- Count.
-