ComponentGrid extends Grid { public Grid.Column addComponentColumn(Object propertyId, ComponentGenerator<T> generator) { return componentGridDecorator.addComponentColumn(propertyId, generator); } ComponentGrid(Class<T> typeOfRows); ComponentGridDecorator<T> getComponentGridDecorator(); FocusPreserveExtension getFocusPreserveExtension(); ComponentGrid<T> remove(T bean); ComponentGrid<T> add(T bean); ComponentGrid<T> addAll(Collection<T> beans); Grid.Column addComponentColumn(Object propertyId, ComponentGenerator<T> generator); ComponentGrid<T> refresh(); ComponentGrid<T> setRows(Collection<T> beans); ComponentGrid<T> generateHeaders(ComponentHeaderGenerator generator); ComponentGrid<T> generateHeaders(TextHeaderGenerator generator); ComponentGrid<T> generateHeaders(HtmlHeaderGenerator generator);  }
@Test public void testAddComponentColumn() { ComponentGrid grid = createTestGrid(); Item firstItem = grid.getContainerDataSource().getItem(grid.getContainerDataSource().getIdByIndex(0)); assertThat((String) firstItem.getItemProperty(COLUMN_CAPTION).getValue(), is(FOO_0)); grid.addComponentColumn(COLUMN_CAPTION, new ComponentGenerator<ExampleBean>() { @Override public Component getComponent(ExampleBean bean) { return new Label(bean.getCaption()); } }); firstItem = grid.getContainerDataSource().getItem(grid.getContainerDataSource().getIdByIndex(0)); assertThat(firstItem.getItemProperty(COLUMN_CAPTION).getValue(), is(instanceOf(Label.class))); Label firstLabel = (Label) firstItem.getItemProperty(COLUMN_CAPTION).getValue(); assertThat(firstLabel.getValue(), is(FOO_0)); }