use of org.linkki.core.binding.TableBinding in project linkki by linkki-framework.
the class PmoBasedTableSectionFactoryTest method testCreateSection_NoAnnotation.
@Test
public void testCreateSection_NoAnnotation() {
NoAnnotationTablePmo containerPmo = new NoAnnotationTablePmo();
BindingContext bindingContext = TestBindingContext.create();
PmoBasedTableSectionFactory<TestRowPmo> factory = new PmoBasedTableSectionFactory<TestRowPmo>(containerPmo, bindingContext);
TableSection<TestRowPmo> tableSection = factory.createSection();
assertThat(tableSection, is(notNullValue()));
// header and table
assertThat(tableSection.getComponentCount(), is(2));
assertThat(tableSection.getComponent(1), is(instanceOf(Table.class)));
Table table = (Table) tableSection.getComponent(1);
assertThat(table.getContainerDataSource(), is(instanceOf(TableBinding.class)));
TableBinding<?> tableBinding = (TableBinding<?>) table.getContainerDataSource();
assertThat(bindingContext.getTableBindings(), hasItem(tableBinding));
}
use of org.linkki.core.binding.TableBinding in project linkki by linkki-framework.
the class PmoBasedTableSectionFactoryTest method testCreateSection_TableIsAddedAndBound.
@Test
public void testCreateSection_TableIsAddedAndBound() {
TestTablePmo containerPmo = new TestTablePmo();
BindingContext bindingContext = TestBindingContext.create();
PmoBasedTableSectionFactory<TestRowPmo> factory = new PmoBasedTableSectionFactory<TestRowPmo>(containerPmo, bindingContext);
TableSection<TestRowPmo> tableSection = factory.createSection();
assertThat(tableSection, is(notNullValue()));
// header and table
assertThat(tableSection.getComponentCount(), is(2));
assertThat(tableSection.getComponent(1), is(instanceOf(Table.class)));
Table table = (Table) tableSection.getComponent(1);
assertThat(table.getContainerDataSource(), is(instanceOf(TableBinding.class)));
TableBinding<?> tableBinding = (TableBinding<?>) table.getContainerDataSource();
assertThat(bindingContext.getTableBindings(), hasItem(tableBinding));
}
Aggregations