use of org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition in project kie-wb-common by kiegroup.
the class BPMNFormGenerationTest method checkPersonForm.
private void checkPersonForm(FormDefinition form, Map<String, FormDefinition> allForms) {
assertNotNull(form);
assertTrue(form.getModel() instanceof JavaFormModel);
assertEquals(4, form.getFields().size());
FieldDefinition field = form.getFieldByBinding("name");
assertFieldStatus(field, "name", String.class.getName());
field = form.getFieldByBinding("type");
assertFieldStatus(field, "type", PersonType.class.getName());
assertTrue(field instanceof EnumListBoxFieldDefinition);
field = form.getFieldByBinding("personalData");
assertFieldStatus(field, "personalData", PersonalData.class.getName());
assertTrue(field instanceof SubFormFieldDefinition);
SubFormFieldDefinition subForm = (SubFormFieldDefinition) field;
assertNotNull(subForm.getNestedForm());
assertNotNull(allForms.get(subForm.getNestedForm()));
field = form.getFieldByBinding("log");
assertFieldStatus(field, "log", LogEntry.class.getName());
assertTrue(field instanceof MultipleSubFormFieldDefinition);
MultipleSubFormFieldDefinition multipleSubForm = (MultipleSubFormFieldDefinition) field;
assertNotNull(multipleSubForm.getCreationForm());
assertEquals(multipleSubForm.getCreationForm(), multipleSubForm.getEditionForm());
FormDefinition nestedForm = allForms.get(multipleSubForm.getCreationForm());
assertNotNull(nestedForm);
assertNotNull(multipleSubForm.getColumnMetas());
assertEquals(nestedForm.getFields().size(), multipleSubForm.getColumnMetas().size());
multipleSubForm.getColumnMetas().forEach(columnMeta -> {
FieldDefinition nestedField = nestedForm.getFieldByBinding(columnMeta.getProperty());
assertNotNull(nestedField);
assertEquals(nestedField.getLabel(), columnMeta.getLabel());
});
}
use of org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition in project kie-wb-common by kiegroup.
the class FieldRendererManagerImplTest method testFunctionallity.
@Test
public void testFunctionallity() {
testRendererFor(new CheckBoxFieldDefinition());
testRendererFor(new DatePickerFieldDefinition());
testRendererFor(new EnumListBoxFieldDefinition());
testRendererFor(new StringListBoxFieldDefinition());
testRendererFor(new StringRadioGroupFieldDefinition());
testRendererFor(new TextAreaFieldDefinition());
testRendererFor(new IntegerSliderDefinition());
testRendererFor(new DoubleSliderDefinition());
testRendererFor(new MultipleSubFormFieldDefinition());
testRendererFor(new SubFormFieldDefinition());
testRendererFor(new TextBoxFieldDefinition());
testRendererFor(new DecimalBoxFieldDefinition());
testRendererFor(new IntegerBoxFieldDefinition());
}
use of org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition in project kie-wb-common by kiegroup.
the class FormDefinitionSerializerImplTest method initTest.
@Before
public void initTest() {
fieldManager = new TestFieldManager();
definitionSerializer = new FormDefinitionSerializerImpl(new FieldSerializer(), new FormModelSerializer(), new TestMetaDataEntryManager());
JavaFormModel model = new PortableJavaModel("org.test.MyParentModel");
formDefinition = new FormDefinition(model);
formDefinition.setId("testForm");
formDefinition.setName("testForm");
formDefinition.setLayoutTemplate(new LayoutTemplate());
for (BasicTypeFieldProvider provider : fieldManager.getAllBasicTypeProviders()) {
for (String type : provider.getSupportedTypes()) {
FieldDefinition field = provider.getFieldByType(new TypeInfoImpl(type));
assertNotNull(field);
String fieldDescription = provider.getFieldTypeName() + "_" + type;
field.setName(fieldDescription);
field.setLabel(fieldDescription);
field.setStandaloneClassName(type);
field.setBinding(fieldDescription);
model.getProperties().add(new ModelPropertyImpl(fieldDescription, new TypeInfoImpl(type)));
formDefinition.getFields().add(field);
}
}
SubFormFieldDefinition subForm = new SubFormFieldDefinition();
subForm.setLabel("SubForm");
subForm.setNestedForm("");
subForm.setBinding("model");
subForm.setStandaloneClassName("org.test.MyTestModel");
subForm.setBinding("SubForm");
formDefinition.getFields().add(subForm);
model.getProperties().add(new ModelPropertyImpl(subForm.getBinding(), new TypeInfoImpl(TypeKind.OBJECT, subForm.getStandaloneClassName(), false)));
MultipleSubFormFieldDefinition multipleSubForm = new MultipleSubFormFieldDefinition();
multipleSubForm.setLabel("MultipleSubForm");
multipleSubForm.setCreationForm("");
multipleSubForm.setEditionForm("");
multipleSubForm.setStandaloneClassName("org.test.MyTestModel");
multipleSubForm.setBinding("MultipleSubForm");
formDefinition.getFields().add(multipleSubForm);
model.getProperties().add(new ModelPropertyImpl(multipleSubForm.getBinding(), new TypeInfoImpl(TypeKind.OBJECT, multipleSubForm.getStandaloneClassName(), true)));
EnumListBoxFieldDefinition enumListBox = new EnumListBoxFieldDefinition();
enumListBox.setLabel("EnumListBox");
enumListBox.setBinding("EnumListBox");
enumListBox.setStandaloneClassName("org.test.MyTestModel");
formDefinition.getFields().add(enumListBox);
model.getProperties().add(new ModelPropertyImpl(enumListBox.getBinding(), new TypeInfoImpl(TypeKind.ENUM, enumListBox.getStandaloneClassName(), false)));
}
use of org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition in project kie-wb-common by kiegroup.
the class MultipleSubformBackendFormRenderingContextManagerTest method getRootForm.
@Override
protected FormDefinition getRootForm() {
FormDefinition form = new FormDefinition(new PortableJavaModel(Person.class.getName()));
form.setId("form");
FieldDefinition field = fieldManager.getDefinitionByDataType(new TypeInfoImpl(TypeKind.OBJECT, Person.class.getName(), true));
field.setName("persons");
field.setBinding("persons");
MultipleSubFormFieldDefinition multpleSubForm = (MultipleSubFormFieldDefinition) field;
multpleSubForm.setCreationForm("person-creation");
multpleSubForm.setEditionForm("person-edition");
form.getFields().add(field);
return form;
}
use of org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition in project kie-wb-common by kiegroup.
the class MultipleSubformFieldAdapter method getFieldDefinition.
@Override
protected FieldDefinition getFieldDefinition(Field originalField) {
MultipleSubFormFieldDefinition fieldDefinition = new MultipleSubFormFieldDefinition();
fieldDefinition.setCreationForm(originalField.getDefaultSubform());
fieldDefinition.setEditionForm(originalField.getDefaultSubform());
return fieldDefinition;
}
Aggregations