-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3083] Add treeItemEndIconsExpression to TreeDescription
Bug: #3083 Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
- Loading branch information
Showing
25 changed files
with
404 additions
and
97 deletions.
There are no files selected for viewing
This file contains 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 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 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
42 changes: 42 additions & 0 deletions
42
...ipse/sirius/components/forms/graphql/datafetchers/form/TreeNodeEndIconURLDataFetcher.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.components.forms.graphql.datafetchers.form; | ||
|
||
import graphql.schema.DataFetchingEnvironment; | ||
|
||
import org.eclipse.sirius.components.annotations.spring.graphql.QueryDataFetcher; | ||
import org.eclipse.sirius.components.forms.TreeNode; | ||
import org.eclipse.sirius.components.graphql.api.IDataFetcherWithFieldCoordinates; | ||
import org.eclipse.sirius.components.graphql.api.URLConstants; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Data fetcher for TreeNode.iconEndURL, to rewrite the relative path of the image into an absolute path on the server. | ||
* <p> | ||
* If the <code>TreeNode.iconEndURL</code> is of the form <code>path/to/image.svg</code>, the rewritten value which will | ||
* be seen by the frontend will be <code>/api/images/path/to/image.svg</code>. | ||
* | ||
* @author mcharfadi | ||
*/ | ||
@QueryDataFetcher(type = "TreeNode", field = "iconEndURL") | ||
public class TreeNodeEndIconURLDataFetcher implements IDataFetcherWithFieldCoordinates<List<List<String>>> { | ||
|
||
@Override | ||
public List<List<String>> get(DataFetchingEnvironment environment) throws Exception { | ||
TreeNode node = environment.getSource(); | ||
return node.getIconEndURL().stream() | ||
.map(list -> list.stream().map(url -> URLConstants.IMAGE_BASE_PATH + url).toList()) | ||
.toList(); | ||
} | ||
} |
This file contains 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 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 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 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 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 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
Oops, something went wrong.