diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2016-07-19 15:34:25 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2016-08-05 10:19:45 +0300 |
commit | 60cf69071233b906bbb52cd3c0a3785d075f4a54 (patch) | |
tree | 43a7370ec97a0686daa1903ecd716224c8d373a8 /documentation | |
parent | 69f703100ed57720672467e6e53319781cb8ebc9 (diff) | |
download | vaadin-framework-60cf69071233b906bbb52cd3c0a3785d075f4a54.tar.gz vaadin-framework-60cf69071233b906bbb52cd3c0a3785d075f4a54.zip |
BoV: Components/ListSelect,NativeSelect,OptionGroup: Small API changes
Change-Id: Id057e602ed286025a80afbd69ecd44f770158297
Diffstat (limited to 'documentation')
3 files changed, 12 insertions, 20 deletions
diff --git a/documentation/components/components-listselect.asciidoc b/documentation/components/components-listselect.asciidoc index 261b68db46..88343ee606 100644 --- a/documentation/components/components-listselect.asciidoc +++ b/documentation/components/components-listselect.asciidoc @@ -22,12 +22,10 @@ visually identical in both modes. [source, java] ---- // Create the selection component -ListSelect select = new ListSelect("The List"); +ListSelect<String> select = new ListSelect<>("The List"); -// Add some items (here by the item ID as the caption) -select.addItems("Mercury", "Venus", "Earth", ...); - -select.setNullSelectionAllowed(false); +// Add some items +select.setItems("Mercury", "Venus", "Earth", ...); // Show 5 items and a scrollbar if there are more select.setRows(5); diff --git a/documentation/components/components-nativeselect.asciidoc b/documentation/components/components-nativeselect.asciidoc index af0b3c01e7..2e97ccac42 100644 --- a/documentation/components/components-nativeselect.asciidoc +++ b/documentation/components/components-nativeselect.asciidoc @@ -20,10 +20,10 @@ the native selection input of web browsers, using the HTML [source, java] ---- // Create the selection component -NativeSelect select = new NativeSelect("Native Selection"); +NativeSelect<String> select = new NativeSelect<>("Native Selection"); // Add some items -select.addItems("Mercury", "Venus", ...); +select.setItems("Mercury", "Venus", ...); ---- The [methodname]#setColumns()# allows setting the width of the list as diff --git a/documentation/components/components-optiongroup.asciidoc b/documentation/components/components-optiongroup.asciidoc index 90fbc80581..3fd8209eb3 100644 --- a/documentation/components/components-optiongroup.asciidoc +++ b/documentation/components/components-optiongroup.asciidoc @@ -29,13 +29,13 @@ enabled with [methodname]#setMultiSelect()#. [source, java] ---- // A single-select radio button group -OptionGroup single = new OptionGroup("Single Selection"); -single.addItems("Single", "Sola", "Yksi"); +OptionGroup<String> single = new OptionGroup<>("Single Selection"); +single.setItems("Single", "Sola", "Yksi"); // A multi-select check box group -OptionGroup multi = new OptionGroup("Multiple Selection"); +OptionGroup<String> multi = new OptionGroup<>("Multiple Selection"); multi.setMultiSelect(true); -multi.addItems("Many", "Muchos", "Monta"); +multi.setItems("Many", "Muchos", "Monta"); ---- <<figure.components.optiongroup>> shows the [classname]#OptionGroup# in both @@ -60,22 +60,16 @@ selection from a disabled to an enabled item. The selections can be changed programmatically regardless of whether an item is enabled or disabled. You can find out whether an item is enabled with [methodname]#isItemEnabled()#. -The [methodname]#setItemEnabled()# identifies the item to be disabled by its -item ID. - [source, java] ---- // Have an option group with some items -OptionGroup group = new OptionGroup("My Disabled Group"); -group.addItems("One", "Two", "Three"); +OptionGroup<String> group = new OptionGroup<>("My Disabled Group"); +group.setItems("One", "Two", "Three"); -// Disable one item by its item ID +// Disable one item group.setItemEnabled("Two", false); ---- -The item IDs are also used for the captions in this example. The result is shown -in <<figure.components.optiongroup.disabling>>. - [[figure.components.optiongroup.disabling]] .[classname]#OptionGroup# with a Disabled Item image::img/optiongroup-disabling.png[width=25%, scaledwidth=50%] |