blob: 55f2c317d3c8d3fcc2add05793211a1fad0174f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/**
*
*/
package com.itmill.toolkit.ui;
import java.util.Collection;
import com.itmill.toolkit.data.Container;
/**
* A filtering dropdown single-select with newItemsAllowed. Items are filtered
* based on user input, and loaded dynamically ("lazy-loading") from the server.
* You can turn off newItemsAllowed and change filtering mode (and also turn it
* off), but you can not turn on multi-select mode.
*
*/
public class ComboBox extends Select {
public ComboBox() {
setMultiSelect(false);
setNewItemsAllowed(true);
}
public ComboBox(String caption, Collection options) {
super(caption, options);
setMultiSelect(false);
setNewItemsAllowed(true);
}
public ComboBox(String caption, Container dataSource) {
super(caption, dataSource);
setMultiSelect(false);
setNewItemsAllowed(true);
}
public ComboBox(String caption) {
super(caption);
setMultiSelect(false);
setNewItemsAllowed(true);
}
public void setMultiSelect(boolean multiSelect) {
if (multiSelect && !isMultiSelect()) {
throw new UnsupportedOperationException("Multiselect not supported");
}
super.setMultiSelect(multiSelect);
}
}
|