use of org.uberfire.ext.layout.editor.api.editor.LayoutComponent in project kie-wb-common by kiegroup.
the class AbstractBPMNFormGeneratorService method generateHTMLElement.
protected LayoutComponent generateHTMLElement(String content) {
LayoutComponent htmlComponent = new LayoutComponent(HTML_COMPONENT);
htmlComponent.addProperty(HTML_CODE_PARAMETER, content);
return htmlComponent;
}
use of org.uberfire.ext.layout.editor.api.editor.LayoutComponent in project kie-wb-common by kiegroup.
the class AbstractFormLayoutTemplateGenerator method addFieldsToTemplate.
protected void addFieldsToTemplate(LayoutTemplate template, List<FieldDefinition> fields, String formId) {
fields.forEach(field -> {
LayoutComponent layoutComponent = new LayoutComponent(getDraggableType());
layoutComponent.addProperty(FormLayoutComponent.FORM_ID, formId);
layoutComponent.addProperty(FormLayoutComponent.FIELD_ID, field.getId());
LayoutColumn column = new LayoutColumn("12");
column.add(layoutComponent);
LayoutRow row = new LayoutRow();
row.add(column);
template.addRow(row);
});
}
use of org.uberfire.ext.layout.editor.api.editor.LayoutComponent in project kie-wb-common by kiegroup.
the class DecoratorFieldAdapter method parseField.
@Override
public void parseField(Field originalField, FormMigrationSummary formSummary, FormDefinition fieldDefinitionConsumer, Consumer<LayoutComponent> layoutElementConsumer) {
String htmlContent;
switch(originalField.getFieldType().getCode()) {
case FieldTypeBuilder.HTML_LABEL:
htmlContent = lookupI18nValue(originalField.getHtmlContent());
break;
default:
htmlContent = "<HR/>";
break;
}
LayoutComponent component = new LayoutComponent(FormsMigrationConstants.HTML_COMPONENT);
component.addProperty(FormsMigrationConstants.HTML_CODE_PARAMETER, htmlContent);
layoutElementConsumer.accept(component);
}
use of org.uberfire.ext.layout.editor.api.editor.LayoutComponent in project kie-wb-common by kiegroup.
the class AbstractFieldAdapter method parseField.
@Override
public void parseField(Field originalField, FormMigrationSummary formSummary, FormDefinition newFormDefinition, Consumer<LayoutComponent> layoutElementConsumer) {
FieldDefinition fieldDefinition = getFieldDefinition(originalField);
fieldDefinition.setId(String.valueOf(originalField.getId()));
fieldDefinition.setName(originalField.getFieldName());
fieldDefinition.setLabel(lookupI18nValue(originalField.getLabel()));
fieldDefinition.setHelpMessage(lookupI18nValue(originalField.getTitle()));
fieldDefinition.setStandaloneClassName(StringUtils.defaultIfBlank(originalField.getBag(), originalField.getFieldType().getFieldClass()));
fieldDefinition.setReadOnly(originalField.getReadonly());
fieldDefinition.setRequired(originalField.getFieldRequired());
String binding = StringUtils.defaultString(StringUtils.defaultIfBlank(originalField.getInputBinding(), originalField.getOutputBinding()));
if (!StringUtils.isEmpty(binding)) {
if (binding.contains("/")) {
binding = binding.substring(binding.indexOf("/") + 1);
}
ModelPropertyImpl property = new ModelPropertyImpl(binding, fieldDefinition.getFieldTypeInfo());
newFormDefinition.getModel().getProperties().add(property);
}
fieldDefinition.setBinding(binding);
newFormDefinition.getFields().add(fieldDefinition);
LayoutComponent component = new LayoutComponent(DRAGGABLE_TYPE);
component.addProperty(FormLayoutComponent.FORM_ID, newFormDefinition.getId());
component.addProperty(FormLayoutComponent.FIELD_ID, fieldDefinition.getId());
layoutElementConsumer.accept(component);
}
use of org.uberfire.ext.layout.editor.api.editor.LayoutComponent in project kie-wb-common by kiegroup.
the class AllFieldTypesFormGenerationTest method checkDecoratorRow.
protected void checkDecoratorRow(LayoutRow row) {
LayoutComponent component = checkRow(row);
Assertions.assertThat(component).isNotNull().hasFieldOrPropertyWithValue("dragTypeName", FormsMigrationConstants.HTML_COMPONENT);
}
Aggregations