use of org.eclipse.sirius.components.validation.elements.ValidationElementProps in project sirius-components by eclipse-sirius.
the class ValidationComponent method render.
@Override
public Element render() {
VariableManager variableManager = this.props.getVariableManager();
ValidationDescription validationDescription = this.props.getValidationDescription();
Optional<Validation> optionalPreviousValidation = this.props.getPreviousValidation();
// $NON-NLS-1$
String id = optionalPreviousValidation.map(Validation::getId).orElseGet(() -> "validation");
String label = validationDescription.getLabel();
List<?> diagnostics = validationDescription.getDiagnosticsProvider().apply(variableManager);
List<Element> children = new ArrayList<>(diagnostics.size());
for (Object diagnostic : diagnostics) {
DiagnosticComponentProps diagnosticComponentProps = new DiagnosticComponentProps(diagnostic, validationDescription);
children.add(new Element(DiagnosticComponent.class, diagnosticComponentProps));
}
// @formatter:off
ValidationElementProps validationElementProps = ValidationElementProps.newValidationElementProps(id).label(label).descriptionId(validationDescription.getId()).children(children).build();
return new Element(ValidationElementProps.TYPE, validationElementProps);
}
Aggregations