From 7bda912a77f6295ac339a3035b0de8d7ed45cfa3 Mon Sep 17 00:00:00 2001 From: Zhe Sun <31067185+ZheSun88@users.noreply.github.com> Date: Fri, 14 Jun 2019 15:31:44 +0300 Subject: Separates a rpc for handling the client event order in DateTimeField (#11574) * Using @Delayed annotation for DateField Rpc * Separate a rpc for handling the time change in DateTimeField * Add test case for wrong event order --- .../com/vaadin/client/ui/VAbstractPopupCalendar.java | 4 ++++ .../main/java/com/vaadin/client/ui/VDateField.java | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'client/src') diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java b/client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java index 2682973964..a199e2cd4a 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java @@ -496,6 +496,10 @@ public abstract class VAbstractPopupCalendar> extends FlowPanel bufferedResolutions.clear(); } + /** + * Puts the {@link #bufferedDateString} and {@link #bufferedResolutions} + * changes into the rpc queue and clears their values. + *

+ * Note: The value will not be sent to the server immediately. It will be + * sent when a non {@link com.vaadin.shared.annotations.Delayed} annotated + * rpc is triggered. + *

+ * + * @since + */ + public void sendBufferedValuesWithDelay() { + rpc.updateValueWithDelay(bufferedDateString, + bufferedResolutions.entrySet().stream().collect( + Collectors.toMap(entry -> entry.getKey().name(), + entry -> entry.getValue()))); + bufferedDateString = null; + bufferedResolutions.clear(); + } + /** * Returns all available resolutions for the field in the ascending order * (which is the same as order of enumeration ordinals). -- cgit v1.2.3