@Test public void editItem_switchEditedItem_itemsAreRefreshed() { grid.getDataCommunicator().getKeyMapper().key("foo"); editor.editItem("bar"); fakeClientResponse(); editor.refreshedItems.clear(); editor.editItem("foo"); fakeClientResponse(); Assert.assertEquals(2, editor.refreshedItems.size()); Assert.assertEquals("bar", editor.refreshedItems.get(0)); Assert.assertEquals("foo", editor.refreshedItems.get(1)); }
@Override public void editItem(T item) { Objects.requireNonNull(item, "Editor can't edit null"); final T it = item; if (editItemRequest == null) { editItemRequest = context -> { requestEditItem(it); editItemRequest = null; }; getGrid().getElement().getNode().runWhenAttached(ui -> ui.getInternals().getStateTree() .beforeClientResponse(getGrid().getElement().getNode(), editItemRequest)); } }
EditorImpl extends AbstractGridExtension<T> implements Editor<T> { @Override public void editItem(T item) { Objects.requireNonNull(item, "Editor can't edit null"); final T it = item; if (editItemRequest == null) { editItemRequest = context -> { requestEditItem(it); editItemRequest = null; }; getGrid().getElement().getNode().runWhenAttached(ui -> ui.getInternals().getStateTree() .beforeClientResponse(getGrid().getElement().getNode(), editItemRequest)); } } }
EditorImpl extends AbstractGridExtension<T> implements Editor<T> { @Override public void editItem(T item) { Objects.requireNonNull(item, "Editor can't edit null"); final T it = item; if (editItemRequest == null) { editItemRequest = context -> { requestEditItem(it); editItemRequest = null; }; getGrid().getElement().getNode().runWhenAttached(ui -> ui.getInternals().getStateTree() .beforeClientResponse(getGrid().getElement().getNode(), editItemRequest)); } } EditorImpl(Grid<T> grid, PropertySet<T> propertySet); }
EditorImpl extends AbstractGridExtension<T> implements Editor<T> { @Override public void editItem(T item) { Objects.requireNonNull(item, "Editor can't edit null"); final T it = item; if (editItemRequest == null) { editItemRequest = context -> { requestEditItem(it); editItemRequest = null; }; getGrid().getElement().getNode().runWhenAttached(ui -> ui.getInternals().getStateTree() .beforeClientResponse(getGrid().getElement().getNode(), editItemRequest)); } } EditorImpl(Grid<T> grid, PropertySet<T> propertySet); @Override Editor<T> setBinder(Binder<T> binder); @Override Binder<T> getBinder(); @Override Editor<T> setBuffered(boolean buffered); @Override boolean isBuffered(); @Override boolean isOpen(); @Override boolean save(); @Override void cancel(); @Override void closeEditor(); @Override void editItem(T item); @Override void refresh(); @Override T getItem(); @Override Grid<T> getGrid(); @Override void generateData(T item, JsonObject jsonObject); @Override Registration addSaveListener(EditorSaveListener<T> listener); @Override Registration addCancelListener(EditorCancelListener<T> listener); @Override Registration addOpenListener(EditorOpenListener<T> listener); @Override Registration addCloseListener(EditorCloseListener<T> listener); }
EditorImpl extends AbstractGridExtension<T> implements Editor<T> { @Override public void editItem(T item) { Objects.requireNonNull(item, "Editor can't edit null"); final T it = item; if (editItemRequest == null) { editItemRequest = context -> { requestEditItem(it); editItemRequest = null; }; getGrid().getElement().getNode().runWhenAttached(ui -> ui.getInternals().getStateTree() .beforeClientResponse(getGrid().getElement().getNode(), editItemRequest)); } } EditorImpl(Grid<T> grid, PropertySet<T> propertySet); @Override Editor<T> setBinder(Binder<T> binder); @Override Binder<T> getBinder(); @Override Editor<T> setBuffered(boolean buffered); @Override boolean isBuffered(); @Override boolean isOpen(); @Override boolean save(); @Override void cancel(); @Override void closeEditor(); @Override void editItem(T item); @Override void refresh(); @Override T getItem(); @Override Grid<T> getGrid(); @Override void generateData(T item, JsonObject jsonObject); @Override Registration addSaveListener(EditorSaveListener<T> listener); @Override Registration addCancelListener(EditorCancelListener<T> listener); @Override Registration addOpenListener(EditorOpenListener<T> listener); @Override Registration addCloseListener(EditorCloseListener<T> listener);  }