Search in sources :

Example 11 with SubFormFieldDefinition

use of org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition 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)

Example 12 with SubFormFieldDefinition

use of org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition in project kie-wb-common by kiegroup.

the class SubformFieldAdapter method getFieldDefinition.

@Override
protected FieldDefinition getFieldDefinition(Field originalField) {
    SubFormFieldDefinition fieldDefinition = new SubFormFieldDefinition();
    fieldDefinition.setNestedForm(originalField.getDefaultSubform());
    return fieldDefinition;
}
Also used : SubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition)

Aggregations

SubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition)12 MultipleSubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition)7 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)5 FormDefinition (org.kie.workbench.common.forms.model.FormDefinition)5 DatePickerFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition)4 EnumListBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.EnumListBoxFieldDefinition)4 Test (org.junit.Test)3 Date (java.util.Date)2 CheckBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition)2 IntegerBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition)2 TextBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition)2 JavaFormModel (org.kie.workbench.common.forms.model.JavaFormModel)2 PortableJavaModel (org.kie.workbench.common.forms.model.impl.PortableJavaModel)2 TypeInfoImpl (org.kie.workbench.common.forms.model.impl.TypeInfoImpl)2 HashMap (java.util.HashMap)1 MapPropertyType (org.jboss.errai.databinding.client.MapPropertyType)1 PropertyType (org.jboss.errai.databinding.client.PropertyType)1 Before (org.junit.Before)1 Person (org.kie.workbench.common.forms.dynamic.backend.server.context.generation.dynamic.impl.model.Person)1 Address (org.kie.workbench.common.forms.dynamic.test.model.Address)1