@Test public void testSectionWithCustomLayout_shouldCreateCustomLayoutSection() { AbstractSection section = PmoBasedSectionFactory.createAndBindSection(new SectionWithCustomLayout(), bindingContext); assertThat(section, is(instanceOf(CustomLayoutSection.class))); }
public static AbstractSection createAndBindSection(Object pmo, BindingContext bindingContext) { requireNonNull(pmo, "pmo must not be null"); requireNonNull(bindingContext, "bindingContext must not be null"); Class<? extends Object> pmoClass = pmo.getClass(); LinkkiComponentDefinition componentDefinition = ComponentAnnotationReader.findComponentDefinition(pmoClass) .orElse(SectionComponentDefiniton.DEFAULT); LinkkiLayoutDefinition layoutDefinition = LayoutAnnotationReader.findLayoutDefinition(pmoClass) .orElse(SectionLayoutDefinition.DEFAULT); ComponentWrapper componentWrapper = UiCreator .createComponent(pmo, bindingContext, componentDefinition, Optional.of(layoutDefinition)); return (AbstractSection)componentWrapper.getComponent(); }
PmoBasedSectionFactory { public static AbstractSection createAndBindSection(Object pmo, BindingContext bindingContext) { requireNonNull(pmo, "pmo must not be null"); requireNonNull(bindingContext, "bindingContext must not be null"); Class<? extends Object> pmoClass = pmo.getClass(); LinkkiComponentDefinition componentDefinition = ComponentAnnotationReader.findComponentDefinition(pmoClass) .orElse(SectionComponentDefiniton.DEFAULT); LinkkiLayoutDefinition layoutDefinition = LayoutAnnotationReader.findLayoutDefinition(pmoClass) .orElse(SectionLayoutDefinition.DEFAULT); ComponentWrapper componentWrapper = UiCreator .createComponent(pmo, bindingContext, componentDefinition, Optional.of(layoutDefinition)); return (AbstractSection)componentWrapper.getComponent(); } }
PmoBasedSectionFactory { public static AbstractSection createAndBindSection(Object pmo, BindingContext bindingContext) { requireNonNull(pmo, "pmo must not be null"); requireNonNull(bindingContext, "bindingContext must not be null"); Class<? extends Object> pmoClass = pmo.getClass(); LinkkiComponentDefinition componentDefinition = ComponentAnnotationReader.findComponentDefinition(pmoClass) .orElse(SectionComponentDefiniton.DEFAULT); LinkkiLayoutDefinition layoutDefinition = LayoutAnnotationReader.findLayoutDefinition(pmoClass) .orElse(SectionLayoutDefinition.DEFAULT); ComponentWrapper componentWrapper = UiCreator .createComponent(pmo, bindingContext, componentDefinition, Optional.of(layoutDefinition)); return (AbstractSection)componentWrapper.getComponent(); }  }
PmoBasedSectionFactory { public static AbstractSection createAndBindSection(Object pmo, BindingContext bindingContext) { requireNonNull(pmo, "pmo must not be null"); requireNonNull(bindingContext, "bindingContext must not be null"); Class<? extends Object> pmoClass = pmo.getClass(); LinkkiComponentDefinition componentDefinition = ComponentAnnotationReader.findComponentDefinition(pmoClass) .orElse(SectionComponentDefiniton.DEFAULT); LinkkiLayoutDefinition layoutDefinition = LayoutAnnotationReader.findLayoutDefinition(pmoClass) .orElse(SectionLayoutDefinition.DEFAULT); ComponentWrapper componentWrapper = UiCreator .createComponent(pmo, bindingContext, componentDefinition, Optional.of(layoutDefinition)); return (AbstractSection)componentWrapper.getComponent(); }  AbstractSection createSection(Object pmo, BindingContext bindingContext); BaseSection createBaseSection(Object pmo, BindingContext bindingContext); TableSection createTableSection(ContainerPmo<T> pmo, BindingContext bindingContext); static AbstractSection createAndBindSection(Object pmo, BindingContext bindingContext); }
PmoBasedSectionFactory { public static AbstractSection createAndBindSection(Object pmo, BindingContext bindingContext) { requireNonNull(pmo, "pmo must not be null"); requireNonNull(bindingContext, "bindingContext must not be null"); Class<? extends Object> pmoClass = pmo.getClass(); LinkkiComponentDefinition componentDefinition = ComponentAnnotationReader.findComponentDefinition(pmoClass) .orElse(SectionComponentDefiniton.DEFAULT); LinkkiLayoutDefinition layoutDefinition = LayoutAnnotationReader.findLayoutDefinition(pmoClass) .orElse(SectionLayoutDefinition.DEFAULT); ComponentWrapper componentWrapper = UiCreator .createComponent(pmo, bindingContext, componentDefinition, Optional.of(layoutDefinition)); return (AbstractSection)componentWrapper.getComponent(); }  AbstractSection createSection(Object pmo, BindingContext bindingContext); BaseSection createBaseSection(Object pmo, BindingContext bindingContext); TableSection createTableSection(ContainerPmo<T> pmo, BindingContext bindingContext); static AbstractSection createAndBindSection(Object pmo, BindingContext bindingContext);  }