use of org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext in project kie-wb-common by kiegroup.
the class DynamicFormRenderer method renderDefaultForm.
public void renderDefaultForm(final Object model, final RenderMode renderMode, final Command callback) {
PortablePreconditions.checkNotNull("model", model);
FormRenderingContext context = dynamicFormModelGenerator.getContextForModel(model);
if (context != null) {
doRenderDefaultForm(context, model, renderMode, callback);
}
}
use of org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext in project kie-wb-common by kiegroup.
the class FieldPropertiesRenderer method render.
protected void render() {
FormRenderingContext context = dynamicFormModelGenerator.getContextForModel(fieldCopy);
if (context != null) {
FormEditorRenderingContext renderingContext = new FormEditorRenderingContext("properties", helper.getPath());
renderingContext.setRootForm(context.getRootForm());
renderingContext.getAvailableForms().putAll(context.getAvailableForms());
renderingContext.setModel(fieldCopy);
doRender(helper, renderingContext);
}
}
use of org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext 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;
}
use of org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext in project kie-wb-common by kiegroup.
the class ConditionEditorFieldEditorRendererTest method testInit.
@Test
public void testInit() {
FormRenderingContext context = mock(FormRenderingContext.class);
ConditionEditorFieldDefinition fieldDefinition = mock(ConditionEditorFieldDefinition.class);
ClientSession session = mock(ClientSession.class);
when(sessionManager.getCurrentSession()).thenReturn(session);
renderer.init(context, fieldDefinition);
verify(widget).init(session);
}
use of org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext in project kie-wb-common by kiegroup.
the class CalledElementFormProviderTest method testGetSelectorData.
@Test
public void testGetSelectorData() {
List<String> names = Arrays.asList("p1", "p2", "p3");
when(dataProvider.getProcessIds()).thenReturn(names);
FormRenderingContext context = mock(FormRenderingContext.class);
SelectorData data = tested.getSelectorData(context);
Map values = data.getValues();
assertNotNull(values);
assertEquals(3, values.size());
assertTrue(values.containsKey("p1"));
assertTrue(values.containsKey("p2"));
assertTrue(values.containsKey("p3"));
verify(event, times(1)).fire(any(RequestProcessDataEvent.class));
}
Aggregations