@Test public void testGetComponentPart() { testCreateComponent(); HTMLElement column = mock(HTMLElement.class); LayoutComponent layoutComponent = new LayoutComponent(FieldLayoutComponent.class.getName()); Optional<IsWidget> result = driver.getComponentPart(column, layoutComponent, ""); Assert.assertTrue(result.isPresent()); verify(wrapperWidgetUtil, times(3)).getWidget(same(driver), any(HTMLElement.class)); FieldLayoutComponent fieldLayoutComponent = driver.getLayoutFields().get(0); verify(fieldLayoutComponent).getContentPart(eq(""), any()); }
@Override public Optional<IsWidget> getComponentPart(HTMLElement column, LayoutComponent layoutComponent, String partId) { FieldDefinition field = getFieldForLayoutComponent(layoutComponent); FieldLayoutComponent dragComponent = getFieldLayoutComponentForField(field); if (dragComponent != null) { Widget columnWidget = getWidget(column); RenderingContext componentContext = new RenderingContext(layoutComponent, columnWidget); return dragComponent.getContentPart(partId, componentContext); } return Optional.empty(); }
FormGeneratorDriver implements LayoutGeneratorDriver { @Override public Optional<IsWidget> getComponentPart(HTMLElement column, LayoutComponent layoutComponent, String partId) { FieldDefinition field = getFieldForLayoutComponent(layoutComponent); FieldLayoutComponent dragComponent = getFieldLayoutComponentForField(field); if (dragComponent != null) { Widget columnWidget = getWidget(column); RenderingContext componentContext = new RenderingContext(layoutComponent, columnWidget); return dragComponent.getContentPart(partId, componentContext); } return Optional.empty(); } }
FormGeneratorDriver implements LayoutGeneratorDriver { @Override public Optional<IsWidget> getComponentPart(HTMLElement column, LayoutComponent layoutComponent, String partId) { FieldDefinition field = getFieldForLayoutComponent(layoutComponent); FieldLayoutComponent dragComponent = getFieldLayoutComponentForField(field); if (dragComponent != null) { Widget columnWidget = getWidget(column); RenderingContext componentContext = new RenderingContext(layoutComponent, columnWidget); return dragComponent.getContentPart(partId, componentContext); } return Optional.empty(); } @Inject  FormGeneratorDriver(SyncBeanManager beanManager, ManagedInstance<LayoutDragComponent> instance, FormsElementWrapperWidgetUtil wrapperWidgetUtil, Document document); }
FormGeneratorDriver implements LayoutGeneratorDriver { @Override public Optional<IsWidget> getComponentPart(HTMLElement column, LayoutComponent layoutComponent, String partId) { FieldDefinition field = getFieldForLayoutComponent(layoutComponent); FieldLayoutComponent dragComponent = getFieldLayoutComponentForField(field); if (dragComponent != null) { Widget columnWidget = getWidget(column); RenderingContext componentContext = new RenderingContext(layoutComponent, columnWidget); return dragComponent.getContentPart(partId, componentContext); } return Optional.empty(); } @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 Optional<IsWidget> getComponentPart(HTMLElement column, LayoutComponent layoutComponent, String partId) { FieldDefinition field = getFieldForLayoutComponent(layoutComponent); FieldLayoutComponent dragComponent = getFieldLayoutComponentForField(field); if (dragComponent != null) { Widget columnWidget = getWidget(column); RenderingContext componentContext = new RenderingContext(layoutComponent, columnWidget); return dragComponent.getContentPart(partId, componentContext); } return Optional.empty(); } @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();  }