Search in sources :

Example 1 with DatePickerFieldDefinition

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;
}
Also used : Expense(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Expense) DataObjectFormModel(org.kie.workbench.common.forms.data.modeller.model.DataObjectFormModel) FormModel(org.kie.workbench.common.forms.model.FormModel) DatePickerFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition) Matchers.anyString(org.mockito.Matchers.anyString) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition) DataObjectFormModel(org.kie.workbench.common.forms.data.modeller.model.DataObjectFormModel)

Example 2 with DatePickerFieldDefinition

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()))));
}
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 DatePickerFieldDefinition

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

Example 4 with DatePickerFieldDefinition

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());
}
Also used : Line(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Line) 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) DatePickerFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition) Client(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Client) Date(java.util.Date) MultipleSubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition) IntegerBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition)

Example 5 with DatePickerFieldDefinition

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());
}
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) 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)

Aggregations

DatePickerFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition)8 Date (java.util.Date)5 TextBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition)5 CheckBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition)4 IntegerBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition)4 DecimalBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.decimalBox.definition.DecimalBoxFieldDefinition)3 SubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition)3 FormDefinition (org.kie.workbench.common.forms.model.FormDefinition)3 Test (org.junit.Test)2 MultipleSubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition)2 Before (org.junit.Before)1 DataObjectFormModel (org.kie.workbench.common.forms.data.modeller.model.DataObjectFormModel)1 Address (org.kie.workbench.common.forms.dynamic.test.model.Address)1 EnumListBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.EnumListBoxFieldDefinition)1 StringListBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.StringListBoxFieldDefinition)1 StringRadioGroupFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.radioGroup.definition.StringRadioGroupFieldDefinition)1 DoubleSliderDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.slider.definition.DoubleSliderDefinition)1 IntegerSliderDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.slider.definition.IntegerSliderDefinition)1 TextAreaFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition)1 Client (org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Client)1