Browse Source

Update combobox docs to use setNewItemProvider (#10901)

tags/8.5.0.alpha2
Anastasia Smirnova 6 years ago
parent
commit
3e82a2b548
1 changed files with 3 additions and 4 deletions
  1. 3
    4
      documentation/components/components-combobox.asciidoc

+ 3
- 4
documentation/components/components-combobox.asciidoc View File

@@ -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);
});
----


Loading…
Cancel
Save