use of org.eclipse.sirius.components.forms.description.LinkDescription in project sirius-components by eclipse-sirius.
the class LinkComponent method render.
@Override
public Element render() {
VariableManager variableManager = this.props.getVariableManager();
LinkDescription linkDescription = this.props.getLinkDescription();
String id = linkDescription.getIdProvider().apply(variableManager);
String label = linkDescription.getLabelProvider().apply(variableManager);
String url = linkDescription.getUrlProvider().apply(variableManager);
List<Element> children = List.of(new Element(DiagnosticComponent.class, new DiagnosticComponentProps(linkDescription, variableManager)));
// @formatter:off
LinkElementProps linkElementProps = LinkElementProps.newLinkElementProps(id).label(label).url(url).children(children).build();
return new Element(LinkElementProps.TYPE, linkElementProps);
// @formatter:on
}
use of org.eclipse.sirius.components.forms.description.LinkDescription in project sirius-components by eclipse-sirius.
the class WidgetComponent method render.
@Override
public Element render() {
VariableManager variableManager = this.props.getVariableManager();
AbstractWidgetDescription widgetDescription = this.props.getWidgetDescription();
Element element = null;
if (widgetDescription instanceof TextfieldDescription) {
TextfieldComponentProps textfieldProps = new TextfieldComponentProps(variableManager, (TextfieldDescription) widgetDescription);
element = new Element(TextfieldComponent.class, textfieldProps);
} else if (widgetDescription instanceof TextareaDescription) {
TextareaComponentProps textareaProps = new TextareaComponentProps(variableManager, (TextareaDescription) widgetDescription);
element = new Element(TextareaComponent.class, textareaProps);
} else if (widgetDescription instanceof CheckboxDescription) {
CheckboxComponentProps checkboxProps = new CheckboxComponentProps(variableManager, (CheckboxDescription) widgetDescription);
element = new Element(CheckboxComponent.class, checkboxProps);
} else if (widgetDescription instanceof SelectDescription) {
SelectComponentProps selectProps = new SelectComponentProps(variableManager, (SelectDescription) widgetDescription);
element = new Element(SelectComponent.class, selectProps);
} else if (widgetDescription instanceof MultiSelectDescription) {
MultiSelectComponentProps multiSelectProps = new MultiSelectComponentProps(variableManager, (MultiSelectDescription) widgetDescription);
element = new Element(MultiSelectComponent.class, multiSelectProps);
} else if (widgetDescription instanceof RadioDescription) {
RadioComponentProps radioProps = new RadioComponentProps(variableManager, (RadioDescription) widgetDescription);
element = new Element(RadioComponent.class, radioProps);
} else if (widgetDescription instanceof ListDescription) {
ListComponentProps listProps = new ListComponentProps(variableManager, (ListDescription) widgetDescription);
element = new Element(ListComponent.class, listProps);
} else if (widgetDescription instanceof LinkDescription) {
LinkComponentProps linkProps = new LinkComponentProps(variableManager, (LinkDescription) widgetDescription);
element = new Element(LinkComponent.class, linkProps);
} else {
// $NON-NLS-1$
String pattern = "Unsupported widget description: {}";
this.logger.warn(pattern, widgetDescription.getClass().getSimpleName());
}
return element;
}
Aggregations