FixedSplitLayout extends BaseSplitLayout<ID, T> { @Override public void reload() { buildFilter(); super.reload(); ListDataProvider<T> provider = (ListDataProvider<T>) getGridWrapper().getDataProvider(); provider.getItems().clear(); provider.getItems().addAll(items); provider.refreshAll(); setSelectedItem(null); } FixedSplitLayout(BaseService<ID, T> service, EntityModel<T> entityModel, FormOptions formOptions, SortOrder<?> sortOrder); @Override void buildFilter(); Collection<T> getItems(); @Override void reload(); @SuppressWarnings("unchecked") @Override void setSelectedItems(Object selectedItems);  }
@Test public void testCreateInEditMode() { FormOptions fo = new FormOptions().setExportAllowed(true); FixedSplitLayout<Integer, TestEntity> layout = new FixedSplitLayout<Integer, TestEntity>(testEntityService, entityModelFactory.getModel(TestEntity.class), fo, new SortOrder<String>("name", SortDirection.ASCENDING)) { private static final long serialVersionUID = 6308563510081372500L; @Override protected Collection<TestEntity> loadItems() { return Lists.newArrayList(e1, e2); } }; layout.build(); assertEquals(2, layout.getGridWrapper().getDataProviderSize()); layout.getGridWrapper().getGrid().select(e1); assertEquals(e1, layout.getSelectedItem()); assertNotNull(layout.getEditForm()); assertFalse(layout.getEditForm().isViewMode()); assertNull(layout.getQuickSearchField()); layout.getGridWrapper().getGrid().deselectAll(); assertNull(layout.getSelectedItem()); layout.reload(); }
@Test public void testCreateDetailLayout() { FormOptions fo = new FormOptions(); FixedDetailLayout<Integer, TestEntity2, Integer, TestEntity> layout = new FixedDetailLayout<Integer, TestEntity2, Integer, TestEntity>( testEntity2Service, e1, testEntityService, entityModelFactory.getModel(TestEntity2.class), fo, null) { private static final long serialVersionUID = 7009824287226683886L; @Override protected Collection<TestEntity2> loadItems() { return Lists.newArrayList(child1); } }; layout.build(); assertEquals(1, layout.getGridWrapper().getDataProviderSize()); assertEquals(e1, layout.getParentEntity()); layout.reload(); }