Search in sources :

Example 1 with FieldPlaceHolderEntry

use of org.kie.workbench.common.forms.fields.shared.model.meta.entries.FieldPlaceHolderEntry in project kie-wb-common by kiegroup.

the class DataObjectFormModelHandler method extractMetaData.

private void extractMetaData(ObjectProperty property, ModelProperty modelProperty) {
    Annotation labelAnnotation = property.getAnnotation(MainDomainAnnotations.LABEL_ANNOTATION);
    if (labelAnnotation != null) {
        String label = labelAnnotation.getValue(MainDomainAnnotations.VALUE_PARAM).toString();
        modelProperty.getMetaData().addEntry(new FieldLabelEntry(label));
        modelProperty.getMetaData().addEntry(new FieldPlaceHolderEntry(label));
    }
}
Also used : FieldLabelEntry(org.kie.workbench.common.forms.model.impl.meta.entries.FieldLabelEntry) FieldPlaceHolderEntry(org.kie.workbench.common.forms.fields.shared.model.meta.entries.FieldPlaceHolderEntry) Annotation(org.kie.workbench.common.services.datamodeller.core.Annotation)

Example 2 with FieldPlaceHolderEntry

use of org.kie.workbench.common.forms.fields.shared.model.meta.entries.FieldPlaceHolderEntry 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);
}
Also used : FieldTypeEntry(org.kie.workbench.common.forms.model.impl.meta.entries.FieldTypeEntry) FieldLabelEntry(org.kie.workbench.common.forms.model.impl.meta.entries.FieldLabelEntry) FieldReadOnlyEntry(org.kie.workbench.common.forms.model.impl.meta.entries.FieldReadOnlyEntry) FieldDefinition(org.kie.workbench.common.forms.model.FieldDefinition) TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) TextAreaFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition) FieldPlaceHolderEntry(org.kie.workbench.common.forms.fields.shared.model.meta.entries.FieldPlaceHolderEntry) FieldRequiredEntry(org.kie.workbench.common.forms.model.impl.meta.entries.FieldRequiredEntry) Test(org.junit.Test)

Aggregations

FieldPlaceHolderEntry (org.kie.workbench.common.forms.fields.shared.model.meta.entries.FieldPlaceHolderEntry)2 FieldLabelEntry (org.kie.workbench.common.forms.model.impl.meta.entries.FieldLabelEntry)2 Test (org.junit.Test)1 TextAreaFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition)1 TextBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition)1 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)1 FieldReadOnlyEntry (org.kie.workbench.common.forms.model.impl.meta.entries.FieldReadOnlyEntry)1 FieldRequiredEntry (org.kie.workbench.common.forms.model.impl.meta.entries.FieldRequiredEntry)1 FieldTypeEntry (org.kie.workbench.common.forms.model.impl.meta.entries.FieldTypeEntry)1 Annotation (org.kie.workbench.common.services.datamodeller.core.Annotation)1