Skip to content

Commit

Permalink
[3680] Remove label from representation content
Browse files Browse the repository at this point in the history
Bug: #3680
Signed-off-by: Guillaume Coutable <[email protected]>
  • Loading branch information
gcoutable committed Oct 14, 2024
1 parent 8c2c366 commit 5eed955
Show file tree
Hide file tree
Showing 155 changed files with 761 additions and 792 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ This allows an error to be displayed when there is a problem during uploading
+ Remove `org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService` and its implementation.
+ Use `org.eclipse.sirius.web.domain.boundedcontexts.representationdata.services.api.IRepresentationMetadataSearchService#findAllMetadataByTargetObjectId` instead of `org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService#findAllByTargetObjectId`.
- https://github.com/eclipse-sirius/sirius-web/issues/3679[#3679] [sirius-web] aql service `hasChildren` requires the editing context like the aql service `getChildren`.
- https://github.com/eclipse-sirius/sirius-web/issues/3680[#3680] [core] The label has been removed from the content of all representations.
+ The label of a representation is available through its metadata that can be retrieve thanks to the service `IRepresentationMetadataSearchService` from sirius-web-domain or, `IRepresentationMetadataProvider` from sirius-components-collaborative.

=== Dependency update

Expand Down
23 changes: 15 additions & 8 deletions integration-tests/cypress/e2e/project/diagrams/diagram-list.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
* Obeo - initial API and implementation
*******************************************************************************/
import { Studio } from '../../../usecases/Studio';
import { Explorer } from '../../../workbench/Explorer';
import { Details } from '../../../workbench/Details';
import { Diagram } from '../../../workbench/Diagram';
import { Explorer } from '../../../workbench/Explorer';

describe('Diagram - list', () => {
const domainName: string = 'diagramList';
Expand All @@ -33,20 +34,26 @@ describe('Diagram - list', () => {

it('Then the node is correctly displayed with the proper separator', () => {
const explorer = new Explorer();
const diagram = new Diagram();
const details = new Details();
explorer.createObject('Root', 'entity1s-Entity1');
details.getTextField('Name').type('list{enter}');
new Explorer().createRepresentation('Root', diagramDescriptionName, diagramTitle);
diagram.fitToScreen();
// Compartment list without label
cy.getByTestId('List - undefined').should('exist');
cy.getByTestId('List - undefined')
.invoke('css', 'border-width')
.then((borderWidth) => {
expect(borderWidth).to.eq('0px 0px 1px');
diagram
.getDiagram(diagramTitle)
.findByTestId('List - undefined')
.should('exist')
.invoke('attr', 'style')
.then((style) => {
expect(style).to.contain('border-width: 0px 0px 1px');
});
// Compartment freeform
cy.getByTestId('FreeForm - list').should('exist');
cy.getByTestId('FreeForm - list')
diagram
.getDiagram(diagramTitle)
.findByTestId('FreeForm - list')
.should('exist')
.invoke('css', 'border-width')
.then((borderWidth) => {
expect(borderWidth).to.eq('0px');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public final class BarChart implements IChart {

private String descriptionId;

private String label;

private String kind;

private String targetObjectId;
Expand Down Expand Up @@ -64,11 +62,6 @@ public String getDescriptionId() {
return this.descriptionId;
}

@Override
public String getLabel() {
return this.label;
}

@Override
public String getKind() {
return this.kind;
Expand Down Expand Up @@ -105,8 +98,8 @@ public static Builder newBarChart(String id) {

@Override
public String toString() {
String pattern = "{0} '{'id: {1}, descriptionId: {2}, label: {3}, kind: {4}, width: {5}, height: {6}, yAxisLabel:{7}'}'";
return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.id, this.descriptionId, this.label, this.kind, this.width, this.height, this.yAxisLabel);
String pattern = "{0} '{'id: {1}, descriptionId: {2}, kind: {3}, width: {4}, height: {5}, yAxisLabel:{6}'}'";
return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.id, this.descriptionId, this.kind, this.width, this.height, this.yAxisLabel);
}

/**
Expand All @@ -121,8 +114,6 @@ public static final class Builder {

private String descriptionId;

private String label;

private String kind = KIND;

private String targetObjectId;
Expand All @@ -146,11 +137,6 @@ public Builder descriptionId(String descriptionId) {
return this;
}

public Builder label(String label) {
this.label = Objects.requireNonNull(label);
return this;
}

public Builder targetObjectId(String targetObjectId) {
this.targetObjectId = Objects.requireNonNull(targetObjectId);
return this;
Expand Down Expand Up @@ -185,7 +171,6 @@ public BarChart build() {
BarChart barChart = new BarChart();
barChart.id = Objects.requireNonNull(this.id);
barChart.descriptionId = Objects.requireNonNull(this.descriptionId);
barChart.label = Objects.requireNonNull(this.label);
barChart.kind = Objects.requireNonNull(this.kind);
barChart.targetObjectId = Objects.requireNonNull(this.targetObjectId);
barChart.entries = Objects.requireNonNull(this.entries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,13 @@ public Element render() {
Optional<BarChart> optionalPreviousBarChart = this.props.getPreviousBarChart();

String id = optionalPreviousBarChart.map(BarChart::getId).orElseGet(() -> UUID.randomUUID().toString());
String label = barChartDescription.getLabelProvider().apply(variableManager);
String targetObjectId = barChartDescription.getTargetObjectIdProvider().apply(variableManager);
List<Number> values = barChartDescription.getValuesProvider().apply(variableManager);
List<String> keys = barChartDescription.getKeysProvider().apply(variableManager);
String yAxisLabel = barChartDescription.getYAxisLabelProvider().apply(variableManager);
BarChartStyle barChartStyle = barChartDescription.getStyleProvider().apply(variableManager);

Builder builder = BarChartElementProps.newBarChartElementProps(id)
.label(label)
.descriptionId(barChartDescription.getId())
.targetObjectId(targetObjectId)
.values(values)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public final class BarChartElementProps implements IProps {

private String descriptionId;

private String label;

private String targetObjectId;

private List<Number> values;
Expand All @@ -61,10 +59,6 @@ public String getDescriptionId() {
return this.descriptionId;
}

public String getLabel() {
return this.label;
}

public String getTargetObjectId() {
return this.targetObjectId;
}
Expand Down Expand Up @@ -108,8 +102,6 @@ public static final class Builder {

private String descriptionId;

private String label;

private String targetObjectId;

private List<Number> values;
Expand All @@ -133,11 +125,6 @@ public Builder descriptionId(String descriptionId) {
return this;
}

public Builder label(String label) {
this.label = Objects.requireNonNull(label);
return this;
}

public Builder targetObjectId(String targetObjectId) {
this.targetObjectId = Objects.requireNonNull(targetObjectId);
return this;
Expand Down Expand Up @@ -177,7 +164,6 @@ public BarChartElementProps build() {
BarChartElementProps barChartElementProps = new BarChartElementProps();
barChartElementProps.id = Objects.requireNonNull(this.id);
barChartElementProps.descriptionId = Objects.requireNonNull(this.descriptionId);
barChartElementProps.label = Objects.requireNonNull(this.label);
barChartElementProps.targetObjectId = Objects.requireNonNull(this.targetObjectId);
barChartElementProps.values = Objects.requireNonNull(this.values);
barChartElementProps.keys = Objects.requireNonNull(this.keys);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public class Hierarchy implements IRepresentation {

private String targetObjectId;

private String label;

private String kind;

private List<HierarchyNode> childNodes;
Expand All @@ -41,11 +39,10 @@ public Hierarchy() {
// Used by Jackson
}

public Hierarchy(String id, String descriptionId, String targetObjectId, String label, String kind, List<HierarchyNode> childNodes) {
public Hierarchy(String id, String descriptionId, String targetObjectId, String kind, List<HierarchyNode> childNodes) {
this.id = Objects.requireNonNull(id);
this.descriptionId = Objects.requireNonNull(descriptionId);
this.targetObjectId = Objects.requireNonNull(targetObjectId);
this.label = Objects.requireNonNull(label);
this.kind = Objects.requireNonNull(kind);
this.childNodes = Objects.requireNonNull(childNodes);
}
Expand All @@ -65,11 +62,6 @@ public String getTargetObjectId() {
return this.targetObjectId;
}

@Override
public String getLabel() {
return this.label;
}

@Override
public String getKind() {
return this.kind;
Expand All @@ -81,8 +73,8 @@ public List<HierarchyNode> getChildNodes() {

@Override
public String toString() {
String pattern = "{0} '{'id: {1}, targetObjectId: {2}, descriptionId: {3}, label: {4}, kind: {5}'}'";
return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.id, this.targetObjectId, this.descriptionId, this.label, this.kind);
String pattern = "{0} '{'id: {1}, targetObjectId: {2}, descriptionId: {3}, kind: {4}'}'";
return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.id, this.targetObjectId, this.descriptionId, this.kind);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@ public Element render() {

String id = optionalPreviousHierarchy.map(Hierarchy::getId).orElseGet(() -> UUID.randomUUID().toString());
String targetObjectId = hierarchyDescription.getTargetObjectIdProvider().apply(variableManager);
String label = variableManager.get(HierarchyDescription.LABEL, String.class).orElse("");
String kind = hierarchyDescription.getKind();

List<HierarchyNode> previousNodes = optionalPreviousHierarchy.map(Hierarchy::getChildNodes).orElse(List.of());

HierarchyNodeComponentProps nodeComponentProps = new HierarchyNodeComponentProps(variableManager, hierarchyDescription, previousNodes, id);
List<Element> children = List.of(new Element(HierarchyNodeComponent.class, nodeComponentProps));

HierarchyElementProps hierarchyElementProps = new HierarchyElementProps(id, hierarchyDescription.getId(), targetObjectId, label, kind, children);
HierarchyElementProps hierarchyElementProps = new HierarchyElementProps(id, hierarchyDescription.getId(), targetObjectId, kind, children);
return new Element(HierarchyElementProps.TYPE, hierarchyElementProps);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 Obeo.
* Copyright (c) 2022, 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
Expand Down Expand Up @@ -33,17 +33,14 @@ public class HierarchyElementProps implements IProps {

private final String targetObjectId;

private final String label;

private final String kind;

private final List<Element> children;

public HierarchyElementProps(String id, String descriptionId, String targetObjectId, String label, String kind, List<Element> children) {
public HierarchyElementProps(String id, String descriptionId, String targetObjectId, String kind, List<Element> children) {
this.id = Objects.requireNonNull(id);
this.descriptionId = Objects.requireNonNull(descriptionId);
this.targetObjectId = Objects.requireNonNull(targetObjectId);
this.label = Objects.requireNonNull(label);
this.kind = Objects.requireNonNull(kind);
this.children = Objects.requireNonNull(children);
}
Expand All @@ -60,10 +57,6 @@ public String getTargetObjectId() {
return this.targetObjectId;
}

public String getLabel() {
return this.label;
}

public String getKind() {
return this.kind;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022, 2023 Obeo.
* Copyright (c) 2022, 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
Expand Down Expand Up @@ -40,23 +40,19 @@ public Object instantiateElement(String type, IProps props, List<Object> childre
}

private Hierarchy instantiateHierarchy(HierarchyElementProps props, List<Object> children) {
// @formatter:off
List<HierarchyNode> nodes = children.stream()
.filter(HierarchyNode.class::isInstance)
.map(HierarchyNode.class::cast)
.toList();
// @formatter:on

return new Hierarchy(props.getId(), props.getDescriptionId(), props.getTargetObjectId(), props.getLabel(), props.getKind(), nodes);
return new Hierarchy(props.getId(), props.getDescriptionId(), props.getTargetObjectId(), props.getKind(), nodes);
}

private HierarchyNode instantiateNode(HierarchyNodeElementProps props, List<Object> children) {
// @formatter:off
List<HierarchyNode> nodes = children.stream()
.filter(HierarchyNode.class::isInstance)
.map(HierarchyNode.class::cast)
.toList();
// @formatter:on

return new HierarchyNode(props.getId(), props.getTargetObjectId(), props.getLabel(), nodes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public final class PieChart implements IChart {

private String descriptionId;

private String label;

private String kind;

private String targetObjectId;
Expand All @@ -58,11 +56,6 @@ public String getDescriptionId() {
return this.descriptionId;
}

@Override
public String getLabel() {
return this.label;
}

@Override
public String getKind() {
return this.kind;
Expand All @@ -87,8 +80,8 @@ public static Builder newPieChart(String id) {

@Override
public String toString() {
String pattern = "{0} '{'id: {1}, descriptionId: {2}, label: {3}, kind: {4}'}'";
return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.id, this.descriptionId, this.label, this.kind);
String pattern = "{0} '{'id: {1}, descriptionId: {2}, kind: {3}'}'";
return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.id, this.descriptionId, this.kind);
}

/**
Expand All @@ -103,8 +96,6 @@ public static final class Builder {

private String descriptionId;

private String label;

private String kind = KIND;

private String targetObjectId;
Expand All @@ -122,11 +113,6 @@ public Builder descriptionId(String descriptionId) {
return this;
}

public Builder label(String label) {
this.label = Objects.requireNonNull(label);
return this;
}

public Builder targetObjectId(String targetObjectId) {
this.targetObjectId = Objects.requireNonNull(targetObjectId);
return this;
Expand All @@ -145,7 +131,6 @@ public Builder style(PieChartStyle style) {
public PieChart build() {
PieChart pieChart = new PieChart();
pieChart.id = Objects.requireNonNull(this.id);
pieChart.label = Objects.requireNonNull(this.label);
pieChart.descriptionId = Objects.requireNonNull(this.descriptionId);
pieChart.kind = Objects.requireNonNull(this.kind);
pieChart.targetObjectId = Objects.requireNonNull(this.targetObjectId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ public Element render() {
Optional<PieChart> optionalPreviousPieChart = this.props.getPreviousPieChart();

String id = optionalPreviousPieChart.map(PieChart::getId).orElseGet(() -> UUID.randomUUID().toString());
String label = Optional.ofNullable(pieChartDescription.getLabel()).orElse("");
String targetObjectId = pieChartDescription.getTargetObjectIdProvider().apply(variableManager);
List<Number> values = pieChartDescription.getValuesProvider().apply(variableManager);
List<String> keys = pieChartDescription.getKeysProvider().apply(variableManager);
PieChartStyle pieChartStyle = pieChartDescription.getStyleProvider().apply(variableManager);

Builder builder = PieChartElementProps.newPieChartElementProps(id)
.label(label)
.descriptionId(pieChartDescription.getId())
.targetObjectId(targetObjectId)
.values(values)
Expand Down
Loading

0 comments on commit 5eed955

Please sign in to comment.