From 14ef8714982a4b268cebadbe858fb08192c42f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Rou=C3=ABn=C3=A9?= Date: Mon, 19 Jun 2023 11:22:42 +0200 Subject: [PATCH] [2077] Add borderStyle to container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: https://github.com/eclipse-sirius/sirius-components/issues/2077 Signed-off-by: Florian Rouëné --- CHANGELOG.adoc | 1 + .../project/edit/formdescriptioneditor.cy.js | 46 ++ .../NumberIfDescriptionProvider.java | 2 +- .../src/main/resources/schema/form.graphqls | 15 + .../forms/ContainerBorderLineStyle.java | 22 + .../forms/ContainerBorderStyle.java | 112 ++++ .../components/forms/FlexboxContainer.java | 15 + .../sirius/components/forms/Group.java | 18 +- .../components/FlexboxContainerComponent.java | 9 +- .../forms/components/GroupComponent.java | 14 +- .../FlexboxContainerDescription.java | 16 + .../forms/description/GroupDescription.java | 15 + .../FlexboxContainerElementProps.java | 17 + .../forms/elements/GroupElementProps.java | 17 + .../forms/renderer/FormElementFactory.java | 20 +- .../src/form/FormEventFragments.ts | 24 + .../src/form/FormEventFragments.types.ts | 9 + .../src/groups/Group.tsx | 24 +- .../src/groups/Group.types.ts | 9 +- .../FlexboxContainerPropertySection.tsx | 14 +- .../FlexboxContainerPropertySection.types.ts | 6 +- .../FlexboxContainerPropertySection.test.tsx | 93 ++++ ...xboxContainerPropertySection.test.tsx.snap | 49 ++ ...onditionalContainerBorderStyleBuilder.java | 99 ++++ .../ContainerBorderStyleBuilder.java | 89 ++++ .../FlexboxContainerDescriptionBuilder.java | 22 + .../generated/GroupDescriptionBuilder.java | 24 +- .../view/builder/generated/ViewBuilders.java | 20 + ...ionalContainerBorderStyleItemProvider.java | 173 +++++++ .../ContainerBorderStyleItemProvider.java | 192 +++++++ ...exboxContainerDescriptionItemProvider.java | 34 +- .../GroupDescriptionItemProvider.java | 11 +- .../ViewItemProviderAdapterFactory.java | 50 ++ .../icons/full/obj16/ConditionalStyle.svg | 63 +++ .../src/main/resources/plugin.properties | 113 ++-- ...opertiesDescriptionRegistryConfigurer.java | 3 +- .../form/ContainerBorderStyleProvider.java | 54 ++ .../form/ViewFormDescriptionConverter.java | 18 + .../ViewFormDescriptionConverterSwitch.java | 15 +- .../view/ConditionalContainerBorderStyle.java | 25 + .../view/ContainerBorderLineStyle.java | 229 +++++++++ .../components/view/ContainerBorderStyle.java | 128 +++++ .../view/FlexboxContainerDescription.java | 46 +- .../components/view/GroupDescription.java | 41 +- .../sirius/components/view/ViewFactory.java | 17 + .../sirius/components/view/ViewPackage.java | 481 ++++++++++++++++-- .../ConditionalContainerBorderStyleImpl.java | 402 +++++++++++++++ .../view/impl/ContainerBorderStyleImpl.java | 353 +++++++++++++ .../impl/FlexboxContainerDescriptionImpl.java | 121 ++++- .../view/impl/GroupDescriptionImpl.java | 117 ++++- .../components/view/impl/ViewFactoryImpl.java | 54 ++ .../components/view/impl/ViewPackageImpl.java | 269 ++++++---- .../view/util/ViewAdapterFactory.java | 40 ++ .../components/view/util/ViewSwitch.java | 48 ++ .../src/main/resources/model/view.ecore | 23 + .../src/main/resources/model/view.genmodel | 16 + 56 files changed, 3719 insertions(+), 238 deletions(-) create mode 100644 packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/ContainerBorderLineStyle.java create mode 100644 packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/ContainerBorderStyle.java create mode 100644 packages/forms/frontend/sirius-components-forms/src/propertysections/__tests__/FlexboxContainerPropertySection.test.tsx create mode 100644 packages/forms/frontend/sirius-components-forms/src/propertysections/__tests__/__snapshots__/FlexboxContainerPropertySection.test.tsx.snap create mode 100644 packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/ConditionalContainerBorderStyleBuilder.java create mode 100644 packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/ContainerBorderStyleBuilder.java create mode 100644 packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ConditionalContainerBorderStyleItemProvider.java create mode 100644 packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ContainerBorderStyleItemProvider.java create mode 100644 packages/view/backend/sirius-components-view-edit/src/main/resources/icons/full/obj16/ConditionalStyle.svg create mode 100644 packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ContainerBorderStyleProvider.java create mode 100644 packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ConditionalContainerBorderStyle.java create mode 100644 packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ContainerBorderLineStyle.java create mode 100644 packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ContainerBorderStyle.java create mode 100644 packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalContainerBorderStyleImpl.java create mode 100644 packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ContainerBorderStyleImpl.java diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 31fe0e4302..526d74d42f 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -42,6 +42,7 @@ An absent/empty candidates expression now simply means the widget is empty. + image:doc/screenshots/ShowIconOptionSelectWidget.jpg[Icons on select widget option,70%,30%] - https://github.com/eclipse-sirius/sirius-components/issues/2055[#2055] [form] Added initial version of a custom widget to view & edit EMF references (both single and multi-valued). +- https://github.com/eclipse-sirius/sirius-components/issues/2077[#2077] [form] Add the ability to define a border style for groups and flexbox containers. === Improvements diff --git a/integration-tests/cypress/e2e/project/edit/formdescriptioneditor.cy.js b/integration-tests/cypress/e2e/project/edit/formdescriptioneditor.cy.js index 919fdffe2f..9fc7643bbe 100644 --- a/integration-tests/cypress/e2e/project/edit/formdescriptioneditor.cy.js +++ b/integration-tests/cypress/e2e/project/edit/formdescriptioneditor.cy.js @@ -209,4 +209,50 @@ describe('/projects/:projectId/edit - FormDescriptionEditor', () => { cy.get('[data-testid^="FlexboxContainer-Widgets-DropArea-"]').trigger('drop', { dataTransfer }); cy.get('[title="ReferenceWidget"]').should('be.visible'); }); + + function createBorderStyleAndCheckProperties(styleName) { + cy.getByTestId("treeitem-contextmenu").findByTestId("new-object").click(); + cy.getByTestId("childCreationDescription").children("[role=\"button\"]").invoke("text").should("have.length.gt", 1); + cy.getByTestId("childCreationDescription") + .click() + .get("[data-value=\"" + styleName + "\"]") + .should("exist") + .click(); + cy.getByTestId("create-object").click(); + cy.getByTestId("Border Color").should("exist"); + cy.getByTestId("Border Radius").should("exist"); + cy.getByTestId("Border Size").should("exist"); + cy.getByTestId("Solid").should("exist"); + cy.getByTestId("Dashed").should("exist"); + cy.getByTestId("Dotted").should("exist"); + } + + it('can create border style in a Group', () => { + cy.getByTestId('PageDescription').dblclick(); + cy.getByTestId('GroupDescription-more').click(); + createBorderStyleAndCheckProperties('Border Style Container Border Style'); + + cy.getByTestId('GroupDescription-more').click(); + createBorderStyleAndCheckProperties('Conditional Border Styles Conditional Container Border Style'); + cy.getByTestId('Condition').should('exist'); + }); + + it('can create border style in a Flexbox Container', () => { + cy.getByTestId('PageDescription').dblclick(); + + // Create a Flexbox inside the Group + var dataTransfer = new DataTransfer(); + cy.getByTestId('FormDescriptionEditor-FlexboxContainer').trigger('dragstart', { dataTransfer }); + cy.get('[data-testid^="Group-Widgets-DropArea-"]').trigger('drop', { dataTransfer }); + cy.get('[title="FlexboxContainer"]').should('be.visible'); + + cy.getByTestId('GroupDescription').dblclick(); + cy.getByTestId('FlexboxContainerDescription-more').click(); + createBorderStyleAndCheckProperties('Border Style Container Border Style'); + + cy.getByTestId('FlexboxContainerDescription-more').click(); + createBorderStyleAndCheckProperties('Conditional Border Styles Conditional Container Border Style'); + cy.getByTestId('Condition').should('exist'); + + }); }); diff --git a/packages/compatibility/backend/sirius-components-compatibility-emf/src/main/java/org/eclipse/sirius/components/compatibility/emf/properties/NumberIfDescriptionProvider.java b/packages/compatibility/backend/sirius-components-compatibility-emf/src/main/java/org/eclipse/sirius/components/compatibility/emf/properties/NumberIfDescriptionProvider.java index da790b2bbd..a2ecb0e719 100644 --- a/packages/compatibility/backend/sirius-components-compatibility-emf/src/main/java/org/eclipse/sirius/components/compatibility/emf/properties/NumberIfDescriptionProvider.java +++ b/packages/compatibility/backend/sirius-components-compatibility-emf/src/main/java/org/eclipse/sirius/components/compatibility/emf/properties/NumberIfDescriptionProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2022 Obeo. + * Copyright (c) 2019, 2023 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 diff --git a/packages/forms/backend/sirius-components-collaborative-forms/src/main/resources/schema/form.graphqls b/packages/forms/backend/sirius-components-collaborative-forms/src/main/resources/schema/form.graphqls index b7818d6711..6d93ca89a9 100644 --- a/packages/forms/backend/sirius-components-collaborative-forms/src/main/resources/schema/form.graphqls +++ b/packages/forms/backend/sirius-components-collaborative-forms/src/main/resources/schema/form.graphqls @@ -64,6 +64,7 @@ type Group { displayMode: GroupDisplayMode! toolbarActions: [ToolbarAction!]! widgets: [Widget!]! + borderStyle: ContainerBorderStyle } enum GroupDisplayMode { @@ -71,6 +72,19 @@ enum GroupDisplayMode { TOGGLEABLE_AREAS } +type ContainerBorderStyle { + color: String + radius: Int! + size: Int! + lineStyle: ContainerBorderLineStyle! +} + +enum ContainerBorderLineStyle { + Dashed + Dotted + Solid +} + interface Widget { id: ID! label: String! @@ -326,6 +340,7 @@ type FlexboxContainer implements Widget { flexWrap: String! flexGrow: Int! children: [Widget!]! + borderStyle: ContainerBorderStyle } type TreeWidget implements Widget { diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/ContainerBorderLineStyle.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/ContainerBorderLineStyle.java new file mode 100644 index 0000000000..63681386ef --- /dev/null +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/ContainerBorderLineStyle.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2023 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.forms; + +/** + * Line style possibility for the border of a container. + * + * @author frouene + */ +public enum ContainerBorderLineStyle { + Solid, Dashed, Dotted +} diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/ContainerBorderStyle.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/ContainerBorderStyle.java new file mode 100644 index 0000000000..31a3b32137 --- /dev/null +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/ContainerBorderStyle.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2023 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.forms; + +import java.util.Objects; + +import org.eclipse.sirius.components.annotations.Immutable; + +/** + * The style of the borders for a container. + * + * @author frouene + */ +@Immutable +public final class ContainerBorderStyle { + + private String color; + + private int radius; + + private int size; + + private ContainerBorderLineStyle lineStyle; + + private ContainerBorderStyle() { + // Prevent instantiation + } + + public static Builder newCheckboxStyle() { + return new Builder(); + } + + public String getColor() { + return this.color; + } + + public int getRadius() { + return this.radius; + } + + public int getSize() { + return this.size; + } + + public ContainerBorderLineStyle getLineStyle() { + return this.lineStyle; + } + + public static Builder newContainerBorderStyle() { + return new Builder(); + } + + /** + * Builder used to create the Container border style. + * + * @author frouene + */ + @SuppressWarnings("checkstyle:HiddenField") + public static final class Builder { + + private String color; + + private int radius; + + private int size; + + private ContainerBorderLineStyle lineStyle; + + private Builder() { + } + + public Builder color(String color) { + this.color = Objects.requireNonNull(color); + return this; + } + + public Builder radius(int radius) { + this.radius = radius; + return this; + } + + public Builder size(int size) { + this.size = size; + return this; + } + + public Builder lineStyle(ContainerBorderLineStyle lineStyle) { + this.lineStyle = Objects.requireNonNull(lineStyle); + return this; + } + + public ContainerBorderStyle build() { + ContainerBorderStyle borderStyle = new ContainerBorderStyle(); + borderStyle.color = this.color; // Optional on purpose + borderStyle.radius = Objects.requireNonNull(this.radius); + borderStyle.size = Objects.requireNonNull(this.size); + borderStyle.lineStyle = Objects.requireNonNull(this.lineStyle); + return borderStyle; + } + + } +} diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/FlexboxContainer.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/FlexboxContainer.java index b2358ca7bb..4622b7e446 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/FlexboxContainer.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/FlexboxContainer.java @@ -27,6 +27,7 @@ */ @Immutable public final class FlexboxContainer extends AbstractWidget { + private String flexDirection; private String flexWrap; @@ -35,6 +36,8 @@ public final class FlexboxContainer extends AbstractWidget { private List children; + private ContainerBorderStyle borderStyle; + private FlexboxContainer() { // Prevent instantiation } @@ -55,6 +58,10 @@ public List getChildren() { return this.children; } + public ContainerBorderStyle getBorderStyle() { + return this.borderStyle; + } + public static Builder newFlexboxContainer(String id) { return new Builder(id); } @@ -90,6 +97,8 @@ public static final class Builder { private Supplier helpTextProvider; + private ContainerBorderStyle borderStyle; + private Builder(String id) { this.id = Objects.requireNonNull(id); } @@ -134,6 +143,11 @@ public Builder helpTextProvider(Supplier helpTextProvider) { return this; } + public Builder borderStyle(ContainerBorderStyle borderStyle) { + this.borderStyle = Objects.requireNonNull(borderStyle); + return this; + } + public FlexboxContainer build() { FlexboxContainer flexboxContainer = new FlexboxContainer(); flexboxContainer.id = Objects.requireNonNull(this.id); @@ -145,6 +159,7 @@ public FlexboxContainer build() { flexboxContainer.children = Objects.requireNonNull(this.children); flexboxContainer.diagnostics = Objects.requireNonNull(this.diagnostics); flexboxContainer.helpTextProvider = this.helpTextProvider; // Optional on purpose + flexboxContainer.borderStyle = this.borderStyle; // Optional on purpose return flexboxContainer; } } diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/Group.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/Group.java index d7b921dc30..2cd12ab78d 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/Group.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/Group.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2022 Obeo. + * Copyright (c) 2019, 2023 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 @@ -25,6 +25,7 @@ */ @Immutable public final class Group { + private String id; private String label; @@ -35,6 +36,8 @@ public final class Group { private List widgets; + private ContainerBorderStyle borderStyle; + private Group() { // Prevent instantiation } @@ -59,6 +62,10 @@ public GroupDisplayMode getDisplayMode() { return this.displayMode; } + public ContainerBorderStyle getBorderStyle() { + return this.borderStyle; + } + public static Builder newGroup(String id) { return new Builder(id); } @@ -76,6 +83,7 @@ public String toString() { */ @SuppressWarnings("checkstyle:HiddenField") public static final class Builder { + private String id; private String label; @@ -86,6 +94,8 @@ public static final class Builder { private List widgets; + private ContainerBorderStyle borderStyle; + private Builder(String id) { this.id = Objects.requireNonNull(id); } @@ -110,6 +120,11 @@ public Builder widgets(List widgets) { return this; } + public Builder borderStyle(ContainerBorderStyle borderStyle) { + this.borderStyle = Objects.requireNonNull(borderStyle); + return this; + } + public Group build() { Group group = new Group(); group.id = Objects.requireNonNull(this.id); @@ -117,6 +132,7 @@ public Group build() { group.displayMode = Objects.requireNonNull(this.displayMode); group.widgets = Objects.requireNonNull(this.widgets); group.toolbarActions = Objects.requireNonNull(this.toolbarActions); + group.borderStyle = this.borderStyle; // Optional on purpose return group; } } diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/FlexboxContainerComponent.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/FlexboxContainerComponent.java index 9213c35214..173083477f 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/FlexboxContainerComponent.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/FlexboxContainerComponent.java @@ -48,6 +48,7 @@ public Element render() { String id = flexboxContainerDescription.getIdProvider().apply(variableManager); String label = flexboxContainerDescription.getLabelProvider().apply(variableManager); FlexDirection flexdirection = flexboxContainerDescription.getFlexDirection(); + var borderStyle = flexboxContainerDescription.getBorderStyleProvider().apply(variableManager); List children = new ArrayList<>(); @@ -63,12 +64,14 @@ public Element render() { } }); - // @formatter:off - var flexboxContainerElementPropsBuilder = FlexboxContainerElementProps.newFlexboxContainerElementProps(id) + FlexboxContainerElementProps.Builder flexboxContainerElementPropsBuilder = FlexboxContainerElementProps.newFlexboxContainerElementProps(id) .label(label) .flexDirection(flexdirection) .children(childrenWidgets); - // @formatter:on + + if (borderStyle != null) { + flexboxContainerElementPropsBuilder.borderStyle(borderStyle); + } if (flexboxContainerDescription.getHelpTextProvider() != null) { flexboxContainerElementPropsBuilder.helpTextProvider(() -> flexboxContainerDescription.getHelpTextProvider().apply(variableManager)); diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/GroupComponent.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/GroupComponent.java index 36120247c3..0a9481e106 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/GroupComponent.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/GroupComponent.java @@ -46,6 +46,7 @@ public GroupComponent(GroupComponentProps props) { public Element render() { VariableManager variableManager = this.props.getVariableManager(); GroupDescription groupDescription = this.props.getGroupDescription(); + var borderStyle = groupDescription.getBorderStyleProvider().apply(variableManager); List semanticElements = groupDescription.getSemanticElementsProvider().apply(variableManager); @@ -64,7 +65,6 @@ public Element render() { groupChildren.add(new Element(ToolbarActionComponent.class, new ToolbarActionComponentProps(groupVariableManager, toolbarActionDescription))); } - // @formatter:off List controlDescriptions = groupDescription.getControlDescriptions(); for (AbstractControlDescription controlDescription : controlDescriptions) { if (controlDescription instanceof AbstractWidgetDescription widgetDescription) { @@ -76,13 +76,17 @@ public Element render() { } } - GroupElementProps groupElementProps = GroupElementProps.newGroupElementProps(id) + GroupElementProps.Builder groupElementPropsBuilder = GroupElementProps.newGroupElementProps(id) .label(label) .displayMode(displayMode) - .children(groupChildren) - .build(); + .children(groupChildren); + + if (borderStyle != null) { + groupElementPropsBuilder.borderStyle(borderStyle); + } + + GroupElementProps groupElementProps = groupElementPropsBuilder.build(); Element groupElement = new Element(GroupElementProps.TYPE, groupElementProps); - // @formatter:on children.add(groupElement); } diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/FlexboxContainerDescription.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/FlexboxContainerDescription.java index e45709a2d7..de3ad4d1a5 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/FlexboxContainerDescription.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/FlexboxContainerDescription.java @@ -18,6 +18,7 @@ import java.util.function.Function; import org.eclipse.sirius.components.annotations.Immutable; +import org.eclipse.sirius.components.forms.ContainerBorderStyle; import org.eclipse.sirius.components.forms.FlexDirection; import org.eclipse.sirius.components.representations.VariableManager; @@ -28,6 +29,7 @@ */ @Immutable public final class FlexboxContainerDescription extends AbstractWidgetDescription { + private Function idProvider; private Function labelProvider; @@ -36,6 +38,8 @@ public final class FlexboxContainerDescription extends AbstractWidgetDescription private List children; + private Function borderStyleProvider; + private FlexboxContainerDescription() { // Prevent instantiation } @@ -56,6 +60,10 @@ public List getChildren() { return this.children; } + public Function getBorderStyleProvider() { + return this.borderStyleProvider; + } + public static Builder newFlexboxContainerDescription(String id) { return new Builder(id); } @@ -91,6 +99,8 @@ public static final class Builder { private Function helpTextProvider; + private Function borderStyleProvider = variableManager -> null; + private Builder(String id) { this.id = Objects.requireNonNull(id); } @@ -135,6 +145,11 @@ public Builder helpTextProvider(Function helpTextProvid return this; } + public Builder borderStyleProvider(Function borderStyleProvider) { + this.borderStyleProvider = Objects.requireNonNull(borderStyleProvider); + return this; + } + public FlexboxContainerDescription build() { FlexboxContainerDescription flexboxContainerDescription = new FlexboxContainerDescription(); flexboxContainerDescription.id = Objects.requireNonNull(this.id); @@ -146,6 +161,7 @@ public FlexboxContainerDescription build() { flexboxContainerDescription.kindProvider = Objects.requireNonNull(this.kindProvider); flexboxContainerDescription.messageProvider = Objects.requireNonNull(this.messageProvider); flexboxContainerDescription.helpTextProvider = this.helpTextProvider; // Optional on purpose + flexboxContainerDescription.borderStyleProvider = Objects.requireNonNull(this.borderStyleProvider); return flexboxContainerDescription; } diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/GroupDescription.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/GroupDescription.java index 68249e5dc5..f5d072091a 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/GroupDescription.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/GroupDescription.java @@ -18,6 +18,7 @@ import java.util.function.Function; import org.eclipse.sirius.components.annotations.Immutable; +import org.eclipse.sirius.components.forms.ContainerBorderStyle; import org.eclipse.sirius.components.forms.GroupDisplayMode; import org.eclipse.sirius.components.representations.VariableManager; @@ -42,6 +43,8 @@ public final class GroupDescription { private List controlDescriptions; + private Function borderStyleProvider; + private GroupDescription() { // Prevent instantiation } @@ -74,6 +77,10 @@ public List getControlDescriptions() { return this.controlDescriptions; } + public Function getBorderStyleProvider() { + return this.borderStyleProvider; + } + public static Builder newGroupDescription(String id) { return new Builder(id); } @@ -105,6 +112,8 @@ public static final class Builder { private List controlDescriptions; + private Function borderStyleProvider = variableManager -> null; + private Builder(String id) { this.id = Objects.requireNonNull(id); } @@ -139,6 +148,11 @@ public Builder controlDescriptions(List controlDescr return this; } + public Builder borderStyleProvider(Function borderStyleProvider) { + this.borderStyleProvider = Objects.requireNonNull(borderStyleProvider); + return this; + } + public GroupDescription build() { GroupDescription groupDescription = new GroupDescription(); groupDescription.id = Objects.requireNonNull(this.id); @@ -148,6 +162,7 @@ public GroupDescription build() { groupDescription.semanticElementsProvider = Objects.requireNonNull(this.semanticElementsProvider); groupDescription.controlDescriptions = Objects.requireNonNull(this.controlDescriptions); groupDescription.toolbarActionDescriptions = Objects.requireNonNull(this.toolbarActionDescriptions); + groupDescription.borderStyleProvider = Objects.requireNonNull(this.borderStyleProvider); return groupDescription; } } diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/elements/FlexboxContainerElementProps.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/elements/FlexboxContainerElementProps.java index 3b88a3c071..55ca757514 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/elements/FlexboxContainerElementProps.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/elements/FlexboxContainerElementProps.java @@ -18,6 +18,7 @@ import java.util.function.Supplier; import org.eclipse.sirius.components.annotations.Immutable; +import org.eclipse.sirius.components.forms.ContainerBorderStyle; import org.eclipse.sirius.components.forms.FlexDirection; import org.eclipse.sirius.components.representations.Element; import org.eclipse.sirius.components.representations.IProps; @@ -29,6 +30,7 @@ */ @Immutable public final class FlexboxContainerElementProps implements IProps { + public static final String TYPE = "FlexboxContainer"; private String id; @@ -41,6 +43,8 @@ public final class FlexboxContainerElementProps implements IProps { private List children; + private ContainerBorderStyle borderStyle; + private FlexboxContainerElementProps() { // Prevent instantiation } @@ -66,6 +70,10 @@ public List getChildren() { return this.children; } + public ContainerBorderStyle getBorderStyle() { + return this.borderStyle; + } + public static Builder newFlexboxContainerElementProps(String id) { return new Builder(id); } @@ -83,6 +91,7 @@ public String toString() { */ @SuppressWarnings("checkstyle:HiddenField") public static final class Builder { + private String id; private String label; @@ -93,6 +102,8 @@ public static final class Builder { private List children; + private ContainerBorderStyle borderStyle; + private Builder(String id) { this.id = Objects.requireNonNull(id); } @@ -117,6 +128,11 @@ public Builder helpTextProvider(Supplier helpTextProvider) { return this; } + public Builder borderStyle(ContainerBorderStyle borderStyle) { + this.borderStyle = Objects.requireNonNull(borderStyle); + return this; + } + public FlexboxContainerElementProps build() { FlexboxContainerElementProps flexboxContainerElementProps = new FlexboxContainerElementProps(); flexboxContainerElementProps.id = Objects.requireNonNull(this.id); @@ -124,6 +140,7 @@ public FlexboxContainerElementProps build() { flexboxContainerElementProps.flexDirection = Objects.requireNonNull(this.flexDirection); flexboxContainerElementProps.children = Objects.requireNonNull(this.children); flexboxContainerElementProps.helpTextProvider = this.helpTextProvider; // Optional on purpose + flexboxContainerElementProps.borderStyle = this.borderStyle; // Optional on purpose return flexboxContainerElementProps; } } diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/elements/GroupElementProps.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/elements/GroupElementProps.java index e4f7b4b09d..32531afe30 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/elements/GroupElementProps.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/elements/GroupElementProps.java @@ -17,6 +17,7 @@ import java.util.Objects; import org.eclipse.sirius.components.annotations.Immutable; +import org.eclipse.sirius.components.forms.ContainerBorderStyle; import org.eclipse.sirius.components.forms.GroupDisplayMode; import org.eclipse.sirius.components.representations.Element; import org.eclipse.sirius.components.representations.IProps; @@ -28,6 +29,7 @@ */ @Immutable public final class GroupElementProps implements IProps { + public static final String TYPE = "Group"; private String id; @@ -38,6 +40,8 @@ public final class GroupElementProps implements IProps { private List children; + private ContainerBorderStyle borderStyle; + private GroupElementProps() { // Prevent instantiation } @@ -59,6 +63,10 @@ public List getChildren() { return this.children; } + public ContainerBorderStyle getBorderStyle() { + return this.borderStyle; + } + public static Builder newGroupElementProps(String id) { return new Builder(id); } @@ -76,6 +84,7 @@ public String toString() { */ @SuppressWarnings("checkstyle:HiddenField") public static final class Builder { + private String id; private String label; @@ -84,6 +93,8 @@ public static final class Builder { private List children; + private ContainerBorderStyle borderStyle; + private Builder(String id) { this.id = Objects.requireNonNull(id); } @@ -103,12 +114,18 @@ public Builder children(List children) { return this; } + public Builder borderStyle(ContainerBorderStyle borderStyle) { + this.borderStyle = Objects.requireNonNull(borderStyle); + return this; + } + public GroupElementProps build() { GroupElementProps groupElementProps = new GroupElementProps(); groupElementProps.id = Objects.requireNonNull(this.id); groupElementProps.label = Objects.requireNonNull(this.label); groupElementProps.displayMode = Objects.requireNonNull(this.displayMode); groupElementProps.children = Objects.requireNonNull(this.children); + groupElementProps.borderStyle = this.borderStyle; // Optional on purpose return groupElementProps; } } diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/renderer/FormElementFactory.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/renderer/FormElementFactory.java index dae5907e17..4f393296b9 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/renderer/FormElementFactory.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/renderer/FormElementFactory.java @@ -229,7 +229,6 @@ private Page instantiatePage(PageElementProps props, List children) { } private Group instantiateGroup(GroupElementProps props, List children) { - // @formatter:off List toolbarActions = children.stream() .filter(ToolbarAction.class::isInstance) .map(ToolbarAction.class::cast) @@ -240,14 +239,17 @@ private Group instantiateGroup(GroupElementProps props, List children) { .map(AbstractWidget.class::cast) .toList(); - - return Group.newGroup(props.getId()) + var groupBuilder = Group.newGroup(props.getId()) .label(props.getLabel()) .displayMode(props.getDisplayMode()) .toolbarActions(toolbarActions) - .widgets(widgets) - .build(); - // @formatter:on + .widgets(widgets); + + if (props.getBorderStyle() != null) { + groupBuilder.borderStyle(props.getBorderStyle()); + } + + return groupBuilder.build(); } private Checkbox instantiateCheckbox(CheckboxElementProps props, List children) { @@ -548,7 +550,6 @@ private Object instantiateChartWidget(ChartWidgetElementProps props, List children) { List diagnostics = this.getDiagnosticsFromChildren(children); - // @formatter:off List widgets = children.stream() .filter(AbstractWidget.class::isInstance) .map(AbstractWidget.class::cast) @@ -565,6 +566,11 @@ private FlexboxContainer instantiateFlexboxContainer(FlexboxContainerElementProp if (props.getHelpTextProvider() != null) { builder.helpTextProvider(props.getHelpTextProvider()); } + + if (props.getBorderStyle() != null) { + builder.borderStyle(props.getBorderStyle()); + } + return builder.build(); } diff --git a/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.ts b/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.ts index c51385af58..6dd5273884 100644 --- a/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.ts +++ b/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.ts @@ -397,10 +397,28 @@ export const flexboxContainerFields = (contributions: Array) children { ...widgetFields } + borderStyle { + color + lineStyle + size + radius + } } } + borderStyle { + color + lineStyle + size + radius + } } } + borderStyle { + color + lineStyle + size + radius + } } `; @@ -425,6 +443,12 @@ export const formRefreshedEventPayloadFragment = (contributions: Array ({ +const useGroupStyles = makeStyles((theme) => ({ group: { display: 'flex', flexDirection: 'column', - paddingTop: theme.spacing(1), + margin: theme.spacing(1), + padding: theme.spacing(0.5), + borderWidth: ({ borderSize }) => borderSize || 0, + borderColor: ({ borderColor }) => borderColor || 'black', + borderStyle: ({ borderLineStyle }) => borderLineStyle || 'solid', + borderRadius: ({ borderRadius }) => borderRadius || 0, }, groupLabelAndToolbar: { display: 'flex', @@ -70,7 +75,14 @@ const useGroupStyles = makeStyles((theme) => ({ })); export const Group = ({ editingContextId, formId, group, widgetSubscriptions, setSelection, readOnly }: GroupProps) => { - const classes = useGroupStyles(); + const props: GroupStyleProps = { + borderColor: group.borderStyle?.color ?? null, + borderRadius: group.borderStyle?.radius ?? null, + borderSize: group.borderStyle?.size ?? null, + borderLineStyle: group.borderStyle?.lineStyle ?? null, + }; + + const classes = useGroupStyles(props); const [visibleWidgetIds, setVisibleWidgetIds] = useState([]); const { httpOrigin } = useContext(ServerContext); diff --git a/packages/forms/frontend/sirius-components-forms/src/groups/Group.types.ts b/packages/forms/frontend/sirius-components-forms/src/groups/Group.types.ts index 9d7117bf78..dca153f9e1 100644 --- a/packages/forms/frontend/sirius-components-forms/src/groups/Group.types.ts +++ b/packages/forms/frontend/sirius-components-forms/src/groups/Group.types.ts @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Obeo. + * Copyright (c) 2021, 2023 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 @@ -21,3 +21,10 @@ export interface GroupProps { setSelection: (selection: Selection) => void; readOnly: boolean; } + +export interface GroupStyleProps { + borderColor: string | null; + borderRadius: number | null; + borderSize: number | null; + borderLineStyle: string | null; +} diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/FlexboxContainerPropertySection.tsx b/packages/forms/frontend/sirius-components-forms/src/propertysections/FlexboxContainerPropertySection.tsx index b27109b296..6f7345cb1e 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/FlexboxContainerPropertySection.tsx +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/FlexboxContainerPropertySection.tsx @@ -20,6 +20,14 @@ import { PropertySectionLabel } from './PropertySectionLabel'; const useFlexboxContainerPropertySectionStyles = makeStyles( (theme) => ({ + containerAndLabel: { + margin: theme.spacing(0.5), + padding: theme.spacing(0.5), + borderWidth: ({ borderSize }) => borderSize || 0, + borderColor: ({ borderColor }) => borderColor || 'black', + borderStyle: ({ borderLineStyle }) => borderLineStyle || 'solid', + borderRadius: ({ borderRadius }) => borderRadius || 0, + }, container: { display: 'flex', flexWrap: ({ flexWrap }) => flexWrap, @@ -46,6 +54,10 @@ export const FlexboxContainerPropertySection = ({ flexDirection: widget.flexDirection, flexWrap: widget.flexWrap, flexGrow: widget.flexGrow, + borderColor: widget.borderStyle?.color ?? null, + borderRadius: widget.borderStyle?.radius ?? null, + borderSize: widget.borderStyle?.size ?? null, + borderLineStyle: widget.borderStyle?.lineStyle ?? null, }); let children = widget.children.map((widget) => ( @@ -63,7 +75,7 @@ export const FlexboxContainerPropertySection = ({ )); return ( -
+
{children}
diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/FlexboxContainerPropertySection.types.ts b/packages/forms/frontend/sirius-components-forms/src/propertysections/FlexboxContainerPropertySection.types.ts index 27a0a954ed..c3d1b2ad57 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/FlexboxContainerPropertySection.types.ts +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/FlexboxContainerPropertySection.types.ts @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022 Obeo. + * Copyright (c) 2022, 2023 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 @@ -31,4 +31,8 @@ export interface FlexboxContainerPropertySectionStyleProps { flexDirection: GQLFlexDirection; flexWrap: GQLFlexWrap; flexGrow: number; + borderColor: string | null; + borderRadius: number | null; + borderSize: number | null; + borderLineStyle: string | null; } diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/__tests__/FlexboxContainerPropertySection.test.tsx b/packages/forms/frontend/sirius-components-forms/src/propertysections/__tests__/FlexboxContainerPropertySection.test.tsx new file mode 100644 index 0000000000..7c5e5819eb --- /dev/null +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/__tests__/FlexboxContainerPropertySection.test.tsx @@ -0,0 +1,93 @@ +/******************************************************************************* + * Copyright (c) 2023 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 + *******************************************************************************/ +import { MockedProvider } from '@apollo/client/testing'; +import { ServerContext, ToastContext, ToastContextValue } from '@eclipse-sirius/sirius-components-core'; +import { render } from '@testing-library/react'; +import { expect, test, vi } from 'vitest'; +import { GQLFlexboxContainer } from '../../form/FormEventFragments.types'; +import { FlexboxContainerPropertySection } from '../FlexboxContainerPropertySection'; + +const defaultFlexboxContainer: GQLFlexboxContainer = { + __typename: 'Flexbox', + id: 'flexboxId', + label: 'label', + borderStyle: null, + children: [], + diagnostics: [], + flexDirection: 'row', + flexGrow: 1, + flexWrap: 'nowrap', + hasHelpText: false, + iconURL: null, +}; + +const flexboxContainerWithStyle: GQLFlexboxContainer = { + ...defaultFlexboxContainer, + borderStyle: { + color: 'black', + lineStyle: 'solid', + radius: 3, + size: 1, + }, +}; + +const mockEnqueue = vi.fn(); + +const toastContextMock: ToastContextValue = { + useToast: () => { + return { + enqueueSnackbar: mockEnqueue, + closeSnackbar: () => {}, + }; + }, +}; + +test('should render the flexbox container without style', () => { + const { container } = render( + + + + {}} + /> + + + + ); + expect(container).toMatchSnapshot(); +}); + +test('should render the flexbox container with border style', () => { + const { container } = render( + + + + {}} + /> + + + + ); + expect(container).toMatchSnapshot(); +}); diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/__tests__/__snapshots__/FlexboxContainerPropertySection.test.tsx.snap b/packages/forms/frontend/sirius-components-forms/src/propertysections/__tests__/__snapshots__/FlexboxContainerPropertySection.test.tsx.snap new file mode 100644 index 0000000000..fbb40b752c --- /dev/null +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/__tests__/__snapshots__/FlexboxContainerPropertySection.test.tsx.snap @@ -0,0 +1,49 @@ +// Vitest Snapshot v1 + +exports[`should render the flexbox container with border style 1`] = ` +
+
+
+
+ label +
+
+
+
+
+
+`; + +exports[`should render the flexbox container without style 1`] = ` +
+
+
+
+ label +
+
+
+
+
+
+`; diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/ConditionalContainerBorderStyleBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/ConditionalContainerBorderStyleBuilder.java new file mode 100644 index 0000000000..80e62ea061 --- /dev/null +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/ConditionalContainerBorderStyleBuilder.java @@ -0,0 +1,99 @@ +/******************************************************************************* + * Copyright (c) 2023 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.view.builder.generated; + +/** + * Builder for ConditionalContainerBorderStyleBuilder. + * + * @author BuilderGenerator + * @generated + */ +public class ConditionalContainerBorderStyleBuilder { + + /** + * Create instance org.eclipse.sirius.components.view.ConditionalContainerBorderStyle. + * + * @generated + */ + private org.eclipse.sirius.components.view.ConditionalContainerBorderStyle conditionalContainerBorderStyle = org.eclipse.sirius.components.view.ViewFactory.eINSTANCE.createConditionalContainerBorderStyle(); + + /** + * Return instance org.eclipse.sirius.components.view.ConditionalContainerBorderStyle. + * + * @generated + */ + protected org.eclipse.sirius.components.view.ConditionalContainerBorderStyle getConditionalContainerBorderStyle() { + return this.conditionalContainerBorderStyle; + } + + /** + * Return instance org.eclipse.sirius.components.view.ConditionalContainerBorderStyle. + * + * @generated + */ + public org.eclipse.sirius.components.view.ConditionalContainerBorderStyle build() { + return this.getConditionalContainerBorderStyle(); + } + + /** + * Setter for Condition. + * + * @generated + */ + public ConditionalContainerBorderStyleBuilder condition(java.lang.String value) { + this.getConditionalContainerBorderStyle().setCondition(value); + return this; + } + + /** + * Setter for BorderColor. + * + * @generated + */ + public ConditionalContainerBorderStyleBuilder borderColor(org.eclipse.sirius.components.view.UserColor value) { + this.getConditionalContainerBorderStyle().setBorderColor(value); + return this; + } + + /** + * Setter for BorderRadius. + * + * @generated + */ + public ConditionalContainerBorderStyleBuilder borderRadius(java.lang.Integer value) { + this.getConditionalContainerBorderStyle().setBorderRadius(value); + return this; + } + + /** + * Setter for BorderSize. + * + * @generated + */ + public ConditionalContainerBorderStyleBuilder borderSize(java.lang.Integer value) { + this.getConditionalContainerBorderStyle().setBorderSize(value); + return this; + } + + /** + * Setter for BorderLineStyle. + * + * @generated + */ + public ConditionalContainerBorderStyleBuilder borderLineStyle(org.eclipse.sirius.components.view.ContainerBorderLineStyle value) { + this.getConditionalContainerBorderStyle().setBorderLineStyle(value); + return this; + } + +} + diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/ContainerBorderStyleBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/ContainerBorderStyleBuilder.java new file mode 100644 index 0000000000..f8a63fc26c --- /dev/null +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/ContainerBorderStyleBuilder.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2023 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.view.builder.generated; + +/** + * Builder for ContainerBorderStyleBuilder. + * + * @author BuilderGenerator + * @generated + */ +public class ContainerBorderStyleBuilder { + + /** + * Create instance org.eclipse.sirius.components.view.ContainerBorderStyle. + * + * @generated + */ + private org.eclipse.sirius.components.view.ContainerBorderStyle containerBorderStyle = org.eclipse.sirius.components.view.ViewFactory.eINSTANCE.createContainerBorderStyle(); + + /** + * Return instance org.eclipse.sirius.components.view.ContainerBorderStyle. + * + * @generated + */ + protected org.eclipse.sirius.components.view.ContainerBorderStyle getContainerBorderStyle() { + return this.containerBorderStyle; + } + + /** + * Return instance org.eclipse.sirius.components.view.ContainerBorderStyle. + * + * @generated + */ + public org.eclipse.sirius.components.view.ContainerBorderStyle build() { + return this.getContainerBorderStyle(); + } + + /** + * Setter for BorderColor. + * + * @generated + */ + public ContainerBorderStyleBuilder borderColor(org.eclipse.sirius.components.view.UserColor value) { + this.getContainerBorderStyle().setBorderColor(value); + return this; + } + + /** + * Setter for BorderRadius. + * + * @generated + */ + public ContainerBorderStyleBuilder borderRadius(java.lang.Integer value) { + this.getContainerBorderStyle().setBorderRadius(value); + return this; + } + + /** + * Setter for BorderSize. + * + * @generated + */ + public ContainerBorderStyleBuilder borderSize(java.lang.Integer value) { + this.getContainerBorderStyle().setBorderSize(value); + return this; + } + + /** + * Setter for BorderLineStyle. + * + * @generated + */ + public ContainerBorderStyleBuilder borderLineStyle(org.eclipse.sirius.components.view.ContainerBorderLineStyle value) { + this.getContainerBorderStyle().setBorderLineStyle(value); + return this; + } + +} + diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/FlexboxContainerDescriptionBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/FlexboxContainerDescriptionBuilder.java index 0388ddf156..a991094018 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/FlexboxContainerDescriptionBuilder.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/FlexboxContainerDescriptionBuilder.java @@ -92,5 +92,27 @@ public FlexboxContainerDescriptionBuilder flexDirection(org.eclipse.sirius.compo return this; } + /** + * Setter for BorderStyle. + * + * @generated + */ + public FlexboxContainerDescriptionBuilder borderStyle(org.eclipse.sirius.components.view.ContainerBorderStyle value) { + this.getFlexboxContainerDescription().setBorderStyle(value); + return this; + } + + /** + * Setter for ConditionalBorderStyles. + * + * @generated + */ + public FlexboxContainerDescriptionBuilder conditionalBorderStyles(org.eclipse.sirius.components.view.ConditionalContainerBorderStyle... values) { + for (org.eclipse.sirius.components.view.ConditionalContainerBorderStyle value : values) { + this.getFlexboxContainerDescription().getConditionalBorderStyles().add(value); + } + return this; + } + } diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/GroupDescriptionBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/GroupDescriptionBuilder.java index a8b08734f8..e665df6b74 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/GroupDescriptionBuilder.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/GroupDescriptionBuilder.java @@ -95,13 +95,35 @@ public GroupDescriptionBuilder toolbarActions(org.eclipse.sirius.components.view * * @generated */ - public GroupDescriptionBuilder widgets(org.eclipse.sirius.components.view.WidgetDescription ... values) { + public GroupDescriptionBuilder widgets(org.eclipse.sirius.components.view.WidgetDescription... values) { for (org.eclipse.sirius.components.view.WidgetDescription value : values) { this.getGroupDescription().getWidgets().add(value); } return this; } + /** + * Setter for BorderStyle. + * + * @generated + */ + public GroupDescriptionBuilder borderStyle(org.eclipse.sirius.components.view.ContainerBorderStyle value) { + this.getGroupDescription().setBorderStyle(value); + return this; + } + + /** + * Setter for ConditionalBorderStyles. + * + * @generated + */ + public GroupDescriptionBuilder conditionalBorderStyles(org.eclipse.sirius.components.view.ConditionalContainerBorderStyle... values) { + for (org.eclipse.sirius.components.view.ConditionalContainerBorderStyle value : values) { + this.getGroupDescription().getConditionalBorderStyles().add(value); + } + return this; + } + } diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/ViewBuilders.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/ViewBuilders.java index 2123fe83bd..56506d2f9f 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/ViewBuilders.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/ViewBuilders.java @@ -719,6 +719,26 @@ public ConditionalListDescriptionStyleBuilder newConditionalListDescriptionStyle return new ConditionalListDescriptionStyleBuilder(); } + /** + * Instantiate a ContainerBorderStyleBuilder . + * + * @author BuilderGenerator + * @generated + */ + public ContainerBorderStyleBuilder newContainerBorderStyle() { + return new ContainerBorderStyleBuilder(); + } + + /** + * Instantiate a ConditionalContainerBorderStyleBuilder . + * + * @author BuilderGenerator + * @generated + */ + public ConditionalContainerBorderStyleBuilder newConditionalContainerBorderStyle() { + return new ConditionalContainerBorderStyleBuilder(); + } + /** * Instantiate a DiagramPaletteBuilder . * diff --git a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ConditionalContainerBorderStyleItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ConditionalContainerBorderStyleItemProvider.java new file mode 100644 index 0000000000..cc7a10d6be --- /dev/null +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ConditionalContainerBorderStyleItemProvider.java @@ -0,0 +1,173 @@ +/******************************************************************************* + * Copyright (c) 2021, 2023 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.view.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.sirius.components.view.ConditionalContainerBorderStyle; +import org.eclipse.sirius.components.view.ViewPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.sirius.components.view.ConditionalContainerBorderStyle} + * object. + * + * @generated + */ +public class ConditionalContainerBorderStyleItemProvider extends ConditionalItemProvider { + + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public ConditionalContainerBorderStyleItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (this.itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + this.addBorderColorPropertyDescriptor(object); + this.addBorderRadiusPropertyDescriptor(object); + this.addBorderSizePropertyDescriptor(object); + this.addBorderLineStylePropertyDescriptor(object); + } + return this.itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Border Color feature. + * + * @generated + */ + protected void addBorderColorPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ContainerBorderStyle_borderColor_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ContainerBorderStyle_borderColor_feature", "_UI_ContainerBorderStyle_type"), + ViewPackage.Literals.CONTAINER_BORDER_STYLE__BORDER_COLOR, true, false, true, null, null, null)); + } + + /** + * This adds a property descriptor for the Border Radius feature. + * + * @generated + */ + protected void addBorderRadiusPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ContainerBorderStyle_borderRadius_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ContainerBorderStyle_borderRadius_feature", "_UI_ContainerBorderStyle_type"), + ViewPackage.Literals.CONTAINER_BORDER_STYLE__BORDER_RADIUS, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Border Size feature. + * + * @generated + */ + protected void addBorderSizePropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ContainerBorderStyle_borderSize_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ContainerBorderStyle_borderSize_feature", "_UI_ContainerBorderStyle_type"), + ViewPackage.Literals.CONTAINER_BORDER_STYLE__BORDER_SIZE, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Border Line Style feature. + * + * @generated + */ + protected void addBorderLineStylePropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ContainerBorderStyle_borderLineStyle_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ContainerBorderStyle_borderLineStyle_feature", "_UI_ContainerBorderStyle_type"), + ViewPackage.Literals.CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This returns ConditionalContainerBorderStyle.gif. + * + * @generated NOT + */ + @Override + public Object getImage(Object object) { + return this.overlayImage(object, this.getResourceLocator().getImage("full/obj16/ConditionalStyle.svg")); + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ConditionalContainerBorderStyle) object).getCondition(); + return label == null || label.length() == 0 ? this.getString("_UI_ConditionalContainerBorderStyle_type") : this.getString("_UI_ConditionalContainerBorderStyle_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating + * a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + this.updateChildren(notification); + + switch (notification.getFeatureID(ConditionalContainerBorderStyle.class)) { + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS: + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE: + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created + * under this object. + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ContainerBorderStyleItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ContainerBorderStyleItemProvider.java new file mode 100644 index 0000000000..59c2e3d1c1 --- /dev/null +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ContainerBorderStyleItemProvider.java @@ -0,0 +1,192 @@ +/******************************************************************************* + * Copyright (c) 2021, 2023 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.view.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IChildCreationExtender; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.sirius.components.view.ContainerBorderStyle; +import org.eclipse.sirius.components.view.ViewPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.sirius.components.view.ContainerBorderStyle} object. + * + * @generated + */ +public class ContainerBorderStyleItemProvider extends ItemProviderAdapter + implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public ContainerBorderStyleItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (this.itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + this.addBorderColorPropertyDescriptor(object); + this.addBorderRadiusPropertyDescriptor(object); + this.addBorderSizePropertyDescriptor(object); + this.addBorderLineStylePropertyDescriptor(object); + } + return this.itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Border Color feature. + * + * @generated + */ + protected void addBorderColorPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ContainerBorderStyle_borderColor_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ContainerBorderStyle_borderColor_feature", "_UI_ContainerBorderStyle_type"), + ViewPackage.Literals.CONTAINER_BORDER_STYLE__BORDER_COLOR, true, false, true, null, null, null)); + } + + /** + * This adds a property descriptor for the Border Radius feature. + * + * @generated + */ + protected void addBorderRadiusPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ContainerBorderStyle_borderRadius_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ContainerBorderStyle_borderRadius_feature", "_UI_ContainerBorderStyle_type"), + ViewPackage.Literals.CONTAINER_BORDER_STYLE__BORDER_RADIUS, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Border Size feature. + * + * @generated + */ + protected void addBorderSizePropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ContainerBorderStyle_borderSize_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ContainerBorderStyle_borderSize_feature", "_UI_ContainerBorderStyle_type"), + ViewPackage.Literals.CONTAINER_BORDER_STYLE__BORDER_SIZE, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Border Line Style feature. + * + * @generated + */ + protected void addBorderLineStylePropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ContainerBorderStyle_borderLineStyle_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ContainerBorderStyle_borderLineStyle_feature", "_UI_ContainerBorderStyle_type"), + ViewPackage.Literals.CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This returns ContainerBorderStyle.gif. + * + * @generated NOT + */ + @Override + public Object getImage(Object object) { + return this.overlayImage(object, this.getResourceLocator().getImage("full/obj16/Style.svg")); + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * @generated + */ + @Override + public String getText(Object object) { + ContainerBorderStyle containerBorderStyle = (ContainerBorderStyle) object; + return this.getString("_UI_ContainerBorderStyle_type") + " " + containerBorderStyle.getBorderRadius(); + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating + * a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + this.updateChildren(notification); + + switch (notification.getFeatureID(ContainerBorderStyle.class)) { + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS: + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE: + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created + * under this object. + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ((IChildCreationExtender) this.adapterFactory).getResourceLocator(); + } + +} diff --git a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/FlexboxContainerDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/FlexboxContainerDescriptionItemProvider.java index c64cc428ed..076414b9a7 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/FlexboxContainerDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/FlexboxContainerDescriptionItemProvider.java @@ -1,4 +1,4 @@ -/** +/******************************************************************************* * Copyright (c) 2021, 2023 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 @@ -8,8 +8,8 @@ * SPDX-License-Identifier: EPL-2.0 * * Contributors: - * Obeo - initial API and implementation - */ + * Obeo - initial API and implementation + *******************************************************************************/ package org.eclipse.sirius.components.view.provider; import java.util.Collection; @@ -97,6 +97,8 @@ public Collection getChildrenFeatures(Object objec if (this.childrenFeatures == null) { super.getChildrenFeatures(object); this.childrenFeatures.add(ViewPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__CHILDREN); + this.childrenFeatures.add(ViewPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE); + this.childrenFeatures.add(ViewPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES); } return this.childrenFeatures; } @@ -164,6 +166,8 @@ public void notifyChanged(Notification notification) { this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__CHILDREN: + case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE: + case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } @@ -236,6 +240,30 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors TextfieldDescription textfieldDescription = ViewFactory.eINSTANCE.createTextfieldDescription(); textfieldDescription.setStyle(ViewFactory.eINSTANCE.createTextfieldDescriptionStyle()); newChildDescriptors.add(this.createChildParameter(ViewPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__CHILDREN, textfieldDescription)); + + newChildDescriptors.add(this.createChildParameter(ViewPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE, ViewFactory.eINSTANCE.createContainerBorderStyle())); + newChildDescriptors + .add(this.createChildParameter(ViewPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES, ViewFactory.eINSTANCE.createConditionalContainerBorderStyle())); + } + + /** + * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. + * + * + * @generated + */ + @Override + public String getCreateChildText(Object owner, Object feature, Object child, Collection selection) { + Object childFeature = feature; + Object childObject = child; + + boolean qualify = childFeature == ViewPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE + || childFeature == ViewPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES; + + if (qualify) { + return this.getString("_UI_CreateChild_text2", new Object[]{this.getTypeText(childObject), this.getFeatureText(childFeature), this.getTypeText(owner)}); + } + return super.getCreateChildText(owner, feature, child, selection); } } diff --git a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/GroupDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/GroupDescriptionItemProvider.java index 494df75176..1562507097 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/GroupDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/GroupDescriptionItemProvider.java @@ -146,6 +146,8 @@ public Collection getChildrenFeatures(Object objec super.getChildrenFeatures(object); this.childrenFeatures.add(ViewPackage.Literals.GROUP_DESCRIPTION__TOOLBAR_ACTIONS); this.childrenFeatures.add(ViewPackage.Literals.GROUP_DESCRIPTION__WIDGETS); + this.childrenFeatures.add(ViewPackage.Literals.GROUP_DESCRIPTION__BORDER_STYLE); + this.childrenFeatures.add(ViewPackage.Literals.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES); } return this.childrenFeatures; } @@ -214,6 +216,8 @@ public void notifyChanged(Notification notification) { return; case ViewPackage.GROUP_DESCRIPTION__TOOLBAR_ACTIONS: case ViewPackage.GROUP_DESCRIPTION__WIDGETS: + case ViewPackage.GROUP_DESCRIPTION__BORDER_STYLE: + case ViewPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } @@ -292,6 +296,8 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors toolbarActionDescription.setName("ToolbarAction"); newChildDescriptors.add(this.createChildParameter(ViewPackage.Literals.GROUP_DESCRIPTION__TOOLBAR_ACTIONS, toolbarActionDescription)); + newChildDescriptors.add(this.createChildParameter(ViewPackage.Literals.GROUP_DESCRIPTION__BORDER_STYLE, ViewFactory.eINSTANCE.createContainerBorderStyle())); + newChildDescriptors.add(this.createChildParameter(ViewPackage.Literals.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES, ViewFactory.eINSTANCE.createConditionalContainerBorderStyle())); } /** @@ -305,10 +311,11 @@ public String getCreateChildText(Object owner, Object feature, Object child, Col Object childFeature = feature; Object childObject = child; - boolean qualify = childFeature == ViewPackage.Literals.GROUP_DESCRIPTION__TOOLBAR_ACTIONS || childFeature == ViewPackage.Literals.GROUP_DESCRIPTION__WIDGETS; + boolean qualify = childFeature == ViewPackage.Literals.GROUP_DESCRIPTION__TOOLBAR_ACTIONS || childFeature == ViewPackage.Literals.GROUP_DESCRIPTION__WIDGETS + || childFeature == ViewPackage.Literals.GROUP_DESCRIPTION__BORDER_STYLE || childFeature == ViewPackage.Literals.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES; if (qualify) { - return this.getString("_UI_CreateChild_text2", new Object[] { this.getTypeText(childObject), this.getFeatureText(childFeature), this.getTypeText(owner) }); + return this.getString("_UI_CreateChild_text2", new Object[]{this.getTypeText(childObject), this.getFeatureText(childFeature), this.getTypeText(owner)}); } return super.getCreateChildText(owner, feature, child, selection); } diff --git a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ViewItemProviderAdapterFactory.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ViewItemProviderAdapterFactory.java index b8e692f7b1..b1da254b64 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ViewItemProviderAdapterFactory.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ViewItemProviderAdapterFactory.java @@ -1613,6 +1613,52 @@ public Adapter createConditionalListDescriptionStyleAdapter() { return this.conditionalListDescriptionStyleItemProvider; } + /** + * This keeps track of the one adapter used for all {@link org.eclipse.sirius.components.view.ContainerBorderStyle} + * instances. + * + * @generated + */ + protected ContainerBorderStyleItemProvider containerBorderStyleItemProvider; + /** + * This keeps track of the one adapter used for all + * {@link org.eclipse.sirius.components.view.ConditionalContainerBorderStyle} instances. + * + * + * @generated + */ + protected ConditionalContainerBorderStyleItemProvider conditionalContainerBorderStyleItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.sirius.components.view.ContainerBorderStyle}. + * + * @generated + */ + @Override + public Adapter createContainerBorderStyleAdapter() { + if (this.containerBorderStyleItemProvider == null) { + this.containerBorderStyleItemProvider = new ContainerBorderStyleItemProvider(this); + } + + return this.containerBorderStyleItemProvider; + } + + /** + * This creates an adapter for a {@link org.eclipse.sirius.components.view.ConditionalContainerBorderStyle}. + * + * @generated + */ + @Override + public Adapter createConditionalContainerBorderStyleAdapter() { + if (this.conditionalContainerBorderStyleItemProvider == null) { + this.conditionalContainerBorderStyleItemProvider = new ConditionalContainerBorderStyleItemProvider(this); + } + + return this.conditionalContainerBorderStyleItemProvider; + } + /** * This keeps track of the one adapter used for all {@link org.eclipse.sirius.components.view.DiagramPalette} * instances. @@ -2090,6 +2136,10 @@ public void dispose() { this.listDescriptionStyleItemProvider.dispose(); if (this.conditionalListDescriptionStyleItemProvider != null) this.conditionalListDescriptionStyleItemProvider.dispose(); + if (this.containerBorderStyleItemProvider != null) + this.containerBorderStyleItemProvider.dispose(); + if (this.conditionalContainerBorderStyleItemProvider != null) + this.conditionalContainerBorderStyleItemProvider.dispose(); if (this.diagramPaletteItemProvider != null) this.diagramPaletteItemProvider.dispose(); if (this.nodePaletteItemProvider != null) diff --git a/packages/view/backend/sirius-components-view-edit/src/main/resources/icons/full/obj16/ConditionalStyle.svg b/packages/view/backend/sirius-components-view-edit/src/main/resources/icons/full/obj16/ConditionalStyle.svg new file mode 100644 index 0000000000..9895b6d7a7 --- /dev/null +++ b/packages/view/backend/sirius-components-view-edit/src/main/resources/icons/full/obj16/ConditionalStyle.svg @@ -0,0 +1,63 @@ + + + + + + image/svg+xml + + + + + + + + + + diff --git a/packages/view/backend/sirius-components-view-edit/src/main/resources/plugin.properties b/packages/view/backend/sirius-components-view-edit/src/main/resources/plugin.properties index b44382dadd..937eef944d 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/resources/plugin.properties +++ b/packages/view/backend/sirius-components-view-edit/src/main/resources/plugin.properties @@ -110,29 +110,31 @@ _UI_LinkDescription_type = Link Description _UI_LinkDescriptionStyle_type = Link Description Style _UI_ConditionalLinkDescriptionStyle_type = Conditional Link Description Style _UI_ListDescription_type = List Description -_UI_ListDescriptionStyle_type=List Description Style -_UI_ConditionalListDescriptionStyle_type=Conditional List Description Style -_UI_DiagramPalette_type=Palette -_UI_NodePalette_type=Palette -_UI_EdgePalette_type=Palette -_UI_Unknown_type=Object -_UI_Unknown_datatype=Value -_UI_View_descriptions_feature=Descriptions -_UI_View_colorPalettes_feature=Color Palettes -_UI_ColorPalette_name_feature=Name -_UI_ColorPalette_colors_feature=Colors -_UI_FixedColor_value_feature=Value -_UI_UserColor_name_feature=Name -_UI_RepresentationDescription_name_feature=Name -_UI_RepresentationDescription_domainType_feature=Domain Type -_UI_RepresentationDescription_preconditionExpression_feature=Precondition Expression -_UI_RepresentationDescription_titleExpression_feature=Title Expression -_UI_DiagramDescription_autoLayout_feature=Auto Layout -_UI_DiagramDescription_nodeDescriptions_feature=Node Descriptions -_UI_DiagramDescription_edgeDescriptions_feature=Edge Descriptions -_UI_DiagramDescription_onDrop_feature=On Drop -_UI_DiagramDescription_palette_feature=Palette -_UI_DiagramElementDescription_name_feature=Name +_UI_ListDescriptionStyle_type = List Description Style +_UI_ConditionalListDescriptionStyle_type = Conditional List Description Style +_UI_ContainerBorderStyle_type = Container Border Style +_UI_ConditionalContainerBorderStyle_type = Conditional Container Border Style +_UI_DiagramPalette_type = Palette +_UI_NodePalette_type = Palette +_UI_EdgePalette_type = Palette +_UI_Unknown_type = Object +_UI_Unknown_datatype = Value +_UI_View_descriptions_feature = Descriptions +_UI_View_colorPalettes_feature = Color Palettes +_UI_ColorPalette_name_feature = Name +_UI_ColorPalette_colors_feature = Colors +_UI_FixedColor_value_feature = Value +_UI_UserColor_name_feature = Name +_UI_RepresentationDescription_name_feature = Name +_UI_RepresentationDescription_domainType_feature = Domain Type +_UI_RepresentationDescription_preconditionExpression_feature = Precondition Expression +_UI_RepresentationDescription_titleExpression_feature = Title Expression +_UI_DiagramDescription_autoLayout_feature = Auto Layout +_UI_DiagramDescription_nodeDescriptions_feature = Node Descriptions +_UI_DiagramDescription_edgeDescriptions_feature = Edge Descriptions +_UI_DiagramDescription_onDrop_feature = On Drop +_UI_DiagramDescription_palette_feature = Palette +_UI_DiagramElementDescription_name_feature = Name _UI_DiagramElementDescription_domainType_feature = Domain Type _UI_DiagramElementDescription_semanticCandidatesExpression_feature = Semantic Candidates Expression _UI_DiagramElementDescription_labelExpression_feature = Label Expression @@ -196,35 +198,37 @@ _UI_CreateInstance_referenceName_feature = Reference Name _UI_CreateInstance_variableName_feature = Variable Name _UI_SetValue_featureName_feature = Feature Name _UI_SetValue_valueExpression_feature = Value Expression -_UI_UnsetValue_featureName_feature=Feature Name -_UI_UnsetValue_elementExpression_feature=Element Expression -_UI_CreateView_parentViewExpression_feature=Parent View Expression -_UI_CreateView_elementDescription_feature=Element Description -_UI_CreateView_semanticElementExpression_feature=Semantic Element Expression -_UI_CreateView_variableName_feature=Variable Name -_UI_CreateView_containmentKind_feature=Containment Kind -_UI_DeleteView_viewExpression_feature=View Expression -_UI_Conditional_condition_feature=Condition -_UI_ConditionalNodeStyle_style_feature=Style -_UI_FormDescription_pages_feature=Pages -_UI_PageDescription_name_feature=Name -_UI_PageDescription_labelExpression_feature=Label Expression +_UI_UnsetValue_featureName_feature = Feature Name +_UI_UnsetValue_elementExpression_feature = Element Expression +_UI_CreateView_parentViewExpression_feature = Parent View Expression +_UI_CreateView_elementDescription_feature = Element Description +_UI_CreateView_semanticElementExpression_feature = Semantic Element Expression +_UI_CreateView_variableName_feature = Variable Name +_UI_CreateView_containmentKind_feature = Containment Kind +_UI_DeleteView_viewExpression_feature = View Expression +_UI_Conditional_condition_feature = Condition +_UI_ConditionalNodeStyle_style_feature = Style +_UI_FormDescription_pages_feature = Pages +_UI_PageDescription_name_feature = Name +_UI_PageDescription_labelExpression_feature = Label Expression _UI_PageDescription_domainType_feature=Domain Type -_UI_PageDescription_semanticCandidatesExpression_feature=Semantic Candidates Expression -_UI_PageDescription_preconditionExpression_feature=Precondition Expression -_UI_PageDescription_groups_feature=Groups -_UI_PageDescription_toolbarActions_feature=Toolbar Actions -_UI_GroupDescription_name_feature=Name -_UI_GroupDescription_labelExpression_feature=Label Expression -_UI_GroupDescription_displayMode_feature=Display Mode -_UI_GroupDescription_semanticCandidatesExpression_feature=Semantic Candidates Expression -_UI_GroupDescription_toolbarActions_feature=Toolbar Actions -_UI_GroupDescription_widgets_feature=Widgets -_UI_WidgetDescription_name_feature=Name -_UI_WidgetDescription_labelExpression_feature=Label Expression +_UI_PageDescription_semanticCandidatesExpression_feature = Semantic Candidates Expression +_UI_PageDescription_preconditionExpression_feature = Precondition Expression +_UI_PageDescription_groups_feature = Groups +_UI_PageDescription_toolbarActions_feature = Toolbar Actions +_UI_GroupDescription_name_feature = Name +_UI_GroupDescription_labelExpression_feature = Label Expression +_UI_GroupDescription_displayMode_feature = Display Mode +_UI_GroupDescription_semanticCandidatesExpression_feature = Semantic Candidates Expression +_UI_GroupDescription_toolbarActions_feature = Toolbar Actions +_UI_GroupDescription_widgets_feature = Widgets +_UI_GroupDescription_borderStyle_feature = Border Style +_UI_GroupDescription_conditionalBorderStyles_feature = Conditional Border Styles +_UI_WidgetDescription_name_feature = Name +_UI_WidgetDescription_labelExpression_feature = Label Expression _UI_WidgetDescription_helpExpression_feature=Help Expression -_UI_TextfieldDescription_valueExpression_feature=Value Expression -_UI_TextfieldDescription_body_feature=Body +_UI_TextfieldDescription_valueExpression_feature = Value Expression +_UI_TextfieldDescription_body_feature = Body _UI_TextfieldDescription_style_feature = Style _UI_TextfieldDescription_conditionalStyles_feature = Conditional Styles _UI_CheckboxDescription_valueExpression_feature = Value Expression @@ -268,6 +272,8 @@ _UI_PieChartDescription_style_feature = Style _UI_PieChartDescription_conditionalStyles_feature = Conditional Styles _UI_FlexboxContainerDescription_children_feature = Children _UI_FlexboxContainerDescription_flexDirection_feature = Flex Direction +_UI_FlexboxContainerDescription_borderStyle_feature = Border Style +_UI_FlexboxContainerDescription_conditionalBorderStyles_feature = Conditional Border Styles _UI_ButtonDescription_buttonLabelExpression_feature = Button Label Expression _UI_ButtonDescription_body_feature = Body _UI_ButtonDescription_imageExpression_feature = Image Expression @@ -308,6 +314,10 @@ _UI_ListDescription_body_feature = Body _UI_ListDescription_style_feature = Style _UI_ListDescription_conditionalStyles_feature = Conditional Styles _UI_ListDescriptionStyle_color_feature = Color +_UI_ContainerBorderStyle_borderColor_feature = Border Color +_UI_ContainerBorderStyle_borderRadius_feature = Border Radius +_UI_ContainerBorderStyle_borderSize_feature = Border Size +_UI_ContainerBorderStyle_borderLineStyle_feature = Border Line Style _UI_DiagramPalette_dropTool_feature = Drop Tool _UI_DiagramPalette_nodeTools_feature = Node Tools _UI_NodePalette_deleteTool_feature = Delete Tool @@ -350,3 +360,6 @@ _UI_FlexDirection_row_literal = row _UI_FlexDirection_rowReverse_literal = row-reverse _UI_FlexDirection_column_literal = column _UI_FlexDirection_columnReverse_literal = column-reverse +_UI_ContainerBorderLineStyle_Solid_literal = Solid +_UI_ContainerBorderLineStyle_Dashed_literal = Dashed +_UI_ContainerBorderLineStyle_Dotted_literal = Dotted diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/ViewPropertiesDescriptionRegistryConfigurer.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/ViewPropertiesDescriptionRegistryConfigurer.java index 0d9b151424..da4477f263 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/ViewPropertiesDescriptionRegistryConfigurer.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/ViewPropertiesDescriptionRegistryConfigurer.java @@ -213,7 +213,8 @@ public boolean handles(EAttribute eAttribute) { EcorePackage.Literals.ELONG, EcorePackage.Literals.ELONG_OBJECT, EcorePackage.Literals.ESHORT, - EcorePackage.Literals.ESHORT_OBJECT + EcorePackage.Literals.ESHORT_OBJECT, + ViewPackage.Literals.LENGTH ); // @formatter:on for (var dataType : numericDataTypes) { diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ContainerBorderStyleProvider.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ContainerBorderStyleProvider.java new file mode 100644 index 0000000000..9e2c3fde4a --- /dev/null +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ContainerBorderStyleProvider.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2023 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.view.emf.form; + +import java.util.Objects; +import java.util.function.Function; + +import org.eclipse.sirius.components.forms.ContainerBorderLineStyle; +import org.eclipse.sirius.components.forms.ContainerBorderStyle; +import org.eclipse.sirius.components.representations.VariableManager; +import org.eclipse.sirius.components.view.FixedColor; + +/** + * The style provider for a container of the View DSL. + * + * @author frouene + */ +public class ContainerBorderStyleProvider implements Function { + + private final org.eclipse.sirius.components.view.ContainerBorderStyle viewStyle; + + public ContainerBorderStyleProvider(org.eclipse.sirius.components.view.ContainerBorderStyle viewStyle) { + this.viewStyle = Objects.requireNonNull(viewStyle); + } + + @Override + public ContainerBorderStyle apply(VariableManager variableManager) { + ContainerBorderStyle.Builder styleBuilder = ContainerBorderStyle.newCheckboxStyle() + .radius(this.viewStyle.getBorderRadius()) + .size(this.viewStyle.getBorderSize()); + + if (this.viewStyle.getBorderColor() instanceof FixedColor fixedColor) { + String color = fixedColor.getValue(); + if (color != null && !color.isBlank()) { + styleBuilder.color(color); + } + } + if (this.viewStyle.getBorderLineStyle() != null) { + styleBuilder.lineStyle(ContainerBorderLineStyle.valueOf(this.viewStyle.getBorderLineStyle().getLiteral())); + } + + return styleBuilder.build(); + } +} diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ViewFormDescriptionConverter.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ViewFormDescriptionConverter.java index c9981a0bbc..14c7b7a16d 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ViewFormDescriptionConverter.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ViewFormDescriptionConverter.java @@ -27,6 +27,7 @@ import org.eclipse.sirius.components.core.api.IEditService; import org.eclipse.sirius.components.core.api.IFeedbackMessageService; import org.eclipse.sirius.components.core.api.IObjectService; +import org.eclipse.sirius.components.forms.ContainerBorderStyle; import org.eclipse.sirius.components.forms.GroupDisplayMode; import org.eclipse.sirius.components.forms.description.AbstractControlDescription; import org.eclipse.sirius.components.forms.description.AbstractWidgetDescription; @@ -147,6 +148,18 @@ private GroupDescription instantiateGroup(org.eclipse.sirius.components.view.Gro String descriptionId = this.getDescriptionId(viewGroupDescription); + Function borderStyleProvider = variableManager -> { + var effectiveStyle = viewGroupDescription.getConditionalBorderStyles().stream() + .filter(style -> this.matches(style.getCondition(), variableManager, interpreter)) + .map(org.eclipse.sirius.components.view.ContainerBorderStyle.class::cast) + .findFirst() + .orElseGet(viewGroupDescription::getBorderStyle); + if (effectiveStyle == null) { + return null; + } + return new ContainerBorderStyleProvider(effectiveStyle).apply(variableManager); + }; + return GroupDescription.newGroupDescription(descriptionId) .idProvider(this.getIdProvider(descriptionId)) .labelProvider(variableManager -> this.computeGroupLabel(viewGroupDescription, variableManager, interpreter)) @@ -154,6 +167,7 @@ private GroupDescription instantiateGroup(org.eclipse.sirius.components.view.Gro .controlDescriptions(controlDescriptions) .toolbarActionDescriptions(toolbarActionDescriptions) .displayModeProvider(variableManager -> this.getGroupDisplayMode(viewGroupDescription)) + .borderStyleProvider(borderStyleProvider) .build(); } @@ -226,4 +240,8 @@ private GroupDisplayMode getGroupDisplayMode(org.eclipse.sirius.components.view. org.eclipse.sirius.components.view.GroupDisplayMode viewDisplayMode = viewGroupDescription.getDisplayMode(); return GroupDisplayMode.valueOf(viewDisplayMode.getLiteral()); } + + private boolean matches(String condition, VariableManager variableManager, AQLInterpreter interpreter) { + return interpreter.evaluateExpression(variableManager.getVariables(), condition).asBoolean().orElse(Boolean.FALSE); + } } diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ViewFormDescriptionConverterSwitch.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ViewFormDescriptionConverterSwitch.java index 1241478f68..35a12f6580 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ViewFormDescriptionConverterSwitch.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ViewFormDescriptionConverterSwitch.java @@ -39,6 +39,7 @@ import org.eclipse.sirius.components.core.api.IObjectService; import org.eclipse.sirius.components.forms.ButtonStyle; import org.eclipse.sirius.components.forms.CheckboxStyle; +import org.eclipse.sirius.components.forms.ContainerBorderStyle; import org.eclipse.sirius.components.forms.FlexDirection; import org.eclipse.sirius.components.forms.LabelWidgetStyle; import org.eclipse.sirius.components.forms.LinkStyle; @@ -415,6 +416,17 @@ public AbstractWidgetDescription caseFlexboxContainerDescription(org.eclipse.sir WidgetIdProvider idProvider = new WidgetIdProvider(); StringValueProvider labelProvider = this.getStringValueProvider(flexboxContainerDescription.getLabelExpression()); FlexDirection flexDirection = FlexDirection.valueOf(flexboxContainerDescription.getFlexDirection().getName()); + Function borderStyleProvider = variableManager -> { + var effectiveStyle = flexboxContainerDescription.getConditionalBorderStyles().stream() + .filter(style -> this.matches(style.getCondition(), variableManager)) + .map(org.eclipse.sirius.components.view.ContainerBorderStyle.class::cast) + .findFirst() + .orElseGet(flexboxContainerDescription::getBorderStyle); + if (effectiveStyle == null) { + return null; + } + return new ContainerBorderStyleProvider(effectiveStyle).apply(variableManager); + }; List children = new ArrayList<>(); flexboxContainerDescription.getChildren().forEach(widget -> children.add(ViewFormDescriptionConverterSwitch.this.doSwitch(widget))); @@ -425,7 +437,8 @@ public AbstractWidgetDescription caseFlexboxContainerDescription(org.eclipse.sir .children(children) .diagnosticsProvider(variableManager -> List.of()) .kindProvider(object -> "") - .messageProvider(object -> ""); + .messageProvider(object -> "") + .borderStyleProvider(borderStyleProvider); if (flexboxContainerDescription.getHelpExpression() != null && !flexboxContainerDescription.getHelpExpression().isBlank()) { builder.helpTextProvider(this.getStringValueProvider(flexboxContainerDescription.getHelpExpression())); } diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ConditionalContainerBorderStyle.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ConditionalContainerBorderStyle.java new file mode 100644 index 0000000000..d04b015c06 --- /dev/null +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ConditionalContainerBorderStyle.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2021, 2023 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.view; + +/** + * A representation of the model object 'Conditional Container Border Style'. + * + * + * @model + * @generated + * @see org.eclipse.sirius.components.view.ViewPackage#getConditionalContainerBorderStyle() + */ +public interface ConditionalContainerBorderStyle extends Conditional, ContainerBorderStyle { + +} // ConditionalContainerBorderStyle diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ContainerBorderLineStyle.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ContainerBorderLineStyle.java new file mode 100644 index 0000000000..a45d70ffb2 --- /dev/null +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ContainerBorderLineStyle.java @@ -0,0 +1,229 @@ +/******************************************************************************* + * Copyright (c) 2021, 2023 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.view; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * A representation of the literals of the enumeration 'Container Border Line + * Style', and utility methods for working with them. + * + * @model + * @generated + * @see org.eclipse.sirius.components.view.ViewPackage#getContainerBorderLineStyle() + */ +public enum ContainerBorderLineStyle implements Enumerator { + /** + * The 'Solid' literal object. + * + * @generated + * @ordered + * @see #SOLID_VALUE + */ + SOLID(0, "Solid", "Solid"), + + /** + * The 'Dashed' literal object. + * + * @generated + * @ordered + * @see #DASHED_VALUE + */ + DASHED(1, "Dashed", "Dashed"), + + /** + * The 'Dotted' literal object. + * + * @generated + * @ordered + * @see #DOTTED_VALUE + */ + DOTTED(2, "Dotted", "Dotted"); + + /** + * The 'Solid' literal value. + * + * @model name="Solid" + * @generated + * @ordered + * @see #SOLID + */ + public static final int SOLID_VALUE = 0; + + /** + * The 'Dashed' literal value. + * + * @model name="Dashed" + * @generated + * @ordered + * @see #DASHED + */ + public static final int DASHED_VALUE = 1; + + /** + * The 'Dotted' literal value. + * + * @model name="Dotted" + * @generated + * @ordered + * @see #DOTTED + */ + public static final int DOTTED_VALUE = 2; + + /** + * An array of all the 'Container Border Line Style' enumerators. + * + * @generated + */ + private static final ContainerBorderLineStyle[] VALUES_ARRAY = new ContainerBorderLineStyle[]{SOLID, DASHED, DOTTED,}; + + /** + * A public read-only list of all the 'Container Border Line Style' enumerators. + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + /** + * + * + * @generated + */ + private final int value; + /** + * + * + * @generated + */ + private final String name; + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * @generated + */ + ContainerBorderLineStyle(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * Returns the 'Container Border Line Style' literal with the specified literal value. + * + * @param literal the literal. + * @return the matching enumerator or null. + * @generated + */ + public static ContainerBorderLineStyle get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ContainerBorderLineStyle result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Container Border Line Style' literal with the specified name. + * + * @param name the name. + * @return the matching enumerator or null. + * @generated + */ + public static ContainerBorderLineStyle getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ContainerBorderLineStyle result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Container Border Line Style' literal with the specified integer value. + * + * @param value the integer value. + * @return the matching enumerator or null. + * @generated + */ + public static ContainerBorderLineStyle get(int value) { + switch (value) { + case SOLID_VALUE: + return SOLID; + case DASHED_VALUE: + return DASHED; + case DOTTED_VALUE: + return DOTTED; + } + return null; + } + + /** + * + * + * @generated + */ + @Override + public int getValue() { + return this.value; + } + + /** + * + * + * @generated + */ + @Override + public String getName() { + return this.name; + } + + /** + * + * + * @generated + */ + @Override + public String getLiteral() { + return this.literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * @generated + */ + @Override + public String toString() { + return this.literal; + } + +} // ContainerBorderLineStyle diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ContainerBorderStyle.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ContainerBorderStyle.java new file mode 100644 index 0000000000..1ed5e46ad2 --- /dev/null +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ContainerBorderStyle.java @@ -0,0 +1,128 @@ +/******************************************************************************* + * Copyright (c) 2021, 2023 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.view; + +import org.eclipse.emf.ecore.EObject; + +/** + * A representation of the model object 'Container Border Style'. + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderColor Border Color}
  • + *
  • {@link org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderRadius Border Radius}
  • + *
  • {@link org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderSize Border Size}
  • + *
  • {@link org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderLineStyle Border Line + * Style}
  • + *
+ * + * @model + * @generated + * @see org.eclipse.sirius.components.view.ViewPackage#getContainerBorderStyle() + */ +public interface ContainerBorderStyle extends EObject { + + /** + * Returns the value of the 'Border Color' reference. + * + * @return the value of the 'Border Color' reference. + * @model required="true" + * @generated + * @see #setBorderColor(UserColor) + * @see org.eclipse.sirius.components.view.ViewPackage#getContainerBorderStyle_BorderColor() + */ + UserColor getBorderColor(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderColor Border + * Color}' reference. + * + * @param value the new value of the 'Border Color' reference. + * @generated + * @see #getBorderColor() + */ + void setBorderColor(UserColor value); + + /** + * Returns the value of the 'Border Radius' attribute. The default value is "3". + * + * @return the value of the 'Border Radius' attribute. + * @model default="3" dataType="org.eclipse.sirius.components.view.Length" required="true" + * @generated + * @see #setBorderRadius(int) + * @see org.eclipse.sirius.components.view.ViewPackage#getContainerBorderStyle_BorderRadius() + */ + int getBorderRadius(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderRadius Border + * Radius}' attribute. + * + * @param value the new value of the 'Border Radius' attribute. + * @generated + * @see #getBorderRadius() + */ + void setBorderRadius(int value); + + /** + * Returns the value of the 'Border Size' attribute. The default value is "1". + * + * @return the value of the 'Border Size' attribute. + * @model default="1" dataType="org.eclipse.sirius.components.view.Length" required="true" + * @generated + * @see #setBorderSize(int) + * @see org.eclipse.sirius.components.view.ViewPackage#getContainerBorderStyle_BorderSize() + */ + int getBorderSize(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderSize Border + * Size}' attribute. + * + * @param value the new value of the 'Border Size' attribute. + * @generated + * @see #getBorderSize() + */ + void setBorderSize(int value); + + /** + * Returns the value of the 'Border Line Style' attribute. The literals are from the enumeration + * {@link org.eclipse.sirius.components.view.ContainerBorderLineStyle}. + * + * @return the value of the 'Border Line Style' attribute. + * @model + * @generated + * @see org.eclipse.sirius.components.view.ContainerBorderLineStyle + * @see #setBorderLineStyle(ContainerBorderLineStyle) + * @see org.eclipse.sirius.components.view.ViewPackage#getContainerBorderStyle_BorderLineStyle() + */ + ContainerBorderLineStyle getBorderLineStyle(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderLineStyle + * Border Line Style}' attribute. + * + * @param value the new value of the 'Border Line Style' attribute. + * @generated + * @see org.eclipse.sirius.components.view.ContainerBorderLineStyle + * @see #getBorderLineStyle() + */ + void setBorderLineStyle(ContainerBorderLineStyle value); + +} // ContainerBorderStyle diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/FlexboxContainerDescription.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/FlexboxContainerDescription.java index 86a3452b8f..2dafac6bd6 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/FlexboxContainerDescription.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/FlexboxContainerDescription.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021, 2022 Obeo. +/******************************************************************************* + * Copyright (c) 2021, 2023 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 @@ -8,8 +8,8 @@ * SPDX-License-Identifier: EPL-2.0 * * Contributors: - * Obeo - initial API and implementation - */ + * Obeo - initial API and implementation + *******************************************************************************/ package org.eclipse.sirius.components.view; import org.eclipse.emf.common.util.EList; @@ -25,6 +25,9 @@ *
  • {@link org.eclipse.sirius.components.view.FlexboxContainerDescription#getChildren Children}
  • *
  • {@link org.eclipse.sirius.components.view.FlexboxContainerDescription#getFlexDirection Flex * Direction}
  • + *
  • {@link org.eclipse.sirius.components.view.FlexboxContainerDescription#getBorderStyle Border Style}
  • + *
  • {@link org.eclipse.sirius.components.view.FlexboxContainerDescription#getConditionalBorderStyles Conditional + * Border Styles}
  • * * * @see org.eclipse.sirius.components.view.ViewPackage#getFlexboxContainerDescription() @@ -32,6 +35,7 @@ * @generated */ public interface FlexboxContainerDescription extends WidgetDescription { + /** * Returns the value of the 'Children' containment reference list. The list contents are of type * {@link org.eclipse.sirius.components.view.WidgetDescription}. @@ -69,4 +73,38 @@ public interface FlexboxContainerDescription extends WidgetDescription { */ void setFlexDirection(FlexDirection value); + /** + * Returns the value of the 'Border Style' containment reference. + * + * @return the value of the 'Border Style' containment reference. + * @model containment="true" + * @generated + * @see #setBorderStyle(ContainerBorderStyle) + * @see org.eclipse.sirius.components.view.ViewPackage#getFlexboxContainerDescription_BorderStyle() + */ + ContainerBorderStyle getBorderStyle(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.FlexboxContainerDescription#getBorderStyle + * Border Style}' containment reference. + * + * @param value the new value of the 'Border Style' containment reference. + * @generated + * @see #getBorderStyle() + */ + void setBorderStyle(ContainerBorderStyle value); + + /** + * Returns the value of the 'Conditional Border Styles' containment reference list. The list + * contents are of type {@link org.eclipse.sirius.components.view.ConditionalContainerBorderStyle}. + * + * @return the value of the 'Conditional Border Styles' containment reference list. + * @model containment="true" + * @generated + * @see org.eclipse.sirius.components.view.ViewPackage#getFlexboxContainerDescription_ConditionalBorderStyles() + */ + EList getConditionalBorderStyles(); + } // FlexboxContainerDescription diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/GroupDescription.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/GroupDescription.java index 202e197856..1b0c0ead6c 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/GroupDescription.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/GroupDescription.java @@ -1,4 +1,4 @@ -/** +/******************************************************************************* * Copyright (c) 2021, 2023 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 @@ -8,8 +8,8 @@ * SPDX-License-Identifier: EPL-2.0 * * Contributors: - * Obeo - initial API and implementation - */ + * Obeo - initial API and implementation + *******************************************************************************/ package org.eclipse.sirius.components.view; import org.eclipse.emf.common.util.EList; @@ -32,6 +32,7 @@ * @generated */ public interface GroupDescription extends EObject { + /** * Returns the value of the 'Name' attribute. * @@ -148,4 +149,38 @@ public interface GroupDescription extends EObject { */ EList getWidgets(); + /** + * Returns the value of the 'Border Style' containment reference. + * + * @return the value of the 'Border Style' containment reference. + * @model containment="true" + * @generated + * @see #setBorderStyle(ContainerBorderStyle) + * @see org.eclipse.sirius.components.view.ViewPackage#getGroupDescription_BorderStyle() + */ + ContainerBorderStyle getBorderStyle(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.GroupDescription#getBorderStyle Border + * Style}' containment reference. + * + * @param value the new value of the 'Border Style' containment reference. + * @generated + * @see #getBorderStyle() + */ + void setBorderStyle(ContainerBorderStyle value); + + /** + * Returns the value of the 'Conditional Border Styles' containment reference list. The list + * contents are of type {@link org.eclipse.sirius.components.view.ConditionalContainerBorderStyle}. + * + * @return the value of the 'Conditional Border Styles' containment reference list. + * @model containment="true" + * @generated + * @see org.eclipse.sirius.components.view.ViewPackage#getGroupDescription_ConditionalBorderStyles() + */ + EList getConditionalBorderStyles(); + } // GroupDescription diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewFactory.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewFactory.java index d4113789d2..e80dd23f12 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewFactory.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewFactory.java @@ -615,6 +615,23 @@ public interface ViewFactory extends EFactory { */ ConditionalListDescriptionStyle createConditionalListDescriptionStyle(); + /** + * Returns a new object of class 'Container Border Style'. + * + * @return a new object of class 'Container Border Style'. + * @generated + */ + ContainerBorderStyle createContainerBorderStyle(); + + /** + * Returns a new object of class 'Conditional Container Border Style'. + * + * @return a new object of class 'Conditional Container Border Style'. + * @generated + */ + ConditionalContainerBorderStyle createConditionalContainerBorderStyle(); + /** * Returns a new object of class 'Diagram Palette'. * diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewPackage.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewPackage.java index 30e520a6f2..1389a027b8 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewPackage.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewPackage.java @@ -3011,6 +3011,24 @@ public interface ViewPackage extends EPackage { */ int GROUP_DESCRIPTION__WIDGETS = 5; + /** + * The feature id for the 'Border Style' containment reference. + * + * @generated + * @ordered + */ + int GROUP_DESCRIPTION__BORDER_STYLE = 6; + + /** + * The feature id for the 'Conditional Border Styles' containment reference list. + * + * @generated + * @ordered + */ + int GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES = 7; + /** * The number of structural features of the 'Group Description' class. @@ -3018,7 +3036,7 @@ public interface ViewPackage extends EPackage { * @generated * @ordered */ - int GROUP_DESCRIPTION_FEATURE_COUNT = 6; + int GROUP_DESCRIPTION_FEATURE_COUNT = 8; /** * The number of operations of the 'Group Description' class. @@ -3992,6 +4010,24 @@ public interface ViewPackage extends EPackage { */ int FLEXBOX_CONTAINER_DESCRIPTION__FLEX_DIRECTION = WIDGET_DESCRIPTION_FEATURE_COUNT + 1; + /** + * The feature id for the 'Border Style' containment reference. + * + * @generated + * @ordered + */ + int FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE = WIDGET_DESCRIPTION_FEATURE_COUNT + 2; + + /** + * The feature id for the 'Conditional Border Styles' containment reference list. + * + * @generated + * @ordered + */ + int FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES = WIDGET_DESCRIPTION_FEATURE_COUNT + 3; + /** * The number of structural features of the 'Flexbox Container Description' class. * @@ -3999,7 +4035,7 @@ public interface ViewPackage extends EPackage { * @generated * @ordered */ - int FLEXBOX_CONTAINER_DESCRIPTION_FEATURE_COUNT = WIDGET_DESCRIPTION_FEATURE_COUNT + 2; + int FLEXBOX_CONTAINER_DESCRIPTION_FEATURE_COUNT = WIDGET_DESCRIPTION_FEATURE_COUNT + 4; /** * The number of operations of the 'Flexbox Container Description' class. + * + * @generated + * @see org.eclipse.sirius.components.view.impl.ContainerBorderStyleImpl + * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getContainerBorderStyle() + */ + int CONTAINER_BORDER_STYLE = 84; + + /** + * The feature id for the 'Border Color' reference. + * + * @generated + * @ordered + */ + int CONTAINER_BORDER_STYLE__BORDER_COLOR = 0; + + /** + * The feature id for the 'Border Radius' attribute. + * + * @generated + * @ordered + */ + int CONTAINER_BORDER_STYLE__BORDER_RADIUS = 1; + + /** + * The feature id for the 'Border Size' attribute. + * + * @generated + * @ordered + */ + int CONTAINER_BORDER_STYLE__BORDER_SIZE = 2; + + /** + * The feature id for the 'Border Line Style' attribute. + * + * @generated + * @ordered + */ + int CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE = 3; + + /** + * The number of structural features of the 'Container Border Style' class. + * + * @generated + * @ordered + */ + int CONTAINER_BORDER_STYLE_FEATURE_COUNT = 4; + + /** + * The number of operations of the 'Container Border Style' class. + * + * @generated + * @ordered + */ + int CONTAINER_BORDER_STYLE_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link org.eclipse.sirius.components.view.impl.ConditionalContainerBorderStyleImpl + * Conditional Container Border Style}' class. + * + * @generated + * @see org.eclipse.sirius.components.view.impl.ConditionalContainerBorderStyleImpl + * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getConditionalContainerBorderStyle() + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE = 85; + + /** + * The feature id for the 'Condition' attribute. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE__CONDITION = CONDITIONAL__CONDITION; + + /** + * The feature id for the 'Border Color' reference. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR = CONDITIONAL_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Border Radius' attribute. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS = CONDITIONAL_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Border Size' attribute. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE = CONDITIONAL_FEATURE_COUNT + 2; + + /** + * The feature id for the 'Border Line Style' attribute. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE = CONDITIONAL_FEATURE_COUNT + 3; + + /** + * The number of structural features of the 'Conditional Container Border Style' class. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE_FEATURE_COUNT = CONDITIONAL_FEATURE_COUNT + 4; + + /** + * The number of operations of the 'Conditional Container Border Style' class. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE_OPERATION_COUNT = CONDITIONAL_OPERATION_COUNT + 0; + /** * The meta object id for the '{@link org.eclipse.sirius.components.view.impl.DiagramPaletteImpl Diagram * Palette}' class. * + * @generated * @see org.eclipse.sirius.components.view.impl.DiagramPaletteImpl * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getDiagramPalette() - * @generated */ - int DIAGRAM_PALETTE = 84; + int DIAGRAM_PALETTE = 86; /** * The feature id for the 'Drop Tool' containment reference. * + * @generated * @see org.eclipse.sirius.components.view.impl.NodePaletteImpl * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getNodePalette() - * @generated */ - int NODE_PALETTE = 85; + int NODE_PALETTE = 87; /** * The feature id for the 'Delete Tool' containment reference. * + * @generated * @see org.eclipse.sirius.components.view.impl.EdgePaletteImpl * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getEdgePalette() - * @generated */ - int EDGE_PALETTE = 86; + int EDGE_PALETTE = 88; /** * The feature id for the 'Delete Tool' containment reference. * + * @generated * @see org.eclipse.sirius.components.view.impl.SelectionDescriptionImpl * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getSelectionDescription() - * @generated */ - int SELECTION_DESCRIPTION = 87; + int SELECTION_DESCRIPTION = 89; /** * The feature id for the 'Selection Candidates Expression' attribute. * + * @generated * @see org.eclipse.sirius.components.view.LayoutDirection * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getLayoutDirection() - * @generated */ - int LAYOUT_DIRECTION = 88; + int LAYOUT_DIRECTION = 90; /** * The meta object id for the '{@link org.eclipse.sirius.components.view.ArrowStyle Arrow Style}' enum. * * + * @generated * @see org.eclipse.sirius.components.view.ArrowStyle * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getArrowStyle() - * @generated */ - int ARROW_STYLE = 89; + int ARROW_STYLE = 91; /** * The meta object id for the '{@link org.eclipse.sirius.components.view.LineStyle Line Style}' enum. * + * @generated * @see org.eclipse.sirius.components.view.NodeContainmentKind * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getNodeContainmentKind() - * @generated */ - int NODE_CONTAINMENT_KIND = 91; + int NODE_CONTAINMENT_KIND = 93; /** * The meta object id for the '{@link org.eclipse.sirius.components.view.SynchronizationPolicy Synchronization * Policy}' enum. * + * @generated * @see org.eclipse.sirius.components.view.SynchronizationPolicy * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getSynchronizationPolicy() - * @generated */ - int SYNCHRONIZATION_POLICY = 92; + int SYNCHRONIZATION_POLICY = 94; /** * The meta object id for the '{@link org.eclipse.sirius.components.view.GroupDisplayMode Group Display * Mode}' enum. * + * @generated * @see org.eclipse.sirius.components.view.GroupDisplayMode * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getGroupDisplayMode() - * @generated */ - int GROUP_DISPLAY_MODE = 93; + int GROUP_DISPLAY_MODE = 95; /** * The meta object id for the '{@link org.eclipse.sirius.components.view.FlexDirection Flex Direction}' * enum. * + * @generated * @see org.eclipse.sirius.components.view.FlexDirection * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getFlexDirection() + */ + int FLEX_DIRECTION = 96; + + /** + * The meta object id for the '{@link org.eclipse.sirius.components.view.ContainerBorderLineStyle Container + * Border Line Style}' enum. + * * @generated + * @see org.eclipse.sirius.components.view.ContainerBorderLineStyle + * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getContainerBorderLineStyle() */ - int FLEX_DIRECTION = 94; + int CONTAINER_BORDER_LINE_STYLE = 97; /** * The meta object id for the 'Identifier' data type. * + * @generated * @see java.lang.String * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getIdentifier() - * @generated */ - int IDENTIFIER = 95; + int IDENTIFIER = 98; /** * The meta object id for the 'Interpreted Expression' data type. * + * @generated * @see java.lang.String * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getDomainType() - * @generated */ - int DOMAIN_TYPE = 97; + int DOMAIN_TYPE = 100; /** * The meta object id for the 'Color' data type. * + * @generated * @see java.lang.String * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getColor() - * @generated */ - int COLOR = 98; + int COLOR = 101; /** * The meta object id for the 'Length' data type. * - * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getLength() * @generated + * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getLength() */ - int LENGTH = 99; + int LENGTH = 102; /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.View View}'. + * + * @return the meta object for the containment reference 'Border Style'. + * @generated + * @see org.eclipse.sirius.components.view.GroupDescription#getBorderStyle() + * @see #getGroupDescription() + */ + EReference getGroupDescription_BorderStyle(); + + /** + * Returns the meta object for the containment reference list + * '{@link org.eclipse.sirius.components.view.GroupDescription#getConditionalBorderStyles Conditional Border + * Styles}'. + * + * @return the meta object for the containment reference list 'Conditional Border Styles'. + * @generated + * @see org.eclipse.sirius.components.view.GroupDescription#getConditionalBorderStyles() + * @see #getGroupDescription() + */ + EReference getGroupDescription_ConditionalBorderStyles(); + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.WidgetDescription Widget * Description}'. * * @return the meta object for class 'Widget Description'. - * @see org.eclipse.sirius.components.view.WidgetDescription * @generated + * @see org.eclipse.sirius.components.view.WidgetDescription */ EClass getWidgetDescription(); @@ -9081,13 +9281,37 @@ public interface ViewPackage extends EPackage { */ EAttribute getFlexboxContainerDescription_FlexDirection(); + /** + * Returns the meta object for the containment reference + * '{@link org.eclipse.sirius.components.view.FlexboxContainerDescription#getBorderStyle Border Style}'. + * + * + * @return the meta object for the containment reference 'Border Style'. + * @generated + * @see org.eclipse.sirius.components.view.FlexboxContainerDescription#getBorderStyle() + * @see #getFlexboxContainerDescription() + */ + EReference getFlexboxContainerDescription_BorderStyle(); + + /** + * Returns the meta object for the containment reference list + * '{@link org.eclipse.sirius.components.view.FlexboxContainerDescription#getConditionalBorderStyles Conditional + * Border Styles}'. + * + * @return the meta object for the containment reference list 'Conditional Border Styles'. + * @generated + * @see org.eclipse.sirius.components.view.FlexboxContainerDescription#getConditionalBorderStyles() + * @see #getFlexboxContainerDescription() + */ + EReference getFlexboxContainerDescription_ConditionalBorderStyles(); + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.ButtonDescription Button * Description}'. * * @return the meta object for class 'Button Description'. - * @see org.eclipse.sirius.components.view.ButtonDescription * @generated + * @see org.eclipse.sirius.components.view.ButtonDescription */ EClass getButtonDescription(); @@ -9857,18 +10081,86 @@ public interface ViewPackage extends EPackage { * Conditional List Description Style}'. * * @return the meta object for class 'Conditional List Description Style'. - * @see org.eclipse.sirius.components.view.ConditionalListDescriptionStyle * @generated + * @see org.eclipse.sirius.components.view.ConditionalListDescriptionStyle */ EClass getConditionalListDescriptionStyle(); + /** + * Returns the meta object for class '{@link org.eclipse.sirius.components.view.ContainerBorderStyle Container + * Border Style}'. + * + * @return the meta object for class 'Container Border Style'. + * @generated + * @see org.eclipse.sirius.components.view.ContainerBorderStyle + */ + EClass getContainerBorderStyle(); + + /** + * Returns the meta object for the reference + * '{@link org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderColor Border Color}'. + * + * @return the meta object for the reference 'Border Color'. + * @generated + * @see org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderColor() + * @see #getContainerBorderStyle() + */ + EReference getContainerBorderStyle_BorderColor(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderRadius Border Radius}'. + * + * @return the meta object for the attribute 'Border Radius'. + * @generated + * @see org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderRadius() + * @see #getContainerBorderStyle() + */ + EAttribute getContainerBorderStyle_BorderRadius(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderSize Border Size}'. + * + * @return the meta object for the attribute 'Border Size'. + * @generated + * @see org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderSize() + * @see #getContainerBorderStyle() + */ + EAttribute getContainerBorderStyle_BorderSize(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderLineStyle Border Line Style}'. + * + * + * @return the meta object for the attribute 'Border Line Style'. + * @generated + * @see org.eclipse.sirius.components.view.ContainerBorderStyle#getBorderLineStyle() + * @see #getContainerBorderStyle() + */ + EAttribute getContainerBorderStyle_BorderLineStyle(); + + /** + * Returns the meta object for class '{@link org.eclipse.sirius.components.view.ConditionalContainerBorderStyle + * Conditional Container Border Style}'. + * + * @return the meta object for class 'Conditional Container Border Style'. + * @generated + * @see org.eclipse.sirius.components.view.ConditionalContainerBorderStyle + */ + EClass getConditionalContainerBorderStyle(); + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.DiagramPalette Diagram * Palette}'. * * @return the meta object for class 'Diagram Palette'. - * @see org.eclipse.sirius.components.view.DiagramPalette * @generated + * @see org.eclipse.sirius.components.view.DiagramPalette */ EClass getDiagramPalette(); @@ -10135,19 +10427,29 @@ public interface ViewPackage extends EPackage { * Direction}'. * * @return the meta object for enum 'Flex Direction'. - * @see org.eclipse.sirius.components.view.FlexDirection * @generated + * @see org.eclipse.sirius.components.view.FlexDirection */ EEnum getFlexDirection(); + /** + * Returns the meta object for enum '{@link org.eclipse.sirius.components.view.ContainerBorderLineStyle + * Container Border Line Style}'. + * + * @return the meta object for enum 'Container Border Line Style'. + * @generated + * @see org.eclipse.sirius.components.view.ContainerBorderLineStyle + */ + EEnum getContainerBorderLineStyle(); + /** * Returns the meta object for data type '{@link java.lang.String Identifier}'. * * * @return the meta object for data type 'Identifier'. - * @see java.lang.String * @model instanceClass="java.lang.String" * @generated + * @see java.lang.String */ EDataType getIdentifier(); @@ -11427,13 +11729,29 @@ interface Literals { */ EReference GROUP_DESCRIPTION__WIDGETS = eINSTANCE.getGroupDescription_Widgets(); + /** + * The meta object literal for the 'Border Style' containment reference feature. + * + * @generated + */ + EReference GROUP_DESCRIPTION__BORDER_STYLE = eINSTANCE.getGroupDescription_BorderStyle(); + + /** + * The meta object literal for the 'Conditional Border Styles' containment reference list + * feature. + * + * @generated + */ + EReference GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES = eINSTANCE.getGroupDescription_ConditionalBorderStyles(); + /** * The meta object literal for the '{@link org.eclipse.sirius.components.view.impl.WidgetDescriptionImpl * Widget Description}' class. * + * @generated * @see org.eclipse.sirius.components.view.impl.WidgetDescriptionImpl * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getWidgetDescription() - * @generated */ EClass WIDGET_DESCRIPTION = eINSTANCE.getWidgetDescription(); @@ -11922,13 +12240,29 @@ interface Literals { */ EAttribute FLEXBOX_CONTAINER_DESCRIPTION__FLEX_DIRECTION = eINSTANCE.getFlexboxContainerDescription_FlexDirection(); + /** + * The meta object literal for the 'Border Style' containment reference feature. + * + * @generated + */ + EReference FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE = eINSTANCE.getFlexboxContainerDescription_BorderStyle(); + + /** + * The meta object literal for the 'Conditional Border Styles' containment reference list + * feature. + * + * @generated + */ + EReference FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES = eINSTANCE.getFlexboxContainerDescription_ConditionalBorderStyles(); + /** * The meta object literal for the '{@link org.eclipse.sirius.components.view.impl.ButtonDescriptionImpl * Button Description}' class. * + * @generated * @see org.eclipse.sirius.components.view.impl.ButtonDescriptionImpl * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getButtonDescription() - * @generated */ EClass BUTTON_DESCRIPTION = eINSTANCE.getButtonDescription(); @@ -12555,13 +12889,66 @@ interface Literals { */ EClass CONDITIONAL_LIST_DESCRIPTION_STYLE = eINSTANCE.getConditionalListDescriptionStyle(); + /** + * The meta object literal for the '{@link org.eclipse.sirius.components.view.impl.ContainerBorderStyleImpl + * Container Border Style}' class. + * + * @generated + * @see org.eclipse.sirius.components.view.impl.ContainerBorderStyleImpl + * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getContainerBorderStyle() + */ + EClass CONTAINER_BORDER_STYLE = eINSTANCE.getContainerBorderStyle(); + + /** + * The meta object literal for the 'Border Color' reference feature. + * + * + * @generated + */ + EReference CONTAINER_BORDER_STYLE__BORDER_COLOR = eINSTANCE.getContainerBorderStyle_BorderColor(); + + /** + * The meta object literal for the 'Border Radius' attribute feature. + * + * + * @generated + */ + EAttribute CONTAINER_BORDER_STYLE__BORDER_RADIUS = eINSTANCE.getContainerBorderStyle_BorderRadius(); + + /** + * The meta object literal for the 'Border Size' attribute feature. + * + * @generated + */ + EAttribute CONTAINER_BORDER_STYLE__BORDER_SIZE = eINSTANCE.getContainerBorderStyle_BorderSize(); + + /** + * The meta object literal for the 'Border Line Style' attribute feature. + * + * @generated + */ + EAttribute CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE = eINSTANCE.getContainerBorderStyle_BorderLineStyle(); + + /** + * The meta object literal for the + * '{@link org.eclipse.sirius.components.view.impl.ConditionalContainerBorderStyleImpl Conditional Container + * Border Style}' class. + * + * @generated + * @see org.eclipse.sirius.components.view.impl.ConditionalContainerBorderStyleImpl + * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getConditionalContainerBorderStyle() + */ + EClass CONDITIONAL_CONTAINER_BORDER_STYLE = eINSTANCE.getConditionalContainerBorderStyle(); + /** * The meta object literal for the '{@link org.eclipse.sirius.components.view.impl.DiagramPaletteImpl * Diagram Palette}' class. * + * @generated * @see org.eclipse.sirius.components.view.impl.DiagramPaletteImpl * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getDiagramPalette() - * @generated */ EClass DIAGRAM_PALETTE = eINSTANCE.getDiagramPalette(); @@ -12771,19 +13158,29 @@ interface Literals { * The meta object literal for the '{@link org.eclipse.sirius.components.view.FlexDirection Flex * Direction}' enum. * + * @generated * @see org.eclipse.sirius.components.view.FlexDirection * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getFlexDirection() - * @generated */ EEnum FLEX_DIRECTION = eINSTANCE.getFlexDirection(); + /** + * The meta object literal for the '{@link org.eclipse.sirius.components.view.ContainerBorderLineStyle + * Container Border Line Style}' enum. + * + * @generated + * @see org.eclipse.sirius.components.view.ContainerBorderLineStyle + * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getContainerBorderLineStyle() + */ + EEnum CONTAINER_BORDER_LINE_STYLE = eINSTANCE.getContainerBorderLineStyle(); + /** * The meta object literal for the 'Identifier' data type. * + * @generated * @see java.lang.String * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getIdentifier() - * @generated */ EDataType IDENTIFIER = eINSTANCE.getIdentifier(); diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalContainerBorderStyleImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalContainerBorderStyleImpl.java new file mode 100644 index 0000000000..f90171b2fe --- /dev/null +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalContainerBorderStyleImpl.java @@ -0,0 +1,402 @@ +/******************************************************************************* + * Copyright (c) 2021, 2023 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.view.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.sirius.components.view.ConditionalContainerBorderStyle; +import org.eclipse.sirius.components.view.ContainerBorderLineStyle; +import org.eclipse.sirius.components.view.ContainerBorderStyle; +import org.eclipse.sirius.components.view.UserColor; +import org.eclipse.sirius.components.view.ViewPackage; + +/** + * An implementation of the model object 'Conditional Container Border Style'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.impl.ConditionalContainerBorderStyleImpl#getBorderColor Border + * Color}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.ConditionalContainerBorderStyleImpl#getBorderRadius Border + * Radius}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.ConditionalContainerBorderStyleImpl#getBorderSize Border + * Size}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.ConditionalContainerBorderStyleImpl#getBorderLineStyle Border + * Line Style}
    • + *
    + * + * @generated + */ +public class ConditionalContainerBorderStyleImpl extends ConditionalImpl implements ConditionalContainerBorderStyle { + + /** + * The cached value of the '{@link #getBorderColor() Border Color}' reference. + * + * @generated + * @ordered + * @see #getBorderColor() + */ + protected UserColor borderColor; + + /** + * The default value of the '{@link #getBorderRadius() Border Radius}' attribute. + * + * + * @generated + * @ordered + * @see #getBorderRadius() + */ + protected static final int BORDER_RADIUS_EDEFAULT = 3; + + /** + * The cached value of the '{@link #getBorderRadius() Border Radius}' attribute. + * + * + * @generated + * @ordered + * @see #getBorderRadius() + */ + protected int borderRadius = BORDER_RADIUS_EDEFAULT; + + /** + * The default value of the '{@link #getBorderSize() Border Size}' attribute. + * + * @generated + * @ordered + * @see #getBorderSize() + */ + protected static final int BORDER_SIZE_EDEFAULT = 1; + + /** + * The cached value of the '{@link #getBorderSize() Border Size}' attribute. + * + * @generated + * @ordered + * @see #getBorderSize() + */ + protected int borderSize = BORDER_SIZE_EDEFAULT; + + /** + * The default value of the '{@link #getBorderLineStyle() Border Line Style}' attribute. + * + * @generated + * @ordered + * @see #getBorderLineStyle() + */ + protected static final ContainerBorderLineStyle BORDER_LINE_STYLE_EDEFAULT = ContainerBorderLineStyle.SOLID; + + /** + * The cached value of the '{@link #getBorderLineStyle() Border Line Style}' attribute. + * + * @generated + * @ordered + * @see #getBorderLineStyle() + */ + protected ContainerBorderLineStyle borderLineStyle = BORDER_LINE_STYLE_EDEFAULT; + + /** + * + * + * @generated + */ + protected ConditionalContainerBorderStyleImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ViewPackage.Literals.CONDITIONAL_CONTAINER_BORDER_STYLE; + } + + /** + * + * + * @generated + */ + @Override + public UserColor getBorderColor() { + if (this.borderColor != null && this.borderColor.eIsProxy()) { + InternalEObject oldBorderColor = (InternalEObject) this.borderColor; + this.borderColor = (UserColor) this.eResolveProxy(oldBorderColor); + if (this.borderColor != oldBorderColor) { + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.RESOLVE, ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR, oldBorderColor, this.borderColor)); + } + } + return this.borderColor; + } + + /** + * + * + * @generated + */ + @Override + public void setBorderColor(UserColor newBorderColor) { + UserColor oldBorderColor = this.borderColor; + this.borderColor = newBorderColor; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR, oldBorderColor, this.borderColor)); + } + + /** + * + * + * @generated + */ + public UserColor basicGetBorderColor() { + return this.borderColor; + } + + /** + * + * + * @generated + */ + @Override + public int getBorderRadius() { + return this.borderRadius; + } + + /** + * + * + * @generated + */ + @Override + public void setBorderRadius(int newBorderRadius) { + int oldBorderRadius = this.borderRadius; + this.borderRadius = newBorderRadius; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS, oldBorderRadius, this.borderRadius)); + } + + /** + * + * + * @generated + */ + @Override + public int getBorderSize() { + return this.borderSize; + } + + /** + * + * + * @generated + */ + @Override + public void setBorderSize(int newBorderSize) { + int oldBorderSize = this.borderSize; + this.borderSize = newBorderSize; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE, oldBorderSize, this.borderSize)); + } + + /** + * + * + * @generated + */ + @Override + public ContainerBorderLineStyle getBorderLineStyle() { + return this.borderLineStyle; + } + + /** + * + * + * @generated + */ + @Override + public void setBorderLineStyle(ContainerBorderLineStyle newBorderLineStyle) { + ContainerBorderLineStyle oldBorderLineStyle = this.borderLineStyle; + this.borderLineStyle = newBorderLineStyle == null ? BORDER_LINE_STYLE_EDEFAULT : newBorderLineStyle; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE, oldBorderLineStyle, this.borderLineStyle)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR: + if (resolve) + return this.getBorderColor(); + return this.basicGetBorderColor(); + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS: + return this.getBorderRadius(); + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE: + return this.getBorderSize(); + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + return this.getBorderLineStyle(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR: + this.setBorderColor((UserColor) newValue); + return; + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS: + this.setBorderRadius((Integer) newValue); + return; + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE: + this.setBorderSize((Integer) newValue); + return; + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + this.setBorderLineStyle((ContainerBorderLineStyle) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR: + this.setBorderColor(null); + return; + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS: + this.setBorderRadius(BORDER_RADIUS_EDEFAULT); + return; + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE: + this.setBorderSize(BORDER_SIZE_EDEFAULT); + return; + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + this.setBorderLineStyle(BORDER_LINE_STYLE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR: + return this.borderColor != null; + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS: + return this.borderRadius != BORDER_RADIUS_EDEFAULT; + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE: + return this.borderSize != BORDER_SIZE_EDEFAULT; + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + return this.borderLineStyle != BORDER_LINE_STYLE_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) { + if (baseClass == ContainerBorderStyle.class) { + switch (derivedFeatureID) { + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR: + return ViewPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR; + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS: + return ViewPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS; + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE: + return ViewPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE; + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + return ViewPackage.CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE; + default: + return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * + * + * @generated + */ + @Override + public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) { + if (baseClass == ContainerBorderStyle.class) { + switch (baseFeatureID) { + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR: + return ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR; + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS: + return ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS; + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE: + return ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE; + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + return ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE; + default: + return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (this.eIsProxy()) + return super.toString(); + + String result = super.toString() + " (borderRadius: " + + this.borderRadius + + ", borderSize: " + + this.borderSize + + ", borderLineStyle: " + + this.borderLineStyle + + ')'; + return result; + } + +} // ConditionalContainerBorderStyleImpl diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ContainerBorderStyleImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ContainerBorderStyleImpl.java new file mode 100644 index 0000000000..a86082c9c1 --- /dev/null +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ContainerBorderStyleImpl.java @@ -0,0 +1,353 @@ +/******************************************************************************* + * Copyright (c) 2021, 2023 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.view.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.sirius.components.view.ContainerBorderLineStyle; +import org.eclipse.sirius.components.view.ContainerBorderStyle; +import org.eclipse.sirius.components.view.UserColor; +import org.eclipse.sirius.components.view.ViewPackage; + +/** + * An implementation of the model object 'Container Border Style'. + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.impl.ContainerBorderStyleImpl#getBorderColor Border + * Color}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.ContainerBorderStyleImpl#getBorderRadius Border + * Radius}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.ContainerBorderStyleImpl#getBorderSize Border Size}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.ContainerBorderStyleImpl#getBorderLineStyle Border Line + * Style}
    • + *
    + * + * @generated + */ +public class ContainerBorderStyleImpl extends MinimalEObjectImpl.Container implements ContainerBorderStyle { + + /** + * The cached value of the '{@link #getBorderColor() Border Color}' reference. + * + * @generated + * @ordered + * @see #getBorderColor() + */ + protected UserColor borderColor; + + /** + * The default value of the '{@link #getBorderRadius() Border Radius}' attribute. + * + * + * @generated + * @ordered + * @see #getBorderRadius() + */ + protected static final int BORDER_RADIUS_EDEFAULT = 3; + + /** + * The cached value of the '{@link #getBorderRadius() Border Radius}' attribute. + * + * + * @generated + * @ordered + * @see #getBorderRadius() + */ + protected int borderRadius = BORDER_RADIUS_EDEFAULT; + + /** + * The default value of the '{@link #getBorderSize() Border Size}' attribute. + * + * @generated + * @ordered + * @see #getBorderSize() + */ + protected static final int BORDER_SIZE_EDEFAULT = 1; + + /** + * The cached value of the '{@link #getBorderSize() Border Size}' attribute. + * + * @generated + * @ordered + * @see #getBorderSize() + */ + protected int borderSize = BORDER_SIZE_EDEFAULT; + + /** + * The default value of the '{@link #getBorderLineStyle() Border Line Style}' attribute. + * + * @generated + * @ordered + * @see #getBorderLineStyle() + */ + protected static final ContainerBorderLineStyle BORDER_LINE_STYLE_EDEFAULT = ContainerBorderLineStyle.SOLID; + + /** + * The cached value of the '{@link #getBorderLineStyle() Border Line Style}' attribute. + * + * @generated + * @ordered + * @see #getBorderLineStyle() + */ + protected ContainerBorderLineStyle borderLineStyle = BORDER_LINE_STYLE_EDEFAULT; + + /** + * + * + * @generated + */ + protected ContainerBorderStyleImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ViewPackage.Literals.CONTAINER_BORDER_STYLE; + } + + /** + * + * + * @generated + */ + @Override + public UserColor getBorderColor() { + if (this.borderColor != null && this.borderColor.eIsProxy()) { + InternalEObject oldBorderColor = (InternalEObject) this.borderColor; + this.borderColor = (UserColor) this.eResolveProxy(oldBorderColor); + if (this.borderColor != oldBorderColor) { + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.RESOLVE, ViewPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR, oldBorderColor, this.borderColor)); + } + } + return this.borderColor; + } + + /** + * + * + * @generated + */ + @Override + public void setBorderColor(UserColor newBorderColor) { + UserColor oldBorderColor = this.borderColor; + this.borderColor = newBorderColor; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR, oldBorderColor, this.borderColor)); + } + + /** + * + * + * @generated + */ + public UserColor basicGetBorderColor() { + return this.borderColor; + } + + /** + * + * + * @generated + */ + @Override + public int getBorderRadius() { + return this.borderRadius; + } + + /** + * + * + * @generated + */ + @Override + public void setBorderRadius(int newBorderRadius) { + int oldBorderRadius = this.borderRadius; + this.borderRadius = newBorderRadius; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS, oldBorderRadius, this.borderRadius)); + } + + /** + * + * + * @generated + */ + @Override + public int getBorderSize() { + return this.borderSize; + } + + /** + * + * + * @generated + */ + @Override + public void setBorderSize(int newBorderSize) { + int oldBorderSize = this.borderSize; + this.borderSize = newBorderSize; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE, oldBorderSize, this.borderSize)); + } + + /** + * + * + * @generated + */ + @Override + public ContainerBorderLineStyle getBorderLineStyle() { + return this.borderLineStyle; + } + + /** + * + * + * @generated + */ + @Override + public void setBorderLineStyle(ContainerBorderLineStyle newBorderLineStyle) { + ContainerBorderLineStyle oldBorderLineStyle = this.borderLineStyle; + this.borderLineStyle = newBorderLineStyle == null ? BORDER_LINE_STYLE_EDEFAULT : newBorderLineStyle; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE, oldBorderLineStyle, this.borderLineStyle)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR: + if (resolve) + return this.getBorderColor(); + return this.basicGetBorderColor(); + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS: + return this.getBorderRadius(); + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE: + return this.getBorderSize(); + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + return this.getBorderLineStyle(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR: + this.setBorderColor((UserColor) newValue); + return; + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS: + this.setBorderRadius((Integer) newValue); + return; + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE: + this.setBorderSize((Integer) newValue); + return; + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + this.setBorderLineStyle((ContainerBorderLineStyle) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR: + this.setBorderColor(null); + return; + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS: + this.setBorderRadius(BORDER_RADIUS_EDEFAULT); + return; + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE: + this.setBorderSize(BORDER_SIZE_EDEFAULT); + return; + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + this.setBorderLineStyle(BORDER_LINE_STYLE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR: + return this.borderColor != null; + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS: + return this.borderRadius != BORDER_RADIUS_EDEFAULT; + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE: + return this.borderSize != BORDER_SIZE_EDEFAULT; + case ViewPackage.CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + return this.borderLineStyle != BORDER_LINE_STYLE_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (this.eIsProxy()) + return super.toString(); + + String result = super.toString() + " (borderRadius: " + + this.borderRadius + + ", borderSize: " + + this.borderSize + + ", borderLineStyle: " + + this.borderLineStyle + + ')'; + return result; + } + +} // ContainerBorderStyleImpl diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/FlexboxContainerDescriptionImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/FlexboxContainerDescriptionImpl.java index bb449e78df..93432628f9 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/FlexboxContainerDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/FlexboxContainerDescriptionImpl.java @@ -1,4 +1,4 @@ -/** +/******************************************************************************* * Copyright (c) 2021, 2023 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 @@ -8,8 +8,8 @@ * SPDX-License-Identifier: EPL-2.0 * * Contributors: - * Obeo - initial API and implementation - */ + * Obeo - initial API and implementation + *******************************************************************************/ package org.eclipse.sirius.components.view.impl; import java.util.Collection; @@ -22,6 +22,8 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.sirius.components.view.ConditionalContainerBorderStyle; +import org.eclipse.sirius.components.view.ContainerBorderStyle; import org.eclipse.sirius.components.view.FlexDirection; import org.eclipse.sirius.components.view.FlexboxContainerDescription; import org.eclipse.sirius.components.view.ViewPackage; @@ -38,6 +40,10 @@ * Children} *
  • {@link org.eclipse.sirius.components.view.impl.FlexboxContainerDescriptionImpl#getFlexDirection Flex * Direction}
  • + *
  • {@link org.eclipse.sirius.components.view.impl.FlexboxContainerDescriptionImpl#getBorderStyle Border + * Style}
  • + *
  • {@link org.eclipse.sirius.components.view.impl.FlexboxContainerDescriptionImpl#getConditionalBorderStyles + * Conditional Border Styles}
  • * * * @generated @@ -67,12 +73,32 @@ public class FlexboxContainerDescriptionImpl extends WidgetDescriptionImpl imple * The cached value of the '{@link #getFlexDirection() Flex Direction}' attribute. * * - * @see #getFlexDirection() * @generated * @ordered + * @see #getFlexDirection() */ protected FlexDirection flexDirection = FLEX_DIRECTION_EDEFAULT; + /** + * The cached value of the '{@link #getBorderStyle() Border Style}' containment reference. + * + * @generated + * @ordered + * @see #getBorderStyle() + */ + protected ContainerBorderStyle borderStyle; + + /** + * The cached value of the '{@link #getConditionalBorderStyles() Conditional Border Styles}' containment + * reference list. + * + * @generated + * @ordered + * @see #getConditionalBorderStyles() + */ + protected EList conditionalBorderStyles; + /** * * @@ -128,6 +154,68 @@ public void setFlexDirection(FlexDirection newFlexDirection) { this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__FLEX_DIRECTION, oldFlexDirection, this.flexDirection)); } + /** + * + * + * @generated + */ + @Override + public ContainerBorderStyle getBorderStyle() { + return this.borderStyle; + } + + /** + * + * + * @generated + */ + @Override + public void setBorderStyle(ContainerBorderStyle newBorderStyle) { + if (newBorderStyle != this.borderStyle) { + NotificationChain msgs = null; + if (this.borderStyle != null) + msgs = ((InternalEObject) this.borderStyle).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE, null, msgs); + if (newBorderStyle != null) + msgs = ((InternalEObject) newBorderStyle).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE, null, msgs); + msgs = this.basicSetBorderStyle(newBorderStyle, msgs); + if (msgs != null) + msgs.dispatch(); + } else if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE, newBorderStyle, newBorderStyle)); + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetBorderStyle(ContainerBorderStyle newBorderStyle, NotificationChain msgs) { + ContainerBorderStyle oldBorderStyle = this.borderStyle; + this.borderStyle = newBorderStyle; + if (this.eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE, oldBorderStyle, newBorderStyle); + if (msgs == null) + msgs = notification; + else + msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + @Override + public EList getConditionalBorderStyles() { + if (this.conditionalBorderStyles == null) { + this.conditionalBorderStyles = new EObjectContainmentEList<>(ConditionalContainerBorderStyle.class, this, + ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES); + } + return this.conditionalBorderStyles; + } + /** * * @@ -138,6 +226,10 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, switch (featureID) { case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__CHILDREN: return ((InternalEList) this.getChildren()).basicRemove(otherEnd, msgs); + case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE: + return this.basicSetBorderStyle(null, msgs); + case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + return ((InternalEList) this.getConditionalBorderStyles()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -154,6 +246,10 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getChildren(); case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__FLEX_DIRECTION: return this.getFlexDirection(); + case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE: + return this.getBorderStyle(); + case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + return this.getConditionalBorderStyles(); } return super.eGet(featureID, resolve, coreType); } @@ -174,6 +270,13 @@ public void eSet(int featureID, Object newValue) { case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__FLEX_DIRECTION: this.setFlexDirection((FlexDirection) newValue); return; + case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE: + this.setBorderStyle((ContainerBorderStyle) newValue); + return; + case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + this.getConditionalBorderStyles().clear(); + this.getConditionalBorderStyles().addAll((Collection) newValue); + return; } super.eSet(featureID, newValue); } @@ -192,6 +295,12 @@ public void eUnset(int featureID) { case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__FLEX_DIRECTION: this.setFlexDirection(FLEX_DIRECTION_EDEFAULT); return; + case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE: + this.setBorderStyle((ContainerBorderStyle) null); + return; + case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + this.getConditionalBorderStyles().clear(); + return; } super.eUnset(featureID); } @@ -208,6 +317,10 @@ public boolean eIsSet(int featureID) { return this.children != null && !this.children.isEmpty(); case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__FLEX_DIRECTION: return this.flexDirection != FLEX_DIRECTION_EDEFAULT; + case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE: + return this.borderStyle != null; + case ViewPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + return this.conditionalBorderStyles != null && !this.conditionalBorderStyles.isEmpty(); } return super.eIsSet(featureID); } diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/GroupDescriptionImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/GroupDescriptionImpl.java index c3980fef96..f4b5ae807c 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/GroupDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/GroupDescriptionImpl.java @@ -1,4 +1,4 @@ -/** +/******************************************************************************* * Copyright (c) 2021, 2023 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 @@ -8,8 +8,8 @@ * SPDX-License-Identifier: EPL-2.0 * * Contributors: - * Obeo - initial API and implementation - */ + * Obeo - initial API and implementation + *******************************************************************************/ package org.eclipse.sirius.components.view.impl; import java.util.Collection; @@ -24,6 +24,8 @@ import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.sirius.components.view.ButtonDescription; +import org.eclipse.sirius.components.view.ConditionalContainerBorderStyle; +import org.eclipse.sirius.components.view.ContainerBorderStyle; import org.eclipse.sirius.components.view.GroupDescription; import org.eclipse.sirius.components.view.GroupDisplayMode; import org.eclipse.sirius.components.view.ViewPackage; @@ -138,12 +140,32 @@ public class GroupDescriptionImpl extends MinimalEObjectImpl.Container implement * The cached value of the '{@link #getWidgets() Widgets}' containment reference list. * - * @see #getWidgets() * @generated * @ordered + * @see #getWidgets() */ protected EList widgets; + /** + * The cached value of the '{@link #getBorderStyle() Border Style}' containment reference. + * + * @generated + * @ordered + * @see #getBorderStyle() + */ + protected ContainerBorderStyle borderStyle; + + /** + * The cached value of the '{@link #getConditionalBorderStyles() Conditional Border Styles}' containment + * reference list. + * + * @generated + * @ordered + * @see #getConditionalBorderStyles() + */ + protected EList conditionalBorderStyles; + /** * * @@ -282,6 +304,68 @@ public EList getWidgets() { return this.widgets; } + /** + * + * + * @generated + */ + @Override + public ContainerBorderStyle getBorderStyle() { + return this.borderStyle; + } + + /** + * + * + * @generated + */ + @Override + public void setBorderStyle(ContainerBorderStyle newBorderStyle) { + if (newBorderStyle != this.borderStyle) { + NotificationChain msgs = null; + if (this.borderStyle != null) + msgs = ((InternalEObject) this.borderStyle).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ViewPackage.GROUP_DESCRIPTION__BORDER_STYLE, null, msgs); + if (newBorderStyle != null) + msgs = ((InternalEObject) newBorderStyle).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ViewPackage.GROUP_DESCRIPTION__BORDER_STYLE, null, msgs); + msgs = this.basicSetBorderStyle(newBorderStyle, msgs); + if (msgs != null) + msgs.dispatch(); + } else if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.GROUP_DESCRIPTION__BORDER_STYLE, newBorderStyle, newBorderStyle)); + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetBorderStyle(ContainerBorderStyle newBorderStyle, NotificationChain msgs) { + ContainerBorderStyle oldBorderStyle = this.borderStyle; + this.borderStyle = newBorderStyle; + if (this.eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ViewPackage.GROUP_DESCRIPTION__BORDER_STYLE, oldBorderStyle, newBorderStyle); + if (msgs == null) + msgs = notification; + else + msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + @Override + public EList getConditionalBorderStyles() { + if (this.conditionalBorderStyles == null) { + this.conditionalBorderStyles = new EObjectContainmentEList<>(ConditionalContainerBorderStyle.class, this, + ViewPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES); + } + return this.conditionalBorderStyles; + } + /** * * @@ -294,6 +378,10 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, return ((InternalEList) this.getToolbarActions()).basicRemove(otherEnd, msgs); case ViewPackage.GROUP_DESCRIPTION__WIDGETS: return ((InternalEList) this.getWidgets()).basicRemove(otherEnd, msgs); + case ViewPackage.GROUP_DESCRIPTION__BORDER_STYLE: + return this.basicSetBorderStyle(null, msgs); + case ViewPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + return ((InternalEList) this.getConditionalBorderStyles()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -318,6 +406,10 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getToolbarActions(); case ViewPackage.GROUP_DESCRIPTION__WIDGETS: return this.getWidgets(); + case ViewPackage.GROUP_DESCRIPTION__BORDER_STYLE: + return this.getBorderStyle(); + case ViewPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + return this.getConditionalBorderStyles(); } return super.eGet(featureID, resolve, coreType); } @@ -351,6 +443,13 @@ public void eSet(int featureID, Object newValue) { this.getWidgets().clear(); this.getWidgets().addAll((Collection) newValue); return; + case ViewPackage.GROUP_DESCRIPTION__BORDER_STYLE: + this.setBorderStyle((ContainerBorderStyle) newValue); + return; + case ViewPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + this.getConditionalBorderStyles().clear(); + this.getConditionalBorderStyles().addAll((Collection) newValue); + return; } super.eSet(featureID, newValue); } @@ -381,6 +480,12 @@ public void eUnset(int featureID) { case ViewPackage.GROUP_DESCRIPTION__WIDGETS: this.getWidgets().clear(); return; + case ViewPackage.GROUP_DESCRIPTION__BORDER_STYLE: + this.setBorderStyle((ContainerBorderStyle) null); + return; + case ViewPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + this.getConditionalBorderStyles().clear(); + return; } super.eUnset(featureID); } @@ -405,6 +510,10 @@ public boolean eIsSet(int featureID) { return this.toolbarActions != null && !this.toolbarActions.isEmpty(); case ViewPackage.GROUP_DESCRIPTION__WIDGETS: return this.widgets != null && !this.widgets.isEmpty(); + case ViewPackage.GROUP_DESCRIPTION__BORDER_STYLE: + return this.borderStyle != null; + case ViewPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + return this.conditionalBorderStyles != null && !this.conditionalBorderStyles.isEmpty(); } return super.eIsSet(featureID); } diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewFactoryImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewFactoryImpl.java index ddaf1a48db..08fb3c016f 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewFactoryImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewFactoryImpl.java @@ -30,6 +30,7 @@ import org.eclipse.sirius.components.view.ConditionalBarChartDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalButtonDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalCheckboxDescriptionStyle; +import org.eclipse.sirius.components.view.ConditionalContainerBorderStyle; import org.eclipse.sirius.components.view.ConditionalEdgeStyle; import org.eclipse.sirius.components.view.ConditionalLabelDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalLinkDescriptionStyle; @@ -41,6 +42,8 @@ import org.eclipse.sirius.components.view.ConditionalSelectDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalTextareaDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalTextfieldDescriptionStyle; +import org.eclipse.sirius.components.view.ContainerBorderLineStyle; +import org.eclipse.sirius.components.view.ContainerBorderStyle; import org.eclipse.sirius.components.view.CreateInstance; import org.eclipse.sirius.components.view.CreateView; import org.eclipse.sirius.components.view.DeleteElement; @@ -282,6 +285,10 @@ public EObject create(EClass eClass) { return this.createListDescriptionStyle(); case ViewPackage.CONDITIONAL_LIST_DESCRIPTION_STYLE: return this.createConditionalListDescriptionStyle(); + case ViewPackage.CONTAINER_BORDER_STYLE: + return this.createContainerBorderStyle(); + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE: + return this.createConditionalContainerBorderStyle(); case ViewPackage.DIAGRAM_PALETTE: return this.createDiagramPalette(); case ViewPackage.NODE_PALETTE: @@ -317,6 +324,8 @@ public Object createFromString(EDataType eDataType, String initialValue) { return this.createGroupDisplayModeFromString(eDataType, initialValue); case ViewPackage.FLEX_DIRECTION: return this.createFlexDirectionFromString(eDataType, initialValue); + case ViewPackage.CONTAINER_BORDER_LINE_STYLE: + return this.createContainerBorderLineStyleFromString(eDataType, initialValue); case ViewPackage.IDENTIFIER: return this.createIdentifierFromString(eDataType, initialValue); case ViewPackage.INTERPRETED_EXPRESSION: @@ -354,6 +363,8 @@ public String convertToString(EDataType eDataType, Object instanceValue) { return this.convertGroupDisplayModeToString(eDataType, instanceValue); case ViewPackage.FLEX_DIRECTION: return this.convertFlexDirectionToString(eDataType, instanceValue); + case ViewPackage.CONTAINER_BORDER_LINE_STYLE: + return this.convertContainerBorderLineStyleToString(eDataType, instanceValue); case ViewPackage.IDENTIFIER: return this.convertIdentifierToString(eDataType, instanceValue); case ViewPackage.INTERPRETED_EXPRESSION: @@ -1139,6 +1150,28 @@ public ConditionalListDescriptionStyle createConditionalListDescriptionStyle() { return conditionalListDescriptionStyle; } + /** + * + * + * @generated + */ + @Override + public ContainerBorderStyle createContainerBorderStyle() { + ContainerBorderStyleImpl containerBorderStyle = new ContainerBorderStyleImpl(); + return containerBorderStyle; + } + + /** + * + * + * @generated + */ + @Override + public ConditionalContainerBorderStyle createConditionalContainerBorderStyle() { + ConditionalContainerBorderStyleImpl conditionalContainerBorderStyle = new ConditionalContainerBorderStyleImpl(); + return conditionalContainerBorderStyle; + } + /** * * @@ -1330,6 +1363,27 @@ public String convertFlexDirectionToString(EDataType eDataType, Object instanceV return instanceValue == null ? null : instanceValue.toString(); } + /** + * + * + * @generated + */ + public ContainerBorderLineStyle createContainerBorderLineStyleFromString(EDataType eDataType, String initialValue) { + ContainerBorderLineStyle result = ContainerBorderLineStyle.get(initialValue); + if (result == null) + throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertContainerBorderLineStyleToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + /** * * diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewPackageImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewPackageImpl.java index 775d7f32c5..0abb521946 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewPackageImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewPackageImpl.java @@ -19,103 +19,7 @@ import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.sirius.components.view.ArrowStyle; -import org.eclipse.sirius.components.view.BarChartDescription; -import org.eclipse.sirius.components.view.BarChartDescriptionStyle; -import org.eclipse.sirius.components.view.BorderStyle; -import org.eclipse.sirius.components.view.ButtonDescription; -import org.eclipse.sirius.components.view.ButtonDescriptionStyle; -import org.eclipse.sirius.components.view.ChangeContext; -import org.eclipse.sirius.components.view.CheckboxDescription; -import org.eclipse.sirius.components.view.CheckboxDescriptionStyle; -import org.eclipse.sirius.components.view.ColorPalette; -import org.eclipse.sirius.components.view.Conditional; -import org.eclipse.sirius.components.view.ConditionalBarChartDescriptionStyle; -import org.eclipse.sirius.components.view.ConditionalButtonDescriptionStyle; -import org.eclipse.sirius.components.view.ConditionalCheckboxDescriptionStyle; -import org.eclipse.sirius.components.view.ConditionalEdgeStyle; -import org.eclipse.sirius.components.view.ConditionalLabelDescriptionStyle; -import org.eclipse.sirius.components.view.ConditionalLinkDescriptionStyle; -import org.eclipse.sirius.components.view.ConditionalListDescriptionStyle; -import org.eclipse.sirius.components.view.ConditionalMultiSelectDescriptionStyle; -import org.eclipse.sirius.components.view.ConditionalNodeStyle; -import org.eclipse.sirius.components.view.ConditionalPieChartDescriptionStyle; -import org.eclipse.sirius.components.view.ConditionalRadioDescriptionStyle; -import org.eclipse.sirius.components.view.ConditionalSelectDescriptionStyle; -import org.eclipse.sirius.components.view.ConditionalTextareaDescriptionStyle; -import org.eclipse.sirius.components.view.ConditionalTextfieldDescriptionStyle; -import org.eclipse.sirius.components.view.CreateInstance; -import org.eclipse.sirius.components.view.CreateView; -import org.eclipse.sirius.components.view.DeleteElement; -import org.eclipse.sirius.components.view.DeleteTool; -import org.eclipse.sirius.components.view.DeleteView; -import org.eclipse.sirius.components.view.DiagramDescription; -import org.eclipse.sirius.components.view.DiagramElementDescription; -import org.eclipse.sirius.components.view.DiagramPalette; -import org.eclipse.sirius.components.view.DropTool; -import org.eclipse.sirius.components.view.EdgeDescription; -import org.eclipse.sirius.components.view.EdgePalette; -import org.eclipse.sirius.components.view.EdgeReconnectionTool; -import org.eclipse.sirius.components.view.EdgeStyle; -import org.eclipse.sirius.components.view.EdgeTool; -import org.eclipse.sirius.components.view.FixedColor; -import org.eclipse.sirius.components.view.FlexDirection; -import org.eclipse.sirius.components.view.FlexboxContainerDescription; -import org.eclipse.sirius.components.view.FormDescription; -import org.eclipse.sirius.components.view.FreeFormLayoutStrategyDescription; -import org.eclipse.sirius.components.view.GroupDescription; -import org.eclipse.sirius.components.view.GroupDisplayMode; -import org.eclipse.sirius.components.view.IconLabelNodeStyleDescription; -import org.eclipse.sirius.components.view.ImageDescription; -import org.eclipse.sirius.components.view.ImageNodeStyleDescription; -import org.eclipse.sirius.components.view.LabelDescription; -import org.eclipse.sirius.components.view.LabelDescriptionStyle; -import org.eclipse.sirius.components.view.LabelEditTool; -import org.eclipse.sirius.components.view.LabelStyle; -import org.eclipse.sirius.components.view.LayoutDirection; -import org.eclipse.sirius.components.view.LayoutStrategyDescription; -import org.eclipse.sirius.components.view.LineStyle; -import org.eclipse.sirius.components.view.LinkDescription; -import org.eclipse.sirius.components.view.LinkDescriptionStyle; -import org.eclipse.sirius.components.view.ListDescription; -import org.eclipse.sirius.components.view.ListDescriptionStyle; -import org.eclipse.sirius.components.view.ListLayoutStrategyDescription; -import org.eclipse.sirius.components.view.MultiSelectDescription; -import org.eclipse.sirius.components.view.MultiSelectDescriptionStyle; -import org.eclipse.sirius.components.view.NodeContainmentKind; -import org.eclipse.sirius.components.view.NodeDescription; -import org.eclipse.sirius.components.view.NodePalette; -import org.eclipse.sirius.components.view.NodeStyleDescription; -import org.eclipse.sirius.components.view.NodeTool; -import org.eclipse.sirius.components.view.Operation; -import org.eclipse.sirius.components.view.PageDescription; -import org.eclipse.sirius.components.view.PieChartDescription; -import org.eclipse.sirius.components.view.PieChartDescriptionStyle; -import org.eclipse.sirius.components.view.RadioDescription; -import org.eclipse.sirius.components.view.RadioDescriptionStyle; -import org.eclipse.sirius.components.view.RectangularNodeStyleDescription; -import org.eclipse.sirius.components.view.RepresentationDescription; -import org.eclipse.sirius.components.view.RichTextDescription; -import org.eclipse.sirius.components.view.SelectDescription; -import org.eclipse.sirius.components.view.SelectDescriptionStyle; -import org.eclipse.sirius.components.view.SelectionDescription; -import org.eclipse.sirius.components.view.SetValue; -import org.eclipse.sirius.components.view.SourceEdgeEndReconnectionTool; -import org.eclipse.sirius.components.view.Style; -import org.eclipse.sirius.components.view.SynchronizationPolicy; -import org.eclipse.sirius.components.view.TargetEdgeEndReconnectionTool; -import org.eclipse.sirius.components.view.TextAreaDescription; -import org.eclipse.sirius.components.view.TextareaDescriptionStyle; -import org.eclipse.sirius.components.view.TextfieldDescription; -import org.eclipse.sirius.components.view.TextfieldDescriptionStyle; -import org.eclipse.sirius.components.view.Tool; -import org.eclipse.sirius.components.view.UnsetValue; -import org.eclipse.sirius.components.view.UserColor; -import org.eclipse.sirius.components.view.View; -import org.eclipse.sirius.components.view.ViewFactory; -import org.eclipse.sirius.components.view.ViewPackage; -import org.eclipse.sirius.components.view.WidgetDescription; -import org.eclipse.sirius.components.view.WidgetDescriptionStyle; +import org.eclipse.sirius.components.view.*; /** * An implementation of the model Package. @@ -711,6 +615,20 @@ public class ViewPackageImpl extends EPackageImpl implements ViewPackage { */ private EClass conditionalListDescriptionStyleEClass = null; + /** + * + * + * @generated + */ + private EClass containerBorderStyleEClass = null; + + /** + * + * + * @generated + */ + private EClass conditionalContainerBorderStyleEClass = null; + /** * * @@ -788,6 +706,13 @@ public class ViewPackageImpl extends EPackageImpl implements ViewPackage { */ private EEnum flexDirectionEEnum = null; + /** + * + * + * @generated + */ + private EEnum containerBorderLineStyleEEnum = null; + /** * * @@ -2284,6 +2209,26 @@ public EReference getGroupDescription_Widgets() { return (EReference) this.groupDescriptionEClass.getEStructuralFeatures().get(5); } + /** + * + * + * @generated + */ + @Override + public EReference getGroupDescription_BorderStyle() { + return (EReference) this.groupDescriptionEClass.getEStructuralFeatures().get(6); + } + + /** + * + * + * @generated + */ + @Override + public EReference getGroupDescription_ConditionalBorderStyles() { + return (EReference) this.groupDescriptionEClass.getEStructuralFeatures().get(7); + } + /** * * @@ -2874,6 +2819,26 @@ public EAttribute getFlexboxContainerDescription_FlexDirection() { return (EAttribute) this.flexboxContainerDescriptionEClass.getEStructuralFeatures().get(1); } + /** + * + * + * @generated + */ + @Override + public EReference getFlexboxContainerDescription_BorderStyle() { + return (EReference) this.flexboxContainerDescriptionEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + @Override + public EReference getFlexboxContainerDescription_ConditionalBorderStyles() { + return (EReference) this.flexboxContainerDescriptionEClass.getEStructuralFeatures().get(3); + } + /** * * @@ -3574,6 +3539,66 @@ public EClass getConditionalListDescriptionStyle() { return this.conditionalListDescriptionStyleEClass; } + /** + * + * + * @generated + */ + @Override + public EClass getContainerBorderStyle() { + return this.containerBorderStyleEClass; + } + + /** + * + * + * @generated + */ + @Override + public EReference getContainerBorderStyle_BorderColor() { + return (EReference) this.containerBorderStyleEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getContainerBorderStyle_BorderRadius() { + return (EAttribute) this.containerBorderStyleEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getContainerBorderStyle_BorderSize() { + return (EAttribute) this.containerBorderStyleEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getContainerBorderStyle_BorderLineStyle() { + return (EAttribute) this.containerBorderStyleEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + @Override + public EClass getConditionalContainerBorderStyle() { + return this.conditionalContainerBorderStyleEClass; + } + /** * * @@ -3824,6 +3849,16 @@ public EEnum getFlexDirection() { return this.flexDirectionEEnum; } + /** + * + * + * @generated + */ + @Override + public EEnum getContainerBorderLineStyle() { + return this.containerBorderLineStyleEEnum; + } + /** * * @@ -4085,6 +4120,8 @@ public void createPackageContents() { this.createEAttribute(this.groupDescriptionEClass, GROUP_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION); this.createEReference(this.groupDescriptionEClass, GROUP_DESCRIPTION__TOOLBAR_ACTIONS); this.createEReference(this.groupDescriptionEClass, GROUP_DESCRIPTION__WIDGETS); + this.createEReference(this.groupDescriptionEClass, GROUP_DESCRIPTION__BORDER_STYLE); + this.createEReference(this.groupDescriptionEClass, GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES); this.widgetDescriptionEClass = this.createEClass(WIDGET_DESCRIPTION); this.createEAttribute(this.widgetDescriptionEClass, WIDGET_DESCRIPTION__NAME); @@ -4155,6 +4192,8 @@ public void createPackageContents() { this.flexboxContainerDescriptionEClass = this.createEClass(FLEXBOX_CONTAINER_DESCRIPTION); this.createEReference(this.flexboxContainerDescriptionEClass, FLEXBOX_CONTAINER_DESCRIPTION__CHILDREN); this.createEAttribute(this.flexboxContainerDescriptionEClass, FLEXBOX_CONTAINER_DESCRIPTION__FLEX_DIRECTION); + this.createEReference(this.flexboxContainerDescriptionEClass, FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE); + this.createEReference(this.flexboxContainerDescriptionEClass, FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES); this.buttonDescriptionEClass = this.createEClass(BUTTON_DESCRIPTION); this.createEAttribute(this.buttonDescriptionEClass, BUTTON_DESCRIPTION__BUTTON_LABEL_EXPRESSION); @@ -4256,6 +4295,14 @@ public void createPackageContents() { this.conditionalListDescriptionStyleEClass = this.createEClass(CONDITIONAL_LIST_DESCRIPTION_STYLE); + this.containerBorderStyleEClass = this.createEClass(CONTAINER_BORDER_STYLE); + this.createEReference(this.containerBorderStyleEClass, CONTAINER_BORDER_STYLE__BORDER_COLOR); + this.createEAttribute(this.containerBorderStyleEClass, CONTAINER_BORDER_STYLE__BORDER_RADIUS); + this.createEAttribute(this.containerBorderStyleEClass, CONTAINER_BORDER_STYLE__BORDER_SIZE); + this.createEAttribute(this.containerBorderStyleEClass, CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE); + + this.conditionalContainerBorderStyleEClass = this.createEClass(CONDITIONAL_CONTAINER_BORDER_STYLE); + this.diagramPaletteEClass = this.createEClass(DIAGRAM_PALETTE); this.createEReference(this.diagramPaletteEClass, DIAGRAM_PALETTE__DROP_TOOL); this.createEReference(this.diagramPaletteEClass, DIAGRAM_PALETTE__NODE_TOOLS); @@ -4286,6 +4333,7 @@ public void createPackageContents() { this.synchronizationPolicyEEnum = this.createEEnum(SYNCHRONIZATION_POLICY); this.groupDisplayModeEEnum = this.createEEnum(GROUP_DISPLAY_MODE); this.flexDirectionEEnum = this.createEEnum(FLEX_DIRECTION); + this.containerBorderLineStyleEEnum = this.createEEnum(CONTAINER_BORDER_LINE_STYLE); // Create data types this.identifierEDataType = this.createEDataType(IDENTIFIER); @@ -4418,6 +4466,8 @@ public void initializePackageContents() { this.listDescriptionStyleEClass.getESuperTypes().add(this.getLabelStyle()); this.conditionalListDescriptionStyleEClass.getESuperTypes().add(this.getConditional()); this.conditionalListDescriptionStyleEClass.getESuperTypes().add(this.getListDescriptionStyle()); + this.conditionalContainerBorderStyleEClass.getESuperTypes().add(this.getConditional()); + this.conditionalContainerBorderStyleEClass.getESuperTypes().add(this.getContainerBorderStyle()); // Initialize classes, features, and operations; add parameters this.initEClass(this.viewEClass, View.class, "View", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -4700,6 +4750,10 @@ public void initializePackageContents() { IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEReference(this.getGroupDescription_Widgets(), this.getWidgetDescription(), null, "widgets", null, 0, -1, GroupDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getGroupDescription_BorderStyle(), this.getContainerBorderStyle(), null, "borderStyle", null, 0, 1, GroupDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getGroupDescription_ConditionalBorderStyles(), this.getConditionalContainerBorderStyle(), null, "conditionalBorderStyles", null, 0, -1, GroupDescription.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEClass(this.widgetDescriptionEClass, WidgetDescription.class, "WidgetDescription", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); this.initEAttribute(this.getWidgetDescription_Name(), this.getIdentifier(), "name", null, 0, 1, WidgetDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, @@ -4818,6 +4872,10 @@ public void initializePackageContents() { IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getFlexboxContainerDescription_FlexDirection(), this.getFlexDirection(), "flexDirection", "row", 1, 1, FlexboxContainerDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getFlexboxContainerDescription_BorderStyle(), this.getContainerBorderStyle(), null, "borderStyle", null, 0, 1, FlexboxContainerDescription.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getFlexboxContainerDescription_ConditionalBorderStyles(), this.getConditionalContainerBorderStyle(), null, "conditionalBorderStyles", null, 0, -1, + FlexboxContainerDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEClass(this.buttonDescriptionEClass, ButtonDescription.class, "ButtonDescription", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); this.initEAttribute(this.getButtonDescription_ButtonLabelExpression(), this.getInterpretedExpression(), "buttonLabelExpression", null, 0, 1, ButtonDescription.class, !IS_TRANSIENT, @@ -4969,6 +5027,18 @@ public void initializePackageContents() { this.initEClass(this.conditionalListDescriptionStyleEClass, ConditionalListDescriptionStyle.class, "ConditionalListDescriptionStyle", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + this.initEClass(this.containerBorderStyleEClass, ContainerBorderStyle.class, "ContainerBorderStyle", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + this.initEReference(this.getContainerBorderStyle_BorderColor(), this.getUserColor(), null, "borderColor", null, 1, 1, ContainerBorderStyle.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getContainerBorderStyle_BorderRadius(), this.getLength(), "borderRadius", "3", 1, 1, ContainerBorderStyle.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getContainerBorderStyle_BorderSize(), this.getLength(), "borderSize", "1", 1, 1, ContainerBorderStyle.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getContainerBorderStyle_BorderLineStyle(), this.getContainerBorderLineStyle(), "borderLineStyle", null, 0, 1, ContainerBorderStyle.class, !IS_TRANSIENT, !IS_VOLATILE, + IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + this.initEClass(this.conditionalContainerBorderStyleEClass, ConditionalContainerBorderStyle.class, "ConditionalContainerBorderStyle", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + this.initEClass(this.diagramPaletteEClass, DiagramPalette.class, "DiagramPalette", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); this.initEReference(this.getDiagramPalette_DropTool(), this.getDropTool(), null, "dropTool", null, 0, 1, DiagramPalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -5049,6 +5119,11 @@ public void initializePackageContents() { this.addEEnumLiteral(this.flexDirectionEEnum, FlexDirection.COLUMN); this.addEEnumLiteral(this.flexDirectionEEnum, FlexDirection.COLUMN_REVERSE); + this.initEEnum(this.containerBorderLineStyleEEnum, ContainerBorderLineStyle.class, "ContainerBorderLineStyle"); + this.addEEnumLiteral(this.containerBorderLineStyleEEnum, ContainerBorderLineStyle.SOLID); + this.addEEnumLiteral(this.containerBorderLineStyleEEnum, ContainerBorderLineStyle.DASHED); + this.addEEnumLiteral(this.containerBorderLineStyleEEnum, ContainerBorderLineStyle.DOTTED); + // Initialize data types this.initEDataType(this.identifierEDataType, String.class, "Identifier", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); this.initEDataType(this.interpretedExpressionEDataType, String.class, "InterpretedExpression", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewAdapterFactory.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewAdapterFactory.java index eca5690a0d..6bab5715b3 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewAdapterFactory.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewAdapterFactory.java @@ -29,6 +29,7 @@ import org.eclipse.sirius.components.view.ConditionalBarChartDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalButtonDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalCheckboxDescriptionStyle; +import org.eclipse.sirius.components.view.ConditionalContainerBorderStyle; import org.eclipse.sirius.components.view.ConditionalEdgeStyle; import org.eclipse.sirius.components.view.ConditionalLabelDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalLinkDescriptionStyle; @@ -40,6 +41,7 @@ import org.eclipse.sirius.components.view.ConditionalSelectDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalTextareaDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalTextfieldDescriptionStyle; +import org.eclipse.sirius.components.view.ContainerBorderStyle; import org.eclipse.sirius.components.view.CreateInstance; import org.eclipse.sirius.components.view.CreateView; import org.eclipse.sirius.components.view.DeleteElement; @@ -577,6 +579,16 @@ public Adapter caseConditionalListDescriptionStyle(ConditionalListDescriptionSty return ViewAdapterFactory.this.createConditionalListDescriptionStyleAdapter(); } + @Override + public Adapter caseContainerBorderStyle(ContainerBorderStyle object) { + return ViewAdapterFactory.this.createContainerBorderStyleAdapter(); + } + + @Override + public Adapter caseConditionalContainerBorderStyle(ConditionalContainerBorderStyle object) { + return ViewAdapterFactory.this.createConditionalContainerBorderStyleAdapter(); + } + @Override public Adapter caseDiagramPalette(DiagramPalette object) { return ViewAdapterFactory.this.createDiagramPaletteAdapter(); @@ -1771,6 +1783,34 @@ public Adapter createConditionalListDescriptionStyleAdapter() { return null; } + /** + * Creates a new adapter for an object of class '{@link org.eclipse.sirius.components.view.ContainerBorderStyle + * Container Border Style}'. This default implementation returns null so that we + * can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @generated + * @see org.eclipse.sirius.components.view.ContainerBorderStyle + */ + public Adapter createContainerBorderStyleAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class + * '{@link org.eclipse.sirius.components.view.ConditionalContainerBorderStyle Conditional Container Border + * Style}'. This default implementation returns null so that we can easily ignore + * cases; it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @generated + * @see org.eclipse.sirius.components.view.ConditionalContainerBorderStyle + */ + public Adapter createConditionalContainerBorderStyleAdapter() { + return null; + } + /** * Creates a new adapter for an object of class '{@link org.eclipse.sirius.components.view.DiagramPalette * Diagram Palette}'. This default implementation returns null so that we can diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewSwitch.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewSwitch.java index 068fee48e9..9dc635b8b3 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewSwitch.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewSwitch.java @@ -28,6 +28,7 @@ import org.eclipse.sirius.components.view.ConditionalBarChartDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalButtonDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalCheckboxDescriptionStyle; +import org.eclipse.sirius.components.view.ConditionalContainerBorderStyle; import org.eclipse.sirius.components.view.ConditionalEdgeStyle; import org.eclipse.sirius.components.view.ConditionalLabelDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalLinkDescriptionStyle; @@ -39,6 +40,7 @@ import org.eclipse.sirius.components.view.ConditionalSelectDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalTextareaDescriptionStyle; import org.eclipse.sirius.components.view.ConditionalTextfieldDescriptionStyle; +import org.eclipse.sirius.components.view.ContainerBorderStyle; import org.eclipse.sirius.components.view.CreateInstance; import org.eclipse.sirius.components.view.CreateView; import org.eclipse.sirius.components.view.DeleteElement; @@ -1006,6 +1008,24 @@ protected T doSwitch(int classifierID, EObject theEObject) { result = this.defaultCase(theEObject); return result; } + case ViewPackage.CONTAINER_BORDER_STYLE: { + ContainerBorderStyle containerBorderStyle = (ContainerBorderStyle) theEObject; + T result = this.caseContainerBorderStyle(containerBorderStyle); + if (result == null) + result = this.defaultCase(theEObject); + return result; + } + case ViewPackage.CONDITIONAL_CONTAINER_BORDER_STYLE: { + ConditionalContainerBorderStyle conditionalContainerBorderStyle = (ConditionalContainerBorderStyle) theEObject; + T result = this.caseConditionalContainerBorderStyle(conditionalContainerBorderStyle); + if (result == null) + result = this.caseConditional(conditionalContainerBorderStyle); + if (result == null) + result = this.caseContainerBorderStyle(conditionalContainerBorderStyle); + if (result == null) + result = this.defaultCase(theEObject); + return result; + } case ViewPackage.DIAGRAM_PALETTE: { DiagramPalette diagramPalette = (DiagramPalette) theEObject; T result = this.caseDiagramPalette(diagramPalette); @@ -2286,6 +2306,34 @@ public T caseConditionalListDescriptionStyle(ConditionalListDescriptionStyle obj return null; } + /** + * Returns the result of interpreting the object as an instance of 'Container Border Style'. This implementation returns null; returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Container Border Style'. + * @generated + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + */ + public T caseContainerBorderStyle(ContainerBorderStyle object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Conditional Container Border Style'. + * This implementation returns null; returning a non-null result will terminate the switch. + * + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Conditional Container Border Style'. + * @generated + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + */ + public T caseConditionalContainerBorderStyle(ConditionalContainerBorderStyle object) { + return null; + } + /** * Returns the result of interpreting the object as an instance of 'Diagram Palette'. This implementation returns null; returning a non-null result will terminate the switch.