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