Skip to content

feat: extract interface HierarchicalTreeData from TreeData#23950

Open
sclassen wants to merge 8 commits intovaadin:mainfrom
sclassen:hierarchicalTreeDataInterface
Open

feat: extract interface HierarchicalTreeData from TreeData#23950
sclassen wants to merge 8 commits intovaadin:mainfrom
sclassen:hierarchicalTreeDataInterface

Conversation

@sclassen
Copy link

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

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

@CLAassistant
Copy link

CLAassistant commented Mar 19, 2026

CLA assistant check
All committers have signed the CLA.

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
@sclassen
Copy link
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 extracted interface has only the minimal set of method required.
  • All existing code is moved or untouched so no changes in behavior results.

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 mshabarov added the Contribution PRs coming from the community or external to the team label Mar 20, 2026
@github-actions
Copy link

github-actions bot commented Mar 20, 2026

Test Results

 1 386 files  ±0   1 386 suites  ±0   1h 29m 50s ⏱️ +17s
 9 927 tests ±0   9 856 ✅ ±0  71 💤 ±0  0 ❌ ±0 
10 400 runs  ±0  10 320 ✅ ±0  80 💤 ±0  0 ❌ ±0 

Results for commit c23deb0. ± Comparison against base commit 6213adb.

♻️ This comment has been updated with latest results.

- rename HierarchicalTreeDataProvider.java -> InMemoryHierarchicalDataProvider.java
- rename HierarchicalTreeData.java -> HierarchicalData.java
- add method InMemoryHierarchicalDataProvider.getHierarchicalData()
@sclassen
Copy link
Author

I am not sure why this PR has the +1.0.0 tag.
No existing API or implementation is changed.
Only new interfaces/classes are added.

From my perspective this should qualify as a +0.1.0.

@mshabarov
Copy link
Contributor

I am not sure why this PR has the +1.0.0 tag. No existing API or implementation is changed. Only new interfaces/classes are added.

From my perspective this should qualify as a +0.1.0.

It fell back to +1.0.0 because the check wasn't actually running until I restarted it. Now it shows +0.1.0.

@sonarqubecloud
Copy link

@mshabarov mshabarov added this pull request to the merge queue Mar 26, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contribution PRs coming from the community or external to the team +0.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce Interface for TreeData used by TreeDataProvider

4 participants