@Test public void testCreateComponent() { HTMLElement column = mock(HTMLElement.class); LayoutComponent layoutComponent = new LayoutComponent(FieldLayoutComponent.class.getName()); driver.createComponent(column, layoutComponent); verify(beanManager).lookupBeans(anyString()); verify(instance).select(eq(FieldLayoutComponent.class)); verify(wrapperWidgetUtil).getWidget(same(driver), any(HTMLElement.class)); Assertions.assertThat(driver.getLayoutFields()) .hasSize(1); FieldLayoutComponent fieldLayoutComponent = driver.getLayoutFields().get(0); verify(fieldLayoutComponent).init(eq(context), any()); verify(fieldLayoutComponent).getShowWidget(any()); layoutComponent = new LayoutComponent(FieldLayoutComponent.class.getName()); driver.createComponent(column, layoutComponent); verify(beanManager, times(1)).lookupBeans(anyString()); verify(instance, times(2)).select(eq(FieldLayoutComponent.class)); verify(wrapperWidgetUtil, times(2)).getWidget(same(driver), any(HTMLElement.class)); Assertions.assertThat(driver.getLayoutFields()) .hasSize(2); fieldLayoutComponent = driver.getLayoutFields().get(1); verify(fieldLayoutComponent).init(eq(context), any()); verify(fieldLayoutComponent).getShowWidget(any()); }
@Override public IsWidget createComponent(HTMLElement column, LayoutComponent layoutComponent) { final LayoutDragComponent dragComponent = lookupComponent(layoutComponent); if (dragComponent != null) { Widget columnWidget = getWidget(column); RenderingContext componentContext = new RenderingContext(layoutComponent, columnWidget); return dragComponent.getShowWidget(componentContext); } return null; }
FormGeneratorDriver implements LayoutGeneratorDriver { @Override public IsWidget createComponent(HTMLElement column, LayoutComponent layoutComponent) { final LayoutDragComponent dragComponent = lookupComponent(layoutComponent); if (dragComponent != null) { Widget columnWidget = getWidget(column); RenderingContext componentContext = new RenderingContext(layoutComponent, columnWidget); return dragComponent.getShowWidget(componentContext); } return null; } }
FormGeneratorDriver implements LayoutGeneratorDriver { @Override public IsWidget createComponent(HTMLElement column, LayoutComponent layoutComponent) { final LayoutDragComponent dragComponent = lookupComponent(layoutComponent); if (dragComponent != null) { Widget columnWidget = getWidget(column); RenderingContext componentContext = new RenderingContext(layoutComponent, columnWidget); return dragComponent.getShowWidget(componentContext); } return null; } @Inject  FormGeneratorDriver(SyncBeanManager beanManager, ManagedInstance<LayoutDragComponent> instance, FormsElementWrapperWidgetUtil wrapperWidgetUtil, Document document); }
FormGeneratorDriver implements LayoutGeneratorDriver { @Override public IsWidget createComponent(HTMLElement column, LayoutComponent layoutComponent) { final LayoutDragComponent dragComponent = lookupComponent(layoutComponent); if (dragComponent != null) { Widget columnWidget = getWidget(column); RenderingContext componentContext = new RenderingContext(layoutComponent, columnWidget); return dragComponent.getShowWidget(componentContext); } return null; } @Inject  FormGeneratorDriver(SyncBeanManager beanManager, ManagedInstance<LayoutDragComponent> instance, FormsElementWrapperWidgetUtil wrapperWidgetUtil, Document document); FormRenderingContext getRenderingContext(); void setRenderingContext(FormRenderingContext renderingContext); @Override HTMLElement createContainer(); @Override HTMLElement createRow(LayoutRow layoutRow); @Override HTMLElement createColumn(LayoutColumn layoutColumn); @Override IsWidget createComponent(HTMLElement column, LayoutComponent layoutComponent); @Override Optional<IsWidget> getComponentPart(HTMLElement column, LayoutComponent layoutComponent, String partId); List<FieldLayoutComponent> getLayoutFields(); FieldLayoutComponent getFieldLayoutComponentForField(FieldDefinition field); void clear(); }
FormGeneratorDriver implements LayoutGeneratorDriver { @Override public IsWidget createComponent(HTMLElement column, LayoutComponent layoutComponent) { final LayoutDragComponent dragComponent = lookupComponent(layoutComponent); if (dragComponent != null) { Widget columnWidget = getWidget(column); RenderingContext componentContext = new RenderingContext(layoutComponent, columnWidget); return dragComponent.getShowWidget(componentContext); } return null; } @Inject  FormGeneratorDriver(SyncBeanManager beanManager, ManagedInstance<LayoutDragComponent> instance, FormsElementWrapperWidgetUtil wrapperWidgetUtil, Document document); FormRenderingContext getRenderingContext(); void setRenderingContext(FormRenderingContext renderingContext); @Override HTMLElement createContainer(); @Override HTMLElement createRow(LayoutRow layoutRow); @Override HTMLElement createColumn(LayoutColumn layoutColumn); @Override IsWidget createComponent(HTMLElement column, LayoutComponent layoutComponent); @Override Optional<IsWidget> getComponentPart(HTMLElement column, LayoutComponent layoutComponent, String partId); List<FieldLayoutComponent> getLayoutFields(); FieldLayoutComponent getFieldLayoutComponentForField(FieldDefinition field); void clear();  }