Search in sources :

Example 1 with TableBinding

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));
}
Also used : Table(com.vaadin.ui.Table) BindingContext(org.linkki.core.binding.BindingContext) TestBindingContext(org.linkki.core.binding.TestBindingContext) TableBinding(org.linkki.core.binding.TableBinding) Test(org.junit.Test)

Example 2 with 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));
}
Also used : Table(com.vaadin.ui.Table) BindingContext(org.linkki.core.binding.BindingContext) TestBindingContext(org.linkki.core.binding.TestBindingContext) TableBinding(org.linkki.core.binding.TableBinding) Test(org.junit.Test)

Aggregations

Table (com.vaadin.ui.Table)2 Test (org.junit.Test)2 BindingContext (org.linkki.core.binding.BindingContext)2 TableBinding (org.linkki.core.binding.TableBinding)2 TestBindingContext (org.linkki.core.binding.TestBindingContext)2