diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/vaadin/ui/AbstractSelect.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/vaadin/ui/AbstractSelect.java b/src/com/vaadin/ui/AbstractSelect.java index 4b5ef4a0a8..088bd5bd0b 100644 --- a/src/com/vaadin/ui/AbstractSelect.java +++ b/src/com/vaadin/ui/AbstractSelect.java @@ -1486,6 +1486,24 @@ public abstract class AbstractSelect extends AbstractField implements } /** + * For multi-selectable fields, also an empty collection of values is + * considered to be an empty field. + * + * @see AbstractField#isEmpty(). + */ + @Override + protected boolean isEmpty() { + if (!multiSelect) { + return super.isEmpty(); + } else { + Object value = getValue(); + return super.isEmpty() + || (value instanceof Collection && ((Collection) value) + .isEmpty()); + } + } + + /** * Allow of disallow empty selection. If the select is in single-select * mode, you can make an item represent the empty selection by calling * <code>setNullSelectionItemId()</code>. This way you can for instance set |