Search in sources :

Example 6 with TypeInfo

use of org.kie.workbench.common.forms.model.TypeInfo in project kie-wb-common by kiegroup.

the class FieldManagerTest method testCompatiblefields.

protected void testCompatiblefields(boolean addFieldType) {
    for (Class clazz : basicTypesSupported) {
        TypeInfo typeInfo = new TypeInfoImpl(clazz.isEnum() ? TypeKind.ENUM : TypeKind.BASE, clazz.getName(), false);
        FieldDefinition fieldDefinition = fieldManager.getDefinitionByDataType(typeInfo);
        Assertions.assertThat(fieldDefinition).isNotNull();
        if (addFieldType) {
            fieldDefinition.setStandaloneClassName(typeInfo.getClassName());
        }
        Collection<String> compatibles = fieldManager.getCompatibleFields(fieldDefinition);
        Assertions.assertThat(compatibles).isNotNull().isNotEmpty();
    }
}
Also used : 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) TypeInfoImpl(org.kie.workbench.common.forms.model.impl.TypeInfoImpl) TypeInfo(org.kie.workbench.common.forms.model.TypeInfo)

Example 7 with TypeInfo

use of org.kie.workbench.common.forms.model.TypeInfo in project kie-wb-common by kiegroup.

the class FieldManagerTest method testGetFieldByTypeInfo.

@Test
public void testGetFieldByTypeInfo() {
    for (Class clazz : basicTypesSupported) {
        TypeInfo typeInfo = new TypeInfoImpl(clazz.isEnum() ? TypeKind.ENUM : TypeKind.BASE, clazz.getName(), false);
        checkFieldExists(typeInfo);
    }
    for (Class clazz : basicMultipleTypesSupported) {
        TypeInfo typeInfo = new TypeInfoImpl(TypeKind.BASE, clazz.getName(), true);
        checkFieldExists(typeInfo);
    }
    // check nested form
    checkFieldExists(new TypeInfoImpl(TypeKind.OBJECT, Object.class.getName(), false));
    // check multiple subform
    checkFieldExists(new TypeInfoImpl(TypeKind.OBJECT, Object.class.getName(), true));
}
Also used : TypeInfoImpl(org.kie.workbench.common.forms.model.impl.TypeInfoImpl) TypeInfo(org.kie.workbench.common.forms.model.TypeInfo) Test(org.junit.Test)

Aggregations

TypeInfo (org.kie.workbench.common.forms.model.TypeInfo)7 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)6 TypeInfoImpl (org.kie.workbench.common.forms.model.impl.TypeInfoImpl)6 TextBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition)4 Test (org.junit.Test)3 TextAreaFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition)3 BasicTypeFieldProvider (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.BasicTypeFieldProvider)2 ModelProperty (org.kie.workbench.common.forms.model.ModelProperty)2 ModelPropertyImpl (org.kie.workbench.common.forms.model.impl.ModelPropertyImpl)2 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 JsonDeserializer (com.google.gson.JsonDeserializer)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 ArrayList (java.util.ArrayList)1 Dependent (javax.enterprise.context.Dependent)1 Inject (javax.inject.Inject)1 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)1 ModuleDataModelOracle (org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle)1 HasMaxLength (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.HasMaxLength)1