Class HierarchyMapper<T,F>
java.lang.Object
com.vaadin.flow.data.provider.hierarchy.HierarchyMapper<T,F>
- Type Parameters:
T- the data typeF- the filter type
- All Implemented Interfaces:
Serializable
@Deprecated(since="24.9",
forRemoval=true)
public class HierarchyMapper<T,F>
extends Object
implements Serializable
Deprecated, for removal: This API element is subject to removal in a future version.
since 24.9 and will be removed in Vaadin 25 where
HierarchicalDataCommunicator will be refactored
to handle hierarchy management entirely on the server side,
requiring data to be stored in a different cache structure.
Mapper for hierarchical data.
Keeps track of the expanded nodes, and size of of the subtrees for each expanded node.
This class is framework internal implementation details, and can be changed / moved at any point. This means that you should not directly use this for anything.
- Since:
- 1.2
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHierarchyMapper(HierarchicalDataProvider<T, F> provider) Deprecated, for removal: This API element is subject to removal in a future version.Constructs a new HierarchyMapper. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDeprecated, for removal: This API element is subject to removal in a future version.Collapses the given item.Deprecated, for removal: This API element is subject to removal in a future version.Collapses the given item.intcountChildItems(T parent) Deprecated, for removal: This API element is subject to removal in a future version.voidDeprecated, for removal: This API element is subject to removal in a future version.booleanDeprecated, for removal: This API element is subject to removal in a future version.Expands the given item.Deprecated, for removal: This API element is subject to removal in a future version.Expands the given item.fetchChildItems(T parent, Range range) Deprecated, for removal: This API element is subject to removal in a future version.fetchHierarchyItems(Range range) Deprecated, for removal: This API element is subject to removal in a future version.Gets a stream of items in the form of a flattened hierarchy from the back-end and filter the wanted results from the list.fetchHierarchyItems(T parent, Range range) Deprecated, for removal: This API element is subject to removal in a future version.Gets a stream of children for the given item in the form of a flattened hierarchy from the back-end and filter the wanted results from the list.fetchRootItems(Range range) Deprecated, for removal: This API element is subject to removal in a future version.Gets a stream of root items from the back-end and filter the wanted results from the list.Deprecated, for removal: This API element is subject to removal in a future version.Gets the current back-end sorting.Deprecated, for removal: This API element is subject to removal in a future version.Gets theHierarchicalDataProviderfor thisHierarchyMapper.intDeprecated, for removal: This API element is subject to removal in a future version.Returns depth of item in the tree starting from zero representing a root.Deprecated, for removal: This API element is subject to removal in a future version.Returns the expanded items in form of an unmodifiable collection.Deprecated, for removal: This API element is subject to removal in a future version.Gets the current filter.Deprecated, for removal: This API element is subject to removal in a future version.Finds the index of the item in active tree.getIndexOf(T target) Deprecated, for removal: This API element is subject to removal in a future version.Finds the current index of given object.Deprecated, for removal: This API element is subject to removal in a future version.Gets the current in-memory sorting.getParentIndex(T item) Deprecated, for removal: This API element is subject to removal in a future version.Finds the index of the parent of the item in given target index.protected TgetParentOfItem(T item) Deprecated, for removal: This API element is subject to removal in a future version.Find parent for the given item among open folders.intDeprecated, for removal: This API element is subject to removal in a future version.Returns the size of root level.intDeprecated, for removal: This API element is subject to removal in a future version.Returns the size of the currently expanded hierarchy.booleanhasChildren(T item) Deprecated, for removal: This API element is subject to removal in a future version.Returns whether given item has children.booleanDeprecated, for removal: This API element is subject to removal in a future version.Returns true if there is any expanded items.booleanisExpanded(T item) Deprecated, for removal: This API element is subject to removal in a future version.Returns whether the given item is expanded.protected voidregisterChildren(T parent, List<T> childList) Deprecated, for removal: This API element is subject to removal in a future version.Register parent and children items into inner structures.protected voidremoveChildren(Object id) Deprecated, for removal: This API element is subject to removal in a future version.Removes all children of an item identified by a given id.voidsetBackEndSorting(List<QuerySortOrder> backEndSorting) Deprecated, for removal: This API element is subject to removal in a future version.Sets the current back-end sorting.voidDeprecated, for removal: This API element is subject to removal in a future version.Sets the current filter.voidsetInMemorySorting(Comparator<T> inMemorySorting) Deprecated, for removal: This API element is subject to removal in a future version.Sets the current in-memory sorting.
-
Constructor Details
-
HierarchyMapper
Deprecated, for removal: This API element is subject to removal in a future version.Constructs a new HierarchyMapper.- Parameters:
provider- the hierarchical data provider for this mapper
-
-
Method Details
-
getTreeSize
public int getTreeSize()Deprecated, for removal: This API element is subject to removal in a future version.Returns the size of the currently expanded hierarchy.- Returns:
- the amount of available data
-
getRootSize
public int getRootSize()Deprecated, for removal: This API element is subject to removal in a future version.Returns the size of root level.- Returns:
- the amount of available root data
-
getParentIndex
Deprecated, for removal: This API element is subject to removal in a future version.Finds the index of the parent of the item in given target index.- Parameters:
item- the item to get the parent of- Returns:
- the parent index or a negative value if the parent is not found
-
getIndex
Deprecated, for removal: This API element is subject to removal in a future version.Finds the index of the item in active tree.- Parameters:
item- the target item- Returns:
- the index or a negative value if item is not found
-
isExpanded
Deprecated, for removal: This API element is subject to removal in a future version.Returns whether the given item is expanded.- Parameters:
item- the item to test- Returns:
trueif item is expanded;falseif not
-
expand
Deprecated, for removal: This API element is subject to removal in a future version.Expands the given item.- Parameters:
item- the item to expand- Returns:
trueif this method expanded the item,falseotherwise
-
expand
Deprecated, for removal: This API element is subject to removal in a future version.Expands the given item.- Parameters:
item- the item to expandposition- the index of the item- Returns:
- range of rows added by expanding the item
-
collapse
Deprecated, for removal: This API element is subject to removal in a future version.Collapses the given item.- Parameters:
item- the item to collapse- Returns:
trueif item has been collapsed,falseif item is empty or already collapsed
-
collapse
Deprecated, for removal: This API element is subject to removal in a future version.Collapses the given item.- Parameters:
item- the item to collapseposition- the index of the item- Returns:
- range of rows removed by collapsing the item
-
getInMemorySorting
Deprecated, for removal: This API element is subject to removal in a future version.Gets the current in-memory sorting.- Returns:
- the in-memory sorting
-
setInMemorySorting
Deprecated, for removal: This API element is subject to removal in a future version.Sets the current in-memory sorting. This will cause the hierarchy to be constructed again.- Parameters:
inMemorySorting- the in-memory sorting
-
getBackEndSorting
Deprecated, for removal: This API element is subject to removal in a future version.Gets the current back-end sorting.- Returns:
- the back-end sorting
-
setBackEndSorting
Deprecated, for removal: This API element is subject to removal in a future version.Sets the current back-end sorting. This will cause the hierarchy to be constructed again.- Parameters:
backEndSorting- the back-end sorting
-
getFilter
Deprecated, for removal: This API element is subject to removal in a future version.Gets the current filter.- Returns:
- the filter
-
setFilter
Deprecated, for removal: This API element is subject to removal in a future version.Sets the current filter. This will cause the hierarchy to be constructed again.- Parameters:
filter- the filter
-
getDataProvider
Deprecated, for removal: This API element is subject to removal in a future version.Gets theHierarchicalDataProviderfor thisHierarchyMapper.- Returns:
- the hierarchical data provider
-
hasChildren
Deprecated, for removal: This API element is subject to removal in a future version.Returns whether given item has children.- Parameters:
item- the node to test- Returns:
trueif node has children;falseif not
-
fetchHierarchyItems
Deprecated, for removal: This API element is subject to removal in a future version.Gets a stream of items in the form of a flattened hierarchy from the back-end and filter the wanted results from the list.- Parameters:
range- the requested item range- Returns:
- the stream of items
-
fetchHierarchyItems
Deprecated, for removal: This API element is subject to removal in a future version.Gets a stream of children for the given item in the form of a flattened hierarchy from the back-end and filter the wanted results from the list.- Parameters:
parent- the parent item for the fetchrange- the requested item range- Returns:
- the stream of items
-
fetchRootItems
Deprecated, for removal: This API element is subject to removal in a future version.Gets a stream of root items from the back-end and filter the wanted results from the list.- Parameters:
range- the requested item range- Returns:
- the stream of items
-
fetchChildItems
Deprecated, for removal: This API element is subject to removal in a future version. -
countChildItems
Deprecated, for removal: This API element is subject to removal in a future version. -
getDepth
Deprecated, for removal: This API element is subject to removal in a future version.Returns depth of item in the tree starting from zero representing a root.- Parameters:
item- Target item- Returns:
- depth of item in the tree or -1 if item is null
-
getParentOfItem
Deprecated, for removal: This API element is subject to removal in a future version.Find parent for the given item among open folders.- Parameters:
item- the item- Returns:
- parent item or
nullfor root items or if the parent is closed
-
removeChildren
Deprecated, for removal: This API element is subject to removal in a future version.Removes all children of an item identified by a given id. Items removed by this method as well as the original item are all marked to be collapsed. May be overridden in subclasses for removing obsolete data to avoid memory leaks.- Parameters:
id- the item id
-
getIndexOf
Deprecated, for removal: This API element is subject to removal in a future version.Finds the current index of given object. This is based on a search in flattened version of the hierarchy.- Parameters:
target- the target object to find- Returns:
- optional index of given object
-
registerChildren
Deprecated, for removal: This API element is subject to removal in a future version.Register parent and children items into inner structures. May be overridden in subclasses.- Parameters:
parent- the parent itemchildList- list of parents children to be registered.
-
destroyAllData
public void destroyAllData()Deprecated, for removal: This API element is subject to removal in a future version. -
hasExpandedItems
public boolean hasExpandedItems()Deprecated, for removal: This API element is subject to removal in a future version.Returns true if there is any expanded items.- Returns:
trueif there is any expanded items.
-
getExpandedItems
Deprecated, for removal: This API element is subject to removal in a future version.Returns the expanded items in form of an unmodifiable collection.- Returns:
- an unmodifiable
Collection<T>containing the expanded items.
-