use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition in project kie-wb-common by kiegroup.
the class FieldRendererManagerImplTest method testFunctionallity.
@Test
public void testFunctionallity() {
testRendererFor(new CheckBoxFieldDefinition(), CheckBoxFieldRenderer.class, 1);
testRendererFor(new DatePickerFieldDefinition(), DatePickerFieldRenderer.class, 1);
testRendererFor(new EnumListBoxFieldDefinition(), EnumListBoxFieldRenderer.class, 1);
testRendererFor(new StringListBoxFieldDefinition(), StringListBoxFieldRenderer.class, 1);
testRendererFor(new IntegerListBoxFieldDefinition(), IntegerListBoxFieldRenderer.class, 1);
testRendererFor(new StringRadioGroupFieldDefinition(), StringRadioGroupFieldRenderer.class, 1);
testRendererFor(new IntegerRadioGroupFieldDefinition(), IntegerRadioGroupFieldRenderer.class, 1);
testRendererFor(new TextAreaFieldDefinition(), TextAreaFieldRenderer.class, 1);
testRendererFor(new IntegerSliderDefinition(), SliderFieldRenderer.class, 1);
testRendererFor(new DoubleSliderDefinition(), SliderFieldRenderer.class, 2);
testRendererFor(new MultipleSubFormFieldDefinition(), MultipleSubFormFieldRenderer.class, 1);
testRendererFor(new SubFormFieldDefinition(), SubFormFieldRenderer.class, 1);
testRendererFor(new TextBoxFieldDefinition(), TextBoxFieldRenderer.class, 1);
testRendererFor(new CharacterBoxFieldDefinition(), TextBoxFieldRenderer.class, 2);
testRendererFor(new DecimalBoxFieldDefinition(), DecimalBoxFieldRenderer.class, 1);
testRendererFor(new IntegerBoxFieldDefinition(), IntegerBoxFieldRenderer.class, 1);
testUnexistingRenderer(new PictureFieldDefinition());
}
use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition in project kie-wb-common by kiegroup.
the class FormEditorHelperTest method initFields.
private void initFields() {
TextBoxFieldDefinition name = new TextBoxFieldDefinition();
name.setId("name");
name.setName("name");
name.setLabel("Name");
name.setPlaceHolder("Name");
name.setBinding("name");
name.setStandaloneClassName(String.class.getName());
nameField = name;
TextBoxFieldDefinition lastName = new TextBoxFieldDefinition();
lastName.setId("lastName");
lastName.setName("lastName");
lastName.setLabel("Last Name");
lastName.setPlaceHolder("Last Name");
lastName.setBinding("lastName");
lastName.setStandaloneClassName(String.class.getName());
lastNameField = lastName;
DatePickerFieldDefinition birthday = new DatePickerFieldDefinition();
birthday.setId("birthday");
birthday.setName("birthday");
birthday.setLabel("Birthday");
birthday.setBinding("birthday");
birthday.setStandaloneClassName(Date.class.getName());
CheckBoxFieldDefinition married = new CheckBoxFieldDefinition();
married.setId("married");
married.setName("married");
married.setLabel("Married");
married.setBinding("married");
married.setStandaloneClassName(Boolean.class.getName());
marriedField = married;
IntegerBoxFieldDefinition age = new IntegerBoxFieldDefinition();
age.setId("age");
age.setName("age");
age.setLabel("Age");
age.setBinding("age");
ageField = age;
DecimalBoxFieldDefinition weight = new DecimalBoxFieldDefinition();
weight.setId("weight");
weight.setName("weight");
weight.setLabel("Weight");
weight.setBinding("weight");
weightField = weight;
employeeFields = new ArrayList<>();
employeeFields.add(name);
employeeFields.add(lastName);
employeeFields.add(birthday);
employeeFields.add(married);
employeeFields.add(age);
employeeFields.add(weight);
modelProperties = new ArrayList<>();
employeeFields.forEach(fieldDefinition -> modelProperties.add(new ModelPropertyImpl(fieldDefinition.getBinding(), new TypeInfoImpl(fieldDefinition.getStandaloneClassName()))));
}
use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition in project kie-wb-common by kiegroup.
the class IntegerBoxFieldRendererTest method getFieldDefinition.
@Override
protected IntegerBoxFieldDefinition getFieldDefinition() {
IntegerBoxFieldDefinition integerBoxFieldDefinition = new IntegerBoxFieldDefinition();
integerBoxFieldDefinition.setName(NAME);
integerBoxFieldDefinition.setBinding(NAME);
integerBoxFieldDefinition.setPlaceHolder(NAME);
return integerBoxFieldDefinition;
}
use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition in project kie-wb-common by kiegroup.
the class FormGenerationWithSynchronizationTest method testAddModelProperties.
@Test
public void testAddModelProperties() {
List<ModelProperty> modelProperties = new ArrayList<>();
modelProperties.add(new ModelPropertyImpl(NAME_PROPERTY, new TypeInfoImpl(String.class.getName())));
modelProperties.add(new ModelPropertyImpl(LASTNAME_PROPERTY, new TypeInfoImpl(String.class.getName())));
modelProperties.add(new ModelPropertyImpl(AGE_PROPERTY, new TypeInfoImpl(Integer.class.getName())));
modelProperties.add(new ModelPropertyImpl(MARRIED_PROPERTY, new TypeInfoImpl(Boolean.class.getName())));
modelProperties.add(new ModelPropertyImpl(ADDRESS_PROPERTY, new TypeInfoImpl(String.class.getName())));
modelProperties.add(new ModelPropertyImpl(JOB_PROPERTY, new TypeInfoImpl(String.class.getName())));
modelProperties.add(new ModelPropertyImpl(HOBBIES_PROPERTY, new TypeInfoImpl(String.class.getName())));
newFormModel = new TaskFormModel(PROCESS_ID, TASK_NAME, modelProperties);
FormGenerationResult generationResult = service.generateForms(newFormModel, source);
assertNotNull(generationResult);
assertNotNull(generationResult.getRootForm());
FormDefinition formDefinition = generationResult.getRootForm();
assertEquals(newFormModel, formDefinition.getModel());
assertEquals(ALL_FORM_FIELDS, Integer.valueOf(formDefinition.getFields().size()));
FieldDefinition field = formDefinition.getFieldByBinding(NAME_PROPERTY);
assertNotNull(field);
assertEquals(field.getStandaloneClassName(), String.class.getName());
assertTrue(field instanceof TextBoxFieldDefinition);
field = formDefinition.getFieldByBinding(LASTNAME_PROPERTY);
assertNotNull(field);
assertEquals(field.getStandaloneClassName(), String.class.getName());
assertTrue(field instanceof TextBoxFieldDefinition);
field = formDefinition.getFieldByBinding(AGE_PROPERTY);
assertEquals(field.getStandaloneClassName(), Integer.class.getName());
assertTrue(field instanceof IntegerBoxFieldDefinition);
field = formDefinition.getFieldByBinding(MARRIED_PROPERTY);
assertNotNull(field);
assertEquals(field.getStandaloneClassName(), Boolean.class.getName());
assertTrue(field instanceof CheckBoxFieldDefinition);
field = formDefinition.getFieldByBinding(ADDRESS_PROPERTY);
assertNotNull(field);
assertEquals(field.getStandaloneClassName(), String.class.getName());
assertTrue(field instanceof TextBoxFieldDefinition);
field = formDefinition.getFieldByBinding(JOB_PROPERTY);
assertNotNull(field);
assertEquals(field.getStandaloneClassName(), String.class.getName());
assertTrue(field instanceof TextBoxFieldDefinition);
field = formDefinition.getFieldByBinding(HOBBIES_PROPERTY);
assertNotNull(field);
assertEquals(field.getStandaloneClassName(), String.class.getName());
assertTrue(field instanceof TextBoxFieldDefinition);
}
use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition in project kie-wb-common by kiegroup.
the class FormGenerationWithSynchronizationTest method testModelPropertiesConflict.
@Test
public void testModelPropertiesConflict() {
List<ModelProperty> modelProperties = new ArrayList<>();
modelProperties.add(new ModelPropertyImpl(NAME_PROPERTY, new TypeInfoImpl(Integer.class.getName())));
modelProperties.add(new ModelPropertyImpl(LASTNAME_PROPERTY, new TypeInfoImpl(Integer.class.getName())));
modelProperties.add(new ModelPropertyImpl(AGE_PROPERTY, new TypeInfoImpl(String.class.getName())));
modelProperties.add(new ModelPropertyImpl(MARRIED_PROPERTY, new TypeInfoImpl(Integer.class.getName())));
modelProperties.add(new ModelPropertyImpl(ADDRESS_PROPERTY, new TypeInfoImpl(Boolean.class.getName())));
newFormModel = new TaskFormModel(PROCESS_ID, TASK_NAME, modelProperties);
FormGenerationResult generationResult = service.generateForms(newFormModel, source);
assertNotNull(generationResult);
assertNotNull(generationResult.getRootForm());
FormDefinition formDefinition = generationResult.getRootForm();
assertEquals(newFormModel, formDefinition.getModel());
assertEquals(ORIGINAL_FORM_FIELDS, Integer.valueOf(formDefinition.getFields().size()));
FieldDefinition field = formDefinition.getFieldByBinding(NAME_PROPERTY);
assertNotNull(field);
assertEquals(field.getStandaloneClassName(), Integer.class.getName());
assertTrue(field instanceof IntegerBoxFieldDefinition);
field = formDefinition.getFieldByBinding(LASTNAME_PROPERTY);
assertNotNull(field);
assertEquals(field.getStandaloneClassName(), Integer.class.getName());
assertTrue(field instanceof IntegerBoxFieldDefinition);
field = formDefinition.getFieldByBinding(AGE_PROPERTY);
assertEquals(field.getStandaloneClassName(), String.class.getName());
assertTrue(field instanceof TextBoxFieldDefinition);
field = formDefinition.getFieldByBinding(MARRIED_PROPERTY);
assertNotNull(field);
assertEquals(field.getStandaloneClassName(), Integer.class.getName());
assertTrue(field instanceof IntegerBoxFieldDefinition);
field = formDefinition.getFieldByBinding(ADDRESS_PROPERTY);
assertNotNull(field);
assertEquals(field.getStandaloneClassName(), Boolean.class.getName());
assertTrue(field instanceof CheckBoxFieldDefinition);
}
Aggregations