Просмотр исходного кода

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

Change-Id: Id057e602ed286025a80afbd69ecd44f770158297
feature/eventbus
Johannes Dahlström 7 лет назад
Родитель
Сommit
d95e394295

+ 3
- 5
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);

+ 2
- 2
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

+ 7
- 13
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%]

Загрузка…
Отмена
Сохранить