feat: extract interface HierarchicalTreeData from TreeData#23950
Open
sclassen wants to merge 5 commits intovaadin:mainfrom
Open
feat: extract interface HierarchicalTreeData from TreeData#23950sclassen wants to merge 5 commits intovaadin:mainfrom
sclassen wants to merge 5 commits intovaadin:mainfrom
Conversation
TreeDataProvider currently takes a TreeData as its source. But it relies only on a few methods of TreeData. This change extracts those methods into an interface. It then introduces a super class to TreeDataProvider which accepts a HierarchicalTreeData instead of a TreeData. A client has now the choice to either use the TreeData and the TreeDataProvider, or it can implement the HierarchicalTreeData interface and use the HierarchicalTreeDataProvider. This change introduces a new interface and a class but does not change or break any existing API. Fixes vaadin#9808
50682ae to
510379c
Compare
Author
|
This is the minimal change I could find to satisfy the desire to have a custom tree data implementation as it is expressed in #9808.
The name of the new interface is semi optimal, as "hierarchical" is already used in other class names with a slightly different semantics. |
This second gerenic parameter represents the concrete type of the HierarchicalTreeData. Having this as a generic parameter allows for better type safty. The client of the provider can get the underlying data structure in a type safe manner. This eases writing stable code.
|
mshabarov
reviewed
Mar 20, 2026
flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalTreeData.java
Outdated
Show resolved
Hide resolved
flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalData.java
Show resolved
Hide resolved
...data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalTreeDataProvider.java
Outdated
Show resolved
Hide resolved
...data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalTreeDataProvider.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/vaadin/flow/data/provider/hierarchy/InMemoryHierarchicalDataProvider.java
Show resolved
Hide resolved
- rename HierarchicalTreeDataProvider.java -> InMemoryHierarchicalDataProvider.java - rename HierarchicalTreeData.java -> HierarchicalData.java - add method InMemoryHierarchicalDataProvider.getHierarchicalData()
Author
|
I am not sure why this PR has the +1.0.0 tag. From my perspective this should qualify as a +0.1.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
TreeDataProvider currently takes a TreeData as its source. But it relies only on a few methods of TreeData.
This change extracts those methods into an interface. It then introduces a super class to TreeDataProvider which accepts a HierarchicalTreeData instead of a TreeData. A client has now the choice to either use the TreeData and the TreeDataProvider, or it can implement the HierarchicalTreeData interface and use the HierarchicalTreeDataProvider.
This change introduces a new interface and a new class but does not change or break any existing API.
Fixes #9808
Type of change
Checklist
Additional for
Featuretype of change