Browse Source

BoV: Components/ListSelect,NativeSelect,OptionGroup: Small API changes

Change-Id: Id057e602ed286025a80afbd69ecd44f770158297
feature/eventbus
Johannes Dahlström 7 years ago
parent
commit
d95e394295

+ 3
- 5
documentation/components/components-listselect.asciidoc View File

[source, java] [source, java]
---- ----
// Create the selection component // 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 // Show 5 items and a scrollbar if there are more
select.setRows(5); select.setRows(5);

+ 2
- 2
documentation/components/components-nativeselect.asciidoc View File

[source, java] [source, java]
---- ----
// Create the selection component // Create the selection component
NativeSelect select = new NativeSelect("Native Selection");
NativeSelect<String> select = new NativeSelect<>("Native Selection");


// Add some items // Add some items
select.addItems("Mercury", "Venus", ...);
select.setItems("Mercury", "Venus", ...);
---- ----


The [methodname]#setColumns()# allows setting the width of the list as The [methodname]#setColumns()# allows setting the width of the list as

+ 7
- 13
documentation/components/components-optiongroup.asciidoc View File

[source, java] [source, java]
---- ----
// A single-select radio button group // 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 // A multi-select check box group
OptionGroup multi = new OptionGroup("Multiple Selection");
OptionGroup<String> multi = new OptionGroup<>("Multiple Selection");
multi.setMultiSelect(true); multi.setMultiSelect(true);
multi.addItems("Many", "Muchos", "Monta");
multi.setItems("Many", "Muchos", "Monta");
---- ----


<<figure.components.optiongroup>> shows the [classname]#OptionGroup# in both <<figure.components.optiongroup>> shows the [classname]#OptionGroup# in both
programmatically regardless of whether an item is enabled or disabled. You can programmatically regardless of whether an item is enabled or disabled. You can
find out whether an item is enabled with [methodname]#isItemEnabled()#. 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] [source, java]
---- ----
// Have an option group with some items // 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); 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]] [[figure.components.optiongroup.disabling]]
.[classname]#OptionGroup# with a Disabled Item .[classname]#OptionGroup# with a Disabled Item
image::img/optiongroup-disabling.png[width=25%, scaledwidth=50%] image::img/optiongroup-disabling.png[width=25%, scaledwidth=50%]

Loading…
Cancel
Save