diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-11-30 15:04:17 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-11-30 13:35:53 +0000 |
commit | 5e8ca8062e360bd84a8ef1d32f800833a0cbb8b9 (patch) | |
tree | b9946ff2b935be94509c6af6985e0959faf9065a /server | |
parent | 429a1b99f3f91dd10aa951e38b90d87e0a4caa44 (diff) | |
download | vaadin-framework-5e8ca8062e360bd84a8ef1d32f800833a0cbb8b9.tar.gz vaadin-framework-5e8ca8062e360bd84a8ef1d32f800833a0cbb8b9.zip |
Use item caption generator in NativeSelect
Change-Id: I9725ce727fe06ac5f911e6b68108ad610a615434
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/NativeSelect.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/server/src/main/java/com/vaadin/ui/NativeSelect.java b/server/src/main/java/com/vaadin/ui/NativeSelect.java index e68dd4fad7..b376979678 100644 --- a/server/src/main/java/com/vaadin/ui/NativeSelect.java +++ b/server/src/main/java/com/vaadin/ui/NativeSelect.java @@ -51,8 +51,11 @@ public class NativeSelect<T> extends AbstractSingleSelect<T> */ public NativeSelect() { registerRpc(new FocusAndBlurServerRpcDecorator(this, this::fireEvent)); - addDataGenerator((item, json) -> json - .put(DataCommunicatorConstants.DATA, String.valueOf(item))); + addDataGenerator( + (item, json) -> json.put(DataCommunicatorConstants.DATA, + getItemCaptionGenerator().apply(item))); + + setItemCaptionGenerator(String::valueOf); } /** @@ -137,4 +140,15 @@ public class NativeSelect<T> extends AbstractSingleSelect<T> public void setDataProvider(DataProvider<T, ?> dataProvider) { internalSetDataProvider(dataProvider); } + + @Override + public void setItemCaptionGenerator( + ItemCaptionGenerator<T> itemCaptionGenerator) { + super.setItemCaptionGenerator(itemCaptionGenerator); + } + + @Override + public ItemCaptionGenerator<T> getItemCaptionGenerator() { + return super.getItemCaptionGenerator(); + } } |