DetailsEditGrid extends BaseDetailsEditGrid<Collection<T>, ID, T> { public int getItemCount() { return provider.getItems().size(); } DetailsEditGrid(EntityModel<T> entityModel, AttributeModel attributeModel, boolean viewMode, FormOptions formOptions); Comparator<T> getComparator(); int getItemCount(); @Override Collection<T> getValue(); void setComparator(Comparator<T> comparator);  }
@Test public void testEditable() { EntityModel<TestEntity> em = factory.getModel(TestEntity.class); DetailsEditGrid<Integer, TestEntity> grid = createGrid(em, em.getAttributeModel("testEntities"), false, false, new FormOptions().setShowRemoveButton(true)); assertTrue(grid.getAddButton().isVisible()); assertFalse(grid.getSearchDialogButton().isVisible()); grid.setValue(Lists.newArrayList(e1, e2)); assertEquals(2, grid.getItemCount()); grid.getAddButton().click(); assertEquals(3, grid.getItemCount()); grid.setValue(Lists.newArrayList(e1)); assertEquals(1, grid.getItemCount()); }
@Test public void testReadOnly() { EntityModel<TestEntity> em = factory.getModel(TestEntity.class); DetailsEditGrid<Integer, TestEntity> grid = createGrid(em, em.getAttributeModel("testEntities"), true, false, new FormOptions()); assertFalse(grid.getAddButton().isVisible()); assertFalse(grid.getSearchDialogButton().isVisible()); grid.setValue(Lists.newArrayList(e1, e2)); assertEquals(2, grid.getItemCount()); }