Search in sources :

Example 1 with LayoutDragComponent

use of org.uberfire.ext.layout.editor.client.api.LayoutDragComponent in project kie-wb-common by kiegroup.

the class FormGeneratorDriver method lookupComponent.

protected LayoutDragComponent lookupComponent(LayoutComponent layoutComponent) {
    Class<? extends LayoutDragComponent> clazz = componentsCache.get(layoutComponent.getDragTypeName());
    if (clazz == null) {
        SyncBeanDef dragTypeDef = beanManager.lookupBeans(layoutComponent.getDragTypeName()).iterator().next();
        componentsCache.put(layoutComponent.getDragTypeName(), dragTypeDef.getBeanClass());
        clazz = dragTypeDef.getBeanClass();
    }
    LayoutDragComponent dragComponent = instance.select(clazz).get();
    if (dragComponent instanceof FieldLayoutComponent) {
        FieldLayoutComponent fieldComponent = (FieldLayoutComponent) dragComponent;
        FieldDefinition field = renderingContext.getRootForm().getFieldById(layoutComponent.getProperties().get(FieldLayoutComponent.FIELD_ID));
        fieldComponent.init(renderingContext, field);
        layoutComponents.add(fieldComponent);
    }
    return dragComponent;
}
Also used : LayoutDragComponent(org.uberfire.ext.layout.editor.client.api.LayoutDragComponent) FieldDefinition(org.kie.workbench.common.forms.model.FieldDefinition) SyncBeanDef(org.jboss.errai.ioc.client.container.SyncBeanDef)

Example 2 with LayoutDragComponent

use of org.uberfire.ext.layout.editor.client.api.LayoutDragComponent in project kie-wb-common by kiegroup.

the class FormGeneratorDriver method createComponent.

@Override
public IsWidget createComponent(HTMLElement column, LayoutComponent layoutComponent) {
    final LayoutDragComponent dragComponent = lookupComponent(layoutComponent);
    if (dragComponent != null) {
        Widget columnWidget = ElementWrapperWidget.getWidget(column);
        RenderingContext componentContext = new RenderingContext(layoutComponent, columnWidget);
        return dragComponent.getShowWidget(componentContext);
    }
    return null;
}
Also used : FormRenderingContext(org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext) RenderingContext(org.uberfire.ext.layout.editor.client.api.RenderingContext) LayoutDragComponent(org.uberfire.ext.layout.editor.client.api.LayoutDragComponent) IsWidget(com.google.gwt.user.client.ui.IsWidget) Widget(com.google.gwt.user.client.ui.Widget) ElementWrapperWidget(org.jboss.errai.common.client.ui.ElementWrapperWidget)

Aggregations

LayoutDragComponent (org.uberfire.ext.layout.editor.client.api.LayoutDragComponent)2 IsWidget (com.google.gwt.user.client.ui.IsWidget)1 Widget (com.google.gwt.user.client.ui.Widget)1 ElementWrapperWidget (org.jboss.errai.common.client.ui.ElementWrapperWidget)1 SyncBeanDef (org.jboss.errai.ioc.client.container.SyncBeanDef)1 FormRenderingContext (org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext)1 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)1 RenderingContext (org.uberfire.ext.layout.editor.client.api.RenderingContext)1