aboutsummaryrefslogtreecommitdiffstats
path: root/documentation
diff options
context:
space:
mode:
authorAnastasia Smirnova <anasmi@utu.fi>2018-05-08 15:13:09 +0300
committerTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2018-05-08 15:13:09 +0300
commit3e82a2b5481aff31c063ba9ed2952b32c5784388 (patch)
treed26ac06ebb156e1403451483ee852e994517b28e /documentation
parent7d9d37b6dd705f2de9f1c6a005b8cf3b54e7242b (diff)
downloadvaadin-framework-3e82a2b5481aff31c063ba9ed2952b32c5784388.tar.gz
vaadin-framework-3e82a2b5481aff31c063ba9ed2952b32c5784388.zip
Update combobox docs to use setNewItemProvider (#10901)
Diffstat (limited to 'documentation')
-rw-r--r--documentation/components/components-combobox.asciidoc7
1 files changed, 3 insertions, 4 deletions
diff --git a/documentation/components/components-combobox.asciidoc b/documentation/components/components-combobox.asciidoc
index 7f7640a079..c7a1fefba8 100644
--- a/documentation/components/components-combobox.asciidoc
+++ b/documentation/components/components-combobox.asciidoc
@@ -52,7 +52,7 @@ attempt to do so may result in an exception.
=== Handling New Items
-Adding new items is handled by a [interfacename]#NewItemHandler#, which gets the
+Adding new items is handled by a [interfacename]#NewItemProvider#, which gets the
item caption string as parameter for the [methodname]#accept(String)# method.
@@ -73,7 +73,7 @@ select.setItemCaptionGenerator(Planet::getName);
// Allow adding new items and add
// handling for new items
-select.setNewItemHandler(inputString -> {
+select.setNewItemProvider(inputString -> {
Planet newPlanet = new Planet(planets.size(), inputString);
planets.add(newPlanet);
@@ -81,8 +81,7 @@ select.setNewItemHandler(inputString -> {
// Update combobox content
select.setItems(planets);
- // Remember to set the selection to the new item
- select.setSelectedItem(newPlanet);
+ return Optional.of(newPlanet);
});
----