-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[4242] Add support to for the customization of the header of each row
Bug: #4242 Signed-off-by: Florian ROUËNÉ <[email protected]>
- Loading branch information
1 parent
6cfcc05
commit 6fed9f6
Showing
17 changed files
with
303 additions
and
26 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
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
48 changes: 48 additions & 0 deletions
48
.../eclipse/sirius/components/tables/graphql/datafetchers/LineHeaderIconURLsDataFetcher.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,48 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 CEA LIST. | ||
* 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.tables.graphql.datafetchers; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.annotations.spring.graphql.QueryDataFetcher; | ||
import org.eclipse.sirius.components.core.api.IImageURLSanitizer; | ||
import org.eclipse.sirius.components.graphql.api.IDataFetcherWithFieldCoordinates; | ||
import org.eclipse.sirius.components.graphql.api.URLConstants; | ||
import org.eclipse.sirius.components.tables.Line; | ||
|
||
import graphql.schema.DataFetchingEnvironment; | ||
|
||
/** | ||
* The data fetcher used to concatenate the server image URL to the row header image path. | ||
* | ||
* @author frouene | ||
*/ | ||
@QueryDataFetcher(type = "Line", field = "headerIconURLs") | ||
public class LineHeaderIconURLsDataFetcher implements IDataFetcherWithFieldCoordinates<List<String>> { | ||
|
||
private final IImageURLSanitizer imageURLSanitizer; | ||
|
||
public LineHeaderIconURLsDataFetcher(IImageURLSanitizer imageURLSanitizer) { | ||
this.imageURLSanitizer = Objects.requireNonNull(imageURLSanitizer); | ||
} | ||
|
||
@Override | ||
public List<String> get(DataFetchingEnvironment environment) throws Exception { | ||
Line source = environment.getSource(); | ||
|
||
return source.getHeaderIconURLs().stream() | ||
.map(url -> this.imageURLSanitizer.sanitize(URLConstants.IMAGE_BASE_PATH, url)) | ||
.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
Oops, something went wrong.