Skip to content

Commit f744933

Browse files
committed
[1525] Add support for the management of the appearance of custom nodes
Bug: #1525 Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
1 parent 87fbb4b commit f744933

62 files changed

Lines changed: 3654 additions & 10 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ Consumers may override this by providing an implementation of `org.eclipse.syson
8282

8383
- https://github.com/eclipse-syson/syson/issues/1314[#1314] [diagrams] (Almost) All node descriptions are now synchronized (based on the exposed elements of ViewUsages).
8484
This contribution allows to switch from one _ViewDefinition_ to another one in a _ViewUsage_ without having to re-create the diagram.
85+
- https://github.com/eclipse-syson/syson/issues/1525[#1525] [diagrams] Add support for the management of the appearance of custom nodes (`Package`, `ImportedPackage`, `Note` and `ViewFrame`) with the extension point `PaletteAppearanceSectionContribution`.
86+
* `DiagramImporterSysMLPackageNodeStyleAppearanceChangeHandler implements IDiagramImporterNodeStyleAppearanceChangeHandler` allows the importation of diagram with `Package` nodes that have custom appearance.
87+
* `EditSysMLPackageNodeAppearanceEventHandler implements IDiagramEventHandler` adds the needed `appearanceChanges` to the `diagramContext` after receiving the mutation.
88+
* `SysMLPackageNodeAppearanceHandler implements INodeAppearanceHandler` handles how the node is updated from the `appearanceChanges`.
89+
* A GraphQL mutation is also added through `editSysMLPackageNodeAppearance`.
90+
* Same mechanism is applied to `ImportedPackage`, `Note` and `ViewFrame` nodes.
8591

8692
== v2025.8.0
8793

backend/application/syson-application-configuration/src/main/java/org/eclipse/syson/application/nodes/SysMLImportedPackageNodeStyle.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public static Builder newSysMLImportedPackageNodeStyle() {
4646
return new Builder();
4747
}
4848

49+
public static Builder newSysMLImportedPackageNodeStyle(SysMLImportedPackageNodeStyle nodeStyle) {
50+
return new Builder(nodeStyle);
51+
}
52+
4953
public String getBackground() {
5054
return this.background;
5155
}
@@ -95,6 +99,14 @@ private Builder() {
9599
// Prevent instantiation
96100
}
97101

102+
private Builder(SysMLImportedPackageNodeStyle nodeStyle) {
103+
this.background = nodeStyle.getBackground();
104+
this.borderColor = nodeStyle.getBorderColor();
105+
this.borderSize = nodeStyle.getBorderSize();
106+
this.borderStyle = nodeStyle.getBorderStyle();
107+
this.childrenLayoutStrategy = nodeStyle.getChildrenLayoutStrategy();
108+
}
109+
98110
public Builder background(String background) {
99111
this.background = Objects.requireNonNull(background);
100112
return this;

backend/application/syson-application-configuration/src/main/java/org/eclipse/syson/application/nodes/SysMLNoteNodeStyle.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public static Builder newSysMLNoteNodeStyle() {
4747
return new Builder();
4848
}
4949

50+
public static Builder newSysMLNoteNodeStyle(SysMLNoteNodeStyle nodeStyle) {
51+
return new Builder(nodeStyle);
52+
}
53+
5054
public String getBackground() {
5155
return this.background;
5256
}
@@ -96,6 +100,14 @@ private Builder() {
96100
// Prevent instantiation
97101
}
98102

103+
private Builder(SysMLNoteNodeStyle nodeStyle) {
104+
this.background = nodeStyle.getBackground();
105+
this.borderColor = nodeStyle.getBorderColor();
106+
this.borderSize = nodeStyle.getBorderSize();
107+
this.borderStyle = nodeStyle.getBorderStyle();
108+
this.childrenLayoutStrategy = nodeStyle.getChildrenLayoutStrategy();
109+
}
110+
99111
public Builder background(String background) {
100112
this.background = Objects.requireNonNull(background);
101113
return this;

backend/application/syson-application-configuration/src/main/java/org/eclipse/syson/application/nodes/SysMLPackageNodeStyle.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public static Builder newSysMLPackageNodeStyle() {
4747
return new Builder();
4848
}
4949

50+
public static Builder newSysMLPackageNodeStyle(SysMLPackageNodeStyle nodeStyle) {
51+
return new Builder(nodeStyle);
52+
}
53+
5054
public String getBackground() {
5155
return this.background;
5256
}
@@ -96,6 +100,14 @@ private Builder() {
96100
// Prevent instantiation
97101
}
98102

103+
private Builder(SysMLPackageNodeStyle nodeStyle) {
104+
this.background = nodeStyle.getBackground();
105+
this.borderColor = nodeStyle.getBorderColor();
106+
this.borderSize = nodeStyle.getBorderSize();
107+
this.borderStyle = nodeStyle.getBorderStyle();
108+
this.childrenLayoutStrategy = nodeStyle.getChildrenLayoutStrategy();
109+
}
110+
99111
public Builder background(String background) {
100112
this.background = Objects.requireNonNull(background);
101113
return this;

backend/application/syson-application-configuration/src/main/java/org/eclipse/syson/application/nodes/SysMLViewFrameNodeStyle.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public static Builder newSysMLViewFrameNodeStyle() {
4848
return new Builder();
4949
}
5050

51+
public static Builder newSysMLViewFrameNodeStyle(SysMLViewFrameNodeStyle nodeStyle) {
52+
return new Builder(nodeStyle);
53+
}
54+
5155
public String getBackground() {
5256
return this.background;
5357
}
@@ -103,6 +107,15 @@ private Builder() {
103107
// Prevent instantiation
104108
}
105109

110+
private Builder(SysMLViewFrameNodeStyle nodeStyle) {
111+
this.background = nodeStyle.getBackground();
112+
this.borderColor = nodeStyle.getBorderColor();
113+
this.borderSize = nodeStyle.getBorderSize();
114+
this.borderStyle = nodeStyle.getBorderStyle();
115+
this.borderRadius = nodeStyle.getBorderRadius();
116+
this.childrenLayoutStrategy = nodeStyle.getChildrenLayoutStrategy();
117+
}
118+
106119
public Builder background(String background) {
107120
this.background = Objects.requireNonNull(background);
108121
return this;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.syson.application.nodes.dto;
14+
15+
import java.util.UUID;
16+
17+
import org.eclipse.sirius.components.collaborative.diagrams.api.IDiagramInput;
18+
19+
/**
20+
* Input for the edition of a SysMLImportedPackage node's appearance.
21+
*
22+
* @author arichard
23+
*/
24+
public record EditSysMLImportedPackageNodeAppearanceInput(UUID id, String editingContextId, String representationId, String nodeId, SysMLImportedPackageNodeAppearanceInput appearance)
25+
implements IDiagramInput {
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.syson.application.nodes.dto;
14+
15+
import java.util.UUID;
16+
17+
import org.eclipse.sirius.components.collaborative.diagrams.api.IDiagramInput;
18+
19+
/**
20+
* Input for the edition of a SysMLPackage node's appearance.
21+
*
22+
* @author arichard
23+
*/
24+
public record EditSysMLNoteNodeAppearanceInput(UUID id, String editingContextId, String representationId, String nodeId, SysMLNoteNodeAppearanceInput appearance) implements IDiagramInput {
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.syson.application.nodes.dto;
14+
15+
import java.util.UUID;
16+
17+
import org.eclipse.sirius.components.collaborative.diagrams.api.IDiagramInput;
18+
19+
/**
20+
* Input for the edition of a SysMLPackage node's appearance.
21+
*
22+
* @author arichard
23+
*/
24+
public record EditSysMLPackageNodeAppearanceInput(UUID id, String editingContextId, String representationId, String nodeId, SysMLPackageNodeAppearanceInput appearance) implements IDiagramInput {
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.syson.application.nodes.dto;
14+
15+
import java.util.UUID;
16+
17+
import org.eclipse.sirius.components.collaborative.diagrams.api.IDiagramInput;
18+
19+
/**
20+
* Input for the edition of a SysMLViewFrame node's appearance.
21+
*
22+
* @author arichard
23+
*/
24+
public record EditSysMLViewFrameNodeAppearanceInput(UUID id, String editingContextId, String representationId, String nodeId, SysMLViewFrameNodeAppearanceInput appearance) implements IDiagramInput {
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.syson.application.nodes.dto;
14+
15+
import org.eclipse.sirius.components.diagrams.LineStyle;
16+
17+
/**
18+
* Input for the edition of a SysMLImportedPackage node's appearance.
19+
*
20+
* @author arichard
21+
*/
22+
public record SysMLImportedPackageNodeAppearanceInput(String background, String borderColor, Integer borderSize, LineStyle borderStyle) {
23+
}

0 commit comments

Comments
 (0)