use of org.kie.workbench.common.forms.model.impl.meta.entries.FieldReadOnlyEntry in project kie-wb-common by kiegroup.
the class BPMNFormModelGeneratorImpl method createModelProperty.
protected ModelProperty createModelProperty(Variable variable, ClassLoader classLoader) {
ModelProperty property = ModelPropertiesGenerator.createModelProperty(variable.getName(), variable.getType(), FormModelPropertiesUtil.isListType(variable.getType()), classLoader);
property.getMetaData().addEntry(new FieldReadOnlyEntry(variable.isInput() && !variable.isOutput()));
if (!property.getTypeInfo().isMultiple() && property.getTypeInfo().getClassName().equals(Object.class.getName())) {
property.getMetaData().addEntry(new FieldTypeEntry(TextAreaFieldDefinition.FIELD_TYPE.getTypeName()));
}
return property;
}
use of org.kie.workbench.common.forms.model.impl.meta.entries.FieldReadOnlyEntry in project kie-wb-common by kiegroup.
the class FieldManagerTest method testGetDefinitionByModelPropertyWithMetaData.
@Test
public void testGetDefinitionByModelPropertyWithMetaData() {
property.getMetaData().addEntry(new FieldTypeEntry(TextAreaFieldType.NAME));
property.getMetaData().addEntry(new FieldLabelEntry(METADATA_LABEL));
property.getMetaData().addEntry(new FieldPlaceHolderEntry(METADATA_PLACEHOLDER));
property.getMetaData().addEntry(new FieldReadOnlyEntry(METADATA_READONLY));
property.getMetaData().addEntry(new FieldRequiredEntry(METADATA_REQUIRED));
FieldDefinition fieldDefinition = fieldManager.getDefinitionByModelProperty(property);
Assertions.assertThat(fieldDefinition).isNotNull().isInstanceOf(TextAreaFieldDefinition.class).hasFieldOrPropertyWithValue("name", PROPERTY_NAME).hasFieldOrPropertyWithValue("label", METADATA_LABEL).hasFieldOrPropertyWithValue("placeHolder", METADATA_PLACEHOLDER).hasFieldOrPropertyWithValue("required", METADATA_REQUIRED).hasFieldOrPropertyWithValue("readOnly", METADATA_READONLY).hasFieldOrPropertyWithValue("binding", PROPERTY_NAME);
}
Aggregations