From 1e2a4afc96a7376b922b342224f8e2e4297385aa Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Thu, 28 Jan 2010 12:13:51 +0000 Subject: [PATCH] #4107 Multi-selectable AbstractSelect was seen as non-empty when nothing was selected svn changeset:11037/svn branch:6.3 --- src/com/vaadin/ui/AbstractSelect.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 -- 2.39.5