From e5240607490d8d2f68683139df9c8dee14b66b27 Mon Sep 17 00:00:00 2001 From: Zhe Sun <31067185+ZheSun88@users.noreply.github.com> Date: Mon, 2 Mar 2020 12:03:32 +0200 Subject: Picks 8.10.2 (#11908) * Removing code causing the trouble (#11898) * Removing code causing the trouble Removing code that was apparently not needed in previous fix and caused regression Fixes: https://github.com/vaadin/framework/issues/11895 * Added feature to test UI * Added test case * Adding missing import * Fixing test UI * Enable DateField * Rewrote debouncing of onResize (#11899) * Rewrote debouncing of onResize Fixes https://github.com/vaadin/framework/issues/11892 * Fixing typo in variable name * Adding missing setPopupPosition(left, top); (#11902) * Adding missing setPopupPosition(left, top); setPopupPosition(left, top); needs to be called in order to top position to be set Fixes https://github.com/vaadin/framework/issues/11894 Co-authored-by: Tatu Lund --- .../vaadin/client/ui/VAbstractCalendarPanel.java | 4 -- .../main/java/com/vaadin/client/ui/VComboBox.java | 1 + .../main/java/com/vaadin/client/widgets/Grid.java | 48 +++++++++++++++------- 3 files changed, 34 insertions(+), 19 deletions(-) (limited to 'client/src') diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java b/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java index 765df8867d..ff60fe154d 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java @@ -975,10 +975,6 @@ public abstract class VAbstractCalendarPanel> public void renderCalendar(boolean updateDate) { if (parent instanceof VAbstractPopupCalendar && !((VAbstractPopupCalendar) parent).popup.isShowing()) { - if (getDate() == null) { - // no date set, cannot pre-render yet - return; - } // a popup that isn't open cannot possibly need a focus change event updateDate = false; } diff --git a/client/src/main/java/com/vaadin/client/ui/VComboBox.java b/client/src/main/java/com/vaadin/client/ui/VComboBox.java index c7fe9e14be..140d8e3ce4 100644 --- a/client/src/main/java/com/vaadin/client/ui/VComboBox.java +++ b/client/src/main/java/com/vaadin/client/ui/VComboBox.java @@ -906,6 +906,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, // ComboBox itself may be incorrectly positioned, don't adjust // popup position yet. Width calculations must be performed // anyway to avoid flickering. + setPopupPosition(left, top); return; } if (left > comboBoxLeft diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java index cd7399fba4..302ccb71b0 100755 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -4366,6 +4366,9 @@ public class Grid extends ResizeComposite implements HasSelectionHandlers, private boolean refreshBodyRequested = false; + private boolean resizeRequested = false; + private boolean resizeRefreshScheduled = false; + private DragAndDropHandler.DragAndDropCallback headerCellDndCallback = new DragAndDropCallback() { private final AutoScrollerCallback autoScrollerCallback = new AutoScrollerCallback() { @@ -9264,23 +9267,38 @@ public class Grid extends ResizeComposite implements HasSelectionHandlers, /* * Delay calculation to be deferred so Escalator can do it's magic. */ - Scheduler.get().scheduleFinally(() -> { - if (escalator - .getInnerWidth() != autoColumnWidthsRecalculator.lastCalculatedInnerWidth) { - recalculateColumnWidths(); - } + resizeRequested = true; + if (!resizeRefreshScheduled) { + resizeRefreshScheduled = true; + Scheduler.get().scheduleFixedDelay(() -> { + if (!resizeRequested) { + doRefreshOnResize(); + resizeRefreshScheduled = false; + return false; + } else { + resizeRequested = false; + return true; + } + }, 50); + } + } + + private void doRefreshOnResize() { + if (escalator + .getInnerWidth() != autoColumnWidthsRecalculator.lastCalculatedInnerWidth) { + recalculateColumnWidths(); + } - // Vertical resizing could make editor positioning invalid so it - // needs to be recalculated on resize - if (isEditorActive()) { - editor.updateVerticalScrollPosition(); - } + // Vertical resizing could make editor positioning invalid so it + // needs to be recalculated on resize + if (isEditorActive()) { + editor.updateVerticalScrollPosition(); + } - // if there is a resize, we need to refresh the body to avoid an - // off-by-one error which occurs when the user scrolls all the - // way to the bottom. - refreshBody(); - }); + // if there is a resize, we need to refresh the body to avoid an + // off-by-one error which occurs when the user scrolls all the + // way to the bottom. + refreshBody(); } private double getEscalatorInnerHeight() { -- cgit v1.2.3