summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin
diff options
context:
space:
mode:
authorHenri Sara <henri.sara@itmill.com>2010-01-28 12:13:51 +0000
committerHenri Sara <henri.sara@itmill.com>2010-01-28 12:13:51 +0000
commit1e2a4afc96a7376b922b342224f8e2e4297385aa (patch)
tree79ef792c12ddba5a473b362a06f7b3abc96d2559 /src/com/vaadin
parentacfc771e70b21fc4064e67b0d2e054cd7b963d85 (diff)
downloadvaadin-framework-1e2a4afc96a7376b922b342224f8e2e4297385aa.tar.gz
vaadin-framework-1e2a4afc96a7376b922b342224f8e2e4297385aa.zip
#4107 Multi-selectable AbstractSelect was seen as non-empty when nothing was selected
svn changeset:11037/svn branch:6.3
Diffstat (limited to 'src/com/vaadin')
-rw-r--r--src/com/vaadin/ui/AbstractSelect.java18
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