use of org.linkki.core.vaadin.component.section.LinkkiSection in project linkki by linkki-framework.
the class BindStyleNamesIntegrationTest method testSection_dynamic_inherited.
@Test
public void testSection_dynamic_inherited() {
TestChildSectionPmoWithDynamicClassStyleNames pmo = new TestChildSectionPmoWithDynamicClassStyleNames();
BindingContext bindingContext = new BindingContext();
LinkkiSection section = PmoBasedSectionFactory.createAndBindSection(pmo, bindingContext);
pmo.setStyleNames(Arrays.asList("ml"));
bindingContext.modelChanged();
assertThat(section.getClassName(), containsString("ml"));
pmo.setStyleNames(Arrays.asList("lisp"));
bindingContext.modelChanged();
String styleNamesAfterUpdate = section.getClassName();
assertThat(styleNamesAfterUpdate, not(containsString("ml")));
assertThat(styleNamesAfterUpdate, containsString("lisp"));
}
use of org.linkki.core.vaadin.component.section.LinkkiSection in project linkki by linkki-framework.
the class PmoNlsServiceTableSectionTest method createAndGetTableSectionCaption.
private String createAndGetTableSectionCaption(ContainerPmo<NlsTableRowPmo> containerPmo) {
PmoBasedSectionFactory factory = new PmoBasedSectionFactory();
LinkkiSection tableSection = factory.createSection(containerPmo, bindingContext);
return tableSection.getCaption();
}
use of org.linkki.core.vaadin.component.section.LinkkiSection in project linkki by linkki-framework.
the class PmoBasedSectionFactory method createAndBindSection.
/**
* Creates a new section based on the given annotated PMO and binds the created controls via the
* given binding context to the PMO. If the given PMO is a {@link ContainerPmo}, a table section is
* created.
*/
public static LinkkiSection 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 (LinkkiSection) componentWrapper.getComponent();
}
use of org.linkki.core.vaadin.component.section.LinkkiSection in project linkki by linkki-framework.
the class ContactComponent method createContent.
private void createContent() {
LinkkiSection contactSection = sectionFactory.createSection(contactPmo, bindingContext);
AddressFields addressFields = new AddressFields();
AddressComponent addressComponent = new AddressComponent(addressFields);
// tag::manual-binding[]
new Binder(addressFields, addressPmo).setupBindings(bindingContext);
// end::manual-binding[]
LinkkiSection childrenSection = sectionFactory.createSection(childrenSectionPmo, bindingContext);
Component buttonsSection = VaadinUiCreator.createComponent(buttonsSectionPmo, bindingContext);
VerticalLayout wrapperLayout = new VerticalLayout(contactSection, addressComponent, childrenSection, buttonsSection);
wrapperLayout.setHorizontalComponentAlignment(Alignment.END, buttonsSection);
add(wrapperLayout);
}
use of org.linkki.core.vaadin.component.section.LinkkiSection in project linkki by linkki-framework.
the class ProductsSampleOverviewPage method createContent.
@Override
public void createContent() {
addSection(new ProductsSamplePmo.VerticalSamplePmo());
addSection(new ProductsSamplePmo.HorizontalSamplePmo());
// Two column layout
addSections(new ProductsSamplePmo.VerticalSamplePmo(), new ProductsSamplePmo.VerticalSamplePmo());
// Scroll and grow table section
LinkkiSection tableSection = addSection(new ProductsSampleTablePmo(100, 0));
ComponentStyles.setOverflowAuto(tableSection);
addAndExpand(tableSection);
}
Aggregations