use of org.linkki.core.vaadin.component.section.BaseSection in project linkki by linkki-framework.
the class PmoBasedSectionFactoryTest method testSetComponentId.
@Test
public void testSetComponentId() {
BaseSection section = (BaseSection) PmoBasedSectionFactory.createAndBindSection(new SCCPmoWithID(), bindingContext);
Component textField = TestUiUtil.getComponentAtIndex(0, section.getContentWrapper());
assertThat(textField.getId(), hasValue("testProperty"));
}
use of org.linkki.core.vaadin.component.section.BaseSection in project linkki by linkki-framework.
the class SectionComponentDefiniton method createComponent.
private Object createComponent(Class<?> pmoClass) {
String nlsCaption = PmoNlsService.get().getSectionCaption(pmoClass, this.caption);
if (ContainerPmo.class.isAssignableFrom(pmoClass)) {
return createTableSection(nlsCaption);
} else {
BaseSection baseSection = new BaseSection(nlsCaption, closeable);
baseSection.getElement().getThemeList().addAll(layout.getThemeNames());
return baseSection;
}
}
use of org.linkki.core.vaadin.component.section.BaseSection in project linkki by linkki-framework.
the class UINestedComponentIntegrationTest method testCreateNestedComponent.
@Test
public void testCreateNestedComponent() {
BaseSection component = (BaseSection) VaadinUiCreator.createComponent(new NestedComponentPmo(), new BindingContext());
List<FormItem> childComponents = component.getContentWrapper().getChildren().map(FormItem.class::cast).collect(Collectors.toList());
assertThat(childComponents.stream().map(i -> getChild(i, 0)).collect(Collectors.toList()), contains(instanceOf(TextField.class), instanceOf(Div.class)));
FormItem nestedComponentFormItem = childComponents.get(1);
assertThat(getChild(nestedComponentFormItem, 1).getElement().getText(), is("Name/Vorname"));
Div nestedComponentWrapper = (Div) getChild(nestedComponentFormItem, 0);
assertThat(nestedComponentWrapper.getWidth(), is("100px"));
assertThat(nestedComponentWrapper.getClassName(), is("style1 style2"));
Component nestedComponent = getChild(nestedComponentWrapper, 0);
assertThat(nestedComponent, instanceOf(HorizontalLayout.class));
assertThat(((HorizontalLayout) nestedComponent).getWidth(), is("100px"));
assertThat(getChild(nestedComponent, 0), instanceOf(TextField.class));
}
use of org.linkki.core.vaadin.component.section.BaseSection in project linkki by linkki-framework.
the class UINestedComponentIntegrationTest method testApsectOnNestedComponent.
@Test
public void testApsectOnNestedComponent() {
NestedComponentPmo pmo = new NestedComponentPmo();
BindingContext bindingContext = new BindingContext();
BaseSection component = (BaseSection) VaadinUiCreator.createComponent(pmo, bindingContext);
LabelComponentFormItem nestedComponent = (LabelComponentFormItem) getChild(component.getContentWrapper(), 1);
assertThat(nestedComponent.isVisible(), is(true));
pmo.setVisible(false);
bindingContext.modelChanged();
assertThat(nestedComponent.isVisible(), is(false));
}
use of org.linkki.core.vaadin.component.section.BaseSection in project linkki by linkki-framework.
the class UIFormSectionIntegrationTest method testCreation.
@Test
void testCreation() {
BindingContext bindingContext = new BindingContext();
FormSectionPmo pmo = new FormSectionPmo();
Component component = VaadinUiCreator.createComponent(pmo, bindingContext);
assertThat("UiCreator should be able to create a FormSection", component, is(instanceOf(BaseSection.class)));
BaseSection formSection = (BaseSection) component;
assertThat(formSection.getCaption(), is("Caption"));
assertThat(formSection.getContentWrapper().getComponentCount(), is(1));
}
Aggregations