Search in sources :

Example 1 with TextareaElementProps

use of org.eclipse.sirius.components.forms.elements.TextareaElementProps in project sirius-components by eclipse-sirius.

the class TextareaComponent method render.

@Override
public Element render() {
    VariableManager variableManager = this.props.getVariableManager();
    TextareaDescription textareaDescription = this.props.getTextareaDescription();
    String id = textareaDescription.getIdProvider().apply(variableManager);
    String label = textareaDescription.getLabelProvider().apply(variableManager);
    String value = textareaDescription.getValueProvider().apply(variableManager);
    Function<String, IStatus> specializedHandler = newValue -> {
        return textareaDescription.getNewValueHandler().apply(variableManager, newValue);
    };
    List<Element> children = List.of(new Element(DiagnosticComponent.class, new DiagnosticComponentProps(textareaDescription, variableManager)));
    // @formatter:off
    TextareaElementProps textareaElementProps = TextareaElementProps.newTextareaElementProps(id).label(label).value(value).newValueHandler(specializedHandler).children(children).build();
    return new Element(TextareaElementProps.TYPE, textareaElementProps);
// @formatter:on
}
Also used : VariableManager(org.eclipse.sirius.components.representations.VariableManager) Objects(java.util.Objects) TextareaElementProps(org.eclipse.sirius.components.forms.elements.TextareaElementProps) List(java.util.List) TextareaDescription(org.eclipse.sirius.components.forms.description.TextareaDescription) IStatus(org.eclipse.sirius.components.representations.IStatus) DiagnosticComponentProps(org.eclipse.sirius.components.forms.validation.DiagnosticComponentProps) VariableManager(org.eclipse.sirius.components.representations.VariableManager) Function(java.util.function.Function) Element(org.eclipse.sirius.components.representations.Element) IComponent(org.eclipse.sirius.components.representations.IComponent) DiagnosticComponent(org.eclipse.sirius.components.forms.validation.DiagnosticComponent) DiagnosticComponent(org.eclipse.sirius.components.forms.validation.DiagnosticComponent) IStatus(org.eclipse.sirius.components.representations.IStatus) TextareaDescription(org.eclipse.sirius.components.forms.description.TextareaDescription) TextareaElementProps(org.eclipse.sirius.components.forms.elements.TextareaElementProps) Element(org.eclipse.sirius.components.representations.Element) DiagnosticComponentProps(org.eclipse.sirius.components.forms.validation.DiagnosticComponentProps)

Aggregations

List (java.util.List)1 Objects (java.util.Objects)1 Function (java.util.function.Function)1 TextareaDescription (org.eclipse.sirius.components.forms.description.TextareaDescription)1 TextareaElementProps (org.eclipse.sirius.components.forms.elements.TextareaElementProps)1 DiagnosticComponent (org.eclipse.sirius.components.forms.validation.DiagnosticComponent)1 DiagnosticComponentProps (org.eclipse.sirius.components.forms.validation.DiagnosticComponentProps)1 Element (org.eclipse.sirius.components.representations.Element)1 IComponent (org.eclipse.sirius.components.representations.IComponent)1 IStatus (org.eclipse.sirius.components.representations.IStatus)1 VariableManager (org.eclipse.sirius.components.representations.VariableManager)1