From: Henri Sara Date: Thu, 28 Jan 2010 12:13:51 +0000 (+0000) Subject: #4107 Multi-selectable AbstractSelect was seen as non-empty when nothing was selected X-Git-Tag: 6.7.0.beta1~2064 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1e2a4afc96a7376b922b342224f8e2e4297385aa;p=vaadin-framework.git #4107 Multi-selectable AbstractSelect was seen as non-empty when nothing was selected svn changeset:11037/svn branch:6.3 --- 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 @@ -1485,6 +1485,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