summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2016-11-30 15:04:17 +0200
committerVaadin Code Review <review@vaadin.com>2016-11-30 13:35:53 +0000
commit5e8ca8062e360bd84a8ef1d32f800833a0cbb8b9 (patch)
treeb9946ff2b935be94509c6af6985e0959faf9065a /server
parent429a1b99f3f91dd10aa951e38b90d87e0a4caa44 (diff)
downloadvaadin-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.java18
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();
+ }
}