diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2016-07-19 15:46:17 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2016-08-05 10:19:45 +0300 |
commit | 2d28180a4e90d11d085aa9aa5fa32c23ef375161 (patch) | |
tree | 70c22d194b5113c26c9bacca6ef8713f7f87160b /documentation/components/components-twincolselect.asciidoc | |
parent | 60cf69071233b906bbb52cd3c0a3785d075f4a54 (diff) | |
download | vaadin-framework-2d28180a4e90d11d085aa9aa5fa32c23ef375161.tar.gz vaadin-framework-2d28180a4e90d11d085aa9aa5fa32c23ef375161.zip |
BoV: Components/TwinColSelect: Selection API changes
Change-Id: I6660e0036c99122970c54131e5c6004bf2c4fe96
Diffstat (limited to 'documentation/components/components-twincolselect.asciidoc')
-rw-r--r-- | documentation/components/components-twincolselect.asciidoc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/documentation/components/components-twincolselect.asciidoc b/documentation/components/components-twincolselect.asciidoc index 08b83cc799..310b85553a 100644 --- a/documentation/components/components-twincolselect.asciidoc +++ b/documentation/components/components-twincolselect.asciidoc @@ -23,7 +23,7 @@ clicking on the "<<" button. .Twin Column Selection image::img/twincolselect-basic.png[width=50%, scaledwidth=80%] -[classname]#TwinColSelect# is always in multi-select mode, so its property value +[classname]#TwinColSelect# is always in multi-select mode, so its selection is always a collection of the item IDs of the selected items, that is, the items in the right column. @@ -35,23 +35,21 @@ column captions with [methodname]#setLeftColumnCaption()# and [source, java] ---- -TwinColSelect select = new TwinColSelect("Select Targets"); +TwinColSelect<String> select = new TwinColSelect<>("Select Targets"); // Put some items in the select -select.addItems("Mercury", "Venus", "Earth", "Mars", +select.setItems("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"); // Few items, so we can set rows to match item count select.setRows(select.size()); -// Preselect a few items by creating a set -select.setValue(new HashSet<String>( - Arrays.asList("Venus", "Earth", "Mars"))); +// Preselect a few items +select.setSelection("Venus", "Earth", "Mars"); // Handle value changes -select.addValueChangeListener(event -> // Java 8 - layout.addComponent(new Label("Selected: " + - event.getProperty().getValue()))); +select.onSelect(selectedItems -> + layout.addComponent(new Label("Selected: " + selectedItems))); ---- See the http://demo.vaadin.com/book-examples-vaadin7/book#component.select.twincolselect.captions[on-line example, window="_blank"]. |