com.vaadin.flow.component.treegrid.
Class TreeGrid<T>
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.grid.Grid<T>
-
- com.vaadin.flow.component.treegrid.TreeGrid<T>
-
Type Parameters:
T
- the grid bean typeAll Implemented Interfaces:
AttachNotifier, BlurNotifier<Grid<T>>, DetachNotifier, Focusable<Grid<T>>, FocusNotifier<Grid<T>>, HasElement, HasEnabled, HasSize, HasStyle, HasTheme, SortEvent.SortNotifier<Grid<T>,GridSortOrder<T>>, HasDataGenerators<T>, HasDataView<T,Void,GridDataView<T>>, HasLazyDataView<T,Void,GridLazyDataView<T>>, HasListDataView<T,GridListDataView<T>>, HasHierarchicalDataProvider<T>, Serializable
@JsModule(value="@vaadin/vaadin-grid/src/vaadin-grid-tree-toggle.js") public class TreeGrid<T> extends Grid<T> implements HasHierarchicalDataProvider<T>
A grid component for displaying hierarchical tabular data.
Author:
Vaadin Ltd
See Also:
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.flow.component.grid.Grid
Grid.AbstractGridExtension<T>, Grid.Column<T>, Grid.DataCommunicatorBuilder<T,U extends ArrayUpdater>, Grid.NestedNullBehavior, Grid.SelectionMode, Grid.UpdateQueue
-
Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
BlurNotifier.BlurEvent<C extends Component>
-
Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
FocusNotifier.FocusEvent<C extends Component>
-
-
Constructor Summary
Constructors Constructor and Description TreeGrid()
Creates a new
TreeGrid
without support for creating columns based on property names.TreeGrid(Class<T> beanType)
Creates a new
TreeGrid
with an initial set of columns for each of the bean's properties.TreeGrid(HierarchicalDataProvider<T,?> dataProvider)
Creates a new
TreeGrid
using the givenHierarchicalDataProvider
, without support for creating columns based on property names.
-
Method Summary
All Methods Modifier and Type Method and Description Registration
addCollapseListener(ComponentEventListener<CollapseEvent<T,TreeGrid<T>>> listener)
Adds a CollapseEvent listener to this TreeGrid.
<V extends Component>
Grid.Column<T>addComponentHierarchyColumn(ValueProvider<T,V> componentProvider)
Adds a new Hierarchy column that shows components.
Registration
addExpandListener(ComponentEventListener<ExpandEvent<T,TreeGrid<T>>> listener)
Adds an ExpandEvent listener to this TreeGrid.
Grid.Column<T>
addHierarchyColumn(ValueProvider<T,?> valueProvider)
Adds a new Hierarchy column to this
Grid
with a value provider.void
collapse(Collection<T> items)
Collapse the given items.
protected void
collapse(Collection<T> items, boolean userOriginated)
Collapse the given items.
void
collapse(T... items)
Collapse the given items.
void
collapseRecursively(Collection<T> items, int depth)
Collapse the given items and their children recursively until the given depth.
void
collapseRecursively(Stream<T> items, int depth)
Collapse the given items and their children recursively until the given depth.
protected GridArrayUpdater
createDefaultArrayUpdater(SerializableBiFunction<GridArrayUpdater.UpdateQueueData,Integer,Grid.UpdateQueue> updateQueueFactory)
void
expand(Collection<T> items)
Expands the given items.
protected void
expand(Collection<T> items, boolean userOriginated)
Expands the given items.
void
expand(T... items)
Expands the given items.
void
expandRecursively(Collection<T> items, int depth)
Expands the given items and their children recursively until the given depth.
void
expandRecursively(Stream<T> items, int depth)
Expands the given items and their children recursively until the given depth.
HierarchicalDataCommunicator<T>
getDataCommunicator()
Returns the data communicator of this Grid.
HierarchicalDataProvider<T,SerializablePredicate<T>>
getDataProvider()
Returns the data provider of this grid.
GridDataView<T>
getGenericDataView()
Deprecated.
not supportedprotected Collection<T>
getItemsWithChildrenRecursively(Collection<T> items, int depth)
Gets given items and their children recursively until the given depth.
GridLazyDataView<T>
getLazyDataView()
Deprecated.
not supportedGridListDataView<T>
getListDataView()
Deprecated.
not supportedprotected ValueProvider<T,String>
getUniqueKeyProvider()
Gets value provider for unique key in row's generated JSON.
boolean
isExpanded(T item)
Returns whether a given item is expanded or collapsed.
void
scrollToIndex(int rowIndex)
The effective index of an item depends on the complete hierarchy of the tree.
Grid.Column<T>
setColumns(String hierarchyPropertyName, ValueProvider<T,?> valueProvider, Collection<String> propertyNames)
Note: This method can only be used for a TreeGrid created from a bean type with
TreeGrid(Class)
.void
setDataProvider(DataProvider<T,?> dataProvider)
void
setDataProvider(HierarchicalDataProvider<T,?> hierarchicalDataProvider)
Sets the hierarchical data provider for this listing.
Grid.Column<T>
setHierarchyColumn(String propertyName)
Note: This method can only be used for a TreeGrid created from a bean type with
TreeGrid(Class)
.Grid.Column<T>
setHierarchyColumn(String propertyName, ValueProvider<T,?> valueProvider)
Note: This method can only be used for a TreeGrid created from a bean type with
TreeGrid(Class)
.GridLazyDataView<T>
setItems(BackEndDataProvider<T,Void> dataProvider)
Deprecated.
GridLazyDataView<T>
setItems(CallbackDataProvider.FetchCallback<T,Void> fetchCallback)
Deprecated.
GridListDataView<T>
setItems(Collection<T> items)
Deprecated.
GridListDataView<T>
setItems(ListDataProvider<T> dataProvider)
Deprecated.
GridListDataView<T>
setItems(T... items)
Deprecated.
void
setUniqueKeyDataGenerator(String propertyName, ValueProvider<T,String> uniqueKeyProvider)
Sets property name and value provider for unique key in row's generated JSON.
-
Methods inherited from class com.vaadin.flow.component.grid.Grid
addCellFocusListener, addColumn, addColumn, addColumn, addColumn, addColumn, addColumn, addColumn, addColumn, addColumn, addColumnReorderListener, addColumnResizeListener, addColumns, addComponentColumn, addContextMenu, addDataGenerator, addDragEndListener, addDragStartListener, addDropListener, addFirstHeaderRow, addItemClickListener, addItemDoubleClickListener, addSelectionListener, addSortListener, addThemeVariants, addValueProvider, appendFooterRow, appendHeaderRow, asMultiSelect, asSingleSelect, compareMaybeComparables, configureBeanType, createColumn, createColumnId, createEditor, createSortingComparator, deselect, deselectAll, getArrayUpdater, getBeanType, getClassNameGenerator, getColumnByKey, getColumnLayers, getColumns, getDefaultColumnFactory, getDefaultHeaderRow, getDragFilter, getDropFilter, getDropMode, getEditor, getFooterRows, getHeaderRows, getNestedNullBehavior, getPageSize, getPropertySet, getSelectedItems, getSelectionModel, getSortOrder, getUniqueKeyProperty, initConnector, insertColumnLayer, isAllRowsVisible, isColumnReorderingAllowed, isDetailsVisible, isDetailsVisibleOnClick, isHeightByRows, isMultiSort, isRowsDraggable, isVerticalScrollingEnabled, onAttach, onDataProviderChange, onDetach, onEnabledStateChanged, prependFooterRow, prependHeaderRow, recalculateColumnWidths, removeAllColumns, removeColumn, removeColumnByKey, removeColumnLayer, removeColumns, removeThemeVariants, scrollToEnd, scrollToStart, select, setAllRowsVisible, setClassNameGenerator, setColumnKey, setColumnOrder, setColumnOrder, setColumnReorderingAllowed, setColumns, setDetailsVisible, setDetailsVisibleOnClick, setDragDataGenerator, setDragFilter, setDropFilter, setDropMode, setHeightByRows, setItemDetailsRenderer, setItems, setItems, setItems, setMultiSort, setNestedNullBehavior, setPageSize, setRowsDraggable, setSelectionDragDetails, setSelectionMode, setSelectionModel, setSortableColumns, setUniqueKeyProperty, setUniqueKeyProvider, setVerticalScrollingEnabled, sort, updateSelectionModeOnClient
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, set, setElement, setId, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider
getTreeData, setItems, setItems, setTreeData
-
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Methods inherited from interface com.vaadin.flow.component.HasSize
getCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
-
Methods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
-
Methods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListener
-
Methods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListener
-
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
-
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Methods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
-
Methods inherited from interface com.vaadin.flow.data.provider.HasLazyDataView
setItems
-
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
-
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
-
-
-
Constructor Detail
-
TreeGrid
public TreeGrid()
Creates a new
TreeGrid
without support for creating columns based on property names. Use an alternative constructor, such asTreeGrid(Class)
, to create aTreeGrid
that automatically sets up columns based on the type of presented data.
-
TreeGrid
public TreeGrid(Class<T> beanType)
Creates a new
TreeGrid
with an initial set of columns for each of the bean's properties. The property-values of the bean will be converted to Strings. Full names of the properties will be used as thecolumn keys
and the property captions will be used as thecolumn headers
.Parameters:
beanType
- the bean type to use, notnull
-
TreeGrid
public TreeGrid(HierarchicalDataProvider<T,?> dataProvider)
Creates a new
TreeGrid
using the givenHierarchicalDataProvider
, without support for creating columns based on property names. Use an alternative constructor, such asTreeGrid(Class)
, to create aTreeGrid
that automatically sets up columns based on the type of presented data.Parameters:
dataProvider
- the data provider, notnull
-
-
Method Detail
-
createDefaultArrayUpdater
protected GridArrayUpdater createDefaultArrayUpdater(SerializableBiFunction<GridArrayUpdater.UpdateQueueData,Integer,Grid.UpdateQueue> updateQueueFactory)
Overrides:
createDefaultArrayUpdater
in classGrid<T>
-
setUniqueKeyDataGenerator
public void setUniqueKeyDataGenerator(String propertyName, ValueProvider<T,String> uniqueKeyProvider)
Sets property name and value provider for unique key in row's generated JSON.
Default property name is 'key' and value is generated by bean's hashCode method.
Parameters:
propertyName
- Property name in JSON datauniqueKeyProvider
- Value provider for the target property in JSON data
-
getUniqueKeyProvider
protected ValueProvider<T,String> getUniqueKeyProvider()
Gets value provider for unique key in row's generated JSON.
Overrides:
getUniqueKeyProvider
in classGrid<T>
Returns:
ValueProvider for unique key for row
-
addExpandListener
public Registration addExpandListener(ComponentEventListener<ExpandEvent<T,TreeGrid<T>>> listener)
Adds an ExpandEvent listener to this TreeGrid.
Parameters:
listener
- the listener to addReturns:
a registration for the listener
See Also:
-
addCollapseListener
public Registration addCollapseListener(ComponentEventListener<CollapseEvent<T,TreeGrid<T>>> listener)
Adds a CollapseEvent listener to this TreeGrid.
Parameters:
listener
- the listener to addReturns:
a registration for the listener
See Also:
-
setDataProvider
public void setDataProvider(DataProvider<T,?> dataProvider)
Description copied from class:
Grid
Specified by:
setDataProvider
in interfaceHasHierarchicalDataProvider<T>
Overrides:
setDataProvider
in classGrid<T>
Parameters:
dataProvider
- the data provider, not null
-
setDataProvider
public void setDataProvider(HierarchicalDataProvider<T,?> hierarchicalDataProvider)
Description copied from interface:
HasHierarchicalDataProvider
Sets the hierarchical data provider for this listing. The data provider provides the items and the hierarchy as needed.
Specified by:
setDataProvider
in interfaceHasHierarchicalDataProvider<T>
Parameters:
hierarchicalDataProvider
- the hierarchical data provider to use, notnull
-
setItems
@Deprecated public GridLazyDataView<T> setItems(BackEndDataProvider<T,Void> dataProvider)
Deprecated. use
setDataProvider(HierarchicalDataProvider)
,HasHierarchicalDataProvider.setItems(Collection, ValueProvider)
,HasHierarchicalDataProvider.setItems(Stream, ValueProvider)
orHasHierarchicalDataProvider.setTreeData(TreeData)
instead.Tree grid does not support data views. Use
setDataProvider(HierarchicalDataProvider)
instead. This method is inherited from Grid and it will throw anUnsupportedOperationException
.Specified by:
setItems
in interfaceHasLazyDataView<T,Void,GridLazyDataView<T>>
Overrides:
Parameters:
dataProvider
- the data providerReturns:
the data view
-
setItems
@Deprecated public GridLazyDataView<T> setItems(CallbackDataProvider.FetchCallback<T,Void> fetchCallback)
Deprecated. use
setDataProvider(HierarchicalDataProvider)
,HasHierarchicalDataProvider.setItems(Collection, ValueProvider)
,HasHierarchicalDataProvider.setItems(Stream, ValueProvider)
orHasHierarchicalDataProvider.setTreeData(TreeData)
instead.Tree grid supports only hierarchical data so use another method instead. This method is inherited from Grid and it will throw an
UnsupportedOperationException
.Specified by:
setItems
in interfaceHasLazyDataView<T,Void,GridLazyDataView<T>>
Parameters:
fetchCallback
- the fetch callbackReturns:
the data view
-
setItems
@Deprecated public GridListDataView<T> setItems(ListDataProvider<T> dataProvider)
Deprecated. use
setDataProvider(HierarchicalDataProvider)
,HasHierarchicalDataProvider.setItems(Collection, ValueProvider)
,HasHierarchicalDataProvider.setItems(Stream, ValueProvider)
orHasHierarchicalDataProvider.setTreeData(TreeData)
instead.Tree grid supports only hierarchical data providers so use another method instead. This method is inherited from Grid and it will throw an
UnsupportedOperationException
.Specified by:
setItems
in interfaceHasListDataView<T,GridListDataView<T>>
Overrides:
Parameters:
dataProvider
- the data providerReturns:
the data view
-
setItems
@Deprecated public GridListDataView<T> setItems(T... items)
Deprecated. use
setDataProvider(HierarchicalDataProvider)
,HasHierarchicalDataProvider.setItems(Collection, ValueProvider)
,HasHierarchicalDataProvider.setItems(Stream, ValueProvider)
orHasHierarchicalDataProvider.setTreeData(TreeData)
instead.Tree grid supports only hierarchical data so use another method instead. This method is inherited from Grid and it will throw an
UnsupportedOperationException
.Specified by:
setItems
in interfaceHasListDataView<T,GridListDataView<T>>
Parameters:
items
- the items to display, notnull
Returns:
the data view
-
setItems
@Deprecated public GridListDataView<T> setItems(Collection<T> items)
Deprecated. use
setDataProvider(HierarchicalDataProvider)
,HasHierarchicalDataProvider.setItems(Collection, ValueProvider)
,HasHierarchicalDataProvider.setItems(Stream, ValueProvider)
orHasHierarchicalDataProvider.setTreeData(TreeData)
instead.Tree grid supports only hierarchical data, so use another method instead. This method is inherited from Grid and it will throw an
UnsupportedOperationException
.Specified by:
setItems
in interfaceHasListDataView<T,GridListDataView<T>>
Parameters:
items
- the items to display, notnull
Returns:
the data view
-
getListDataView
@Deprecated public GridListDataView<T> getListDataView()
Deprecated. not supported
Tree grid does not support list data view, this will throw an
UnsupportedOperationException
.Specified by:
getListDataView
in interfaceHasListDataView<T,GridListDataView<T>>
Overrides:
getListDataView
in classGrid<T>
Returns:
exception is thrown
-
getLazyDataView
@Deprecated public GridLazyDataView<T> getLazyDataView()
Deprecated. not supported
Tree grid does not support list data view, this will throw an
UnsupportedOperationException
.Specified by:
getLazyDataView
in interfaceHasLazyDataView<T,Void,GridLazyDataView<T>>
Overrides:
getLazyDataView
in classGrid<T>
Returns:
exception is thrown
-
getGenericDataView
@Deprecated public GridDataView<T> getGenericDataView()
Deprecated. not supported
Tree grid does not support list data view, this will throw an
UnsupportedOperationException
.Specified by:
getGenericDataView
in interfaceHasDataView<T,Void,GridDataView<T>>
Overrides:
getGenericDataView
in classGrid<T>
Returns:
exception is thrown
See Also:
-
addHierarchyColumn
public Grid.Column<T> addHierarchyColumn(ValueProvider<T,?> valueProvider)
Adds a new Hierarchy column to this
Grid
with a value provider. The value is converted to String when sent to the client by usingString.valueOf(Object)
.Hierarchy column is rendered by using 'vaadin-grid-tree-toggle' web component.
Parameters:
valueProvider
- the value providerReturns:
the created hierarchy column
-
addComponentHierarchyColumn
public <V extends Component> Grid.Column<T> addComponentHierarchyColumn(ValueProvider<T,V> componentProvider)
Adds a new Hierarchy column that shows components.
NOTE: Using
ComponentRenderer
is not as efficient as the built in renderers.Type Parameters:
V
- the component typeParameters:
componentProvider
- a value provider that will return a component for the given itemReturns:
the new column
See Also:
-
setHierarchyColumn
public Grid.Column<T> setHierarchyColumn(String propertyName)
Note: This method can only be used for a TreeGrid created from a bean type with
TreeGrid(Class)
.Resets columns and their order based on bean properties.
This is a shortcut for removing all columns and then calling
Grid.addColumn(String)
for each property except hierarchy column in the bean andaddHierarchyColumn(String)
for the given propertyName.Previous column order is preserved.
You can add columns for nested properties with dot notation, eg.
"property.nestedProperty"
Note that this also resets the headers and footers.
Parameters:
propertyName
- a target hierarchy column property nameReturns:
the created hierarchy column
-
setHierarchyColumn
public Grid.Column<T> setHierarchyColumn(String propertyName, ValueProvider<T,?> valueProvider)
Note: This method can only be used for a TreeGrid created from a bean type with
TreeGrid(Class)
.Resets columns and their order based on bean properties.
This is a shortcut for removing all columns and then calling
Grid.addColumn(String)
for each property except hierarchy column in the bean andaddHierarchyColumn(String)
oraddHierarchyColumn(ValueProvider)
for the given propertyName.Previous column order is preserved.
You can add columns for nested properties with dot notation, eg.
"property.nestedProperty"
Note that this also resets the headers and footers.
Parameters:
propertyName
- a target hierarchy column property namevalueProvider
- optional value providerReturns:
the created hierarchy column
-
setColumns
public Grid.Column<T> setColumns(String hierarchyPropertyName, ValueProvider<T,?> valueProvider, Collection<String> propertyNames)
Note: This method can only be used for a TreeGrid created from a bean type with
TreeGrid(Class)
.Sets the columns and their order based on the given properties.
This is a shortcut for removing all columns and then calling
Grid.addColumn(String)
for each property except hierarchy property in the bean andaddHierarchyColumn(String)
for the given hierarchyPropertyName.You can add columns for nested properties with dot notation, eg.
"property.nestedProperty"
Note that this also resets the headers and footers.
Parameters:
hierarchyPropertyName
- a target hierarchy column property namevalueProvider
- optional value providerpropertyNames
- set of properties to create columns for. Including given hierarchyPropertyNameReturns:
the hierarchy column
-
expand
public void expand(T... items)
Expands the given items.
If an item is currently expanded, does nothing. If an item does not have any children, does nothing.
Parameters:
items
- the items to expand
-
expand
public void expand(Collection<T> items)
Expands the given items.
If an item is currently expanded, does nothing. If an item does not have any children, does nothing.
Parameters:
items
- the items to expand
-
expand
protected void expand(Collection<T> items, boolean userOriginated)
Expands the given items.
Parameters:
items
- the items to expanduserOriginated
-true
if aExpandEvent
triggered by this operation is user originated,false
otherwise.
-
expandRecursively
public void expandRecursively(Stream<T> items, int depth)
Expands the given items and their children recursively until the given depth.
depth
describes the maximum distance between a given item and its descendant, meaning thatexpandRecursively(items, 0)
expands only the given items whileexpandRecursively(items, 2)
expands the given items as well as their children and grandchildren.This method will not fire events for expanded nodes.
Parameters:
items
- the items to expand recursivelydepth
- the maximum depth of recursionSince:
8.4
-
expandRecursively
public void expandRecursively(Collection<T> items, int depth)
Expands the given items and their children recursively until the given depth.
depth
describes the maximum distance between a given item and its descendant, meaning thatexpandRecursively(items, 0)
expands only the given items whileexpandRecursively(items, 2)
expands the given items as well as their children and grandchildren.This method will not fire events for expanded nodes.
Parameters:
items
- the items to expand recursivelydepth
- the maximum depth of recursionSince:
8.4
-
collapse
public void collapse(T... items)
Collapse the given items.
For items that are already collapsed, does nothing.
Parameters:
items
- the collection of items to collapse
-
collapse
public void collapse(Collection<T> items)
Collapse the given items.
For items that are already collapsed, does nothing.
Parameters:
items
- the collection of items to collapse
-
collapse
protected void collapse(Collection<T> items, boolean userOriginated)
Collapse the given items.
Parameters:
items
- the collection of items to collapseuserOriginated
-true
if aCollapseEvent
triggered by this operation is user originated,false
otherwise.
-
collapseRecursively
public void collapseRecursively(Stream<T> items, int depth)
Collapse the given items and their children recursively until the given depth.
depth
describes the maximum distance between a given item and its descendant, meaning thatcollapseRecursively(items, 0)
collapses only the given items whilecollapseRecursively(items, 2)
collapses the given items as well as their children and grandchildren.This method will not fire events for collapsed nodes.
Parameters:
items
- the items to collapse recursivelydepth
- the maximum depth of recursionSince:
8.4
-
collapseRecursively
public void collapseRecursively(Collection<T> items, int depth)
Collapse the given items and their children recursively until the given depth.
depth
describes the maximum distance between a given item and its descendant, meaning thatcollapseRecursively(items, 0)
collapses only the given items whilecollapseRecursively(items, 2)
collapses the given items as well as their children and grandchildren.This method will not fire events for collapsed nodes.
Parameters:
items
- the items to collapse recursivelydepth
- the maximum depth of recursionSince:
8.4
-
getItemsWithChildrenRecursively
protected Collection<T> getItemsWithChildrenRecursively(Collection<T> items, int depth)
Gets given items and their children recursively until the given depth.
depth
describes the maximum distance between a given item and its descendant, meaning thatgetItemsWithChildrenRecursively(items, 0)
gets only the given items whilegetItemsWithChildrenRecursively(items, 2)
gets the given items as well as their children and grandchildren.Parameters:
items
- the items to expand recursivelydepth
- the maximum depth of recursionReturns:
collection of given items and their children recursively until the given depth
-
isExpanded
public boolean isExpanded(T item)
Returns whether a given item is expanded or collapsed.
Parameters:
item
- the item to checkReturns:
true if the item is expanded, false if collapsed
-
getDataCommunicator
public HierarchicalDataCommunicator<T> getDataCommunicator()
Description copied from class:
Grid
Returns the data communicator of this Grid.
Overrides:
getDataCommunicator
in classGrid<T>
Returns:
the data communicator, not
null
-
getDataProvider
public HierarchicalDataProvider<T,SerializablePredicate<T>> getDataProvider()
Description copied from class:
Grid
Returns the data provider of this grid.
To get information and control over the items in the grid, use either
Grid.getListDataView()
orGrid.getLazyDataView()
instead.Specified by:
getDataProvider
in interfaceHasHierarchicalDataProvider<T>
Overrides:
getDataProvider
in classGrid<T>
Returns:
the data provider of this grid, not
null
-
scrollToIndex
public void scrollToIndex(int rowIndex)
The effective index of an item depends on the complete hierarchy of the tree.
TreeGrid
uses lazy loading for performance reasons and does not know about the complete hierarchy. Without the knowledge of the complete hierarchy,TreeGrid
can?t reliably calculate an exact scroll position. This uncertainty makes this method unreliable and so should be avoided.Overrides:
scrollToIndex
in classGrid<T>
Parameters:
rowIndex
- zero based index of the item to scroll to in the current view.
-
-