use of org.eclipse.sirius.components.forms.elements.CheckboxElementProps in project sirius-components by eclipse-sirius.
the class CheckboxComponent method render.
@Override
public Element render() {
VariableManager variableManager = this.props.getVariableManager();
CheckboxDescription checkboxDescription = this.props.getCheckboxDescription();
String id = checkboxDescription.getIdProvider().apply(variableManager);
String label = checkboxDescription.getLabelProvider().apply(variableManager);
Boolean value = checkboxDescription.getValueProvider().apply(variableManager);
BiFunction<VariableManager, Boolean, IStatus> genericHandler = checkboxDescription.getNewValueHandler();
Function<Boolean, IStatus> specializedHandler = newValue -> genericHandler.apply(variableManager, newValue);
List<Element> children = List.of(new Element(DiagnosticComponent.class, new DiagnosticComponentProps(checkboxDescription, variableManager)));
// @formatter:off
CheckboxElementProps checkboxElementProps = CheckboxElementProps.newCheckboxElementProps(id).label(label).value(value.booleanValue()).newValueHandler(specializedHandler).children(children).build();
return new Element(CheckboxElementProps.TYPE, checkboxElementProps);
// @formatter:on
}
Aggregations