diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-01-25 12:27:44 +0200 |
---|---|---|
committer | Denis <denis@vaadin.com> | 2017-01-25 12:27:44 +0200 |
commit | 294ca0a2f5c29b65f9c4dc5887bfa0abc1cb7c7f (patch) | |
tree | 0a4630122dadc632e6508c85e4e79c717508de85 /server/src/main/java/com/vaadin/data/provider/DataKeyMapper.java | |
parent | be694984fb35262b32c89be075e6d4a059931b62 (diff) | |
download | vaadin-framework-294ca0a2f5c29b65f9c4dc5887bfa0abc1cb7c7f.tar.gz vaadin-framework-294ca0a2f5c29b65f9c4dc5887bfa0abc1cb7c7f.zip |
Add APIs to inform components of stale objects in DataProvider (#8271)
* Add DataProvider refreshItem for single item update
* Add 'id' concept for DataProviders
This patch also adds a simplified data provider that can replace items
based on their id. This can be used to simulate stale objects from an actual
backend.
* Add refresh logic to Grid SelectionModels
* Remove broken equals and hashCode
* Refresh KeyMapper, clean up some methods
* Fix UI.access in test
* Fix tests and Grid single selection model
* Do clean up before replacing data provider
* Check correct variable for null value
* Fix other selects, add generic tests
* Code style fixes, removed assert
* Merge remote-tracking branch 'origin/master' into 286_refresh_items
* Fix documentation for refreshing an item
* Improve introduction chapter, minor clarifications
* Merge remote-tracking branch 'origin/master' into 287_refresh_items
* Add missing parameters in unit tests
Diffstat (limited to 'server/src/main/java/com/vaadin/data/provider/DataKeyMapper.java')
-rw-r--r-- | server/src/main/java/com/vaadin/data/provider/DataKeyMapper.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/data/provider/DataKeyMapper.java b/server/src/main/java/com/vaadin/data/provider/DataKeyMapper.java index 63bd2d92f8..0ec6748a85 100644 --- a/server/src/main/java/com/vaadin/data/provider/DataKeyMapper.java +++ b/server/src/main/java/com/vaadin/data/provider/DataKeyMapper.java @@ -17,6 +17,8 @@ package com.vaadin.data.provider; import java.io.Serializable; +import com.vaadin.data.ValueProvider; + /** * DataKeyMapper to map data objects to key strings. * @@ -59,4 +61,16 @@ public interface DataKeyMapper<T> extends Serializable { * Dropped keys are not reused. */ void removeAll(); + + /** + * Updates any existing mappings of given data object. The equality of two + * data objects is determined by the equality of their identifiers provided + * by the given value provider. + * + * @param dataObject + * the data object to update + * @param identifierGetter + * the function to get an identifier from a data object + */ + void refresh(T dataObject, ValueProvider<T, Object> identifierGetter); } |