T
- the data typeF
- the filter typepublic class HierarchyMapper<T,F> extends Object implements Serializable
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.
Constructor and Description |
---|
HierarchyMapper(HierarchicalDataProvider<T,F> provider)
Constructs a new HierarchyMapper.
|
Modifier and Type | Method and Description |
---|---|
boolean |
collapse(T item)
Collapses the given item.
|
Range |
collapse(T item,
Integer position)
Collapses the given item.
|
int |
countChildItems(T parent) |
void |
destroyAllData() |
boolean |
expand(T item)
Expands the given item.
|
Range |
expand(T item,
Integer position)
Expands the given item.
|
Stream<T> |
fetchChildItems(T parent,
Range range) |
Stream<T> |
fetchHierarchyItems(Range range)
Gets a stream of items in the form of a flattened hierarchy from the
back-end and filter the wanted results from the list.
|
Stream<T> |
fetchHierarchyItems(T parent,
Range range)
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.
|
Stream<T> |
fetchRootItems(Range range)
Gets a stream of root items from the back-end and filter the wanted
results from the list.
|
List<QuerySortOrder> |
getBackEndSorting()
Gets the current back-end sorting.
|
HierarchicalDataProvider<T,F> |
getDataProvider()
Gets the
HierarchicalDataProvider for this
HierarchyMapper . |
int |
getDepth(T item)
Returns depth of item in the tree starting from zero representing a root.
|
F |
getFilter()
Gets the current filter.
|
Integer |
getIndex(T item)
Finds the index of the item in active tree.
|
Optional<Integer> |
getIndexOf(T target)
Finds the current index of given object.
|
Comparator<T> |
getInMemorySorting()
Gets the current in-memory sorting.
|
Integer |
getParentIndex(T item)
Finds the index of the parent of the item in given target index.
|
protected T |
getParentOfItem(T item)
Find parent for the given item among open folders.
|
int |
getRootSize()
Returns the size of root level.
|
int |
getTreeSize()
Returns the size of the currently expanded hierarchy.
|
boolean |
hasChildren(T item)
Returns whether given item has children.
|
boolean |
hasExpandedItems()
Returns true if there is any expanded items.
|
boolean |
isExpanded(T item)
Returns whether the given item is expanded.
|
protected void |
registerChildren(T parent,
List<T> childList)
Register parent and children items into inner structures.
|
protected void |
removeChildren(Object id)
Removes all children of an item identified by a given id.
|
void |
setBackEndSorting(List<QuerySortOrder> backEndSorting)
Sets the current back-end sorting.
|
void |
setFilter(Object filter)
Sets the current filter.
|
void |
setInMemorySorting(Comparator<T> inMemorySorting)
Sets the current in-memory sorting.
|
public HierarchyMapper(HierarchicalDataProvider<T,F> provider)
provider
- the hierarchical data provider for this mapperpublic int getTreeSize()
public int getRootSize()
public Integer getParentIndex(T item)
item
- the item to get the parent ofpublic Integer getIndex(T item)
item
- the target itempublic boolean isExpanded(T item)
item
- the item to testtrue
if item is expanded; false
if notpublic boolean expand(T item)
item
- the item to expandtrue
if this method expanded the item, false
otherwisepublic Range expand(T item, Integer position)
item
- the item to expandposition
- the index of the itempublic boolean collapse(T item)
item
- the item to collapsepublic Range collapse(T item, Integer position)
item
- the item to collapseposition
- the index of the itempublic Comparator<T> getInMemorySorting()
public void setInMemorySorting(Comparator<T> inMemorySorting)
inMemorySorting
- the in-memory sortingpublic List<QuerySortOrder> getBackEndSorting()
public void setBackEndSorting(List<QuerySortOrder> backEndSorting)
backEndSorting
- the back-end sortingpublic F getFilter()
public void setFilter(Object filter)
filter
- the filterpublic HierarchicalDataProvider<T,F> getDataProvider()
HierarchicalDataProvider
for this
HierarchyMapper
.public boolean hasChildren(T item)
item
- the node to testtrue
if node has children; false
if notpublic Stream<T> fetchHierarchyItems(Range range)
range
- the requested item rangepublic Stream<T> fetchHierarchyItems(T parent, Range range)
parent
- the parent item for the fetchrange
- the requested item rangepublic Stream<T> fetchRootItems(Range range)
range
- the requested item rangepublic int countChildItems(T parent)
public int getDepth(T item)
item
- Target itemprotected T getParentOfItem(T item)
item
- the itemnull
for root items or if the parent is
closedprotected void removeChildren(Object id)
id
- the item idpublic Optional<Integer> getIndexOf(T target)
target
- the target object to findprotected void registerChildren(T parent, List<T> childList)
parent
- the parent itemchildList
- list of parents children to be registered.public void destroyAllData()
public boolean hasExpandedItems()
true
if there is any expanded items.Copyright © 2025. All rights reserved.