Search in sources :

Example 1 with AbstractNestedFormFormGroup

use of org.kie.workbench.common.forms.dynamic.client.rendering.formGroups.impl.nestedForm.AbstractNestedFormFormGroup in project kie-wb-common by kiegroup.

the class SubFormFieldRenderer method getFormGroup.

@Override
protected FormGroup getFormGroup(RenderMode renderMode) {
    String nestedNS = renderingContext.getNamespace() + FormRenderingContext.NAMESPACE_SEPARATOR + field.getName();
    FormRenderingContext nestedContext = renderingContext.getCopyFor(nestedNS, field.getNestedForm(), null);
    if (field.getReadOnly()) {
        nestedContext.setRenderMode(RenderMode.READ_ONLY_MODE);
    }
    subFormWidget.render(nestedContext);
    AbstractNestedFormFormGroup formGroup;
    if (Container.COLLAPSIBLE.equals(field.getContainer())) {
        formGroup = formGroupsInstance.select(CollapsibleFormGroup.class).get();
    } else {
        formGroup = formGroupsInstance.select(FieldSetFormGroup.class).get();
    }
    formGroup.render(subFormWidget, field);
    return formGroup;
}
Also used : FormRenderingContext(org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext) AbstractNestedFormFormGroup(org.kie.workbench.common.forms.dynamic.client.rendering.formGroups.impl.nestedForm.AbstractNestedFormFormGroup)

Example 2 with AbstractNestedFormFormGroup

use of org.kie.workbench.common.forms.dynamic.client.rendering.formGroups.impl.nestedForm.AbstractNestedFormFormGroup in project kie-wb-common by kiegroup.

the class SubFormFieldRendererTest method testGetFormGroup.

private void testGetFormGroup(Class<? extends AbstractNestedFormFormGroup> expectedGroupType) {
    AbstractNestedFormFormGroup group = (AbstractNestedFormFormGroup) renderer.getFormGroup(RenderMode.EDIT_MODE);
    Assertions.assertThat(group).isNotNull().isInstanceOf(expectedGroupType);
    verify(context).getCopyFor(Mockito.<String>any(), any(), any());
    verify(formGroupsInstance).get();
    subFormWidget.render(eq(context));
    verify(group).render(any(), any());
}
Also used : AbstractNestedFormFormGroup(org.kie.workbench.common.forms.dynamic.client.rendering.formGroups.impl.nestedForm.AbstractNestedFormFormGroup)

Aggregations

AbstractNestedFormFormGroup (org.kie.workbench.common.forms.dynamic.client.rendering.formGroups.impl.nestedForm.AbstractNestedFormFormGroup)2 FormRenderingContext (org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext)1