From: Anna Koskinen Date: Thu, 26 Mar 2020 08:51:19 +0000 (+0200) Subject: Add setters to Criterion to fix serialization. (#11926) X-Git-Tag: 8.11.0.alpha1~25 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b1ff64c6fd97359056adfccf7dc06eb3116e9e10;p=vaadin-framework.git Add setters to Criterion to fix serialization. (#11926) Fixes #11909 --- diff --git a/shared/src/main/java/com/vaadin/shared/ui/dnd/criteria/Criterion.java b/shared/src/main/java/com/vaadin/shared/ui/dnd/criteria/Criterion.java index 73c022a033..e734a5edc1 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/dnd/criteria/Criterion.java +++ b/shared/src/main/java/com/vaadin/shared/ui/dnd/criteria/Criterion.java @@ -116,10 +116,10 @@ public class Criterion implements Serializable { */ private Criterion(String key, ComparisonOperator operator, String value, Payload.ValueType valueType) { - this.key = key; - this.value = value; - this.valueType = valueType; - this.operator = operator; + setKey(key); + setValue(value); + setValueType(valueType); + setOperator(operator); } /** @@ -131,6 +131,16 @@ public class Criterion implements Serializable { return key; } + /** + * Sets the key of the payload to be compared. + * + * @param key + * key of the payload to be compared + */ + public void setKey(String key) { + this.key = key; + } + /** * Gets the value of the payload to be compared. * @@ -140,6 +150,16 @@ public class Criterion implements Serializable { return value; } + /** + * Sets the value of the payload to be compared. + * + * @param value + * value of the payload to be compared + */ + public void setValue(String value) { + this.value = value; + } + /** * Gets the type of the payload value to be compared. * @@ -149,6 +169,16 @@ public class Criterion implements Serializable { return valueType; } + /** + * Sets the type of the payload value to be compared. + * + * @param valueType + * type of the payload to be compared + */ + public void setValueType(Payload.ValueType valueType) { + this.valueType = valueType; + } + /** * Gets the comparison operator. * @@ -158,6 +188,16 @@ public class Criterion implements Serializable { return operator; } + /** + * Sets the comparison operator. + * + * @param operator + * comparison operator + */ + public void setOperator(ComparisonOperator operator) { + this.operator = operator; + } + /** * Compares this criterion's value to the given payload's value and returns * whether the result matches the criterion's operator. The comparison is diff --git a/uitest/src/main/java/com/vaadin/tests/dnd/CriterionSerialization.java b/uitest/src/main/java/com/vaadin/tests/dnd/CriterionSerialization.java new file mode 100644 index 0000000000..3cc508f64b --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/dnd/CriterionSerialization.java @@ -0,0 +1,59 @@ +package com.vaadin.tests.dnd; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Button; +import com.vaadin.ui.dnd.DragSourceExtension; +import com.vaadin.ui.dnd.DropTargetExtension; + +public class CriterionSerialization extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + Button button = new Button(); + button.setCaption("drag me"); + button.setId("drag"); + DragSourceExtension