Add entry-tree parameter to collapse children#277
Add entry-tree parameter to collapse children#277bhufmann merged 2 commits intoeclipse-tracecompass:masterfrom
Conversation
| boolean isComplete = true; | ||
| List<Entry<M, Object>> entries = new ArrayList<>(); | ||
| List<ITableColumnDescriptor> columnDescriptor = null; | ||
| boolean collapseChildren = false; |
There was a problem hiding this comment.
This would collapse the children of the root. What about have a expandLevel parameter instead, that indicates to which level the tree should be expanded? If expandLevel is missing or has value of -1 it would mean that all the levels are expanded (as it is the current behaviour). If the expandLevel is set to 1 for example, it will expand to the first nodes under the root. WDYT?
bhufmann
left a comment
There was a problem hiding this comment.
Thanks for the contribution. I have some comments. Please add a test case to TmfTreeModelTest (see method testTmfTreeModelConstructor2.
| * would mean that all the levels are expanded (default behaviour). If the expandLevel is set to 1 for | ||
| * example, it will expand to the first nodes under the root. | ||
| */ | ||
| private int fExpandLevel = -1; |
There was a problem hiding this comment.
There should be a constant available for -1 and used in the both classes.
Add this to this class:
/**
* Expand level to indicate that all tree levels are expanded. (default)
* @since 9.6
*/
public static final int ALL_LEVELS = -1;Also, rename variable to fAutoExpandLevel
| * Indicates which level of the tree should be expanded. If expandLevel is missing or has value of -1 it | ||
| * would mean that all the levels are expanded (default behaviour). If the expandLevel is set to 1 for | ||
| * example, it will expand to the first nodes under the root. | ||
| */ |
There was a problem hiding this comment.
Change the comment to:
/**
* Indicates which level of the tree should be expanded.
*/The more detail information
| /** | ||
| * @return | ||
| */ | ||
| public int getExpandLevel() { |
| /** | ||
| * @param expandLevel | ||
| */ | ||
| public void setExpandLevel(int expandLevel) { |
| } | ||
|
|
||
| /** | ||
| * @param expandLevel |
There was a problem hiding this comment.
change java doc
/**
* 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>
* @since 9.6
*/| } | ||
|
|
||
| /** | ||
| * @return |
There was a problem hiding this comment.
change java doc
/**
* 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 9.6| private List<ITableColumnDescriptor> fColumnDescriptors = new ArrayList<>(); | ||
| private List<T> fEntries; | ||
| private @Nullable String fScope; | ||
| private int fExpandLevel = -1; |
| * | ||
| * @param expandLevel | ||
| * expand level of the tree model | ||
| * @return this {@link Builder} object |
| * expand level of the tree model | ||
| * @return this {@link Builder} object | ||
| */ | ||
| public Builder<T> setExpandLevel(int expandLevel) { |
There was a problem hiding this comment.
rename to setAutoExpandLevel
| boolean isComplete = true; | ||
| List<Entry<M, Object>> entries = new ArrayList<>(); | ||
| List<ITableColumnDescriptor> columnDescriptor = null; | ||
| int expandLevel = -1; |
There was a problem hiding this comment.
use constant ALL_LEVEL (see comment below for TmfTreeModel)
|
I'm going to update this PR with my suggestions to help with this contribution. |
| boolean isComplete = true; | ||
| List<Entry<M, Object>> entries = new ArrayList<>(); | ||
| List<ITableColumnDescriptor> columnDescriptor = null; | ||
| int expandLevel = -1; |
| * Indicates which level of the tree should be expanded. If expandLevel is missing or has value of -1 it | ||
| * would mean that all the levels are expanded (default behaviour). If the expandLevel is set to 1 for | ||
| * example, it will expand to the first nodes under the root. | ||
| */ |
| * would mean that all the levels are expanded (default behaviour). If the expandLevel is set to 1 for | ||
| * example, it will expand to the first nodes under the root. | ||
| */ | ||
| private int fExpandLevel = -1; |
| } | ||
|
|
||
| /** | ||
| * @return |
| /** | ||
| * @return | ||
| */ | ||
| public int getExpandLevel() { |
| } | ||
|
|
||
| /** | ||
| * @param expandLevel |
| /** | ||
| * @param expandLevel | ||
| */ | ||
| public void setExpandLevel(int expandLevel) { |
| private List<ITableColumnDescriptor> fColumnDescriptors = new ArrayList<>(); | ||
| private List<T> fEntries; | ||
| private @Nullable String fScope; | ||
| private int fExpandLevel = -1; |
| * | ||
| * @param expandLevel | ||
| * expand level of the tree model | ||
| * @return this {@link Builder} object |
| * expand level of the tree model | ||
| * @return this {@link Builder} object | ||
| */ | ||
| public Builder<T> setExpandLevel(int expandLevel) { |
Signed-off-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
The auto-expand level is supposed 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. The value -1 means that all subtrees should be expanded (default). [Added] Add auto-expand level in TmfTreeModel Signed-off-by: Hriday Panchasara hriday.panchasara@ericsson.com Signed-off-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
03300f2 to
9f48c7b
Compare
What it does
tmf: Add auto-expand level in TmfTreeModel
The auto-expand level is supposed 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.
The value -1 means that all subtrees should be expanded (default).
Contributes to fix eclipse-cdt-cloud/theia-trace-extension#801
How to test
Run updated unit test.
Follow-ups
Related incubator PR.
eclipse-tracecompass-incubator/org.eclipse.tracecompass.incubator#196
Review checklist
Signed-off-by: Hriday Panchasara hriday.panchasara@ericsson.com
Signed-off-by: Bernd Hufmann bernd.hufmann@ericsson.com