Search in sources :

Example 1 with IntegerBoxFieldDefinition

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());
}
Also used : IntegerListBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.IntegerListBoxFieldDefinition) DoubleSliderDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.slider.definition.DoubleSliderDefinition) DatePickerFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition) CheckBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition) StringListBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.StringListBoxFieldDefinition) TextAreaFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition) EnumListBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.EnumListBoxFieldDefinition) MultipleSubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition) IntegerRadioGroupFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.radioGroup.definition.IntegerRadioGroupFieldDefinition) DecimalBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.decimalBox.definition.DecimalBoxFieldDefinition) StringRadioGroupFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.radioGroup.definition.StringRadioGroupFieldDefinition) CharacterBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.CharacterBoxFieldDefinition) SubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition) MultipleSubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition) TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) PictureFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.image.definition.PictureFieldDefinition) IntegerSliderDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.slider.definition.IntegerSliderDefinition) IntegerBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition) Test(org.junit.Test)

Example 2 with IntegerBoxFieldDefinition

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()))));
}
Also used : TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) DatePickerFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition) CheckBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition) Mockito.anyString(org.mockito.Mockito.anyString) ModelPropertyImpl(org.kie.workbench.common.forms.model.impl.ModelPropertyImpl) TypeInfoImpl(org.kie.workbench.common.forms.model.impl.TypeInfoImpl) Date(java.util.Date) IntegerBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition) DecimalBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.decimalBox.definition.DecimalBoxFieldDefinition)

Example 3 with IntegerBoxFieldDefinition

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;
}
Also used : IntegerBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition)

Example 4 with 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);
}
Also used : TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) FieldDefinition(org.kie.workbench.common.forms.model.FieldDefinition) CheckBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition) IntegerBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition) ArrayList(java.util.ArrayList) CheckBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition) ModelPropertyImpl(org.kie.workbench.common.forms.model.impl.ModelPropertyImpl) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel) FormGenerationResult(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult) TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) ModelProperty(org.kie.workbench.common.forms.model.ModelProperty) TypeInfoImpl(org.kie.workbench.common.forms.model.impl.TypeInfoImpl) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition) IntegerBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition) Test(org.junit.Test)

Example 5 with 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 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);
}
Also used : TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) FieldDefinition(org.kie.workbench.common.forms.model.FieldDefinition) CheckBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition) IntegerBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition) ArrayList(java.util.ArrayList) CheckBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition) ModelPropertyImpl(org.kie.workbench.common.forms.model.impl.ModelPropertyImpl) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel) FormGenerationResult(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult) TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) ModelProperty(org.kie.workbench.common.forms.model.ModelProperty) TypeInfoImpl(org.kie.workbench.common.forms.model.impl.TypeInfoImpl) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition) IntegerBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition) Test(org.junit.Test)

Aggregations

IntegerBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition)5 CheckBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition)4 TextBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition)4 Test (org.junit.Test)3 ModelPropertyImpl (org.kie.workbench.common.forms.model.impl.ModelPropertyImpl)3 TypeInfoImpl (org.kie.workbench.common.forms.model.impl.TypeInfoImpl)3 ArrayList (java.util.ArrayList)2 DatePickerFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition)2 DecimalBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.decimalBox.definition.DecimalBoxFieldDefinition)2 TaskFormModel (org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel)2 FormGenerationResult (org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult)2 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)2 FormDefinition (org.kie.workbench.common.forms.model.FormDefinition)2 ModelProperty (org.kie.workbench.common.forms.model.ModelProperty)2 Date (java.util.Date)1 PictureFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.image.definition.PictureFieldDefinition)1 EnumListBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.EnumListBoxFieldDefinition)1 IntegerListBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.IntegerListBoxFieldDefinition)1 StringListBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.StringListBoxFieldDefinition)1 IntegerRadioGroupFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.radioGroup.definition.IntegerRadioGroupFieldDefinition)1