-
Notifications
You must be signed in to change notification settings - Fork 27
Add entry-tree parameter to collapse children #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bhufmann
merged 2 commits into
eclipse-tracecompass:master
from
hriday-panchasara:collpase-entry-tree
Jun 10, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /********************************************************************** | ||
| * Copyright (c) 2019 Ericsson | ||
| * Copyright (c) 2019, 2025 Ericsson | ||
| * | ||
| * All rights reserved. This program and the accompanying materials are | ||
| * made available under the terms of the Eclipse Public License 2.0 which | ||
|
|
@@ -31,11 +31,24 @@ | |
| * @since 5.0 | ||
| */ | ||
| public class TmfTreeModel<T extends ITmfTreeDataModel> { | ||
|
|
||
| /** | ||
| * Expand level to indicate that all tree levels are expanded. (default) | ||
| * | ||
| * @since 10.1 | ||
| */ | ||
| public static final int ALL_LEVELS = -1; | ||
|
|
||
| private List<String> fHeaders; | ||
| private List<ITableColumnDescriptor> fColumnDescriptors; | ||
| private List<T> fEntries; | ||
| private @Nullable String fScope; | ||
|
|
||
| /** | ||
| * Indicates which level of the tree should be expanded. | ||
| */ | ||
| private int fAutoExpandLevel = ALL_LEVELS; | ||
|
|
||
| /** | ||
| * Constructor | ||
| * | ||
|
|
@@ -88,6 +101,7 @@ private TmfTreeModel(Builder<T> builder) { | |
| fColumnDescriptors = builder.fColumnDescriptors; | ||
| fEntries = builder.fEntries; | ||
| fScope = builder.fScope; | ||
| fAutoExpandLevel = builder.fAutoExpandLevel; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -118,6 +132,36 @@ public List<T> getEntries() { | |
| return fScope; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the auto-expand level. | ||
| * | ||
| * @return non-negative level, or <code>ALL_LEVELS</code> if all levels of | ||
| * the tree are expanded automatically | ||
| * @see #setAutoExpandLevel | ||
| * @since 10.1 | ||
| */ | ||
| public int getAutoExpandLevel() { | ||
| return fAutoExpandLevel; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the auto-expand level to be used for the input of the tree. The | ||
| * value 0 means that there is no auto-expand; 1 means that top-level | ||
| * elements are expanded, but not their children; 2 means that top-level | ||
| * elements are expanded, and their children, but not grand-children; and so | ||
| * on. | ||
| * <p> | ||
| * The value {@link #ALL_LEVELS} means that all subtrees should be expanded. | ||
| * </p> | ||
| * | ||
| * @param autoExpandLevel | ||
| * The auto expand level to set | ||
| * @since 10.1 | ||
| */ | ||
| public void setAutoExpandLevel(int autoExpandLevel) { | ||
| this.fAutoExpandLevel = autoExpandLevel; | ||
| } | ||
|
|
||
| /** | ||
| * | ||
| * A builder class to build instances implementing interface | ||
|
|
@@ -131,6 +175,7 @@ public static class Builder<T extends ITmfTreeDataModel> { | |
| private List<ITableColumnDescriptor> fColumnDescriptors = new ArrayList<>(); | ||
| private List<T> fEntries; | ||
| private @Nullable String fScope; | ||
| private int fAutoExpandLevel = ALL_LEVELS; | ||
|
|
||
| /** | ||
| * Constructor | ||
|
|
@@ -175,6 +220,20 @@ public Builder<T> setScope(String scope) { | |
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Sets which level of the tree should be expanded | ||
| * | ||
| * @param autoExpandLevel | ||
| * expand level of the tree model | ||
| * @return this {@link Builder} object | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| * @see TmfTreeModel#setAutoExpandLevel(int) | ||
| * @since 10.1 | ||
| */ | ||
| public Builder<T> setAutoExpandLevel(int autoExpandLevel) { | ||
| fAutoExpandLevel = autoExpandLevel; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * The method to construct an instance of {@link TmfTreeModel} | ||
| * | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the comment to:
The more detail information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done