From 99307865b408a84d8b49948c724d612b874db380 Mon Sep 17 00:00:00 2001 From: Laurent Fasani Date: Tue, 22 Feb 2022 17:46:16 +0100 Subject: [PATCH] [1071] Support the border node label display The auto layout uses the CoreOptions.PORT_LABELS_PLACEMENT with the value PortLabelPlacement.outside(). It means that the label is positioned on a corner of the border node without entering the parent node. The incremental layout uses, for the border nodes label, the same policy. It is applied when the border node is moved on its container and when it is newly created. Bug: https://github.com/eclipse-sirius/sirius-components/issues/1071 Signed-off-by: Laurent Fasani --- CHANGELOG.adoc | 1 + .../diagrams/layout/ELKDiagramConverter.java | 6 +- .../layout/LayoutConfiguratorRegistry.java | 4 +- .../layout/incremental/BorderNodesOnSide.java | 44 ++++++++++++ .../incremental/IncrementalLayoutEngine.java | 44 +++++++++--- .../BorderNodeLabelPositionProvider.java | 54 ++++++++++++++ .../incremental/BorderNodePositionTests.java | 71 +++++++++++++++++-- .../src/diagram/palette/ContextualPalette.tsx | 2 +- .../src/diagram/sprotty/convertDiagram.tsx | 5 +- 9 files changed, 210 insertions(+), 21 deletions(-) create mode 100644 backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/incremental/BorderNodesOnSide.java create mode 100644 backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/incremental/provider/BorderNodeLabelPositionProvider.java diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index afa33ae772..3495e2e3b1 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -59,6 +59,7 @@ - https://github.com/eclipse-sirius/sirius-components/issues/1081[#1081] [workbench] It is now possible to specify the component to display in the main area when no representation is open instead of the `OnboardArea` (which is still the default when there is no override) - https://github.com/eclipse-sirius/sirius-components/issues/1070[#1070] [explorer] When selecting an element or opening a representation (for example from its URL or from the onboard area), it is automatically made visible and selected in the explorer. - https://github.com/eclipse-sirius/sirius-components/issues/919[#919] [diagram] Support the parent container resize for the border nodes on back-end +- https://github.com/eclipse-sirius/sirius-components/issues/1071[#1071] [diagram] Add a label for the border nodes. === New features diff --git a/backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/ELKDiagramConverter.java b/backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/ELKDiagramConverter.java index 761e4e932d..b2da021861 100644 --- a/backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/ELKDiagramConverter.java +++ b/backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/ELKDiagramConverter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 Obeo. + * Copyright (c) 2019, 2022 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 @@ -355,8 +355,8 @@ private void convertBorderNode(Node borderNode, ElkNode elkNode, Map borderNodes; + + private final RectangleSide side; + + BorderNodesOnSide(RectangleSide side, List borderNodes) { + this.side = Objects.requireNonNull(side); + this.borderNodes = Objects.requireNonNull(borderNodes); + } + + public List getBorderNodes() { + return this.borderNodes; + } + + public RectangleSide getSide() { + return this.side; + } +} diff --git a/backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/incremental/IncrementalLayoutEngine.java b/backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/incremental/IncrementalLayoutEngine.java index 8a30f9cc5a..7efbdc1658 100644 --- a/backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/incremental/IncrementalLayoutEngine.java +++ b/backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/incremental/IncrementalLayoutEngine.java @@ -17,9 +17,9 @@ import java.util.ArrayList; import java.util.EnumMap; import java.util.List; -import java.util.Map.Entry; import java.util.Objects; import java.util.Optional; +import java.util.stream.Collectors; import org.eclipse.elk.core.options.CoreOptions; import org.eclipse.sirius.components.diagrams.Position; @@ -34,6 +34,7 @@ import org.eclipse.sirius.components.diagrams.layout.incremental.data.EdgeLayoutData; import org.eclipse.sirius.components.diagrams.layout.incremental.data.IContainerLayoutData; import org.eclipse.sirius.components.diagrams.layout.incremental.data.NodeLayoutData; +import org.eclipse.sirius.components.diagrams.layout.incremental.provider.BorderNodeLabelPositionProvider; import org.eclipse.sirius.components.diagrams.layout.incremental.provider.EdgeLabelPositionProvider; import org.eclipse.sirius.components.diagrams.layout.incremental.provider.EdgeRoutingPointsProvider; import org.eclipse.sirius.components.diagrams.layout.incremental.provider.NodeLabelPositionProvider; @@ -66,6 +67,8 @@ public class IncrementalLayoutEngine { private NodeLabelPositionProvider nodeLabelPositionProvider; + private BorderNodeLabelPositionProvider borderNodeLabelPositionProvider; + private final EdgeRoutingPointsProvider edgeRoutingPointsProvider = new EdgeRoutingPointsProvider(); private EdgeLabelPositionProvider edgeLabelPositionProvider; @@ -80,6 +83,7 @@ public IncrementalLayoutEngine(NodeSizeProvider nodeSizeProvider) { public void layout(Optional optionalDiagramElementEvent, DiagramLayoutData diagram, ISiriusWebLayoutConfigurator layoutConfigurator) { this.nodePositionProvider.reset(); + this.borderNodeLabelPositionProvider = new BorderNodeLabelPositionProvider(); this.nodeLabelPositionProvider = new NodeLabelPositionProvider(layoutConfigurator); this.edgeLabelPositionProvider = new EdgeLabelPositionProvider(layoutConfigurator); @@ -175,10 +179,24 @@ private void layoutBorderNodes(Optional optionalDiagramElementEve } // 2- recompute the border node - EnumMap> borderNodesPerSide = this.snapBorderNodes(borderNodesLayoutData, initialNodeBounds.getSize(), layoutConfigurator); + List borderNodesPerSide = this.snapBorderNodes(borderNodesLayoutData, initialNodeBounds.getSize(), layoutConfigurator); // 3 - move the border node along the side according to the side change this.updateBorderNodeAccordingParentResize(optionalDiagramElementEvent, initialNodeBounds, newNodeBounds, borderNodesPerSide, borderNodesLayoutData.get(0).getParent().getId()); + + // 4- set the label position if the border is newly created + this.updateBorderNodeLabel(optionalDiagramElementEvent, borderNodesPerSide); + } + } + + private void updateBorderNodeLabel(Optional optionalDiagramElementEvent, List borderNodesPerSideList) { + + for (BorderNodesOnSide borderNodesOnSide : borderNodesPerSideList) { + RectangleSide side = borderNodesOnSide.getSide(); + List borderNodes = borderNodesOnSide.getBorderNodes(); + for (NodeLayoutData borderNodeLayoutData : borderNodes) { + this.borderNodeLabelPositionProvider.updateLabelPosition(optionalDiagramElementEvent, side, borderNodeLayoutData); + } } } @@ -186,7 +204,7 @@ private void layoutBorderNodes(Optional optionalDiagramElementEve * Move the border node along the side according to the parent Size changes. */ private void updateBorderNodeAccordingParentResize(Optional optionalDiagramElementEvent, Bounds initialNodeBounds, Bounds newNodeBounds, - EnumMap> borderNodesPerSide, String parentId) { + List borderNodesPerSideList, String parentId) { // @formatter:off boolean isParentRectangleResized = optionalDiagramElementEvent .filter(ResizeEvent.class::isInstance) @@ -202,11 +220,11 @@ private void updateBorderNodeAccordingParentResize(Optional optio Size initialSize = initialNodeBounds.getSize(); Size newSize = newNodeBounds.getSize(); - for (Entry> entry : borderNodesPerSide.entrySet()) { - RectangleSide side = entry.getKey(); - List borderNodeOnSide = entry.getValue(); - double homotheticRatio = sideHomotheticRatio.get(entry.getKey()); - for (NodeLayoutData borderNodeLayoutData : borderNodeOnSide) { + for (BorderNodesOnSide borderNodesOnSide : borderNodesPerSideList) { + RectangleSide side = borderNodesOnSide.getSide(); + List borderNodes = borderNodesOnSide.getBorderNodes(); + double homotheticRatio = sideHomotheticRatio.get(side); + for (NodeLayoutData borderNodeLayoutData : borderNodes) { // The border node position is done in the parent node coordinate system Position position = borderNodeLayoutData.getPosition(); Size size = borderNodeLayoutData.getSize(); @@ -249,10 +267,9 @@ private void updateBorderNodePosition(Optional optionalDiagramEle * * @param borderNodesLayoutData * the border nodes which position is given in the rectangle upper right corner coordinates system - * @param layoutConfigurator * @return for each side of the given parentRectangle, the list of the updates border node */ - private EnumMap> snapBorderNodes(List borderNodesLayoutData, Size parentRectangle, ISiriusWebLayoutConfigurator layoutConfigurator) { + private List snapBorderNodes(List borderNodesLayoutData, Size parentRectangle, ISiriusWebLayoutConfigurator layoutConfigurator) { EnumMap> borderNodesPerSide = new EnumMap<>(RectangleSide.class); Geometry geometry = new Geometry(); @@ -268,7 +285,12 @@ private EnumMap> snapBorderNodes(List new ArrayList<>()); borderNodesPerSide.get(borderNodePositionOnSide.getSide()).add(borderNodeLayoutData); } - return borderNodesPerSide; + + // @formatter:off + return borderNodesPerSide.entrySet().stream() + .map(entry -> new BorderNodesOnSide(entry.getKey(), entry.getValue())) + .collect(Collectors.toList()); + // @formatter:on } /** diff --git a/backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/incremental/provider/BorderNodeLabelPositionProvider.java b/backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/incremental/provider/BorderNodeLabelPositionProvider.java new file mode 100644 index 0000000000..3a3fde901a --- /dev/null +++ b/backend/sirius-components-diagrams-layout/src/main/java/org/eclipse/sirius/components/diagrams/layout/incremental/provider/BorderNodeLabelPositionProvider.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2022 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.diagrams.layout.incremental.provider; + +import java.util.Optional; + +import org.eclipse.sirius.components.diagrams.Position; +import org.eclipse.sirius.components.diagrams.events.IDiagramEvent; +import org.eclipse.sirius.components.diagrams.events.MoveEvent; +import org.eclipse.sirius.components.diagrams.layout.incremental.data.LabelLayoutData; +import org.eclipse.sirius.components.diagrams.layout.incremental.data.NodeLayoutData; +import org.eclipse.sirius.components.diagrams.layout.incremental.utils.RectangleSide; + +/** + * Provides the position logic to apply to a BorderNode Label. + * + * @author lfasani + */ +public class BorderNodeLabelPositionProvider { + + public void updateLabelPosition(Optional optionalDiagramElementEvent, RectangleSide side, NodeLayoutData borderNodeLayoutData) { + LabelLayoutData label = borderNodeLayoutData.getLabel(); + if (label != null) { + // @formatter:off + Boolean isBorderNodeMoved = optionalDiagramElementEvent + .filter(MoveEvent.class::isInstance) + .map(MoveEvent.class::cast) + .map(MoveEvent::getNodeId) + .filter(borderNodeLayoutData.getId()::equals) + .isPresent(); + // @formatter:on + + if (borderNodeLayoutData.getLabel().getPosition().getX() == -1 || Boolean.TRUE.equals(isBorderNodeMoved)) { + if (RectangleSide.NORTH.equals(side)) { + label.setPosition(Position.at(-label.getTextBounds().getSize().getWidth(), -label.getTextBounds().getSize().getHeight())); + } else if (RectangleSide.EAST.equals(side)) { + label.setPosition(Position.at(borderNodeLayoutData.getSize().getWidth(), borderNodeLayoutData.getSize().getHeight())); + } else { + label.setPosition(Position.at(-label.getTextBounds().getSize().getWidth(), borderNodeLayoutData.getSize().getHeight())); + } + } + } + } +} diff --git a/backend/sirius-components-diagrams-layout/src/test/java/org/eclipse/sirius/components/diagrams/layout/incremental/BorderNodePositionTests.java b/backend/sirius-components-diagrams-layout/src/test/java/org/eclipse/sirius/components/diagrams/layout/incremental/BorderNodePositionTests.java index d9fc4e00ce..450f60da5b 100644 --- a/backend/sirius-components-diagrams-layout/src/test/java/org/eclipse/sirius/components/diagrams/layout/incremental/BorderNodePositionTests.java +++ b/backend/sirius-components-diagrams-layout/src/test/java/org/eclipse/sirius/components/diagrams/layout/incremental/BorderNodePositionTests.java @@ -27,6 +27,7 @@ import org.eclipse.sirius.components.diagrams.TextBounds; import org.eclipse.sirius.components.diagrams.events.IDiagramEvent; import org.eclipse.sirius.components.diagrams.events.MoveEvent; +import org.eclipse.sirius.components.diagrams.events.NodeCreationEvent; import org.eclipse.sirius.components.diagrams.events.ResizeEvent; import org.eclipse.sirius.components.diagrams.layout.LayoutConfiguratorRegistry; import org.eclipse.sirius.components.diagrams.layout.incremental.data.DiagramLayoutData; @@ -49,6 +50,10 @@ public class BorderNodePositionTests { private static final Size DEFAULT_BORDER_NODE_SIZE = Size.of(24, 20); + private static final TextBounds BORDER_NODE_LABEL_TEXT_BOUNDS = new TextBounds(Size.of(100, 26), Position.at(0, 20)); + + private static final Position BORDER_NODE_LABEL_TEXT_POSITION = Position.at(-100, DEFAULT_BORDER_NODE_SIZE.getHeight()); + private static final Position ZERO_POSITION = Position.at(0, 0); @BeforeAll @@ -71,6 +76,31 @@ public void testSnap() { incrementalLayoutEngine.layout(Optional.empty(), initializeDiagram, new LayoutConfiguratorRegistry(List.of()).getDefaultLayoutConfigurator()); this.checkBorderNodesAtInitialPosition(borderNodes); + + this.checkBorderNodeLabel(borderNodes.get(0).getLabel(), BORDER_NODE_LABEL_TEXT_POSITION, BORDER_NODE_LABEL_TEXT_BOUNDS); + } + + private void checkBorderNodeLabel(LabelLayoutData labelLayoutData, Position borderNodeLabelTextPosition, TextBounds borderNodeLabelTextBounds) { + assertThat(labelLayoutData.getPosition()).isEqualTo(borderNodeLabelTextPosition); + assertThat(labelLayoutData.getTextBounds()).isEqualTo(borderNodeLabelTextBounds); + } + + @Test + public void testBorderNodeCreationEvent() { + DiagramLayoutData initializeDiagram = this.initializeDiagram(); + List borderNodes = initializeDiagram.getChildrenNodes().get(0).getBorderNodes(); + + // add a border node with an non positioned label + LabelLayoutData labelLayoutData = this.createLabelLayoutData(Position.at(-1, -1), "any", BORDER_NODE_LABEL_TEXT_BOUNDS); //$NON-NLS-1$ + borderNodes.add(this.createBorderNodeLayoutData(BORDER_NODE_LABEL_TEXT_POSITION, DEFAULT_BORDER_NODE_SIZE, initializeDiagram, NodeType.NODE_RECTANGLE, labelLayoutData)); + + NodeSizeProvider nodeSizeProvider = new NodeSizeProvider(new ImageSizeProvider()); + IncrementalLayoutEngine incrementalLayoutEngine = new IncrementalLayoutEngine(nodeSizeProvider); + + Optional creationEvent = Optional.of(new NodeCreationEvent(Position.at(10, 10))); + incrementalLayoutEngine.layout(creationEvent, initializeDiagram, new LayoutConfiguratorRegistry(List.of()).getDefaultLayoutConfigurator()); + + this.checkBorderNodeLabel(borderNodes.get(0).getLabel(), BORDER_NODE_LABEL_TEXT_POSITION, BORDER_NODE_LABEL_TEXT_BOUNDS); } @Test @@ -86,6 +116,29 @@ public void testMoveParentNodeEvent() { incrementalLayoutEngine.layout(resizeEvent, initializeDiagram, new LayoutConfiguratorRegistry(List.of()).getDefaultLayoutConfigurator()); this.checkBorderNodesAtInitialPosition(borderNodes); + + this.checkBorderNodeLabel(borderNodes.get(0).getLabel(), BORDER_NODE_LABEL_TEXT_POSITION, BORDER_NODE_LABEL_TEXT_BOUNDS); + } + + @Test + public void testMoveBorderNodeEvent() { + DiagramLayoutData initializeDiagram = this.initializeDiagram(); + NodeLayoutData northBorderNode = initializeDiagram.getChildrenNodes().get(0).getBorderNodes().get(0); + NodeLayoutData eastBorderNode = initializeDiagram.getChildrenNodes().get(0).getBorderNodes().get(3); + + NodeSizeProvider nodeSizeProvider = new NodeSizeProvider(new ImageSizeProvider()); + IncrementalLayoutEngine incrementalLayoutEngine = new IncrementalLayoutEngine(nodeSizeProvider); + + // move slightly the north border node so that the incremental layout updates the label position + Optional resizeEvent = Optional.of(new MoveEvent(northBorderNode.getId(), Position.at(northBorderNode.getPosition().getX() + 1, northBorderNode.getPosition().getY()))); + incrementalLayoutEngine.layout(resizeEvent, initializeDiagram, new LayoutConfiguratorRegistry(List.of()).getDefaultLayoutConfigurator()); + + this.checkBorderNodeLabel(northBorderNode.getLabel(), Position.at(-100, -BORDER_NODE_LABEL_TEXT_BOUNDS.getSize().getHeight()), BORDER_NODE_LABEL_TEXT_BOUNDS); + + // move slightly the east border node so that the incremental layout updates the label position + resizeEvent = Optional.of(new MoveEvent(eastBorderNode.getId(), Position.at(eastBorderNode.getPosition().getX() + 1, eastBorderNode.getPosition().getY()))); + incrementalLayoutEngine.layout(resizeEvent, initializeDiagram, new LayoutConfiguratorRegistry(List.of()).getDefaultLayoutConfigurator()); + this.checkBorderNodeLabel(eastBorderNode.getLabel(), Position.at(DEFAULT_BORDER_NODE_SIZE.getWidth(), DEFAULT_BORDER_NODE_SIZE.getHeight()), BORDER_NODE_LABEL_TEXT_BOUNDS); } private void checkBorderNodesAtInitialPosition(List borderNodes) { @@ -119,6 +172,8 @@ public void testResizeParentNodeSouthEastEvent() { incrementalLayoutEngine.layout(resizeEvent, initializeDiagram, new LayoutConfiguratorRegistry(List.of()).getDefaultLayoutConfigurator()); this.checkBorderNodesAtInitialPosition(borderNodes); + + this.checkBorderNodeLabel(borderNodes.get(0).getLabel(), BORDER_NODE_LABEL_TEXT_POSITION, BORDER_NODE_LABEL_TEXT_BOUNDS); } @Test @@ -142,6 +197,7 @@ public void testResizeParentNodeNorthWestEvent() { this.checkBorderNodesAtInitialPosition(borderNodes); + this.checkBorderNodeLabel(borderNodes.get(0).getLabel(), BORDER_NODE_LABEL_TEXT_POSITION, BORDER_NODE_LABEL_TEXT_BOUNDS); } private void checkBorderNodesAfterResize(List borderNodes) { @@ -212,7 +268,7 @@ private DiagramLayoutData createDiagramLayoutData() { return diagramLayoutData; } - private NodeLayoutData createBorderNodeLayoutData(Position position, Size size, IContainerLayoutData parent, String nodeType) { + private NodeLayoutData createBorderNodeLayoutData(Position position, Size size, IContainerLayoutData parent, String nodeType, LabelLayoutData labelLayoutData) { NodeLayoutData nodeLayoutData = new NodeLayoutData(); nodeLayoutData.setId(UUID.randomUUID().toString()); nodeLayoutData.setParent(parent); @@ -220,6 +276,13 @@ private NodeLayoutData createBorderNodeLayoutData(Position position, Size size, nodeLayoutData.setSize(size); nodeLayoutData.setNodeType(nodeType); nodeLayoutData.setBorderNode(true); + nodeLayoutData.setLabel(labelLayoutData); + return nodeLayoutData; + } + + private NodeLayoutData createBorderNodeLayoutData(Position position, Size size, IContainerLayoutData parent, String nodeType) { + NodeLayoutData nodeLayoutData = this.createBorderNodeLayoutData(position, size, parent, nodeType, + this.createLabelLayoutData(BORDER_NODE_LABEL_TEXT_POSITION, "any", BORDER_NODE_LABEL_TEXT_BOUNDS)); //$NON-NLS-1$ return nodeLayoutData; } @@ -231,16 +294,16 @@ private NodeLayoutData createNodeLayoutData(Position position, Size size, IConta nodeLayoutData.setSize(size); nodeLayoutData.setNodeType(nodeType); nodeLayoutData.setChildrenNodes(new ArrayList<>()); - nodeLayoutData.setLabel(this.createLabelLayoutData(Position.at(0, 0), Size.of(0, 0), nodeLayoutData, "inside")); //$NON-NLS-1$ + nodeLayoutData.setLabel(this.createLabelLayoutData(Position.at(0, 0), "inside", new TextBounds(Size.of(0, 0), Position.at(0, 0)))); //$NON-NLS-1$ return nodeLayoutData; } - private LabelLayoutData createLabelLayoutData(Position position, Size size, IContainerLayoutData parent, String labelType) { + private LabelLayoutData createLabelLayoutData(Position position, String labelType, TextBounds textBounds) { LabelLayoutData labelLayoutData = new LabelLayoutData(); labelLayoutData.setId(UUID.randomUUID().toString()); labelLayoutData.setPosition(position); labelLayoutData.setLabelType(labelType); - labelLayoutData.setTextBounds(new TextBounds(Size.of(0, 0), Position.at(0, 0))); + labelLayoutData.setTextBounds(textBounds); return labelLayoutData; } diff --git a/frontend/src/diagram/palette/ContextualPalette.tsx b/frontend/src/diagram/palette/ContextualPalette.tsx index 264cd01282..241af5c6b7 100644 --- a/frontend/src/diagram/palette/ContextualPalette.tsx +++ b/frontend/src/diagram/palette/ContextualPalette.tsx @@ -245,7 +245,7 @@ export const ContextualPalette = ({ }); let renameEntry; - if (invokeLabelEdit && !(targetElement instanceof BorderNode)) { + if (invokeLabelEdit) { renameEntry = (
invokeLabelEdit()} /> diff --git a/frontend/src/diagram/sprotty/convertDiagram.tsx b/frontend/src/diagram/sprotty/convertDiagram.tsx index 1937d97751..8ae92655a4 100644 --- a/frontend/src/diagram/sprotty/convertDiagram.tsx +++ b/frontend/src/diagram/sprotty/convertDiagram.tsx @@ -146,17 +146,20 @@ const convertBorderNode = ( readOnly: boolean, autoLayout: boolean ): BorderNode => { - const { id, descriptionId, type, targetObjectId, targetObjectKind, targetObjectLabel, size, position, style } = + const { id, label, descriptionId, type, targetObjectId, targetObjectKind, targetObjectLabel, size, position, style } = gqlNode; const node: BorderNode = new BorderNode(); parentElement.add(node); + const convertedLabel = convertLabel(node, label, httpOrigin, readOnly); + node.id = id; node.type = type.replace('node:', 'port:'); node.kind = `siriusComponents://graphical?representationType=Diagram&type=Node`; node.descriptionId = descriptionId; node.style = convertNodeStyle(style, httpOrigin); + node.editableLabel = !readOnly ? convertedLabel : null; node.targetObjectId = targetObjectId; node.targetObjectKind = targetObjectKind; node.targetObjectLabel = targetObjectLabel;