com.vaadin.data.
Interface HasHierarchicalDataProvider<T>
-
Type Parameters:
T
- the item data typeAll Superinterfaces:
ClientConnector
,Component
,Connector
,HasDataProvider<T>
,HasItems<T>
,Serializable
,Sizeable
public interface HasHierarchicalDataProvider<T> extends HasDataProvider<T>
A generic interface for hierarchical listing components that use a data provider for showing data.
Since:
8.1
Author:
Vaadin Ltd
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
-
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
-
-
Field Summary
-
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
-
-
Method Summary
All Methods Modifier and Type Method Description default TreeData<T>
getTreeData()
Gets the backing
TreeData
instance of the data provider, if the data provider is aTreeDataProvider
.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 givenTreeData
.-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, readDesign, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible, writeDesign
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.data.HasDataProvider
setDataProvider
-
Methods inherited from interface com.vaadin.data.HasItems
getDataProvider
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull, setWidthUndefined
-
-
-
-
Method Detail
-
setTreeData
default void setTreeData(TreeData<T> treeData)
Sets a new
TreeDataProvider
wrapping the givenTreeData
.Parameters:
treeData
- the tree data to set
-
getTreeData
default TreeData<T> getTreeData()
Gets the backing
TreeData
instance of the data provider, if the data provider is aTreeDataProvider
.Returns:
the TreeData instance used by the data provider
Throws:
IllegalStateException
- if the type of the data provider is notTreeDataProvider
-
setItems
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.
The provided items are wrapped into a
TreeDataProvider
backed by a flatTreeData
structure. The data provider instance is used as a parameter for theHasDataProvider.setDataProvider(DataProvider)
method. It means that the items collection can be accessed later on viagetTreeData()
: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 withDataProvider.refreshItem(Object)
and when adding or removing itemsDataProvider.refreshAll()
should be called.Parameters:
rootItems
- the root items to display, notnull
childItemProvider
- the value provider used to recursively populate the given root items with child items, notnull
-
setItems
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.
The provided items are wrapped into a
TreeDataProvider
backed by a flatTreeData
structure. The data provider instance is used as a parameter for theHasDataProvider.setDataProvider(DataProvider)
method. It means that the items collection can be accessed later on viagetTreeData()
: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 withDataProvider.refreshItem(Object)
and when adding or removing itemsDataProvider.refreshAll()
should be called.Parameters:
rootItems
- the root items to display, notnull
childItemProvider
- the value provider used to recursively populate the given root items with child items, notnull
-
setItems
default void setItems(Collection<T> items)
Sets the data items of this component provided as a collection.
The provided items are wrapped into a
TreeDataProvider
backed by a flatTreeData
structure. The data provider instance is used as a parameter for theHasDataProvider.setDataProvider(DataProvider)
method. It means that the items collection can be accessed later on viagetTreeData()
: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 withDataProvider.refreshItem(Object)
and when adding or removing itemsDataProvider.refreshAll()
should be called.
-
setItems
default void setItems(Stream<T> items)
Sets the data items of this component provided as a stream.
The provided items are wrapped into a
TreeDataProvider
backed by a flatTreeData
structure. The data provider instance is used as a parameter for theHasDataProvider.setDataProvider(DataProvider)
method. It means that the items collection can be accessed later on viagetTreeData()
: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 withDataProvider.refreshItem(Object)
and when adding or removing itemsDataProvider.refreshAll()
should be called.
-
setItems
default void setItems(T... items)
Sets the data items of this listing.
The provided items are wrapped into a
TreeDataProvider
backed by a flatTreeData
structure. The data provider instance is used as a parameter for theHasDataProvider.setDataProvider(DataProvider)
method. It means that the items collection can be accessed later on viagetTreeData()
: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 withDataProvider.refreshItem(Object)
and when adding or removing itemsDataProvider.refreshAll()
should be called.
-
-