T - the item data typepublic interface HasHierarchicalDataProvider<T> extends HasDataProvider<T>
| Modifier and Type | Method and Description |
|---|---|
HierarchicalDataProvider<T,SerializablePredicate<T>> |
getDataProvider() |
default TreeData<T> |
getTreeData()
Gets the backing
TreeData instance of the data provider, if the
data provider is a TreeDataProvider. |
default void |
setItems(Collection<T> items)
Sets the data items of this component provided as a collection.
|
default void |
setItems(Collection<T> rootItems,
ValueProvider<T,Collection<T>> childItemProvider)
Sets the root data items of this component provided as a collection and
recursively populates them with child items with the given value
provider.
|
default void |
setItems(Stream<T> items)
Sets the data items of this component provided as a stream.
|
default void |
setItems(Stream<T> rootItems,
ValueProvider<T,Stream<T>> childItemProvider)
Sets the root data items of this component provided as a stream and
recursively populates them with child items with the given value
provider.
|
default void |
setItems(T... items)
Sets the data items of this listing.
|
default void |
setTreeData(TreeData<T> treeData)
Sets a new
TreeDataProvider wrapping the given TreeData. |
setDataProviderHierarchicalDataProvider<T,SerializablePredicate<T>> getDataProvider()
default void setTreeData(TreeData<T> treeData)
TreeDataProvider wrapping the given TreeData.treeData - the tree data to setdefault TreeData<T> getTreeData()
TreeData instance of the data provider, if the
data provider is a TreeDataProvider.IllegalStateException - if the type of the data provider is not
TreeDataProviderdefault void setItems(Collection<T> rootItems, ValueProvider<T,Collection<T>> childItemProvider)
The provided items are wrapped into a TreeDataProvider backed by
a flat TreeData structure. The data provider instance is used as
a parameter for the HasDataProvider.setDataProvider(DataProvider) method. It
means that the items collection can be accessed later on via
getTreeData():
Collection<Person> grandParents = getGrandParents();
HasHierarchicalDataProvider<Person> treeGrid = new TreeGrid<>();
treeGrid.setItems(grandParents, Person::getChildren);
...
TreeData<Person> data = treeGrid.getTreeData();
The returned TreeData instance may be used as-is to add, remove
or modify items in the hierarchy. These modifications to the object are
not automatically reflected back to the TreeGrid. Items modified should
be refreshed with DataProvider.refreshItem(Object)
and when adding or removing items
DataProvider.refreshAll() should be called.
rootItems - the root items to display, not nullchildItemProvider - the value provider used to recursively populate the given root
items with child items, not nulldefault void setItems(Stream<T> rootItems, ValueProvider<T,Stream<T>> childItemProvider)
The provided items are wrapped into a TreeDataProvider backed by
a flat TreeData structure. The data provider instance is used as
a parameter for the HasDataProvider.setDataProvider(DataProvider) method. It
means that the items collection can be accessed later on via
getTreeData():
Stream<Person> grandParents = getGrandParents();
HasHierarchicalDataProvider<Person> treeGrid = new TreeGrid<>();
treeGrid.setItems(grandParents, Person::getChildren);
...
TreeData<Person> data = treeGrid.getTreeData();
The returned TreeData instance may be used as-is to add, remove
or modify items in the hierarchy. These modifications to the object are
not automatically reflected back to the TreeGrid. Items modified should
be refreshed with DataProvider.refreshItem(Object)
and when adding or removing items
DataProvider.refreshAll() should be called.
rootItems - the root items to display, not nullchildItemProvider - the value provider used to recursively populate the given root
items with child items, not nulldefault void setItems(Collection<T> items)
The provided items are wrapped into a TreeDataProvider backed by
a flat TreeData structure. The data provider instance is used as
a parameter for the HasDataProvider.setDataProvider(DataProvider) method. It
means that the items collection can be accessed later on via
getTreeData():
HasHierarchicalDataProvider<String> treeGrid = new TreeGrid<>();
treeGrid.setItems(Arrays.asList("a","b"));
...
TreeData<String> data = treeGrid.getTreeData();
The returned TreeData instance may be used as-is to add, remove
or modify items in the hierarchy. These modifications to the object are
not automatically reflected back to the TreeGrid. Items modified should
be refreshed with DataProvider.refreshItem(Object)
and when adding or removing items
DataProvider.refreshAll() should be called.
default void setItems(Stream<T> items)
The provided items are wrapped into a TreeDataProvider backed by
a flat TreeData structure. The data provider instance is used as
a parameter for the HasDataProvider.setDataProvider(DataProvider) method. It
means that the items collection can be accessed later on via
getTreeData():
HasHierarchicalDataProvider<String> treeGrid = new TreeGrid<>();
treeGrid.setItems(Stream.of("a","b"));
...
TreeData<String> data = treeGrid.getTreeData();
The returned TreeData instance may be used as-is to add, remove
or modify items in the hierarchy. These modifications to the object are
not automatically reflected back to the TreeGrid. Items modified should
be refreshed with DataProvider.refreshItem(Object)
and when adding or removing items
DataProvider.refreshAll() should be called.
setItems in interface HasItems<T>items - the data items to display, not nullHasItems.setItems(Collection)default void setItems(T... items)
The provided items are wrapped into a TreeDataProvider backed by
a flat TreeData structure. The data provider instance is used as
a parameter for the HasDataProvider.setDataProvider(DataProvider) method. It
means that the items collection can be accessed later on via
getTreeData():
TreeGrid<String> treeGrid = new TreeGrid<>();
treeGrid.setItems("a","b");
...
TreeData<String> data = treeGrid.getTreeData();
The returned TreeData instance may be used as-is to add, remove
or modify items in the hierarchy. These modifications to the object are
not automatically reflected back to the TreeGrid. Items modified should
be refreshed with DataProvider.refreshItem(Object)
and when adding or removing items
DataProvider.refreshAll() should be called.
setItems in interface HasItems<T>items - the data items to display, not nullHasItems.setItems(Collection)Copyright © 2025. All rights reserved.