use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition in project kie-wb-common by kiegroup.
the class NestedFormsBPMNVFSFormDefinitionGeneratorServiceTest method findVFSForms.
private List<FormDefinition> findVFSForms(InvocationOnMock invocationOnMock) {
String className = invocationOnMock.getArguments()[0].toString();
if (Expense.class.getName().equals(className)) {
FormModel formModel = new DataObjectFormModel(className, className);
// Creating empty form
FormDefinition emptyForm = new FormDefinition(formModel);
emptyForm.setName(EMPTY_FORM_ID);
emptyForm.setId(EMPTY_FORM_ID);
// Creating a form with a field
FormDefinition fullForm = new FormDefinition(formModel);
fullForm.setName(EXPENSE_FORM_ID);
fullForm.setId(EXPENSE_FORM_ID);
DatePickerFieldDefinition field = new DatePickerFieldDefinition();
field.setId(DATE_VARIABLE);
field.setName(DATE_VARIABLE);
field.setLabel(DATE_VARIABLE);
field.setBinding(DATE_VARIABLE);
fullForm.getFields().add(field);
return Arrays.asList(emptyForm, fullForm);
}
return null;
}
use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition 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.datePicker.definition.DatePickerFieldDefinition in project kie-wb-common by kiegroup.
the class DataObjectFormModelHandlerTest method datePickerHasCorrectProperties.
@Test
public void datePickerHasCorrectProperties() {
formModel = handler.createFormModel(dataObject, path);
DatePickerFieldDefinition datePicker = (DatePickerFieldDefinition) checkCommonProperties("Date");
assertTrue(datePicker.getShowTime());
}
use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition in project kie-wb-common by kiegroup.
the class AbstractBPMNFormGeneratorServiceTest method testExpenseForm.
protected void testExpenseForm(FormDefinition form) {
assertEquals(4, form.getFields().size());
IntegerBoxFieldDefinition id = (IntegerBoxFieldDefinition) form.getFieldByBinding("id");
assertNotNull(id);
assertEquals(Long.class.getName(), id.getStandaloneClassName());
DatePickerFieldDefinition date = (DatePickerFieldDefinition) form.getFieldByBinding("date");
assertNotNull(date);
assertEquals(Date.class.getName(), date.getStandaloneClassName());
SubFormFieldDefinition client = (SubFormFieldDefinition) form.getFieldByBinding("client");
assertNotNull(client);
assertNotNull(client.getNestedForm());
assertEquals(Client.class.getName(), client.getStandaloneClassName());
MultipleSubFormFieldDefinition lines = (MultipleSubFormFieldDefinition) form.getFieldByBinding("lines");
assertNotNull(lines);
assertNotNull(lines.getCreationForm());
assertNotNull(lines.getEditionForm());
assertEquals(lines.getEditionForm(), lines.getCreationForm());
assertFalse(lines.getColumnMetas().isEmpty());
assertEquals(Line.class.getName(), lines.getStandaloneClassName());
}
use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition in project kie-wb-common by kiegroup.
the class AbstractBPMNFormGeneratorServiceTest method testLineForm.
protected void testLineForm(FormDefinition form) {
assertEquals(4, form.getFields().size());
IntegerBoxFieldDefinition id = (IntegerBoxFieldDefinition) form.getFieldByBinding("id");
assertNotNull(id);
assertEquals(Long.class.getName(), id.getStandaloneClassName());
TextBoxFieldDefinition product = (TextBoxFieldDefinition) form.getFieldByBinding("product");
assertNotNull(product);
assertEquals(String.class.getName(), product.getStandaloneClassName());
DatePickerFieldDefinition date = (DatePickerFieldDefinition) form.getFieldByBinding("date");
assertNotNull(date);
assertEquals(Date.class.getName(), date.getStandaloneClassName());
DecimalBoxFieldDefinition price = (DecimalBoxFieldDefinition) form.getFieldByBinding("price");
assertNotNull(price);
assertEquals(Double.class.getName(), price.getStandaloneClassName());
}
Aggregations