Search in sources :

Example 6 with DataObjectFormModel

use of org.kie.workbench.common.forms.data.modeller.model.DataObjectFormModel 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 7 with DataObjectFormModel

use of org.kie.workbench.common.forms.data.modeller.model.DataObjectFormModel in project kie-wb-common by kiegroup.

the class AbstractFormAdapter method createModelForDO.

protected FormModel createModelForDO(DataHolder dataHolder) {
    String className = dataHolder.getClassName();
    String modelName = className.substring(className.lastIndexOf(".") + 1);
    DataObjectFormModel formModel = new DataObjectFormModel(modelName, className);
    if (Boolean.TRUE.equals(Boolean.parseBoolean(dataHolder.getSupportedType()))) {
        formModel.setSource(Source.EXTERNAL);
    }
    return formModel;
}
Also used : DataObjectFormModel(org.kie.workbench.common.forms.data.modeller.model.DataObjectFormModel)

Aggregations

DataObjectFormModel (org.kie.workbench.common.forms.data.modeller.model.DataObjectFormModel)7 Expense (org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Expense)2 FormDefinition (org.kie.workbench.common.forms.model.FormDefinition)2 ArrayList (java.util.ArrayList)1 TranslationService (org.jboss.errai.ui.client.local.spi.TranslationService)1 Before (org.junit.Before)1 DataObjectFormModelCreationService (org.kie.workbench.common.forms.data.modeller.service.DataObjectFormModelCreationService)1 DatePickerFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition)1 FormGenerationResult (org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult)1 Line (org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Line)1 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)1 FormModel (org.kie.workbench.common.forms.model.FormModel)1 DataModel (org.kie.workbench.common.services.datamodeller.core.DataModel)1 Matchers.anyString (org.mockito.Matchers.anyString)1 Path (org.uberfire.backend.vfs.Path)1