Search in sources :

Example 1 with NodeStyle

use of org.eclipse.sirius.components.view.NodeStyle in project sirius-components by eclipse-sirius.

the class NodeStylePropertiesConfigurer method getNodeStyleProperties.

private FormDescription getNodeStyleProperties() {
    // $NON-NLS-1$
    UUID formDescriptionId = UUID.nameUUIDFromBytes("nodestyle".getBytes());
    // @formatter:off
    List<AbstractControlDescription> controls = List.of(// $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "nodestyle.sizeExpression", // $NON-NLS-1$ //$NON-NLS-2$
    "Size Expression", style -> ((NodeStyle) style).getSizeComputationExpression(), (style, newSizeExpression) -> ((NodeStyle) style).setSizeComputationExpression(newSizeExpression), ViewPackage.Literals.NODE_STYLE__SIZE_COMPUTATION_EXPRESSION), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "nodestyle.labelColor", // $NON-NLS-1$ //$NON-NLS-2$
    "Label Color", style -> ((NodeStyle) style).getLabelColor(), (style, newLabelColor) -> ((NodeStyle) style).setLabelColor(newLabelColor), ViewPackage.Literals.NODE_STYLE__LABEL_COLOR), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "nodestyle.color", // $NON-NLS-1$ //$NON-NLS-2$
    "Color", style -> ((NodeStyle) style).getColor(), (style, newColor) -> ((NodeStyle) style).setColor(newColor), ViewPackage.Literals.STYLE__COLOR), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "nodestyle.borderColor", // $NON-NLS-1$ //$NON-NLS-2$
    "Border Color", style -> ((NodeStyle) style).getBorderColor(), (style, newColor) -> ((NodeStyle) style).setBorderColor(newColor), ViewPackage.Literals.BORDER_STYLE__BORDER_COLOR), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "nodestyle.borderRadius", // $NON-NLS-1$ //$NON-NLS-2$
    "Border Radius", style -> String.valueOf(((NodeStyle) style).getBorderRadius()), (style, newBorderRadius) -> {
        try {
            ((NodeStyle) style).setBorderRadius(Integer.parseInt(newBorderRadius));
        } catch (NumberFormatException nfe) {
        // Ignore.
        }
    }, ViewPackage.Literals.BORDER_STYLE__BORDER_RADIUS), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "nodestyle.borderSize", // $NON-NLS-1$ //$NON-NLS-2$
    "Border Size", style -> String.valueOf(((NodeStyle) style).getBorderSize()), (style, newBorderSize) -> {
        try {
            ((NodeStyle) style).setBorderSize(Integer.parseInt(newBorderSize));
        } catch (NumberFormatException nfe) {
        // Ignore.
        }
    }, ViewPackage.Literals.BORDER_STYLE__BORDER_SIZE), // $NON-NLS-1$
    this.createBorderLineStyleSelectionField("nodestyle.borderstyle", ViewPackage.Literals.BORDER_STYLE__BORDER_LINE_STYLE), // $NON-NLS-1$ //$NON-NLS-2$
    this.createCheckbox(// $NON-NLS-1$ //$NON-NLS-2$
    "nodestyle.listMode", // $NON-NLS-1$ //$NON-NLS-2$
    "List Mode", style -> ((NodeStyle) style).isListMode(), (style, newListMode) -> ((NodeStyle) style).setListMode(newListMode), ViewPackage.Literals.NODE_STYLE__LIST_MODE), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "nodestyle.fontSize", // $NON-NLS-1$ //$NON-NLS-2$
    "Font Size", style -> String.valueOf(((LabelStyle) style).getFontSize()), (style, newColor) -> {
        try {
            ((LabelStyle) style).setFontSize(Integer.parseInt(newColor));
        } catch (NumberFormatException nfe) {
        // Ignore.
        }
    }, ViewPackage.Literals.LABEL_STYLE__FONT_SIZE), // $NON-NLS-1$ //$NON-NLS-2$
    this.createCheckbox(// $NON-NLS-1$ //$NON-NLS-2$
    "nodestyle.italic", // $NON-NLS-1$ //$NON-NLS-2$
    "Italic", style -> ((LabelStyle) style).isItalic(), (style, newItalic) -> ((LabelStyle) style).setItalic(newItalic), ViewPackage.Literals.LABEL_STYLE__ITALIC), // $NON-NLS-1$ //$NON-NLS-2$
    this.createCheckbox(// $NON-NLS-1$ //$NON-NLS-2$
    "nodestyle.bold", // $NON-NLS-1$ //$NON-NLS-2$
    "Bold", style -> ((LabelStyle) style).isBold(), (style, newBold) -> ((LabelStyle) style).setBold(newBold), ViewPackage.Literals.LABEL_STYLE__BOLD), // $NON-NLS-1$ //$NON-NLS-2$
    this.createCheckbox(// $NON-NLS-1$ //$NON-NLS-2$
    "nodestyle.underline", // $NON-NLS-1$ //$NON-NLS-2$
    "Underline", style -> ((LabelStyle) style).isUnderline(), (style, newUnderline) -> ((LabelStyle) style).setUnderline(newUnderline), ViewPackage.Literals.LABEL_STYLE__UNDERLINE), // $NON-NLS-1$ //$NON-NLS-2$
    this.createCheckbox(// $NON-NLS-1$ //$NON-NLS-2$
    "nodestyle.strikeThrough", // $NON-NLS-1$ //$NON-NLS-2$
    "Strike Through", style -> ((LabelStyle) style).isStrikeThrough(), (style, newStrikeThrough) -> ((LabelStyle) style).setStrikeThrough(newStrikeThrough), ViewPackage.Literals.LABEL_STYLE__STRIKE_THROUGH), this.createShapeSelectionField(ViewPackage.Literals.NODE_STYLE__SHAPE));
    GroupDescription groupDescription = this.createSimpleGroupDescription(controls);
    Predicate<VariableManager> canCreatePagePredicate = variableManager -> variableManager.get(VariableManager.SELF, Object.class).filter(self -> self instanceof List<?>).map(self -> (List<?>) self).flatMap(self -> self.stream().findFirst()).filter(self -> self instanceof NodeStyle && !(self instanceof ConditionalNodeStyle)).isPresent();
    return FormDescription.newFormDescription(formDescriptionId).label(// $NON-NLS-1$
    "Node Style").labelProvider(variableManager -> variableManager.get(VariableManager.SELF, NodeStyle.class).map(NodeStyle::getColor).orElse(UNNAMED)).canCreatePredicate(variableManager -> true).idProvider(new GetOrCreateRandomIdProvider()).targetObjectIdProvider(this.getTargetObjectIdProvider()).pageDescriptions(List.of(this.createSimplePageDescription(groupDescription, canCreatePagePredicate))).groupDescriptions(List.of(groupDescription)).build();
// @formatter:on
}
Also used : IPropertiesDescriptionRegistryConfigurer(org.eclipse.sirius.components.collaborative.forms.services.api.IPropertiesDescriptionRegistryConfigurer) IEditingContext(org.eclipse.sirius.components.core.api.IEditingContext) LineStyle(org.eclipse.sirius.components.view.LineStyle) PageDescription(org.eclipse.sirius.components.forms.description.PageDescription) BiFunction(java.util.function.BiFunction) SelectComponent(org.eclipse.sirius.components.forms.components.SelectComponent) Function(java.util.function.Function) CustomImage(org.eclipse.sirius.components.emf.view.CustomImage) FormDescription(org.eclipse.sirius.components.forms.description.FormDescription) LabelStyle(org.eclipse.sirius.components.view.LabelStyle) IStatus(org.eclipse.sirius.components.representations.IStatus) TextfieldDescription(org.eclipse.sirius.components.forms.description.TextfieldDescription) ICustomImageSearchService(org.eclipse.sirius.components.emf.view.ICustomImageSearchService) BiConsumer(java.util.function.BiConsumer) IValidationService(org.eclipse.sirius.components.collaborative.validation.api.IValidationService) GroupDescription(org.eclipse.sirius.components.forms.description.GroupDescription) CheckboxDescription(org.eclipse.sirius.components.forms.description.CheckboxDescription) NodeStyle(org.eclipse.sirius.components.view.NodeStyle) Failure(org.eclipse.sirius.components.representations.Failure) Predicate(java.util.function.Predicate) SelectDescription(org.eclipse.sirius.components.forms.description.SelectDescription) Success(org.eclipse.sirius.components.representations.Success) Diagnostic(org.eclipse.emf.common.util.Diagnostic) EcoreUtil(org.eclipse.emf.ecore.util.EcoreUtil) EObject(org.eclipse.emf.ecore.EObject) UUID(java.util.UUID) ConditionalNodeStyle(org.eclipse.sirius.components.view.ConditionalNodeStyle) Collectors(java.util.stream.Collectors) ViewPackage(org.eclipse.sirius.components.view.ViewPackage) Objects(java.util.Objects) List(java.util.List) GetOrCreateRandomIdProvider(org.eclipse.sirius.components.representations.GetOrCreateRandomIdProvider) Component(org.springframework.stereotype.Component) AbstractControlDescription(org.eclipse.sirius.components.forms.description.AbstractControlDescription) BorderStyle(org.eclipse.sirius.components.view.BorderStyle) Optional(java.util.Optional) IPropertiesDescriptionRegistry(org.eclipse.sirius.components.collaborative.forms.services.api.IPropertiesDescriptionRegistry) VariableManager(org.eclipse.sirius.components.representations.VariableManager) Comparator(java.util.Comparator) VariableManager(org.eclipse.sirius.components.representations.VariableManager) NodeStyle(org.eclipse.sirius.components.view.NodeStyle) ConditionalNodeStyle(org.eclipse.sirius.components.view.ConditionalNodeStyle) LabelStyle(org.eclipse.sirius.components.view.LabelStyle) GroupDescription(org.eclipse.sirius.components.forms.description.GroupDescription) AbstractControlDescription(org.eclipse.sirius.components.forms.description.AbstractControlDescription) EObject(org.eclipse.emf.ecore.EObject) List(java.util.List) ConditionalNodeStyle(org.eclipse.sirius.components.view.ConditionalNodeStyle) UUID(java.util.UUID) GetOrCreateRandomIdProvider(org.eclipse.sirius.components.representations.GetOrCreateRandomIdProvider)

Example 2 with NodeStyle

use of org.eclipse.sirius.components.view.NodeStyle in project sirius-components by eclipse-sirius.

the class NodeStylePropertiesConfigurer method getConditionalNodeStyleProperties.

private FormDescription getConditionalNodeStyleProperties() {
    // $NON-NLS-1$
    UUID formDescriptionId = UUID.nameUUIDFromBytes("conditionalnodestyle".getBytes());
    // @formatter:off
    List<AbstractControlDescription> controls = List.of(// $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.sizeExpression", // $NON-NLS-1$ //$NON-NLS-2$
    "Size Expression", style -> ((NodeStyle) style).getSizeComputationExpression(), (style, newSizeExpression) -> ((NodeStyle) style).setSizeComputationExpression(newSizeExpression), ViewPackage.Literals.NODE_STYLE__SIZE_COMPUTATION_EXPRESSION), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.condition", // $NON-NLS-1$ //$NON-NLS-2$
    "Condition", style -> ((ConditionalNodeStyle) style).getCondition(), (style, newCondition) -> ((ConditionalNodeStyle) style).setCondition(newCondition), ViewPackage.Literals.CONDITIONAL__CONDITION), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.labelColor", // $NON-NLS-1$ //$NON-NLS-2$
    "Label Color", style -> ((NodeStyle) style).getLabelColor(), (style, newLabelColor) -> ((NodeStyle) style).setLabelColor(newLabelColor), ViewPackage.Literals.NODE_STYLE__LABEL_COLOR), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.color", // $NON-NLS-1$ //$NON-NLS-2$
    "Color", style -> ((NodeStyle) style).getColor(), (style, newColor) -> ((NodeStyle) style).setColor(newColor), ViewPackage.Literals.STYLE__COLOR), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.borderColor", // $NON-NLS-1$ //$NON-NLS-2$
    "Border Color", style -> ((NodeStyle) style).getBorderColor(), (style, newColor) -> ((NodeStyle) style).setBorderColor(newColor), ViewPackage.Literals.BORDER_STYLE__BORDER_COLOR), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.borderRadius", // $NON-NLS-1$ //$NON-NLS-2$
    "Border Radius", style -> String.valueOf(((NodeStyle) style).getBorderRadius()), (style, newBorderRadius) -> {
        try {
            ((NodeStyle) style).setBorderRadius(Integer.parseInt(newBorderRadius));
        } catch (NumberFormatException nfe) {
        // Ignore.
        }
    }, ViewPackage.Literals.BORDER_STYLE__BORDER_RADIUS), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.borderSize", // $NON-NLS-1$ //$NON-NLS-2$
    "Border Size", style -> String.valueOf(((NodeStyle) style).getBorderSize()), (style, newBorderSize) -> {
        try {
            ((NodeStyle) style).setBorderSize(Integer.parseInt(newBorderSize));
        } catch (NumberFormatException nfe) {
        // Ignore.
        }
    }, ViewPackage.Literals.BORDER_STYLE__BORDER_SIZE), // $NON-NLS-1$
    this.createBorderLineStyleSelectionField("conditionalnodestyle.borderstyle", ViewPackage.Literals.BORDER_STYLE__BORDER_LINE_STYLE), // $NON-NLS-1$ //$NON-NLS-2$
    this.createCheckbox(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.listMode", // $NON-NLS-1$ //$NON-NLS-2$
    "List Mode", style -> ((NodeStyle) style).isListMode(), (style, newListMode) -> ((NodeStyle) style).setListMode(newListMode), ViewPackage.Literals.NODE_STYLE__LIST_MODE), // $NON-NLS-1$ //$NON-NLS-2$
    this.createTextField(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.fontSize", // $NON-NLS-1$ //$NON-NLS-2$
    "Font Size", style -> String.valueOf(((LabelStyle) style).getFontSize()), (style, newColor) -> {
        try {
            ((LabelStyle) style).setFontSize(Integer.parseInt(newColor));
        } catch (NumberFormatException nfe) {
        // Ignore.
        }
    }, ViewPackage.Literals.LABEL_STYLE__FONT_SIZE), // $NON-NLS-1$ //$NON-NLS-2$
    this.createCheckbox(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.italic", // $NON-NLS-1$ //$NON-NLS-2$
    "Italic", style -> ((LabelStyle) style).isItalic(), (style, newItalic) -> ((LabelStyle) style).setItalic(newItalic), ViewPackage.Literals.LABEL_STYLE__ITALIC), // $NON-NLS-1$ //$NON-NLS-2$
    this.createCheckbox(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.bold", // $NON-NLS-1$ //$NON-NLS-2$
    "Bold", style -> ((LabelStyle) style).isBold(), (style, newBold) -> ((LabelStyle) style).setBold(newBold), ViewPackage.Literals.LABEL_STYLE__BOLD), // $NON-NLS-1$ //$NON-NLS-2$
    this.createCheckbox(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.underline", // $NON-NLS-1$ //$NON-NLS-2$
    "Underline", style -> ((LabelStyle) style).isUnderline(), (style, newUnderline) -> ((LabelStyle) style).setUnderline(newUnderline), ViewPackage.Literals.LABEL_STYLE__UNDERLINE), // $NON-NLS-1$ //$NON-NLS-2$
    this.createCheckbox(// $NON-NLS-1$ //$NON-NLS-2$
    "conditionalnodestyle.strikeThrough", // $NON-NLS-1$ //$NON-NLS-2$
    "Strike Through", style -> ((LabelStyle) style).isStrikeThrough(), (style, newStrikeThrough) -> ((LabelStyle) style).setStrikeThrough(newStrikeThrough), ViewPackage.Literals.LABEL_STYLE__STRIKE_THROUGH), this.createShapeSelectionField(ViewPackage.Literals.NODE_STYLE__SHAPE));
    GroupDescription groupDescription = this.createSimpleGroupDescription(controls);
    Predicate<VariableManager> canCreatePagePredicate = variableManager -> variableManager.get(VariableManager.SELF, Object.class).filter(self -> self instanceof List<?>).map(self -> (List<?>) self).flatMap(self -> self.stream().findFirst()).filter(self -> self instanceof ConditionalNodeStyle).isPresent();
    return FormDescription.newFormDescription(formDescriptionId).label(// $NON-NLS-1$
    "Conditional Node Style").labelProvider(variableManager -> variableManager.get(VariableManager.SELF, ConditionalNodeStyle.class).map(ConditionalNodeStyle::getCondition).orElse(UNNAMED)).canCreatePredicate(variableManager -> true).idProvider(new GetOrCreateRandomIdProvider()).targetObjectIdProvider(this.getTargetObjectIdProvider()).pageDescriptions(List.of(this.createSimplePageDescription(groupDescription, canCreatePagePredicate))).groupDescriptions(List.of(groupDescription)).build();
// @formatter:on
}
Also used : IPropertiesDescriptionRegistryConfigurer(org.eclipse.sirius.components.collaborative.forms.services.api.IPropertiesDescriptionRegistryConfigurer) IEditingContext(org.eclipse.sirius.components.core.api.IEditingContext) LineStyle(org.eclipse.sirius.components.view.LineStyle) PageDescription(org.eclipse.sirius.components.forms.description.PageDescription) BiFunction(java.util.function.BiFunction) SelectComponent(org.eclipse.sirius.components.forms.components.SelectComponent) Function(java.util.function.Function) CustomImage(org.eclipse.sirius.components.emf.view.CustomImage) FormDescription(org.eclipse.sirius.components.forms.description.FormDescription) LabelStyle(org.eclipse.sirius.components.view.LabelStyle) IStatus(org.eclipse.sirius.components.representations.IStatus) TextfieldDescription(org.eclipse.sirius.components.forms.description.TextfieldDescription) ICustomImageSearchService(org.eclipse.sirius.components.emf.view.ICustomImageSearchService) BiConsumer(java.util.function.BiConsumer) IValidationService(org.eclipse.sirius.components.collaborative.validation.api.IValidationService) GroupDescription(org.eclipse.sirius.components.forms.description.GroupDescription) CheckboxDescription(org.eclipse.sirius.components.forms.description.CheckboxDescription) NodeStyle(org.eclipse.sirius.components.view.NodeStyle) Failure(org.eclipse.sirius.components.representations.Failure) Predicate(java.util.function.Predicate) SelectDescription(org.eclipse.sirius.components.forms.description.SelectDescription) Success(org.eclipse.sirius.components.representations.Success) Diagnostic(org.eclipse.emf.common.util.Diagnostic) EcoreUtil(org.eclipse.emf.ecore.util.EcoreUtil) EObject(org.eclipse.emf.ecore.EObject) UUID(java.util.UUID) ConditionalNodeStyle(org.eclipse.sirius.components.view.ConditionalNodeStyle) Collectors(java.util.stream.Collectors) ViewPackage(org.eclipse.sirius.components.view.ViewPackage) Objects(java.util.Objects) List(java.util.List) GetOrCreateRandomIdProvider(org.eclipse.sirius.components.representations.GetOrCreateRandomIdProvider) Component(org.springframework.stereotype.Component) AbstractControlDescription(org.eclipse.sirius.components.forms.description.AbstractControlDescription) BorderStyle(org.eclipse.sirius.components.view.BorderStyle) Optional(java.util.Optional) IPropertiesDescriptionRegistry(org.eclipse.sirius.components.collaborative.forms.services.api.IPropertiesDescriptionRegistry) VariableManager(org.eclipse.sirius.components.representations.VariableManager) Comparator(java.util.Comparator) VariableManager(org.eclipse.sirius.components.representations.VariableManager) NodeStyle(org.eclipse.sirius.components.view.NodeStyle) ConditionalNodeStyle(org.eclipse.sirius.components.view.ConditionalNodeStyle) LabelStyle(org.eclipse.sirius.components.view.LabelStyle) GroupDescription(org.eclipse.sirius.components.forms.description.GroupDescription) AbstractControlDescription(org.eclipse.sirius.components.forms.description.AbstractControlDescription) EObject(org.eclipse.emf.ecore.EObject) List(java.util.List) ConditionalNodeStyle(org.eclipse.sirius.components.view.ConditionalNodeStyle) UUID(java.util.UUID) GetOrCreateRandomIdProvider(org.eclipse.sirius.components.representations.GetOrCreateRandomIdProvider)

Example 3 with NodeStyle

use of org.eclipse.sirius.components.view.NodeStyle in project sirius-components by eclipse-sirius.

the class ViewValidatorTests method testConditionalNodeStyleDefaultValuesAreValid.

@Test
public void testConditionalNodeStyleDefaultValuesAreValid() {
    Map<Object, Object> defaultContext = Diagnostician.INSTANCE.createDefaultContext();
    NodeStyle conditionalNodeStyle = ViewFactory.eINSTANCE.createConditionalNodeStyle();
    BasicDiagnostic diagnosticChain = new BasicDiagnostic(Diagnostic.OK, null, 0, null, null);
    boolean validationResult = new DiagramDescriptionValidator().validate(conditionalNodeStyle.eClass(), conditionalNodeStyle, diagnosticChain, defaultContext);
    assertThat(validationResult).isTrue();
    assertThat(diagnosticChain).isEqualTo(new BasicDiagnostic(Diagnostic.OK, null, 0, null, null));
}
Also used : NodeStyle(org.eclipse.sirius.components.view.NodeStyle) ConditionalNodeStyle(org.eclipse.sirius.components.view.ConditionalNodeStyle) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) DiagramDescriptionValidator(org.eclipse.sirius.components.emf.view.diagram.DiagramDescriptionValidator) Test(org.junit.jupiter.api.Test)

Example 4 with NodeStyle

use of org.eclipse.sirius.components.view.NodeStyle in project sirius-components by eclipse-sirius.

the class NodeDescriptionImpl method basicSetStyle.

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 *
 * @generated
 */
public NotificationChain basicSetStyle(NodeStyle newStyle, NotificationChain msgs) {
    NodeStyle oldStyle = this.style;
    this.style = newStyle;
    if (this.eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ViewPackage.NODE_DESCRIPTION__STYLE, oldStyle, newStyle);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : NodeStyle(org.eclipse.sirius.components.view.NodeStyle) ConditionalNodeStyle(org.eclipse.sirius.components.view.ConditionalNodeStyle) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 5 with NodeStyle

use of org.eclipse.sirius.components.view.NodeStyle in project sirius-components by eclipse-sirius.

the class ViewValidatorTests method testNodeStyleDefaultValuesAreValid.

@Test
public void testNodeStyleDefaultValuesAreValid() {
    Map<Object, Object> defaultContext = Diagnostician.INSTANCE.createDefaultContext();
    NodeStyle nodeStyle = ViewFactory.eINSTANCE.createNodeStyle();
    BasicDiagnostic diagnosticChain = new BasicDiagnostic(Diagnostic.OK, null, 0, null, null);
    boolean validationResult = new DiagramDescriptionValidator().validate(nodeStyle.eClass(), nodeStyle, diagnosticChain, defaultContext);
    assertThat(validationResult).isTrue();
    assertThat(diagnosticChain).isEqualTo(new BasicDiagnostic(Diagnostic.OK, null, 0, null, null));
}
Also used : NodeStyle(org.eclipse.sirius.components.view.NodeStyle) ConditionalNodeStyle(org.eclipse.sirius.components.view.ConditionalNodeStyle) BasicDiagnostic(org.eclipse.emf.common.util.BasicDiagnostic) DiagramDescriptionValidator(org.eclipse.sirius.components.emf.view.diagram.DiagramDescriptionValidator) Test(org.junit.jupiter.api.Test)

Aggregations

NodeStyle (org.eclipse.sirius.components.view.NodeStyle)7 ConditionalNodeStyle (org.eclipse.sirius.components.view.ConditionalNodeStyle)5 Comparator (java.util.Comparator)2 List (java.util.List)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 UUID (java.util.UUID)2 BiConsumer (java.util.function.BiConsumer)2 BiFunction (java.util.function.BiFunction)2 Function (java.util.function.Function)2 Predicate (java.util.function.Predicate)2 Collectors (java.util.stream.Collectors)2 BasicDiagnostic (org.eclipse.emf.common.util.BasicDiagnostic)2 Diagnostic (org.eclipse.emf.common.util.Diagnostic)2 EObject (org.eclipse.emf.ecore.EObject)2 EcoreUtil (org.eclipse.emf.ecore.util.EcoreUtil)2 IPropertiesDescriptionRegistry (org.eclipse.sirius.components.collaborative.forms.services.api.IPropertiesDescriptionRegistry)2 IPropertiesDescriptionRegistryConfigurer (org.eclipse.sirius.components.collaborative.forms.services.api.IPropertiesDescriptionRegistryConfigurer)2 IValidationService (org.eclipse.sirius.components.collaborative.validation.api.IValidationService)2 IEditingContext (org.eclipse.sirius.components.core.api.IEditingContext)2