Skip to content

Commit

Permalink
[2195] Set border color to None now set the color to none
Browse files Browse the repository at this point in the history
Instead of set the color to a default color

Bug: #2195
Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
  • Loading branch information
AxelRICHARD committed Sep 7, 2023
1 parent 415ade2 commit 610dfb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.adoc
Expand Up @@ -63,6 +63,7 @@ A suitable implementation is to get the id of the `self` object using `IObjectSe
- https://github.com/eclipse-sirius/sirius-web/issues/2192[#2192] [view] Fix an issue where the _Shape_ property of an ImageNodeStyle was not mandatory.
An error message is now displayed if the _Shape_ is not set.
- https://github.com/eclipse-sirius/sirius-web/issues/2309[#2309] [diagram] Fix an issue where the edge labels where not always centered on react-flow diagrams
- https://github.com/eclipse-sirius/sirius-web/issues/2195[#2195] [view] Fix an issue where a border color set to _None_ would set the color to a default color, not none.

=== New Features

Expand All @@ -72,7 +73,7 @@ An error message is now displayed if the _Shape_ is not set.
- https://github.com/eclipse-sirius/sirius-web/issues/2253[#2253] [diagram] Add the possibility of organizing palette tools into sections
- https://github.com/eclipse-sirius/sirius-web/issues/2236[#2236] [forms] It is now possible to use `For` and `If` constructs inside the definition of Form (currently only inside _Groups_ and _Flexbox containers_).
Both constructs are commonly combined together, with e.g. _For_ iterating on the different features of the current semantic element and several _If_ inside the loop to decide which concrete widget(s) to instantiate depending on the feature's type.
They can however also be used independently (e.g. a single _If_ ouside of a _For_ to make the presence of a widget conditional) and combined in arbitrary ways (e.g. nested loops or conditionals).
They can however also be used independently (e.g. a single _If_ outside of a _For_ to make the presence of a widget conditional) and combined in arbitrary ways (e.g. nested loops or conditionals).
Note that this first version has a known limitation: _FormDescriptions_ which use _For_ or _If_ elements can not be reliably edited using the _Form Description Editor_.
This will be fixed in the next version.

Expand Down
Expand Up @@ -52,7 +52,6 @@ public StylesFactory(List<INodeStyleProvider> iNodeStyleProviders, IObjectServic
}

public LabelStyleDescription createLabelStyleDescription(NodeStyleDescription nodeStyle) {
// @formatter:off
return LabelStyleDescription.newLabelStyleDescription()
.colorProvider(variableManager -> Optional.ofNullable(nodeStyle.getLabelColor())
.filter(FixedColor.class::isInstance)
Expand All @@ -72,11 +71,9 @@ public LabelStyleDescription createLabelStyleDescription(NodeStyleDescription no
return iconURL;
})
.build();
// @formatter:on
}

public LabelStyleDescription createEdgeLabelStyleDescription(org.eclipse.sirius.components.view.diagram.EdgeStyle edgeStyle) {
// @formatter:off
return LabelStyleDescription.newLabelStyleDescription()
.colorProvider(variableManager -> Optional.ofNullable(edgeStyle.getColor())
.filter(FixedColor.class::isInstance)
Expand All @@ -96,11 +93,9 @@ public LabelStyleDescription createEdgeLabelStyleDescription(org.eclipse.sirius.
return iconURL;
})
.build();
// @formatter:on
}

public EdgeStyle createEdgeStyle(org.eclipse.sirius.components.view.diagram.EdgeStyle edgeStyle) {
// @formatter:off
return EdgeStyle.newEdgeStyle()
.color(Optional.ofNullable(edgeStyle.getColor())
.filter(FixedColor.class::isInstance)
Expand All @@ -112,7 +107,6 @@ public EdgeStyle createEdgeStyle(org.eclipse.sirius.components.view.diagram.Edge
.sourceArrow(ArrowStyle.valueOf(edgeStyle.getSourceArrowStyle().getLiteral()))
.targetArrow(ArrowStyle.valueOf(edgeStyle.getTargetArrowStyle().getLiteral()))
.build();
// @formatter:on
}

public String getNodeType(NodeStyleDescription nodeStyleDescription) {
Expand Down Expand Up @@ -140,7 +134,6 @@ public INodeStyle createNodeStyle(NodeStyleDescription nodeStyle, Optional<Strin
result = IconLabelNodeStyle.newIconLabelNodeStyle().backgroundColor("transparent").build();
break;
case NodeType.NODE_RECTANGLE:
// @formatter:off
result = RectangularNodeStyle.newRectangularNodeStyle()
.withHeader(((RectangularNodeStyleDescription) nodeStyle).isWithHeader())
.color(Optional.ofNullable(nodeStyle.getColor())
Expand All @@ -152,13 +145,12 @@ public INodeStyle createNodeStyle(NodeStyleDescription nodeStyle, Optional<Strin
.filter(FixedColor.class::isInstance)
.map(FixedColor.class::cast)
.map(FixedColor::getValue)
.orElse(DEFAULT_COLOR))
.orElse(""))
.borderSize(nodeStyle.getBorderSize())
.borderStyle(LineStyle.valueOf(nodeStyle.getBorderLineStyle().getLiteral()))
.borderRadius(nodeStyle.getBorderRadius())
.build();
break;
// @formatter:on
default:
for (INodeStyleProvider iNodeStyleProvider : this.iNodeStyleProviders) {
Optional<INodeStyle> nodeStyleOpt = iNodeStyleProvider.createNodeStyle(nodeStyle, optionalEditingContextId);
Expand All @@ -169,7 +161,6 @@ public INodeStyle createNodeStyle(NodeStyleDescription nodeStyle, Optional<Strin
}
}
if (result == null) {
// @formatter:off
result = RectangularNodeStyle.newRectangularNodeStyle()
.withHeader(true)
.color(Optional.ofNullable(nodeStyle.getColor())
Expand All @@ -181,15 +172,13 @@ public INodeStyle createNodeStyle(NodeStyleDescription nodeStyle, Optional<Strin
.filter(FixedColor.class::isInstance)
.map(FixedColor.class::cast)
.map(FixedColor::getValue)
.orElse(DEFAULT_COLOR))
.orElse(""))
.borderSize(nodeStyle.getBorderSize())
.borderStyle(LineStyle.valueOf(nodeStyle.getBorderLineStyle().getLiteral()))
.borderRadius(nodeStyle.getBorderRadius())
.build();
// @formatter:on
}

return result;
}
// CHECKSTYLE:ON
}

0 comments on commit 610dfb1

Please sign in to comment.