Closed stefanuebe closed 3 years ago
I reverted the PR. At least it requires a demo with a dataprovider that is not a TreeDataProvider. I think it's not working since internally the component is using TreeData: https://github.com/vaadin-component-factory/selection-grid-flow/blob/main/selection-grid-flow/src/main/java/com/vaadin/componentfactory/selectiongrid/SelectionTreeGrid.java#L122
It's probably not needed for the selection but it's required for the focus method.
I reverted the PR. At least it requires a demo with a dataprovider that is not a TreeDataProvider. I think it's not working since internally the component is using TreeData: https://github.com/vaadin-component-factory/selection-grid-flow/blob/main/selection-grid-flow/src/main/java/com/vaadin/componentfactory/selectiongrid/SelectionTreeGrid.java#L122
It's probably not needed for the selection but it's required for the focus method.
Hm, did not see that. How about an additional interface HasTreeData, that provides the TreeData? If the data provider is a TreeDataProvider, it uses directly its TreeData. If not, then the data provider needs to implement HasTreeData. If that is also not the case, then it throws an UnsupportedOperationException or IllegalStateException.
Or maybe even more generic a "HasParentProvider" or similar, which takes an item and returns the parent for it. This would allow to use a hierarchical data provider, that not needs to use a TreeData instance.
You don't need to check this, it's already checked in the TreeGrid. It has to be a HierarchicalDataProvider
.
What is the use case for not using a TreeDataProvider but that requires a dataprovider that requires a TreeData?
https://github.com/vaadin-component-factory/selection-grid-flow/issues/20