diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 94d8c92da1..8d7acd9981 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -46,6 +46,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/2056[#2056] [form] Add the possibility to control read-only mode for widgets with an expression. +- 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 8f6e499c49..59b6e48fbe 100644 --- a/integration-tests/cypress/e2e/project/edit/formdescriptioneditor.cy.js +++ b/integration-tests/cypress/e2e/project/edit/formdescriptioneditor.cy.js @@ -233,4 +233,50 @@ describe('/projects/:projectId/edit - FormDescriptionEditor', () => { checkWidgetIsEnabledExpression('Toolbar Actions Button', 'exist'); checkWidgetIsEnabledExpression('Widgets Slider', 'exist'); }); + + 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/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/ContainerBorderStyleProvider.java b/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/ContainerBorderStyleProvider.java new file mode 100644 index 0000000000..f2c83348fb --- /dev/null +++ b/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/ContainerBorderStyleProvider.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * 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.formdescriptioneditors.components; + +import java.util.Objects; + +import org.eclipse.sirius.components.forms.ContainerBorderLineStyle; +import org.eclipse.sirius.components.forms.ContainerBorderStyle; +import org.eclipse.sirius.components.view.FixedColor; + +/** + * The style provider for the Border Style of the View DSL. This only handles "static" or "preview" styles. + * + * @author frouene + */ +public class ContainerBorderStyleProvider { + + private final org.eclipse.sirius.components.view.form.ContainerBorderStyle viewStyle; + + public ContainerBorderStyleProvider(org.eclipse.sirius.components.view.form.ContainerBorderStyle viewStyle) { + this.viewStyle = Objects.requireNonNull(viewStyle); + } + + public ContainerBorderStyle build() { + ContainerBorderStyle.Builder containerBorderStyle = ContainerBorderStyle + .newContainerBorderStyle() + .size(this.viewStyle.getBorderSize()) + .radius(this.viewStyle.getBorderRadius()) + .lineStyle(ContainerBorderLineStyle.valueOf(this.viewStyle.getBorderLineStyle().getLiteral())); + + if (this.viewStyle.getBorderColor() instanceof FixedColor fixedColor) { + String color = fixedColor.getValue(); + if (color != null && !color.isBlank()) { + containerBorderStyle.color(color); + } + } + + + return containerBorderStyle.build(); + } +} diff --git a/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/FormDescriptionEditorGroupComponent.java b/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/FormDescriptionEditorGroupComponent.java index 00e2c0ab95..ba8a4ab0d2 100644 --- a/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/FormDescriptionEditorGroupComponent.java +++ b/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/FormDescriptionEditorGroupComponent.java @@ -81,13 +81,15 @@ public Element render() { childrenWidgets.add(new Element(WidgetComponent.class, widgetComponentProps)); }); - GroupElementProps groupElementProps = GroupElementProps.newGroupElementProps(id) + GroupElementProps.Builder groupElementPropsBuilder = GroupElementProps.newGroupElementProps(id) .label(label) .displayMode(this.getGroupDisplayMode(groupDescription)) - .children(childrenWidgets) - .build(); + .children(childrenWidgets); + if (groupDescription.getBorderStyle() != null) { + groupElementPropsBuilder.borderStyle(new ContainerBorderStyleProvider(groupDescription.getBorderStyle()).build()); + } - return new Element(GroupElementProps.TYPE, groupElementProps); + return new Element(GroupElementProps.TYPE, groupElementPropsBuilder.build()); } public String getGroupLabel(org.eclipse.sirius.components.view.form.GroupDescription groupDescription, String defaultLabel) { @@ -106,4 +108,5 @@ private GroupDisplayMode getGroupDisplayMode(GroupDescription viewGroupDescripti org.eclipse.sirius.components.view.form.GroupDisplayMode viewDisplayMode = viewGroupDescription.getDisplayMode(); return GroupDisplayMode.valueOf(viewDisplayMode.getLiteral()); } + } diff --git a/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/ViewFormDescriptionEditorConverterSwitch.java b/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/ViewFormDescriptionEditorConverterSwitch.java index ebcbc717c3..c04d625e72 100644 --- a/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/ViewFormDescriptionEditorConverterSwitch.java +++ b/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/ViewFormDescriptionEditorConverterSwitch.java @@ -27,6 +27,7 @@ import org.eclipse.sirius.components.formdescriptioneditors.description.FormDescriptionEditorDescription; 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; @@ -287,6 +288,13 @@ public AbstractWidgetDescription caseFlexboxContainerDescription(org.eclipse.sir children.add(ViewFormDescriptionEditorConverterSwitch.this.doSwitch(viewWidgetDescription)); }); + Function borderStyleProvider = vm -> { + org.eclipse.sirius.components.view.form.ContainerBorderStyle style = viewFlexboxContainerDescription.getBorderStyle(); + if (style == null) { + return null; + } + return new ContainerBorderStyleProvider(style).build(); + }; FlexboxContainerDescription.Builder builder = FlexboxContainerDescription.newFlexboxContainerDescription(UUID.randomUUID().toString()) .idProvider(vm -> id) @@ -295,7 +303,8 @@ public AbstractWidgetDescription caseFlexboxContainerDescription(org.eclipse.sir .children(children) .diagnosticsProvider(vm -> List.of()) .kindProvider(object -> "") - .messageProvider(object -> ""); + .messageProvider(object -> "") + .borderStyleProvider(borderStyleProvider); if (viewFlexboxContainerDescription.getHelpExpression() != null && !viewFlexboxContainerDescription.getHelpExpression().isBlank()) { builder.helpTextProvider(vm -> this.getWidgetHelpText(viewFlexboxContainerDescription)); } diff --git a/packages/formdescriptioneditors/frontend/sirius-components-formdescriptioneditors/src/FlexboxContainerWidget.tsx b/packages/formdescriptioneditors/frontend/sirius-components-formdescriptioneditors/src/FlexboxContainerWidget.tsx index 5b4db09946..e3a57e7ab7 100644 --- a/packages/formdescriptioneditors/frontend/sirius-components-formdescriptioneditors/src/FlexboxContainerWidget.tsx +++ b/packages/formdescriptioneditors/frontend/sirius-components-formdescriptioneditors/src/FlexboxContainerWidget.tsx @@ -13,8 +13,8 @@ import { useMutation } from '@apollo/client'; import { Toast } from '@eclipse-sirius/sirius-components-core'; import { GQLWidget, PropertySectionContext } from '@eclipse-sirius/sirius-components-forms'; +import { makeStyles, Theme } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; -import { Theme, makeStyles } from '@material-ui/core/styles'; import HelpOutlineOutlined from '@material-ui/icons/HelpOutlineOutlined'; import React, { useContext, useEffect, useRef, useState } from 'react'; import { FlexboxContainerWidgetState, FlexboxContainerWidgetStyleProps } from './FlexboxContainerWidget.types'; @@ -41,8 +41,13 @@ const useStyles = makeStyles((theme) => selected: { color: theme.palette.primary.main, }, - widget: { - width: '100%', + containerAndLabel: { + margin: ({ borderStyle }) => (borderStyle ? theme.spacing(0.5) : 0), + padding: ({ borderStyle }) => (borderStyle ? theme.spacing(0.5) : 0), + borderWidth: ({ borderStyle }) => borderStyle?.size || 1, + borderColor: ({ borderStyle }) => borderStyle?.color || 'gray', + borderStyle: ({ borderStyle }) => borderStyle?.lineStyle || 'solid', + borderRadius: ({ borderStyle }) => borderStyle?.radius || 0, }, container: { display: 'flex', @@ -88,6 +93,7 @@ export const FlexboxContainerWidget = ({ const classes = useStyles({ flexDirection: widget.flexDirection, flexWrap: widget.flexWrap, + borderStyle: widget.borderStyle, }); const initialState: FlexboxContainerWidgetState = { message: null, selected: false }; @@ -226,7 +232,7 @@ export const FlexboxContainerWidget = ({ }); return ( -
+
) => ` ${widgetFields(contributions)} @@ -54,6 +54,12 @@ export const formDescriptionEditorEventSubscription = (contributions: Array((theme) => ({ +const useGroupEntryStyles = makeStyles((theme) => ({ group: { display: 'flex', flexDirection: 'column', flexGrow: 1, - border: '1px solid gray', - borderRadius: '10px', + borderWidth: ({ borderStyle }) => (borderStyle ? borderStyle.size : 1), + borderColor: ({ borderStyle }) => (borderStyle ? borderStyle?.color || 'transparent' : 'gray'), + borderStyle: ({ borderStyle }) => borderStyle?.lineStyle || 'solid', + borderRadius: ({ borderStyle }) => (borderStyle ? borderStyle.radius : 10), paddingTop: '1px', '&:hover': { borderColor: theme.palette.primary.main, @@ -145,7 +148,9 @@ export const Group = ({ selection, setSelection, }: GroupProps) => { - const classes = useGroupEntryStyles(); + const classes = useGroupEntryStyles({ + borderStyle: group.borderStyle, + }); const initialState: GroupState = { message: null, selected: false }; const [state, setState] = useState(initialState); diff --git a/packages/formdescriptioneditors/frontend/sirius-components-formdescriptioneditors/src/WidgetEntry.tsx b/packages/formdescriptioneditors/frontend/sirius-components-formdescriptioneditors/src/WidgetEntry.tsx index a6d9dc8d8a..383acc50df 100644 --- a/packages/formdescriptioneditors/frontend/sirius-components-formdescriptioneditors/src/WidgetEntry.tsx +++ b/packages/formdescriptioneditors/frontend/sirius-components-formdescriptioneditors/src/WidgetEntry.tsx @@ -31,8 +31,8 @@ import { GQLWidget, PropertySectionContext, } from '@eclipse-sirius/sirius-components-forms'; +import { makeStyles, Theme, withStyles } from '@material-ui/core/styles'; import Tooltip from '@material-ui/core/Tooltip'; -import { Theme, makeStyles, withStyles } from '@material-ui/core/styles'; import React, { useContext, useEffect, useState } from 'react'; import { BarChartWidget } from './BarChartWidget'; import { ButtonWidget } from './ButtonWidget'; @@ -77,7 +77,7 @@ const useWidgetEntryStyles = makeStyles((theme) => }, widgetElement: { flexGrow: ({ flexGrow }) => flexGrow, - border: ({ kind }) => (kind === 'FlexboxContainer' ? '1px solid gray' : '1px solid transparent'), + border: '1px solid transparent', '&:hover': { borderColor: theme.palette.primary.main, }, 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 097c6d1356..c15f10329b 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! @@ -341,6 +355,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..dc8a2afde2 --- /dev/null +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/ContainerBorderStyle.java @@ -0,0 +1,108 @@ +/******************************************************************************* + * 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 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 = this.radius; + borderStyle.size = 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 6fd96e06d3..c88ff44475 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); } @@ -92,6 +99,8 @@ public static final class Builder { private boolean readOnly; + private ContainerBorderStyle borderStyle; + private Builder(String id) { this.id = Objects.requireNonNull(id); } @@ -141,6 +150,11 @@ public Builder readOnly(boolean readOnly) { 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); @@ -153,6 +167,7 @@ public FlexboxContainer build() { flexboxContainer.diagnostics = Objects.requireNonNull(this.diagnostics); flexboxContainer.helpTextProvider = this.helpTextProvider; // Optional on purpose flexboxContainer.readOnly = this.readOnly; + 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 127aff2676..e256ed2fa6 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 @@ -49,6 +49,7 @@ public Element render() { String label = flexboxContainerDescription.getLabelProvider().apply(variableManager); Boolean readOnly = flexboxContainerDescription.getIsReadOnlyProvider().apply(variableManager); FlexDirection flexdirection = flexboxContainerDescription.getFlexDirection(); + var borderStyle = flexboxContainerDescription.getBorderStyleProvider().apply(variableManager); List children = new ArrayList<>(); @@ -73,6 +74,10 @@ public Element render() { flexboxContainerElementPropsBuilder.readOnly(readOnly); } + 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 97ee2db36a..47218cb61a 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); } @@ -94,6 +102,8 @@ public static final class Builder { private Function helpTextProvider; + private Function borderStyleProvider = variableManager -> null; + private Builder(String id) { this.id = Objects.requireNonNull(id); } @@ -143,6 +153,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); @@ -155,6 +170,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..0b64a10f90 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020, 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 @@ -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 02f9df519c..17e09900a7 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; @@ -44,6 +45,8 @@ public final class FlexboxContainerElementProps implements IProps { private List children; + private ContainerBorderStyle borderStyle; + private FlexboxContainerElementProps() { // Prevent instantiation } @@ -73,6 +76,10 @@ public List getChildren() { return this.children; } + public ContainerBorderStyle getBorderStyle() { + return this.borderStyle; + } + public static Builder newFlexboxContainerElementProps(String id) { return new Builder(id); } @@ -103,6 +110,8 @@ public static final class Builder { private List children; + private ContainerBorderStyle borderStyle; + private Builder(String id) { this.id = Objects.requireNonNull(id); } @@ -132,6 +141,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); @@ -140,6 +154,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..d206c05125 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020, 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 @@ -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 e732361f3d..d2ba6f1160 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) { @@ -558,7 +560,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) @@ -576,6 +577,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 f17b169dcc..b1918d666f 100644 --- a/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.ts +++ b/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.ts @@ -399,10 +399,28 @@ export const flexboxContainerFields = (contributions: Array) children { ...widgetFields } + borderStyle { + color + lineStyle + size + radius + } } } + borderStyle { + color + lineStyle + size + radius + } } } + borderStyle { + color + lineStyle + size + radius + } } `; @@ -427,6 +445,12 @@ export const formRefreshedEventPayloadFragment = (contributions: Array ({ +const useGroupStyles = makeStyles((theme) => ({ group: { display: 'flex', flexDirection: 'column', - paddingTop: theme.spacing(1), + margin: ({ borderStyle }) => (borderStyle ? theme.spacing(0.5) : 0), + padding: ({ borderStyle }) => (borderStyle ? theme.spacing(0.5) : 0), + borderWidth: ({ borderStyle }) => borderStyle?.size || 0, + borderColor: ({ borderStyle }) => borderStyle?.color || 'transparent', + borderStyle: ({ borderStyle }) => borderStyle?.lineStyle || 'solid', + borderRadius: ({ borderStyle }) => borderStyle?.radius || 0, }, groupLabelAndToolbar: { display: 'flex', @@ -70,7 +75,11 @@ const useGroupStyles = makeStyles((theme) => ({ })); export const Group = ({ editingContextId, formId, group, widgetSubscriptions, setSelection, readOnly }: GroupProps) => { - const classes = useGroupStyles(); + const props: GroupStyleProps = { + borderStyle: group.borderStyle, + }; + + 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..b1c5d35197 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 @@ -11,7 +11,7 @@ * Obeo - initial API and implementation *******************************************************************************/ import { Selection } from '@eclipse-sirius/sirius-components-core'; -import { GQLGroup, GQLWidgetSubscription } from '../form/FormEventFragments.types'; +import { GQLContainerBorderStyle, GQLGroup, GQLWidgetSubscription } from '../form/FormEventFragments.types'; export interface GroupProps { editingContextId: string; @@ -21,3 +21,7 @@ export interface GroupProps { setSelection: (selection: Selection) => void; readOnly: boolean; } + +export interface GroupStyleProps { + borderStyle: GQLContainerBorderStyle | 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 83e2b79893..7762785777 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: ({ borderStyle }) => (borderStyle ? theme.spacing(0.5) : 0), + padding: ({ borderStyle }) => (borderStyle ? theme.spacing(0.5) : 0), + borderWidth: ({ borderStyle }) => borderStyle?.size || 0, + borderColor: ({ borderStyle }) => borderStyle?.color || 'transparent', + borderStyle: ({ borderStyle }) => borderStyle?.lineStyle || 'solid', + borderRadius: ({ borderStyle }) => borderStyle?.radius || 0, + }, container: { display: 'flex', flexWrap: ({ flexWrap }) => flexWrap, @@ -46,6 +54,7 @@ export const FlexboxContainerPropertySection = ({ flexDirection: widget.flexDirection, flexWrap: widget.flexWrap, flexGrow: widget.flexGrow, + borderStyle: widget.borderStyle, }); let children = widget.children.map((widget) => ( @@ -63,7 +72,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..c53299fa11 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 @@ -12,6 +12,7 @@ *******************************************************************************/ import { Selection } from '@eclipse-sirius/sirius-components-core'; import { + GQLContainerBorderStyle, GQLFlexboxContainer, GQLFlexDirection, GQLFlexWrap, @@ -31,4 +32,5 @@ export interface FlexboxContainerPropertySectionStyleProps { flexDirection: GQLFlexDirection; flexWrap: GQLFlexWrap; flexGrow: number; + borderStyle: GQLContainerBorderStyle | 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..65d4585b50 --- /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,96 @@ +/** + * 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.form.ConditionalContainerBorderStyle. + * + * @generated + */ + private final org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle conditionalContainerBorderStyle = org.eclipse.sirius.components.view.form.FormFactory.eINSTANCE.createConditionalContainerBorderStyle(); + + /** + * Return instance org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle. + * + * @generated + */ + protected org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle getConditionalContainerBorderStyle() { + return this.conditionalContainerBorderStyle; + } + + /** + * Return instance org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle. + * + * @generated + */ + public org.eclipse.sirius.components.view.form.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.form.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..331736160c --- /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,87 @@ +/** + * 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.form.ContainerBorderStyle. + * + * @generated + */ + private final org.eclipse.sirius.components.view.form.ContainerBorderStyle containerBorderStyle = org.eclipse.sirius.components.view.form.FormFactory.eINSTANCE.createContainerBorderStyle(); + + /** + * Return instance org.eclipse.sirius.components.view.form.ContainerBorderStyle. + * + * @generated + */ + protected org.eclipse.sirius.components.view.form.ContainerBorderStyle getContainerBorderStyle() { + return this.containerBorderStyle; + } + + /** + * Return instance org.eclipse.sirius.components.view.form.ContainerBorderStyle. + * + * @generated + */ + public org.eclipse.sirius.components.view.form.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.form.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 b556b70feb..49e69ad9a8 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 @@ -101,5 +101,28 @@ public FlexboxContainerDescriptionBuilder isEnabledExpression(java.lang.String v return this; } + /** + * Setter for BorderStyle. + * + * @generated + */ + public FlexboxContainerDescriptionBuilder borderStyle(org.eclipse.sirius.components.view.form.ContainerBorderStyle value) { + this.getFlexboxContainerDescription().setBorderStyle(value); + return this; + } + + /** + * Setter for ConditionalBorderStyles. + * + * @generated + */ + public FlexboxContainerDescriptionBuilder conditionalBorderStyles(org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle... values) { + for (org.eclipse.sirius.components.view.form.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/FormBuilders.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/FormBuilders.java index 8ad88509f1..8f55540224 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/FormBuilders.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/FormBuilders.java @@ -439,5 +439,25 @@ public ConditionalTextfieldDescriptionStyleBuilder newConditionalTextfieldDescri return new ConditionalTextfieldDescriptionStyleBuilder(); } + /** + * Instantiate a ContainerBorderStyleBuilder . + * + * @author BuilderGenerator + * @generated + */ + public ContainerBorderStyleBuilder newContainerBorderStyle() { + return new ContainerBorderStyleBuilder(); + } + + /** + * Instantiate a ConditionalContainerBorderStyleBuilder . + * + * @author BuilderGenerator + * @generated + */ + public ConditionalContainerBorderStyleBuilder newConditionalContainerBorderStyle() { + return new ConditionalContainerBorderStyleBuilder(); + } + } 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 28f4de939c..c76ad9bcf7 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.form.WidgetDescription ... values) { + public GroupDescriptionBuilder widgets(org.eclipse.sirius.components.view.form.WidgetDescription... values) { for (org.eclipse.sirius.components.view.form.WidgetDescription value : values) { this.getGroupDescription().getWidgets().add(value); } return this; } + /** + * Setter for BorderStyle. + * + * @generated + */ + public GroupDescriptionBuilder borderStyle(org.eclipse.sirius.components.view.form.ContainerBorderStyle value) { + this.getGroupDescription().setBorderStyle(value); + return this; + } + + /** + * Setter for ConditionalBorderStyles. + * + * @generated + */ + public GroupDescriptionBuilder conditionalBorderStyles(org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle... values) { + for (org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle value : values) { + this.getGroupDescription().getConditionalBorderStyles().add(value); + } + return this; + } + } 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-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 ef047de48b..baf3041e37 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 @@ -222,7 +222,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..a4f3863386 --- /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.form.ContainerBorderStyle viewStyle; + + public ContainerBorderStyleProvider(org.eclipse.sirius.components.view.form.ContainerBorderStyle viewStyle) { + this.viewStyle = Objects.requireNonNull(viewStyle); + } + + @Override + public ContainerBorderStyle apply(VariableManager variableManager) { + ContainerBorderStyle.Builder styleBuilder = ContainerBorderStyle.newContainerBorderStyle() + .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 97ebd9332c..c1a55a14ce 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.for 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.form.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.for .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.form.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 1076ae7b2e..1394a145a9 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; @@ -430,6 +431,17 @@ public AbstractWidgetDescription caseFlexboxContainerDescription(org.eclipse.sir StringValueProvider labelProvider = this.getStringValueProvider(flexboxContainerDescription.getLabelExpression()); Function isReadOnlyProvider = this.getReadOnlyValueProvider(flexboxContainerDescription.getIsEnabledExpression()); 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.form.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))); @@ -441,7 +453,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-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/ButtonDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/ButtonDescriptionItemProvider.java index 1c1e1db8fb..f8f65ce7b6 100644 --- a/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/ButtonDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/ButtonDescriptionItemProvider.java @@ -191,7 +191,7 @@ public void notifyChanged(Notification notification) { * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created * under this object. * - * @generated + * @generated NOT */ @Override protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { @@ -209,8 +209,6 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors newChildDescriptors.add(this.createChildParameter(FormPackage.Literals.BUTTON_DESCRIPTION__STYLE, FormFactory.eINSTANCE.createButtonDescriptionStyle())); - newChildDescriptors.add(this.createChildParameter(FormPackage.Literals.BUTTON_DESCRIPTION__STYLE, FormFactory.eINSTANCE.createConditionalButtonDescriptionStyle())); - newChildDescriptors.add(this.createChildParameter(FormPackage.Literals.BUTTON_DESCRIPTION__CONDITIONAL_STYLES, FormFactory.eINSTANCE.createConditionalButtonDescriptionStyle())); } diff --git a/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/CheckboxDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/CheckboxDescriptionItemProvider.java index 118ac7e8b5..283df11db9 100644 --- a/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/CheckboxDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/CheckboxDescriptionItemProvider.java @@ -176,7 +176,7 @@ public void notifyChanged(Notification notification) { * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created * under this object. * - * @generated + * @generated NOT */ @Override protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { @@ -194,8 +194,6 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors newChildDescriptors.add(this.createChildParameter(FormPackage.Literals.CHECKBOX_DESCRIPTION__STYLE, FormFactory.eINSTANCE.createCheckboxDescriptionStyle())); - newChildDescriptors.add(this.createChildParameter(FormPackage.Literals.CHECKBOX_DESCRIPTION__STYLE, FormFactory.eINSTANCE.createConditionalCheckboxDescriptionStyle())); - newChildDescriptors.add(this.createChildParameter(FormPackage.Literals.CHECKBOX_DESCRIPTION__CONDITIONAL_STYLES, FormFactory.eINSTANCE.createConditionalCheckboxDescriptionStyle())); } diff --git a/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/ConditionalContainerBorderStyleItemProvider.java b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/ConditionalContainerBorderStyleItemProvider.java new file mode 100644 index 0000000000..2f804c98a8 --- /dev/null +++ b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/ConditionalContainerBorderStyleItemProvider.java @@ -0,0 +1,174 @@ +/** + * 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.form.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.form.ConditionalContainerBorderStyle; +import org.eclipse.sirius.components.view.form.FormPackage; +import org.eclipse.sirius.components.view.provider.ConditionalItemProvider; + +/** + * This is the item provider adapter for a + * {@link org.eclipse.sirius.components.view.form.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"), + FormPackage.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"), + FormPackage.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"), + FormPackage.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"), + FormPackage.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 FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS: + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE: + case FormPackage.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-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/ContainerBorderStyleItemProvider.java b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/ContainerBorderStyleItemProvider.java new file mode 100644 index 0000000000..8f3e175110 --- /dev/null +++ b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/ContainerBorderStyleItemProvider.java @@ -0,0 +1,191 @@ +/** + * 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.form.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.form.ContainerBorderStyle; +import org.eclipse.sirius.components.view.form.FormPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.sirius.components.view.form.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"), + FormPackage.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"), + FormPackage.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"), + FormPackage.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"), + FormPackage.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 FormPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS: + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE: + case FormPackage.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-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/FlexboxContainerDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/FlexboxContainerDescriptionItemProvider.java index 9b5743796b..37a79ee0bc 100644 --- a/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/FlexboxContainerDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/FlexboxContainerDescriptionItemProvider.java @@ -111,6 +111,8 @@ public Collection getChildrenFeatures(Object objec if (this.childrenFeatures == null) { super.getChildrenFeatures(object); this.childrenFeatures.add(FormPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__CHILDREN); + this.childrenFeatures.add(FormPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE); + this.childrenFeatures.add(FormPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES); } return this.childrenFeatures; } @@ -179,6 +181,8 @@ public void notifyChanged(Notification notification) { this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__CHILDREN: + case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE: + case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } @@ -251,6 +255,31 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors TextfieldDescription textfieldDescription = FormFactory.eINSTANCE.createTextfieldDescription(); textfieldDescription.setStyle(FormFactory.eINSTANCE.createTextfieldDescriptionStyle()); newChildDescriptors.add(this.createChildParameter(FormPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__CHILDREN, textfieldDescription)); + + newChildDescriptors.add(this.createChildParameter(FormPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE, FormFactory.eINSTANCE.createContainerBorderStyle())); + + newChildDescriptors + .add(this.createChildParameter(FormPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES, FormFactory.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 == FormPackage.Literals.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE + || childFeature == FormPackage.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-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/FormItemProviderAdapterFactory.java b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/FormItemProviderAdapterFactory.java index 3312559fbd..f87f1016b0 100644 --- a/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/FormItemProviderAdapterFactory.java +++ b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/FormItemProviderAdapterFactory.java @@ -1105,6 +1105,53 @@ public Adapter createConditionalTextfieldDescriptionStyleAdapter() { return this.conditionalTextfieldDescriptionStyleItemProvider; } + /** + * This keeps track of the one adapter used for all + * {@link org.eclipse.sirius.components.view.form.ContainerBorderStyle} instances. + * + * @generated + */ + protected ContainerBorderStyleItemProvider containerBorderStyleItemProvider; + /** + * This keeps track of the one adapter used for all + * {@link org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle} instances. + * + * @generated + */ + protected ConditionalContainerBorderStyleItemProvider conditionalContainerBorderStyleItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.sirius.components.view.form.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.form.ConditionalContainerBorderStyle}. + * + * + * @generated + */ + @Override + public Adapter createConditionalContainerBorderStyleAdapter() { + if (this.conditionalContainerBorderStyleItemProvider == null) { + this.conditionalContainerBorderStyleItemProvider = new ConditionalContainerBorderStyleItemProvider(this); + } + + return this.conditionalContainerBorderStyleItemProvider; + } + /** * This returns the root adapter factory that contains this factory. * @@ -1318,6 +1365,10 @@ public void dispose() { this.textfieldDescriptionStyleItemProvider.dispose(); if (this.conditionalTextfieldDescriptionStyleItemProvider != null) this.conditionalTextfieldDescriptionStyleItemProvider.dispose(); + if (this.containerBorderStyleItemProvider != null) + this.containerBorderStyleItemProvider.dispose(); + if (this.conditionalContainerBorderStyleItemProvider != null) + this.conditionalContainerBorderStyleItemProvider.dispose(); } /** diff --git a/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/GroupDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/GroupDescriptionItemProvider.java index cc3b9d56da..2ad45926a7 100644 --- a/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/GroupDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-form-edit/src/main/java/org/eclipse/sirius/components/view/form/provider/GroupDescriptionItemProvider.java @@ -131,6 +131,8 @@ public Collection getChildrenFeatures(Object objec super.getChildrenFeatures(object); this.childrenFeatures.add(FormPackage.Literals.GROUP_DESCRIPTION__TOOLBAR_ACTIONS); this.childrenFeatures.add(FormPackage.Literals.GROUP_DESCRIPTION__WIDGETS); + this.childrenFeatures.add(FormPackage.Literals.GROUP_DESCRIPTION__BORDER_STYLE); + this.childrenFeatures.add(FormPackage.Literals.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES); } return this.childrenFeatures; } @@ -199,6 +201,8 @@ public void notifyChanged(Notification notification) { return; case FormPackage.GROUP_DESCRIPTION__TOOLBAR_ACTIONS: case FormPackage.GROUP_DESCRIPTION__WIDGETS: + case FormPackage.GROUP_DESCRIPTION__BORDER_STYLE: + case FormPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } @@ -209,7 +213,7 @@ public void notifyChanged(Notification notification) { * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created * under this object. * - * @generated + * @generated NOT */ @Override protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { @@ -246,6 +250,10 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors newChildDescriptors.add(this.createChildParameter(FormPackage.Literals.GROUP_DESCRIPTION__WIDGETS, FormFactory.eINSTANCE.createTextAreaDescription())); newChildDescriptors.add(this.createChildParameter(FormPackage.Literals.GROUP_DESCRIPTION__WIDGETS, FormFactory.eINSTANCE.createTextfieldDescription())); + + newChildDescriptors.add(this.createChildParameter(FormPackage.Literals.GROUP_DESCRIPTION__BORDER_STYLE, FormFactory.eINSTANCE.createContainerBorderStyle())); + + newChildDescriptors.add(this.createChildParameter(FormPackage.Literals.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES, FormFactory.eINSTANCE.createConditionalContainerBorderStyle())); } /** @@ -259,10 +267,11 @@ public String getCreateChildText(Object owner, Object feature, Object child, Col Object childFeature = feature; Object childObject = child; - boolean qualify = childFeature == FormPackage.Literals.GROUP_DESCRIPTION__TOOLBAR_ACTIONS || childFeature == FormPackage.Literals.GROUP_DESCRIPTION__WIDGETS; + boolean qualify = childFeature == FormPackage.Literals.GROUP_DESCRIPTION__TOOLBAR_ACTIONS || childFeature == FormPackage.Literals.GROUP_DESCRIPTION__WIDGETS + || childFeature == FormPackage.Literals.GROUP_DESCRIPTION__BORDER_STYLE || childFeature == FormPackage.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-form-edit/src/main/resources/plugin.properties b/packages/view/backend/sirius-components-view-form-edit/src/main/resources/plugin.properties index 1d2c46a34b..d52d7306b9 100644 --- a/packages/view/backend/sirius-components-view-form-edit/src/main/resources/plugin.properties +++ b/packages/view/backend/sirius-components-view-form-edit/src/main/resources/plugin.properties @@ -63,8 +63,10 @@ _UI_TextareaDescriptionStyle_type = Textarea Description Style _UI_ConditionalTextareaDescriptionStyle_type = Conditional Textarea Description Style _UI_TextfieldDescriptionStyle_type = Textfield Description Style _UI_ConditionalTextfieldDescriptionStyle_type = Conditional Textfield Description Style +_UI_ContainerBorderStyle_type = Container Border Style +_UI_ConditionalContainerBorderStyle_type = Conditional Container Border Style _UI_Unknown_type = Object -_UI_Unknown_datatype= Value +_UI_Unknown_datatype = Value _UI_FormDescription_pages_feature = Pages _UI_PageDescription_name_feature = Name _UI_PageDescription_labelExpression_feature = Label Expression @@ -79,6 +81,8 @@ _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 @@ -103,6 +107,8 @@ _UI_CheckboxDescription_IsEnabledExpression_feature = Is Enabled Expression _UI_FlexboxContainerDescription_children_feature = Children _UI_FlexboxContainerDescription_flexDirection_feature = Flex Direction _UI_FlexboxContainerDescription_IsEnabledExpression_feature = Is Enabled Expression +_UI_FlexboxContainerDescription_borderStyle_feature = Border Style +_UI_FlexboxContainerDescription_conditionalBorderStyles_feature = Conditional Border Styles _UI_ImageDescription_urlExpression_feature = Url Expression _UI_ImageDescription_maxWidthExpression_feature = Max Width Expression _UI_LabelDescription_valueExpression_feature = Value Expression @@ -178,6 +184,10 @@ _UI_TextareaDescriptionStyle_backgroundColor_feature = Background Color _UI_TextareaDescriptionStyle_foregroundColor_feature = Foreground Color _UI_TextfieldDescriptionStyle_backgroundColor_feature = Background Color _UI_TextfieldDescriptionStyle_foregroundColor_feature = Foreground 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_Unknown_feature = Unspecified _UI_FlexDirection_row_literal = row _UI_FlexDirection_rowReverse_literal = row-reverse @@ -189,3 +199,6 @@ _UI_LabelPlacement_end_literal = end _UI_LabelPlacement_top_literal = top _UI_LabelPlacement_start_literal = start _UI_LabelPlacement_bottom_literal = bottom +_UI_ContainerBorderLineStyle_Solid_literal = Solid +_UI_ContainerBorderLineStyle_Dashed_literal = Dashed +_UI_ContainerBorderLineStyle_Dotted_literal = Dotted diff --git a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/ConditionalContainerBorderStyle.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/ConditionalContainerBorderStyle.java new file mode 100644 index 0000000000..d65b4895c8 --- /dev/null +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/ConditionalContainerBorderStyle.java @@ -0,0 +1,26 @@ +/** + * 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.form; + +import org.eclipse.sirius.components.view.Conditional; + +/** + * A representation of the model object 'Conditional Container Border Style'. + * + * + * @model + * @generated + * @see org.eclipse.sirius.components.view.form.FormPackage#getConditionalContainerBorderStyle() + */ +public interface ConditionalContainerBorderStyle extends Conditional, ContainerBorderStyle { +} // ConditionalContainerBorderStyle diff --git a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/ContainerBorderLineStyle.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/ContainerBorderLineStyle.java new file mode 100644 index 0000000000..196a306aa0 --- /dev/null +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/ContainerBorderLineStyle.java @@ -0,0 +1,234 @@ +/** + * 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.form; + +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.form.FormPackage#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)); + + /** + * 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 + */ + 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; + } + + /** + * + * + * @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-form/src/main/java/org/eclipse/sirius/components/view/form/ContainerBorderStyle.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/ContainerBorderStyle.java new file mode 100644 index 0000000000..cde9e9651d --- /dev/null +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/ContainerBorderStyle.java @@ -0,0 +1,132 @@ +/** + * 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.form; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.components.view.UserColor; + +/** + * A representation of the model object 'Container Border Style'. + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderColor Border Color}
  • + *
  • {@link org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderRadius Border Radius}
  • + *
  • {@link org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderSize Border Size}
  • + *
  • {@link org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderLineStyle Border Line + * Style}
  • + *
+ * + * @see org.eclipse.sirius.components.view.form.FormPackage#getContainerBorderStyle() + * @model + * @generated + */ +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.form.FormPackage#getContainerBorderStyle_BorderColor() + */ + UserColor getBorderColor(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.form.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. + * @see #setBorderRadius(int) + * @see org.eclipse.sirius.components.view.form.FormPackage#getContainerBorderStyle_BorderRadius() + * @model default="3" dataType="org.eclipse.sirius.components.view.Length" required="true" + * @generated + */ + int getBorderRadius(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderRadius + * Border Radius}' attribute. + * + * @param value + * the new value of the 'Border Radius' attribute. + * @see #getBorderRadius() + * @generated + */ + 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. + * @see #setBorderSize(int) + * @see org.eclipse.sirius.components.view.form.FormPackage#getContainerBorderStyle_BorderSize() + * @model default="1" dataType="org.eclipse.sirius.components.view.Length" required="true" + * @generated + */ + int getBorderSize(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderSize + * Border Size}' attribute. + * + * @param value + * the new value of the 'Border Size' attribute. + * @see #getBorderSize() + * @generated + */ + 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.form.ContainerBorderLineStyle}. + * + * @return the value of the 'Border Line Style' attribute. + * @see org.eclipse.sirius.components.view.form.ContainerBorderLineStyle + * @see #setBorderLineStyle(ContainerBorderLineStyle) + * @see org.eclipse.sirius.components.view.form.FormPackage#getContainerBorderStyle_BorderLineStyle() + * @model + * @generated + */ + ContainerBorderLineStyle getBorderLineStyle(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderLineStyle + * Border Line Style}' attribute. + * + * @param value + * the new value of the 'Border Line Style' attribute. + * @see org.eclipse.sirius.components.view.form.ContainerBorderLineStyle + * @see #getBorderLineStyle() + * @generated + */ + void setBorderLineStyle(ContainerBorderLineStyle value); + +} // ContainerBorderStyle diff --git a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/FlexboxContainerDescription.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/FlexboxContainerDescription.java index 457da09436..37d8dfe8ae 100644 --- a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/FlexboxContainerDescription.java +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/FlexboxContainerDescription.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.form; import org.eclipse.emf.common.util.EList; @@ -27,6 +27,10 @@ * Direction} *
  • {@link org.eclipse.sirius.components.view.form.FlexboxContainerDescription#getIsEnabledExpression Is Enabled * Expression}
  • + *
  • {@link org.eclipse.sirius.components.view.form.FlexboxContainerDescription#getBorderStyle Border + * Style}
  • + *
  • {@link org.eclipse.sirius.components.view.form.FlexboxContainerDescription#getConditionalBorderStyles + * Conditional Border Styles}
  • * * * @see org.eclipse.sirius.components.view.form.FormPackage#getFlexboxContainerDescription() @@ -96,4 +100,38 @@ public interface FlexboxContainerDescription extends WidgetDescription { */ void setIsEnabledExpression(String 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.form.FormPackage#getFlexboxContainerDescription_BorderStyle() + */ + ContainerBorderStyle getBorderStyle(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.form.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.form.ConditionalContainerBorderStyle}. + * + * @return the value of the 'Conditional Border Styles' containment reference list. + * @model containment="true" + * @generated + * @see org.eclipse.sirius.components.view.form.FormPackage#getFlexboxContainerDescription_ConditionalBorderStyles() + */ + EList getConditionalBorderStyles(); + } // FlexboxContainerDescription diff --git a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/FormFactory.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/FormFactory.java index e852cbd7ba..886cdc8bb1 100644 --- a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/FormFactory.java +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/FormFactory.java @@ -384,6 +384,23 @@ public interface FormFactory extends EFactory { */ ConditionalTextfieldDescriptionStyle createConditionalTextfieldDescriptionStyle(); + /** + * 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 the package supported by this factory. * diff --git a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/FormPackage.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/FormPackage.java index 7a9455bdd7..0af861149b 100644 --- a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/FormPackage.java +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/FormPackage.java @@ -283,6 +283,24 @@ public interface FormPackage 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. @@ -290,7 +308,7 @@ public interface FormPackage 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. @@ -732,6 +750,24 @@ public interface FormPackage extends EPackage { */ int FLEXBOX_CONTAINER_DESCRIPTION__IS_ENABLED_EXPRESSION = WIDGET_DESCRIPTION_FEATURE_COUNT + 2; + /** + * The feature id for the 'Border Style' containment reference. + * + * @generated + * @ordered + */ + int FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE = WIDGET_DESCRIPTION_FEATURE_COUNT + 3; + + /** + * The feature id for the 'Conditional Border Styles' containment reference list. + * + * @generated + * @ordered + */ + int FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES = WIDGET_DESCRIPTION_FEATURE_COUNT + 4; + /** * The number of structural features of the 'Flexbox Container Description' class. * @@ -739,7 +775,7 @@ public interface FormPackage extends EPackage { * @generated * @ordered */ - int FLEXBOX_CONTAINER_DESCRIPTION_FEATURE_COUNT = WIDGET_DESCRIPTION_FEATURE_COUNT + 3; + int FLEXBOX_CONTAINER_DESCRIPTION_FEATURE_COUNT = WIDGET_DESCRIPTION_FEATURE_COUNT + 5; /** * The number of operations of the 'Flexbox Container Description' class. + * + * @generated + * @see org.eclipse.sirius.components.view.form.impl.ContainerBorderStyleImpl + * @see org.eclipse.sirius.components.view.form.impl.FormPackageImpl#getContainerBorderStyle() + */ + int CONTAINER_BORDER_STYLE = 44; + + /** + * 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.form.impl.ConditionalContainerBorderStyleImpl Conditional + * Container Border Style}' class. + * + * @generated + * @see org.eclipse.sirius.components.view.form.impl.ConditionalContainerBorderStyleImpl + * @see org.eclipse.sirius.components.view.form.impl.FormPackageImpl#getConditionalContainerBorderStyle() + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE = 45; + + /** + * The feature id for the 'Condition' attribute. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE__CONDITION = ViewPackage.CONDITIONAL__CONDITION; + + /** + * The feature id for the 'Border Color' reference. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR = ViewPackage.CONDITIONAL_FEATURE_COUNT; + + /** + * The feature id for the 'Border Radius' attribute. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS = ViewPackage.CONDITIONAL_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Border Size' attribute. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE = ViewPackage.CONDITIONAL_FEATURE_COUNT + 2; + + /** + * The feature id for the 'Border Line Style' attribute. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE = ViewPackage.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 = ViewPackage.CONDITIONAL_FEATURE_COUNT + 4; + + /** + * The number of operations of the 'Conditional Container Border Style' class. + * + * @generated + * @ordered + */ + int CONDITIONAL_CONTAINER_BORDER_STYLE_OPERATION_COUNT = ViewPackage.CONDITIONAL_OPERATION_COUNT; + /** * The meta object id for the '{@link org.eclipse.sirius.components.view.form.FlexDirection Flex * Direction}' enum. * + * @generated * @see org.eclipse.sirius.components.view.form.FlexDirection * @see org.eclipse.sirius.components.view.form.impl.FormPackageImpl#getFlexDirection() - * @generated */ - int FLEX_DIRECTION = 44; + int FLEX_DIRECTION = 46; /** * The meta object id for the '{@link org.eclipse.sirius.components.view.form.GroupDisplayMode Group Display @@ -3881,7 +4048,7 @@ public interface FormPackage extends EPackage { * @see org.eclipse.sirius.components.view.form.GroupDisplayMode * @see org.eclipse.sirius.components.view.form.impl.FormPackageImpl#getGroupDisplayMode() */ - int GROUP_DISPLAY_MODE = 45; + int GROUP_DISPLAY_MODE = 47; /** * The meta object id for the '{@link org.eclipse.sirius.components.view.form.LabelPlacement Label @@ -3891,7 +4058,17 @@ public interface FormPackage extends EPackage { * @see org.eclipse.sirius.components.view.form.LabelPlacement * @see org.eclipse.sirius.components.view.form.impl.FormPackageImpl#getLabelPlacement() */ - int LABEL_PLACEMENT = 46; + int LABEL_PLACEMENT = 48; + + /** + * The meta object id for the '{@link org.eclipse.sirius.components.view.form.ContainerBorderLineStyle Container + * Border Line Style}' enum. + * + * @generated + * @see org.eclipse.sirius.components.view.form.ContainerBorderLineStyle + * @see org.eclipse.sirius.components.view.form.impl.FormPackageImpl#getContainerBorderLineStyle() + */ + int CONTAINER_BORDER_LINE_STYLE = 49; /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.form.FormDescription @@ -4090,13 +4267,37 @@ public interface FormPackage extends EPackage { */ EReference getGroupDescription_Widgets(); + /** + * Returns the meta object for the containment reference + * '{@link org.eclipse.sirius.components.view.form.GroupDescription#getBorderStyle Border Style}'. + * + * @return the meta object for the containment reference 'Border Style'. + * @generated + * @see org.eclipse.sirius.components.view.form.GroupDescription#getBorderStyle() + * @see #getGroupDescription() + */ + EReference getGroupDescription_BorderStyle(); + + /** + * Returns the meta object for the containment reference list + * '{@link org.eclipse.sirius.components.view.form.GroupDescription#getConditionalBorderStyles Conditional + * Border Styles}'. + * + * @return the meta object for the containment reference list 'Conditional Border Styles'. + * @generated + * @see org.eclipse.sirius.components.view.form.GroupDescription#getConditionalBorderStyles() + * @see #getGroupDescription() + */ + EReference getGroupDescription_ConditionalBorderStyles(); + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.form.WidgetDescription Widget * Description}'. * * @return the meta object for class 'Widget Description'. - * @see org.eclipse.sirius.components.view.form.WidgetDescription * @generated + * @see org.eclipse.sirius.components.view.form.WidgetDescription */ EClass getWidgetDescription(); @@ -4428,6 +4629,30 @@ public interface FormPackage extends EPackage { */ EAttribute getFlexboxContainerDescription_IsEnabledExpression(); + /** + * Returns the meta object for the containment reference + * '{@link org.eclipse.sirius.components.view.form.FlexboxContainerDescription#getBorderStyle Border + * Style}'. + * + * @return the meta object for the containment reference 'Border Style'. + * @generated + * @see org.eclipse.sirius.components.view.form.FlexboxContainerDescription#getBorderStyle() + * @see #getFlexboxContainerDescription() + */ + EReference getFlexboxContainerDescription_BorderStyle(); + + /** + * Returns the meta object for the containment reference list + * '{@link org.eclipse.sirius.components.view.form.FlexboxContainerDescription#getConditionalBorderStyles + * Conditional Border Styles}'. + * + * @return the meta object for the containment reference list 'Conditional Border Styles'. + * @generated + * @see org.eclipse.sirius.components.view.form.FlexboxContainerDescription#getConditionalBorderStyles() + * @see #getFlexboxContainerDescription() + */ + EReference getFlexboxContainerDescription_ConditionalBorderStyles(); + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.form.ImageDescription Image * Description}'. @@ -5698,13 +5923,81 @@ public interface FormPackage extends EPackage { */ EClass getConditionalTextfieldDescriptionStyle(); + /** + * Returns the meta object for class '{@link org.eclipse.sirius.components.view.form.ContainerBorderStyle + * Container Border Style}'. + * + * @return the meta object for class 'Container Border Style'. + * @generated + * @see org.eclipse.sirius.components.view.form.ContainerBorderStyle + */ + EClass getContainerBorderStyle(); + + /** + * Returns the meta object for the reference + * '{@link org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderColor Border Color}'. + * + * @return the meta object for the reference 'Border Color'. + * @generated + * @see org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderColor() + * @see #getContainerBorderStyle() + */ + EReference getContainerBorderStyle_BorderColor(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderRadius Border Radius}'. + * + * + * @return the meta object for the attribute 'Border Radius'. + * @generated + * @see org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderRadius() + * @see #getContainerBorderStyle() + */ + EAttribute getContainerBorderStyle_BorderRadius(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderSize Border Size}'. + * + * @return the meta object for the attribute 'Border Size'. + * @generated + * @see org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderSize() + * @see #getContainerBorderStyle() + */ + EAttribute getContainerBorderStyle_BorderSize(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderLineStyle Border Line + * Style}'. + * + * @return the meta object for the attribute 'Border Line Style'. + * @generated + * @see org.eclipse.sirius.components.view.form.ContainerBorderStyle#getBorderLineStyle() + * @see #getContainerBorderStyle() + */ + EAttribute getContainerBorderStyle_BorderLineStyle(); + + /** + * Returns the meta object for class '{@link org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle + * Conditional Container Border Style}'. + * + * @return the meta object for class 'Conditional Container Border Style'. + * @generated + * @see org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle + */ + EClass getConditionalContainerBorderStyle(); + /** * Returns the meta object for enum '{@link org.eclipse.sirius.components.view.form.FlexDirection Flex * Direction}'. * * @return the meta object for enum 'Flex Direction'. - * @see org.eclipse.sirius.components.view.form.FlexDirection * @generated + * @see org.eclipse.sirius.components.view.form.FlexDirection */ EEnum getFlexDirection(); @@ -5728,6 +6021,16 @@ public interface FormPackage extends EPackage { */ EEnum getLabelPlacement(); + /** + * Returns the meta object for enum '{@link org.eclipse.sirius.components.view.form.ContainerBorderLineStyle + * Container Border Line Style}'. + * + * @return the meta object for enum 'Container Border Line Style'. + * @generated + * @see org.eclipse.sirius.components.view.form.ContainerBorderLineStyle + */ + EEnum getContainerBorderLineStyle(); + /** * Returns the factory that creates the instances of the model. * @@ -5892,13 +6195,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.form.impl.WidgetDescriptionImpl * Widget Description}' class. * + * @generated * @see org.eclipse.sirius.components.view.form.impl.WidgetDescriptionImpl * @see org.eclipse.sirius.components.view.form.impl.FormPackageImpl#getWidgetDescription() - * @generated */ EClass WIDGET_DESCRIPTION = eINSTANCE.getWidgetDescription(); @@ -6135,6 +6454,22 @@ interface Literals { */ EAttribute FLEXBOX_CONTAINER_DESCRIPTION__IS_ENABLED_EXPRESSION = eINSTANCE.getFlexboxContainerDescription_IsEnabledExpression(); + /** + * 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.form.impl.ImageDescriptionImpl * Image Description}' class. @@ -7119,13 +7454,66 @@ interface Literals { */ EClass CONDITIONAL_TEXTFIELD_DESCRIPTION_STYLE = eINSTANCE.getConditionalTextfieldDescriptionStyle(); + /** + * The meta object literal for the '{@link org.eclipse.sirius.components.view.form.impl.ContainerBorderStyleImpl + * Container Border Style}' class. + * + * @generated + * @see org.eclipse.sirius.components.view.form.impl.ContainerBorderStyleImpl + * @see org.eclipse.sirius.components.view.form.impl.FormPackageImpl#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.form.impl.ConditionalContainerBorderStyleImpl Conditional + * Container Border Style}' class. + * + * @generated + * @see org.eclipse.sirius.components.view.form.impl.ConditionalContainerBorderStyleImpl + * @see org.eclipse.sirius.components.view.form.impl.FormPackageImpl#getConditionalContainerBorderStyle() + */ + EClass CONDITIONAL_CONTAINER_BORDER_STYLE = eINSTANCE.getConditionalContainerBorderStyle(); + /** * The meta object literal for the '{@link org.eclipse.sirius.components.view.form.FlexDirection Flex * Direction}' enum. * + * @generated * @see org.eclipse.sirius.components.view.form.FlexDirection * @see org.eclipse.sirius.components.view.form.impl.FormPackageImpl#getFlexDirection() - * @generated */ EEnum FLEX_DIRECTION = eINSTANCE.getFlexDirection(); @@ -7149,6 +7537,16 @@ interface Literals { */ EEnum LABEL_PLACEMENT = eINSTANCE.getLabelPlacement(); + /** + * The meta object literal for the '{@link org.eclipse.sirius.components.view.form.ContainerBorderLineStyle + * Container Border Line Style}' enum. + * + * @generated + * @see org.eclipse.sirius.components.view.form.ContainerBorderLineStyle + * @see org.eclipse.sirius.components.view.form.impl.FormPackageImpl#getContainerBorderLineStyle() + */ + EEnum CONTAINER_BORDER_LINE_STYLE = eINSTANCE.getContainerBorderLineStyle(); + } } // FormPackage diff --git a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/GroupDescription.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/GroupDescription.java index a8e350d7d9..e6fd207d2e 100644 --- a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/GroupDescription.java +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/GroupDescription.java @@ -38,6 +38,7 @@ * @generated */ public interface GroupDescription extends EObject { + /** * Returns the value of the 'Name' attribute. * @@ -156,4 +157,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.form.FormPackage#getGroupDescription_BorderStyle() + */ + ContainerBorderStyle getBorderStyle(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.form.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.form.ConditionalContainerBorderStyle}. + * + * @return the value of the 'Conditional Border Styles' containment reference list. + * @model containment="true" + * @generated + * @see org.eclipse.sirius.components.view.form.FormPackage#getGroupDescription_ConditionalBorderStyles() + */ + EList getConditionalBorderStyles(); + } // GroupDescription diff --git a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/ConditionalContainerBorderStyleImpl.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/ConditionalContainerBorderStyleImpl.java new file mode 100644 index 0000000000..e08ae63d43 --- /dev/null +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/ConditionalContainerBorderStyleImpl.java @@ -0,0 +1,403 @@ +/** + * 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.form.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.UserColor; +import org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle; +import org.eclipse.sirius.components.view.form.ContainerBorderLineStyle; +import org.eclipse.sirius.components.view.form.ContainerBorderStyle; +import org.eclipse.sirius.components.view.form.FormPackage; +import org.eclipse.sirius.components.view.impl.ConditionalImpl; + +/** + * An implementation of the model object 'Conditional Container Border Style'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.form.impl.ConditionalContainerBorderStyleImpl#getBorderColor Border + * Color}
    • + *
    • {@link org.eclipse.sirius.components.view.form.impl.ConditionalContainerBorderStyleImpl#getBorderRadius + * Border Radius}
    • + *
    • {@link org.eclipse.sirius.components.view.form.impl.ConditionalContainerBorderStyleImpl#getBorderSize Border + * Size}
    • + *
    • {@link org.eclipse.sirius.components.view.form.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 FormPackage.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, FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR, oldBorderColor, this.borderColor)); + } + } + return this.borderColor; + } + + /** + * + * + * @generated + */ + public UserColor basicGetBorderColor() { + 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, FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR, oldBorderColor, 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, FormPackage.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, FormPackage.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, FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE, oldBorderLineStyle, this.borderLineStyle)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR: + if (resolve) + return this.getBorderColor(); + return this.basicGetBorderColor(); + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS: + return this.getBorderRadius(); + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE: + return this.getBorderSize(); + case FormPackage.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 FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR: + this.setBorderColor((UserColor) newValue); + return; + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS: + this.setBorderRadius((Integer) newValue); + return; + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE: + this.setBorderSize((Integer) newValue); + return; + case FormPackage.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 FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR: + this.setBorderColor(null); + return; + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS: + this.setBorderRadius(BORDER_RADIUS_EDEFAULT); + return; + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE: + this.setBorderSize(BORDER_SIZE_EDEFAULT); + return; + case FormPackage.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 FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR: + return this.borderColor != null; + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS: + return this.borderRadius != BORDER_RADIUS_EDEFAULT; + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE: + return this.borderSize != BORDER_SIZE_EDEFAULT; + case FormPackage.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 FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR: + return FormPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR; + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS: + return FormPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS; + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE: + return FormPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE; + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + return FormPackage.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 FormPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR: + return FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_COLOR; + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS: + return FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_RADIUS; + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE: + return FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE__BORDER_SIZE; + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE: + return FormPackage.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-form/src/main/java/org/eclipse/sirius/components/view/form/impl/ContainerBorderStyleImpl.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/ContainerBorderStyleImpl.java new file mode 100644 index 0000000000..4fb1ea1059 --- /dev/null +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/ContainerBorderStyleImpl.java @@ -0,0 +1,354 @@ +/** + * 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.form.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.UserColor; +import org.eclipse.sirius.components.view.form.ContainerBorderLineStyle; +import org.eclipse.sirius.components.view.form.ContainerBorderStyle; +import org.eclipse.sirius.components.view.form.FormPackage; + +/** + * An implementation of the model object 'Container Border Style'. + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.form.impl.ContainerBorderStyleImpl#getBorderColor Border + * Color}
    • + *
    • {@link org.eclipse.sirius.components.view.form.impl.ContainerBorderStyleImpl#getBorderRadius Border + * Radius}
    • + *
    • {@link org.eclipse.sirius.components.view.form.impl.ContainerBorderStyleImpl#getBorderSize Border + * Size}
    • + *
    • {@link org.eclipse.sirius.components.view.form.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 FormPackage.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, FormPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR, oldBorderColor, this.borderColor)); + } + } + return this.borderColor; + } + + /** + * + * + * @generated + */ + public UserColor basicGetBorderColor() { + 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, FormPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR, oldBorderColor, 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, FormPackage.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, FormPackage.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, FormPackage.CONTAINER_BORDER_STYLE__BORDER_LINE_STYLE, oldBorderLineStyle, this.borderLineStyle)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR: + if (resolve) + return this.getBorderColor(); + return this.basicGetBorderColor(); + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS: + return this.getBorderRadius(); + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE: + return this.getBorderSize(); + case FormPackage.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 FormPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR: + this.setBorderColor((UserColor) newValue); + return; + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS: + this.setBorderRadius((Integer) newValue); + return; + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE: + this.setBorderSize((Integer) newValue); + return; + case FormPackage.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 FormPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR: + this.setBorderColor(null); + return; + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS: + this.setBorderRadius(BORDER_RADIUS_EDEFAULT); + return; + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE: + this.setBorderSize(BORDER_SIZE_EDEFAULT); + return; + case FormPackage.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 FormPackage.CONTAINER_BORDER_STYLE__BORDER_COLOR: + return this.borderColor != null; + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_RADIUS: + return this.borderRadius != BORDER_RADIUS_EDEFAULT; + case FormPackage.CONTAINER_BORDER_STYLE__BORDER_SIZE: + return this.borderSize != BORDER_SIZE_EDEFAULT; + case FormPackage.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-form/src/main/java/org/eclipse/sirius/components/view/form/impl/FlexboxContainerDescriptionImpl.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/FlexboxContainerDescriptionImpl.java index cac62c3368..7b18912445 100644 --- a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/FlexboxContainerDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/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.form.impl; import java.util.Collection; @@ -23,6 +23,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.form.ConditionalContainerBorderStyle; +import org.eclipse.sirius.components.view.form.ContainerBorderStyle; import org.eclipse.sirius.components.view.form.FlexDirection; import org.eclipse.sirius.components.view.form.FlexboxContainerDescription; import org.eclipse.sirius.components.view.form.FormPackage; @@ -41,6 +43,10 @@ * Direction
    } *
  • {@link org.eclipse.sirius.components.view.form.impl.FlexboxContainerDescriptionImpl#getIsEnabledExpression Is * Enabled Expression}
  • + *
  • {@link org.eclipse.sirius.components.view.form.impl.FlexboxContainerDescriptionImpl#getBorderStyle Border + * Style}
  • + *
  • {@link org.eclipse.sirius.components.view.form.impl.FlexboxContainerDescriptionImpl#getConditionalBorderStyles + * Conditional Border Styles}
  • * * * @generated @@ -60,12 +66,22 @@ public class FlexboxContainerDescriptionImpl extends WidgetDescriptionImpl imple * The default value of the '{@link #getFlexDirection() Flex Direction}' attribute. * * - * @see #getFlexDirection() * @generated * @ordered + * @see #getFlexDirection() */ protected static final FlexDirection FLEX_DIRECTION_EDEFAULT = FlexDirection.ROW; + /** + * The cached value of the '{@link #getFlexDirection() Flex Direction}' attribute. + * + * + * @generated + * @ordered + * @see #getFlexDirection() + */ + protected FlexDirection flexDirection = FLEX_DIRECTION_EDEFAULT; + /** * The default value of the '{@link #getIsEnabledExpression() Is Enabled Expression}' attribute. @@ -75,24 +91,36 @@ public class FlexboxContainerDescriptionImpl extends WidgetDescriptionImpl imple * @see #getIsEnabledExpression() */ protected static final String IS_ENABLED_EXPRESSION_EDEFAULT = null; + /** - * The cached value of the '{@link #getFlexDirection() Flex Direction}' attribute. - * + * The cached value of the '{@link #getIsEnabledExpression() Is Enabled Expression}' attribute. * * @generated * @ordered - * @see #getFlexDirection() + * @see #getIsEnabledExpression() */ - protected FlexDirection flexDirection = FLEX_DIRECTION_EDEFAULT; + protected String isEnabledExpression = IS_ENABLED_EXPRESSION_EDEFAULT; + /** - * The cached value of the '{@link #getIsEnabledExpression() Is Enabled Expression}' attribute. * * @generated * @ordered - * @see #getIsEnabledExpression() + * @see #getBorderStyle() */ - protected String isEnabledExpression = IS_ENABLED_EXPRESSION_EDEFAULT; + protected ContainerBorderStyle borderStyle; + + /** + * The cached value of the '{@link #getConditionalBorderStyles() Conditional Border Styles}' containment + * reference list. + * + * @generated + * @ordered + * @see #getConditionalBorderStyles() + */ + protected EList conditionalBorderStyles; /** * @@ -172,6 +200,68 @@ public void setIsEnabledExpression(String newIsEnabledExpression) { this.eNotify(new ENotificationImpl(this, Notification.SET, FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__IS_ENABLED_EXPRESSION, oldIsEnabledExpression, this.isEnabledExpression)); } + /** + * + * + * @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 - FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE, null, msgs); + if (newBorderStyle != null) + msgs = ((InternalEObject) newBorderStyle).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FormPackage.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, FormPackage.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, FormPackage.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, + FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES); + } + return this.conditionalBorderStyles; + } + /** * * @@ -182,6 +272,10 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, switch (featureID) { case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__CHILDREN: return ((InternalEList) this.getChildren()).basicRemove(otherEnd, msgs); + case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE: + return this.basicSetBorderStyle(null, msgs); + case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + return ((InternalEList) this.getConditionalBorderStyles()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -200,6 +294,10 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getFlexDirection(); case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__IS_ENABLED_EXPRESSION: return this.getIsEnabledExpression(); + case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE: + return this.getBorderStyle(); + case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + return this.getConditionalBorderStyles(); } return super.eGet(featureID, resolve, coreType); } @@ -223,6 +321,13 @@ public void eSet(int featureID, Object newValue) { case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__IS_ENABLED_EXPRESSION: this.setIsEnabledExpression((String) newValue); return; + case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE: + this.setBorderStyle((ContainerBorderStyle) newValue); + return; + case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + this.getConditionalBorderStyles().clear(); + this.getConditionalBorderStyles().addAll((Collection) newValue); + return; } super.eSet(featureID, newValue); } @@ -244,6 +349,12 @@ public void eUnset(int featureID) { case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__IS_ENABLED_EXPRESSION: this.setIsEnabledExpression(IS_ENABLED_EXPRESSION_EDEFAULT); return; + case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE: + this.setBorderStyle(null); + return; + case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + this.getConditionalBorderStyles().clear(); + return; } super.eUnset(featureID); } @@ -262,6 +373,10 @@ public boolean eIsSet(int featureID) { return this.flexDirection != FLEX_DIRECTION_EDEFAULT; case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__IS_ENABLED_EXPRESSION: return !Objects.equals(IS_ENABLED_EXPRESSION_EDEFAULT, this.isEnabledExpression); + case FormPackage.FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE: + return this.borderStyle != null; + case FormPackage.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-form/src/main/java/org/eclipse/sirius/components/view/form/impl/FormFactoryImpl.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/FormFactoryImpl.java index a82c29f614..c16facf353 100644 --- a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/FormFactoryImpl.java +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/FormFactoryImpl.java @@ -27,6 +27,7 @@ import org.eclipse.sirius.components.view.form.ConditionalBarChartDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalButtonDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalCheckboxDescriptionStyle; +import org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle; import org.eclipse.sirius.components.view.form.ConditionalLabelDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalLinkDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalListDescriptionStyle; @@ -36,6 +37,8 @@ import org.eclipse.sirius.components.view.form.ConditionalSelectDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalTextareaDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalTextfieldDescriptionStyle; +import org.eclipse.sirius.components.view.form.ContainerBorderLineStyle; +import org.eclipse.sirius.components.view.form.ContainerBorderStyle; import org.eclipse.sirius.components.view.form.FlexDirection; import org.eclipse.sirius.components.view.form.FlexboxContainerDescription; import org.eclipse.sirius.components.view.form.FormDescription; @@ -190,6 +193,10 @@ public EObject create(EClass eClass) { return this.createTextfieldDescriptionStyle(); case FormPackage.CONDITIONAL_TEXTFIELD_DESCRIPTION_STYLE: return this.createConditionalTextfieldDescriptionStyle(); + case FormPackage.CONTAINER_BORDER_STYLE: + return this.createContainerBorderStyle(); + case FormPackage.CONDITIONAL_CONTAINER_BORDER_STYLE: + return this.createConditionalContainerBorderStyle(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } @@ -209,6 +216,8 @@ public Object createFromString(EDataType eDataType, String initialValue) { return this.createGroupDisplayModeFromString(eDataType, initialValue); case FormPackage.LABEL_PLACEMENT: return this.createLabelPlacementFromString(eDataType, initialValue); + case FormPackage.CONTAINER_BORDER_LINE_STYLE: + return this.createContainerBorderLineStyleFromString(eDataType, initialValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } @@ -228,6 +237,8 @@ public String convertToString(EDataType eDataType, Object instanceValue) { return this.convertGroupDisplayModeToString(eDataType, instanceValue); case FormPackage.LABEL_PLACEMENT: return this.convertLabelPlacementToString(eDataType, instanceValue); + case FormPackage.CONTAINER_BORDER_LINE_STYLE: + return this.convertContainerBorderLineStyleToString(eDataType, instanceValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } @@ -695,6 +706,28 @@ public ConditionalTextfieldDescriptionStyle createConditionalTextfieldDescriptio return conditionalTextfieldDescriptionStyle; } + /** + * + * + * @generated + */ + @Override + public ContainerBorderStyle createContainerBorderStyle() { + ContainerBorderStyleImpl containerBorderStyle = new ContainerBorderStyleImpl(); + return containerBorderStyle; + } + + /** + * + * + * @generated + */ + @Override + public ConditionalContainerBorderStyle createConditionalContainerBorderStyle() { + ConditionalContainerBorderStyleImpl conditionalContainerBorderStyle = new ConditionalContainerBorderStyleImpl(); + return conditionalContainerBorderStyle; + } + /** * * @@ -758,6 +791,27 @@ public String convertLabelPlacementToString(EDataType eDataType, Object instance 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-form/src/main/java/org/eclipse/sirius/components/view/form/impl/FormPackageImpl.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/FormPackageImpl.java index aaa8ab949e..c21bb6505e 100644 --- a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/FormPackageImpl.java +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/FormPackageImpl.java @@ -28,6 +28,7 @@ import org.eclipse.sirius.components.view.form.ConditionalBarChartDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalButtonDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalCheckboxDescriptionStyle; +import org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle; import org.eclipse.sirius.components.view.form.ConditionalLabelDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalLinkDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalListDescriptionStyle; @@ -37,6 +38,8 @@ import org.eclipse.sirius.components.view.form.ConditionalSelectDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalTextareaDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalTextfieldDescriptionStyle; +import org.eclipse.sirius.components.view.form.ContainerBorderLineStyle; +import org.eclipse.sirius.components.view.form.ContainerBorderStyle; import org.eclipse.sirius.components.view.form.FlexDirection; import org.eclipse.sirius.components.view.form.FlexboxContainerDescription; import org.eclipse.sirius.components.view.form.FormDescription; @@ -383,6 +386,20 @@ public class FormPackageImpl extends EPackageImpl implements FormPackage { */ private EClass conditionalTextfieldDescriptionStyleEClass = null; + /** + * + * + * @generated + */ + private EClass containerBorderStyleEClass = null; + + /** + * + * + * @generated + */ + private EClass conditionalContainerBorderStyleEClass = null; + /** * * @@ -404,6 +421,13 @@ public class FormPackageImpl extends EPackageImpl implements FormPackage { */ private EEnum labelPlacementEEnum = null; + /** + * + * + * @generated + */ + private EEnum containerBorderLineStyleEEnum = null; + /** * Creates an instance of the model Package, registered with {@link org.eclipse.emf.ecore.EPackage.Registry * EPackage.Registry} by the package package URI value. @@ -638,6 +662,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); + } + /** * * @@ -928,6 +972,26 @@ public EAttribute getFlexboxContainerDescription_IsEnabledExpression() { return (EAttribute) this.flexboxContainerDescriptionEClass.getEStructuralFeatures().get(2); } + /** + * + * + * @generated + */ + @Override + public EReference getFlexboxContainerDescription_BorderStyle() { + return (EReference) this.flexboxContainerDescriptionEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + @Override + public EReference getFlexboxContainerDescription_ConditionalBorderStyles() { + return (EReference) this.flexboxContainerDescriptionEClass.getEStructuralFeatures().get(4); + } + /** * * @@ -2038,6 +2102,66 @@ public EClass getConditionalTextfieldDescriptionStyle() { return this.conditionalTextfieldDescriptionStyleEClass; } + /** + * + * + * @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; + } + /** * * @@ -2068,6 +2192,16 @@ public EEnum getLabelPlacement() { return this.labelPlacementEEnum; } + /** + * + * + * @generated + */ + @Override + public EEnum getContainerBorderLineStyle() { + return this.containerBorderLineStyleEEnum; + } + /** * * @@ -2116,6 +2250,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); @@ -2150,6 +2286,8 @@ public void createPackageContents() { this.createEReference(this.flexboxContainerDescriptionEClass, FLEXBOX_CONTAINER_DESCRIPTION__CHILDREN); this.createEAttribute(this.flexboxContainerDescriptionEClass, FLEXBOX_CONTAINER_DESCRIPTION__FLEX_DIRECTION); this.createEAttribute(this.flexboxContainerDescriptionEClass, FLEXBOX_CONTAINER_DESCRIPTION__IS_ENABLED_EXPRESSION); + this.createEReference(this.flexboxContainerDescriptionEClass, FLEXBOX_CONTAINER_DESCRIPTION__BORDER_STYLE); + this.createEReference(this.flexboxContainerDescriptionEClass, FLEXBOX_CONTAINER_DESCRIPTION__CONDITIONAL_BORDER_STYLES); this.imageDescriptionEClass = this.createEClass(IMAGE_DESCRIPTION); this.createEAttribute(this.imageDescriptionEClass, IMAGE_DESCRIPTION__URL_EXPRESSION); @@ -2298,10 +2436,19 @@ public void createPackageContents() { this.conditionalTextfieldDescriptionStyleEClass = this.createEClass(CONDITIONAL_TEXTFIELD_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); + // Create enums this.flexDirectionEEnum = this.createEEnum(FLEX_DIRECTION); this.groupDisplayModeEEnum = this.createEEnum(GROUP_DISPLAY_MODE); this.labelPlacementEEnum = this.createEEnum(LABEL_PLACEMENT); + this.containerBorderLineStyleEEnum = this.createEEnum(CONTAINER_BORDER_LINE_STYLE); } /** @@ -2398,6 +2545,8 @@ public void initializePackageContents() { this.textfieldDescriptionStyleEClass.getESuperTypes().add(theViewPackage.getLabelStyle()); this.conditionalTextfieldDescriptionStyleEClass.getESuperTypes().add(theViewPackage.getConditional()); this.conditionalTextfieldDescriptionStyleEClass.getESuperTypes().add(this.getTextfieldDescriptionStyle()); + this.conditionalContainerBorderStyleEClass.getESuperTypes().add(theViewPackage.getConditional()); + this.conditionalContainerBorderStyleEClass.getESuperTypes().add(this.getContainerBorderStyle()); // Initialize classes, features, and operations; add parameters this.initEClass(this.formDescriptionEClass, FormDescription.class, "FormDescription", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -2433,6 +2582,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(), theViewPackage.getIdentifier(), "name", null, 0, 1, WidgetDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, @@ -2491,6 +2644,10 @@ public void initializePackageContents() { IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getFlexboxContainerDescription_IsEnabledExpression(), theViewPackage.getInterpretedExpression(), "IsEnabledExpression", null, 0, 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.imageDescriptionEClass, ImageDescription.class, "ImageDescription", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); this.initEAttribute(this.getImageDescription_UrlExpression(), theViewPackage.getInterpretedExpression(), "urlExpression", null, 0, 1, ImageDescription.class, !IS_TRANSIENT, !IS_VOLATILE, @@ -2724,6 +2881,18 @@ public void initializePackageContents() { this.initEClass(this.conditionalTextfieldDescriptionStyleEClass, ConditionalTextfieldDescriptionStyle.class, "ConditionalTextfieldDescriptionStyle", !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(), theViewPackage.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(), theViewPackage.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(), theViewPackage.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); + // Initialize enums and add enum literals this.initEEnum(this.flexDirectionEEnum, FlexDirection.class, "FlexDirection"); this.addEEnumLiteral(this.flexDirectionEEnum, FlexDirection.ROW); @@ -2741,6 +2910,11 @@ public void initializePackageContents() { this.addEEnumLiteral(this.labelPlacementEEnum, LabelPlacement.START); this.addEEnumLiteral(this.labelPlacementEEnum, LabelPlacement.BOTTOM); + 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); + // Create resource this.createResource(eNS_URI); } diff --git a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/GroupDescriptionImpl.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/GroupDescriptionImpl.java index 06d5276c47..2c75e1f3e1 100644 --- a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/GroupDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/impl/GroupDescriptionImpl.java @@ -24,6 +24,8 @@ import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.sirius.components.view.form.ButtonDescription; +import org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle; +import org.eclipse.sirius.components.view.form.ContainerBorderStyle; import org.eclipse.sirius.components.view.form.FormPackage; import org.eclipse.sirius.components.view.form.GroupDescription; import org.eclipse.sirius.components.view.form.GroupDisplayMode; @@ -145,12 +147,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; + /** * * @@ -289,6 +311,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 - FormPackage.GROUP_DESCRIPTION__BORDER_STYLE, null, msgs); + if (newBorderStyle != null) + msgs = ((InternalEObject) newBorderStyle).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FormPackage.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, FormPackage.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, FormPackage.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, + FormPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES); + } + return this.conditionalBorderStyles; + } + /** * * @@ -301,6 +385,10 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, return ((InternalEList) this.getToolbarActions()).basicRemove(otherEnd, msgs); case FormPackage.GROUP_DESCRIPTION__WIDGETS: return ((InternalEList) this.getWidgets()).basicRemove(otherEnd, msgs); + case FormPackage.GROUP_DESCRIPTION__BORDER_STYLE: + return this.basicSetBorderStyle(null, msgs); + case FormPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + return ((InternalEList) this.getConditionalBorderStyles()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -325,6 +413,10 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getToolbarActions(); case FormPackage.GROUP_DESCRIPTION__WIDGETS: return this.getWidgets(); + case FormPackage.GROUP_DESCRIPTION__BORDER_STYLE: + return this.getBorderStyle(); + case FormPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + return this.getConditionalBorderStyles(); } return super.eGet(featureID, resolve, coreType); } @@ -358,6 +450,13 @@ public void eSet(int featureID, Object newValue) { this.getWidgets().clear(); this.getWidgets().addAll((Collection) newValue); return; + case FormPackage.GROUP_DESCRIPTION__BORDER_STYLE: + this.setBorderStyle((ContainerBorderStyle) newValue); + return; + case FormPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + this.getConditionalBorderStyles().clear(); + this.getConditionalBorderStyles().addAll((Collection) newValue); + return; } super.eSet(featureID, newValue); } @@ -388,6 +487,12 @@ public void eUnset(int featureID) { case FormPackage.GROUP_DESCRIPTION__WIDGETS: this.getWidgets().clear(); return; + case FormPackage.GROUP_DESCRIPTION__BORDER_STYLE: + this.setBorderStyle(null); + return; + case FormPackage.GROUP_DESCRIPTION__CONDITIONAL_BORDER_STYLES: + this.getConditionalBorderStyles().clear(); + return; } super.eUnset(featureID); } @@ -412,6 +517,10 @@ public boolean eIsSet(int featureID) { return this.toolbarActions != null && !this.toolbarActions.isEmpty(); case FormPackage.GROUP_DESCRIPTION__WIDGETS: return this.widgets != null && !this.widgets.isEmpty(); + case FormPackage.GROUP_DESCRIPTION__BORDER_STYLE: + return this.borderStyle != null; + case FormPackage.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-form/src/main/java/org/eclipse/sirius/components/view/form/util/FormAdapterFactory.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/util/FormAdapterFactory.java index dfac667410..dad9322d5e 100644 --- a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/util/FormAdapterFactory.java +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/util/FormAdapterFactory.java @@ -28,6 +28,7 @@ import org.eclipse.sirius.components.view.form.ConditionalBarChartDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalButtonDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalCheckboxDescriptionStyle; +import org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle; import org.eclipse.sirius.components.view.form.ConditionalLabelDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalLinkDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalListDescriptionStyle; @@ -37,6 +38,7 @@ import org.eclipse.sirius.components.view.form.ConditionalSelectDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalTextareaDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalTextfieldDescriptionStyle; +import org.eclipse.sirius.components.view.form.ContainerBorderStyle; import org.eclipse.sirius.components.view.form.FlexboxContainerDescription; import org.eclipse.sirius.components.view.form.FormDescription; import org.eclipse.sirius.components.view.form.FormPackage; @@ -336,6 +338,16 @@ public Adapter caseConditionalTextfieldDescriptionStyle(ConditionalTextfieldDesc return FormAdapterFactory.this.createConditionalTextfieldDescriptionStyleAdapter(); } + @Override + public Adapter caseContainerBorderStyle(ContainerBorderStyle object) { + return FormAdapterFactory.this.createContainerBorderStyleAdapter(); + } + + @Override + public Adapter caseConditionalContainerBorderStyle(ConditionalContainerBorderStyle object) { + return FormAdapterFactory.this.createConditionalContainerBorderStyleAdapter(); + } + @Override public Adapter caseRepresentationDescription(RepresentationDescription object) { return FormAdapterFactory.this.createRepresentationDescriptionAdapter(); @@ -996,6 +1008,34 @@ public Adapter createConditionalTextfieldDescriptionStyleAdapter() { return null; } + /** + * Creates a new adapter for an object of class '{@link org.eclipse.sirius.components.view.form.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.form.ContainerBorderStyle + */ + public Adapter createContainerBorderStyleAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class + * '{@link org.eclipse.sirius.components.view.form.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.form.ConditionalContainerBorderStyle + */ + public Adapter createConditionalContainerBorderStyleAdapter() { + return null; + } + /** * Creates a new adapter for an object of class '{@link org.eclipse.sirius.components.view.RepresentationDescription * Representation Description}'. This default implementation returns null so that diff --git a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/util/FormSwitch.java b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/util/FormSwitch.java index d6932fe54f..3f4c8bc933 100644 --- a/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/util/FormSwitch.java +++ b/packages/view/backend/sirius-components-view-form/src/main/java/org/eclipse/sirius/components/view/form/util/FormSwitch.java @@ -27,6 +27,7 @@ import org.eclipse.sirius.components.view.form.ConditionalBarChartDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalButtonDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalCheckboxDescriptionStyle; +import org.eclipse.sirius.components.view.form.ConditionalContainerBorderStyle; import org.eclipse.sirius.components.view.form.ConditionalLabelDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalLinkDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalListDescriptionStyle; @@ -36,6 +37,7 @@ import org.eclipse.sirius.components.view.form.ConditionalSelectDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalTextareaDescriptionStyle; import org.eclipse.sirius.components.view.form.ConditionalTextfieldDescriptionStyle; +import org.eclipse.sirius.components.view.form.ContainerBorderStyle; import org.eclipse.sirius.components.view.form.FlexboxContainerDescription; import org.eclipse.sirius.components.view.form.FormDescription; import org.eclipse.sirius.components.view.form.FormPackage; @@ -595,6 +597,24 @@ protected T doSwitch(int classifierID, EObject theEObject) { result = this.defaultCase(theEObject); return result; } + case FormPackage.CONTAINER_BORDER_STYLE: { + ContainerBorderStyle containerBorderStyle = (ContainerBorderStyle) theEObject; + T result = this.caseContainerBorderStyle(containerBorderStyle); + if (result == null) + result = this.defaultCase(theEObject); + return result; + } + case FormPackage.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; + } default: return this.defaultCase(theEObject); } @@ -1265,6 +1285,34 @@ public T caseConditionalTextfieldDescriptionStyle(ConditionalTextfieldDescriptio 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 'Representation Description'. This implementation returns null; returning a non-null result will terminate the switch.