Skip to content

Add entry-tree parameter to collapse children #196

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2020 École Polytechnique de Montréal
* Copyright (c) 2020, 2025 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
Expand Down Expand Up @@ -36,6 +36,7 @@ public class EntryModelStub implements Serializable {

private final List<EntryStub> fEntries;
private final List<EntryHeaderStub> fHeaders;
private final int fAutoExpandLevel;

/**
* {@link JsonCreator} Constructor for final fields
Expand All @@ -44,12 +45,16 @@ public class EntryModelStub implements Serializable {
* The set of entries for this model
* @param headers
* The set of headers for this model
* @param autoExpandLevel
* The auto-expand level for this model
*/
@JsonCreator
public EntryModelStub(@JsonProperty("entries") List<EntryStub> entries,
@JsonProperty("headers") List<EntryHeaderStub> headers) {
@JsonProperty("headers") List<EntryHeaderStub> headers,
@JsonProperty("autoExpandLevel") Integer autoExpandLevel) {
fEntries = Objects.requireNonNull(entries, "The 'entries' json field was not set");
fHeaders = headers == null ? Collections.emptyList() : headers;
fAutoExpandLevel = autoExpandLevel == null ? -1 : autoExpandLevel;
}

/**
Expand All @@ -70,4 +75,13 @@ public List<EntryHeaderStub> getHeaders() {
return fHeaders;
}

/**
* Get the auto-expand level
*
* @return auto-expand level
*/
public int getAutoExpandLevel() {
return fAutoExpandLevel;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2020 École Polytechnique de Montréal
* Copyright (c) 2020, 2025 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
Expand Down Expand Up @@ -36,6 +36,7 @@ public class TgEntryModelStub implements Serializable {

private final Set<TimeGraphEntryStub> fEntries;
private final Set<EntryHeaderStub> fHeaders;
private final int fAutoExpandLevel;

/**
* {@link JsonCreator} Constructor for final fields
Expand All @@ -44,12 +45,16 @@ public class TgEntryModelStub implements Serializable {
* The set of entries for this model
* @param headers
* The set of headers for this model
* @param autoExpandLevel
* The auto-expand level for this model
*/
@JsonCreator
public TgEntryModelStub(@JsonProperty("entries") Set<TimeGraphEntryStub> entries,
@JsonProperty("headers") Set<EntryHeaderStub> headers) {
@JsonProperty("headers") Set<EntryHeaderStub> headers,
@JsonProperty("autoExpandLevel") Integer autoExpandLevel) {
fEntries = Objects.requireNonNull(entries, "The 'entries' json field was not set");
fHeaders = headers == null ? Collections.emptySet() : headers;
fAutoExpandLevel = autoExpandLevel == null ? -1 : autoExpandLevel;
}

/**
Expand All @@ -70,4 +75,12 @@ public Set<EntryHeaderStub> getHeaders() {
return fHeaders;
}

/**
* Get the auto-expand level
*
* @return auto-expand level
*/
public int getAutoExpandLevel() {
return fAutoExpandLevel;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2023 Ericsson
* Copyright (c) 2023, 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
Expand Down Expand Up @@ -32,6 +32,7 @@ public class XyEntryModelStub implements Serializable {

private final List<XyEntryStub> fEntries;
private final List<EntryHeaderStub> fHeaders;
private final int fAutoExpandLevel;

/**
* {@link JsonCreator} Constructor for final fields
Expand All @@ -40,12 +41,16 @@ public class XyEntryModelStub implements Serializable {
* The set of entries for this model
* @param headers
* The set of headers for this model
* @param autoExpandLevel
* The auto-expand level for this model
*/
@JsonCreator
public XyEntryModelStub(@JsonProperty("entries") List<XyEntryStub> entries,
@JsonProperty("headers") List<EntryHeaderStub> headers) {
@JsonProperty("headers") List<EntryHeaderStub> headers,
@JsonProperty("autoExpandLevel") Integer autoExpandLevel) {
fEntries = Objects.requireNonNull(entries, "The 'entries' json field was not set");
fHeaders = headers == null ? Collections.emptyList() : headers;
fAutoExpandLevel = autoExpandLevel == null ? -1 : autoExpandLevel;
}

/**
Expand All @@ -65,4 +70,13 @@ public List<XyEntryStub> getEntries() {
public List<EntryHeaderStub> getHeaders() {
return fHeaders;
}

/**
* Get the auto-expand level
*
* @return auto-expand level
*/
public int getAutoExpandLevel() {
return fAutoExpandLevel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,14 @@ public interface TreeEntryModel {
*/
@NonNull
List<@NonNull TreeColumnHeader> getHeaders();

/**
* @return The auto-expand level.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add before method the following schema annotation:

@Schema(description = "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. The value -1 means that all subtrees should be expanded.")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Schema(description = "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. The value -1 means that all subtrees should be expanded.")
int getAutoExpandLevel();
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,12 @@ public TreeModelWrapper(TmfTreeModel<@NonNull ITmfTreeDataModel> model) {
return fModel.getEntries();
}

/**
* Wrapper to the {@link TmfTreeModel#getAutoExpandLevel()} method
*
* @return Indicates till which level of the tree we should expand the nodes
*/
public int getAutoExpandLevel() {
return fModel.getAutoExpandLevel();
}
}
Loading