Search in sources :

Example 1 with PathAwareFormContext

use of org.kie.workbench.common.stunner.forms.context.PathAwareFormContext in project kie-wb-common by kiegroup.

the class FormDisplayer method doRender.

private void doRender(Element<? extends Definition<?>> element, Object definition, Path diagramPath, FieldChangeHandler changeHandler) {
    if (renderer.isInitialized()) {
        LOGGER.fine("Clearing previous form");
        renderer.unBind();
    }
    LOGGER.fine("Rendering a new form for element");
    Collection<FormElementFilter> filters = FormFiltersProviderFactory.getFilterForDefinition(element.getUUID(), element, definition);
    final BindableProxy<?> proxy = (BindableProxy<?>) BindableProxyFactory.getBindableProxy(definition);
    final StaticModelFormRenderingContext generatedCtx = modelGenerator.getContextForModel(proxy.deepUnwrap(), filters.stream().toArray(FormElementFilter[]::new));
    final FormRenderingContext<?> pathAwareCtx = new PathAwareFormContext<>(generatedCtx, diagramPath);
    renderer.render(pathAwareCtx);
    renderer.addFieldChangeHandler(changeHandler);
}
Also used : BindableProxy(org.jboss.errai.databinding.client.BindableProxy) StaticModelFormRenderingContext(org.kie.workbench.common.forms.dynamic.service.shared.impl.StaticModelFormRenderingContext) FormElementFilter(org.kie.workbench.common.forms.adf.engine.shared.FormElementFilter) PathAwareFormContext(org.kie.workbench.common.stunner.forms.context.PathAwareFormContext)

Aggregations

BindableProxy (org.jboss.errai.databinding.client.BindableProxy)1 FormElementFilter (org.kie.workbench.common.forms.adf.engine.shared.FormElementFilter)1 StaticModelFormRenderingContext (org.kie.workbench.common.forms.dynamic.service.shared.impl.StaticModelFormRenderingContext)1 PathAwareFormContext (org.kie.workbench.common.stunner.forms.context.PathAwareFormContext)1