Search in sources :

Example 11 with TextBoxFieldDefinition

use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition in project kie-wb-common by kiegroup.

the class FormLayoutTemplateGeneratorTest method testLayoutTemplateUpdate.

@Test
public void testLayoutTemplateUpdate() {
    testTemplateGeneration();
    TextBoxFieldDefinition address = new TextBoxFieldDefinition();
    address.setId("address");
    address.setName("employee_Address");
    address.setLabel("Address");
    address.setPlaceHolder("Address");
    address.setBinding("Address");
    address.setStandaloneClassName(String.class.getName());
    TextBoxFieldDefinition age = new TextBoxFieldDefinition();
    age.setId("age");
    age.setName("employee_age");
    age.setLabel("age");
    age.setPlaceHolder("age");
    age.setBinding("age");
    age.setStandaloneClassName(Integer.class.getName());
    List<FieldDefinition> newFields = new ArrayList<>();
    newFields.add(address);
    newFields.add(age);
    templateGenerator.updateLayoutTemplate(form, newFields);
    testGeneratedLayout();
}
Also used : TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) 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) FieldDefinition(org.kie.workbench.common.forms.model.FieldDefinition) CheckBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 12 with TextBoxFieldDefinition

use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition in project kie-wb-common by kiegroup.

the class FormLayoutTemplateGeneratorTest method init.

@Before
public void init() {
    templateGenerator = getTemplateGenerator();
    form = new FormDefinition();
    form.setName("Test");
    form.setId("Test-ID");
    TextBoxFieldDefinition name = new TextBoxFieldDefinition();
    name.setId("name");
    name.setName("employee_name");
    name.setLabel("Name");
    name.setPlaceHolder("Name");
    name.setBinding("name");
    name.setStandaloneClassName(String.class.getName());
    TextBoxFieldDefinition lastName = new TextBoxFieldDefinition();
    lastName.setId("lastName");
    lastName.setName("employee_lastName");
    lastName.setLabel("Last Name");
    lastName.setPlaceHolder("Last Name");
    lastName.setBinding("lastName");
    lastName.setStandaloneClassName(String.class.getName());
    DatePickerFieldDefinition birthday = new DatePickerFieldDefinition();
    birthday.setId("birthday");
    birthday.setName("employee_birthday");
    birthday.setLabel("Birthday");
    birthday.setBinding("birthday");
    birthday.setStandaloneClassName(Date.class.getName());
    CheckBoxFieldDefinition married = new CheckBoxFieldDefinition();
    married.setId("married");
    married.setName("employee_married");
    married.setLabel("Married");
    married.setBinding("married");
    married.setStandaloneClassName(Boolean.class.getName());
    form.getFields().add(name);
    form.getFields().add(lastName);
    form.getFields().add(birthday);
    form.getFields().add(married);
}
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) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition) Date(java.util.Date) Before(org.junit.Before)

Example 13 with TextBoxFieldDefinition

use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition in project kie-wb-common by kiegroup.

the class TestFormGenerator method getAddressForm.

public static FormDefinition getAddressForm() {
    FormDefinition form = new FormDefinition();
    form.setName("Address");
    form.setId("Address");
    TextBoxFieldDefinition name = new TextBoxFieldDefinition();
    name.setId(ADDRESS_STREET);
    name.setName(ADDRESS_STREET);
    name.setLabel("Street Name");
    name.setPlaceHolder("Street Name");
    name.setBinding(ADDRESS_STREET);
    name.setStandaloneClassName(String.class.getName());
    TextBoxFieldDefinition num = new TextBoxFieldDefinition();
    num.setId(ADDRESS_NUM);
    num.setName(ADDRESS_NUM);
    num.setLabel("#");
    num.setPlaceHolder("#");
    num.setBinding(ADDRESS_NUM);
    num.setStandaloneClassName(Integer.class.getName());
    form.getFields().add(name);
    form.getFields().add(num);
    form.setModel(generateModelFor(form));
    return form;
}
Also used : TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition)

Example 14 with TextBoxFieldDefinition

use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition in project kie-wb-common by kiegroup.

the class TestFormGenerator method getEmployeeForm.

public static FormDefinition getEmployeeForm() {
    FormDefinition form = new FormDefinition();
    form.setName("Employee");
    form.setId("Employee");
    TextBoxFieldDefinition name = new TextBoxFieldDefinition();
    name.setId(EMPLOYEE_NAME);
    name.setName(EMPLOYEE_NAME);
    name.setLabel("Name");
    name.setPlaceHolder("Name");
    name.setBinding(EMPLOYEE_NAME);
    name.setStandaloneClassName(String.class.getName());
    TextBoxFieldDefinition lastName = new TextBoxFieldDefinition();
    lastName.setId(EMPLOYEE_SURNAME);
    lastName.setName(EMPLOYEE_SURNAME);
    lastName.setLabel("Surname");
    lastName.setPlaceHolder("SurName");
    lastName.setBinding(EMPLOYEE_SURNAME);
    lastName.setStandaloneClassName(String.class.getName());
    DatePickerFieldDefinition birthday = new DatePickerFieldDefinition();
    birthday.setId(EMPLOYEE_BIRTHDAY);
    birthday.setName(EMPLOYEE_BIRTHDAY);
    birthday.setLabel("Birthday");
    birthday.setBinding(EMPLOYEE_BIRTHDAY);
    birthday.setStandaloneClassName(Date.class.getName());
    TextBoxFieldDefinition age = new TextBoxFieldDefinition();
    age.setId(EMPLOYEE_AGE);
    age.setName(EMPLOYEE_AGE);
    age.setLabel("Age");
    age.setPlaceHolder("Age");
    age.setBinding(EMPLOYEE_AGE_BINDING);
    age.setStandaloneClassName(Integer.class.getName());
    CheckBoxFieldDefinition married = new CheckBoxFieldDefinition();
    married.setId(EMPLOYEE_MARRIED);
    married.setName(EMPLOYEE_MARRIED);
    married.setLabel("Married");
    married.setBinding(EMPLOYEE_MARRIED);
    married.setStandaloneClassName(Boolean.class.getName());
    SubFormFieldDefinition address = new SubFormFieldDefinition();
    address.setId(EMPLOYEE_ADDRESS);
    address.setName(EMPLOYEE_ADDRESS);
    address.setLabel("Address");
    address.setBinding(EMPLOYEE_ADDRESS);
    address.setNestedForm("Address");
    address.setStandaloneClassName(Address.class.getName());
    form.getFields().add(name);
    form.getFields().add(lastName);
    form.getFields().add(birthday);
    form.getFields().add(age);
    form.getFields().add(married);
    form.getFields().add(address);
    form.setModel(generateModelFor(form));
    return form;
}
Also used : SubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition) Address(org.kie.workbench.common.forms.dynamic.test.model.Address) 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) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition) Date(java.util.Date)

Aggregations

TextBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition)14 CheckBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition)7 DatePickerFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition)6 IntegerBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition)6 FormDefinition (org.kie.workbench.common.forms.model.FormDefinition)6 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)4 DecimalBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.decimalBox.definition.DecimalBoxFieldDefinition)3 ModelPropertyImpl (org.kie.workbench.common.forms.model.impl.ModelPropertyImpl)3 TypeInfoImpl (org.kie.workbench.common.forms.model.impl.TypeInfoImpl)3 Mockito.anyString (org.mockito.Mockito.anyString)3 Before (org.junit.Before)2 FormModelerContent (org.kie.workbench.common.forms.editor.model.FormModelerContent)2 TextAreaFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition)2 SubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition)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 ModelProperty (org.kie.workbench.common.forms.model.ModelProperty)2