summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/AbstractSelect.java
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2015-09-10 14:09:32 +0300
committerMarkus Koivisto <markus@vaadin.com>2015-09-30 14:00:18 +0300
commit7228df5b09b12ca8b0fa86bc736a033e9e043066 (patch)
tree40dbce4d48721e4d3f6db41cb9c4c8ea9110982f /server/src/com/vaadin/ui/AbstractSelect.java
parent33a14ce3c1954d1fecd8580549158872307f0db7 (diff)
downloadvaadin-framework-7228df5b09b12ca8b0fa86bc736a033e9e043066.tar.gz
vaadin-framework-7228df5b09b12ca8b0fa86bc736a033e9e043066.zip
Parse readonly values for AbstractFields correctly #18850
Change-Id: I6f7d8731d185fe1c88e861435a401d887b2defbe
Diffstat (limited to 'server/src/com/vaadin/ui/AbstractSelect.java')
-rw-r--r--server/src/com/vaadin/ui/AbstractSelect.java30
1 files changed, 19 insertions, 11 deletions
diff --git a/server/src/com/vaadin/ui/AbstractSelect.java b/server/src/com/vaadin/ui/AbstractSelect.java
index bbd486a8f9..3a427562d2 100644
--- a/server/src/com/vaadin/ui/AbstractSelect.java
+++ b/server/src/com/vaadin/ui/AbstractSelect.java
@@ -34,8 +34,10 @@ import org.jsoup.nodes.Element;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
+import com.vaadin.data.Validator.InvalidValueException;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.data.util.converter.Converter;
+import com.vaadin.data.util.converter.Converter.ConversionException;
import com.vaadin.data.util.converter.ConverterUtil;
import com.vaadin.event.DataBoundTransferable;
import com.vaadin.event.Transferable;
@@ -701,22 +703,28 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
* the New selected item or collection of selected items.
* @param repaintIsNotNeeded
* True if caller is sure that repaint is not needed.
+ * @param ignoreReadOnly
+ * True if read-only check should be omitted.
* @see com.vaadin.ui.AbstractField#setValue(java.lang.Object,
* java.lang.Boolean)
*/
@Override
- protected void setValue(Object newValue, boolean repaintIsNotNeeded)
- throws Property.ReadOnlyException {
-
+ protected void setValue(Object newFieldValue, boolean repaintIsNotNeeded,
+ boolean ignoreReadOnly)
+ throws com.vaadin.data.Property.ReadOnlyException,
+ ConversionException, InvalidValueException {
if (isMultiSelect()) {
- if (newValue == null) {
- super.setValue(new LinkedHashSet<Object>(), repaintIsNotNeeded);
- } else if (Collection.class.isAssignableFrom(newValue.getClass())) {
+ if (newFieldValue == null) {
+ super.setValue(new LinkedHashSet<Object>(), repaintIsNotNeeded,
+ ignoreReadOnly);
+ } else if (Collection.class.isAssignableFrom(newFieldValue
+ .getClass())) {
super.setValue(new LinkedHashSet<Object>(
- (Collection<?>) newValue), repaintIsNotNeeded);
+ (Collection<?>) newFieldValue), repaintIsNotNeeded,
+ ignoreReadOnly);
}
- } else if (newValue == null || items.containsId(newValue)) {
- super.setValue(newValue, repaintIsNotNeeded);
+ } else if (newFieldValue == null || items.containsId(newFieldValue)) {
+ super.setValue(newFieldValue, repaintIsNotNeeded, ignoreReadOnly);
}
}
@@ -2196,9 +2204,9 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
}
if (!selected.isEmpty()) {
if (isMultiSelect()) {
- setValue(selected);
+ setValue(selected, false, true);
} else if (selected.size() == 1) {
- setValue(selected.iterator().next());
+ setValue(selected.iterator().next(), false, true);
} else {
throw new DesignException(
"Multiple values selected for a single select component");