Anna Koskinen [Thu, 11 Feb 2021 13:55:21 +0000 (15:55 +0200)]
Clear out ClientCache when UI is detached to prevent a minor memory leak (#12199)
* Clear out ClientCache when UI is detached to prevent a minor memory leak
Implemented with a listener rather than direct call from UI.detach() in
order to avoid new public API, since the whole feature has been marked
for removal. This doesn't yet prevent the cache or the type map from
getting slightly bloated during the UI's lifetime.
Tatu Lund [Fri, 29 Jan 2021 11:32:09 +0000 (13:32 +0200)]
fix: use time-constant comparison for security tokens (#12189)
This is the same as https://github.com/vaadin/framework/pull/12188,
but also applied for the upload security key
and the push id since both of those are also used to protect against
cross-site attacks. In addition, documentation for the push id is
clarified to point out its role.
Tatu Lund [Thu, 7 Jan 2021 11:21:46 +0000 (13:21 +0200)]
Move call to getMessageHandler().onResynchronize(); to right place (#12178)
https://github.com/vaadin/framework/pull/12043 changed resync message sending to be deferred to queue. Now also the setting of the semaphor in message handler needs to be deferred to its right place. Otherwise there is possibility for a timing glitch. I.e. MessageHandler is set to resync handling mode before message is actually send.
Anna Koskinen [Fri, 18 Dec 2020 11:16:26 +0000 (13:16 +0200)]
Fix to LayoutManager size calculations during transform. (#12138)
* Fix to LayoutManager size calculations during transform.
- ComputedStyle is slower but more reliable than using
getBoundingClientRect, which does not work as expected if a transform
has been applied to the element or one of its parents. This is a problem
e.g. with PopupView, where getBoundingClientRect will return too small
size (or even zero size) for all the popup contents while the opening
animation is active. ComputedStyle ignores the transform and returns the
expected value.
- The presence of the element in DOM must be checked before the size is
requested from ComputedStyle, if the element has disappeared from DOM
without a warning and calculation is attempted anyway, the browser gets
stuck.
- Possibility to configure LayoutManager to use the less reliable
calculations for applications where the slight performance difference is
more important than layout issues within elements that have transform
animations.
- Manual test, problem isn't reproducible by TestBench.
Anna Koskinen [Tue, 10 Nov 2020 09:51:25 +0000 (11:51 +0200)]
Tweaks to Grid/Escalator column size handling (#12145)
- ScrollbarBundle: removed delays in scroll handling that were only
needed for IE8, added possibility to update offsetSize and scrollSize at
the same time in order to avoid triggering unnecessary scrollbar
visibility change events during the intermediate state.
- ColumnConfigurator: added new method that allows setting column widths
without triggering element size recalculations.
- EscalatorProxy: added implementation of the new method to
ColumnConfigurationProxy.
- Escalator: switched to use new methods in ScrollbarBundle and
ColumnConfigurator, added a pixel to a scrollbar offsetSize calculation
that was for some reason consistently one pixel too low, removed
duplicate method calls from sectionHeightCalculated handling as those
are already handled by the calling method and can cause incorrect
intermediate state and unnecessary scrollbar visibility change events,
added implementation of the new method to ColumnConfigurationImpl with
the element size recalculations made optional.
- Grid: updated column minimum width calculations to take into account
the potential presence of a resize handle, updated expand ratio handling
to not trigger element size recalculations until the entire handling is
finished.
- Test for column width handling when there are multiple columns with
setMinimumWidthFromContent(false)
Tatu Lund [Thu, 22 Oct 2020 11:16:17 +0000 (14:16 +0300)]
Use generated id of the menu item to help testing of the menubar (#12124)
Use generated IDs for MenuItems when an ID is set for MenuBar. Tying the ID to MenuBar's ID helps with the possible case of having multiple MenuBars on the same view and avoids to have excess id's when not needed.
Anna Koskinen [Mon, 12 Oct 2020 11:42:40 +0000 (14:42 +0300)]
When a Grid gets scroll-locked, cancel the scrollInProgress handler. (#12116)
Otherwise opening a Grid editor can cause ApplicationConnection to get
stuck in 'active' state even if no actual scroll position processing is
ongoing, which in turn causes TestBench delays when it tries to wait
until ApplicationConnection indicates that everything necessary has been
processed.
Tatu Lund [Fri, 7 Aug 2020 14:39:23 +0000 (17:39 +0300)]
Explicitly remove old dataprovider listener when new one is set (#12064)
* Explicitly remove old dataprovider listener when new one is set
If not done, this can cause memory leakage
* Formatting
* Fixed coding style
* Take into account further scenarios
Component maybe detached permanently and thus data provider listener needs to be remove in detach. Also if this is only momentary remove from layout add back cycle, re-setup is needed in attach, in case it was not already setup before attaching by setDataProvider.
Anna Koskinen [Thu, 30 Jul 2020 10:01:44 +0000 (13:01 +0300)]
Use queue for resync requests. (#12043)
There might be pending requests in the queue when a resync request is
made (e.g. through a theme change). This can cause conflicts if the
resync request is handled immediately. Therefore the resync request
should also be added to the queue and only get resolved when
doSendInvocationsToServer() gets triggered again.
Anna Koskinen [Thu, 23 Jul 2020 10:27:11 +0000 (13:27 +0300)]
Add column width recalculation when vertical scrollbar hidden/shown. (#12058)
- If the Grid has any columns with non-fixed widths, the presence of a
vertical scrollbar affects the column width calculations. Horizontal
scrollbar should only be shown when actually needed.
Tatu Lund [Fri, 3 Jul 2020 10:17:34 +0000 (13:17 +0300)]
Add support for "ww" in date format (#12037)
Calculate number of the week in the year based on Date. Note, support for "ww" is missing from GWT DateTimeFormat and java.util.Calendar is not supported in GWT, hence DIY method is needed.
Anna Koskinen [Tue, 19 May 2020 10:13:25 +0000 (13:13 +0300)]
Table / TreeTable multiselect disabling of touch detection (#12014)
Added a toggle in Table (and thus TreeTable) where you can explicitly
disable multiselect touch screen detection. This allows you to work
around issues on hybrid devices that have both a touch screen and a
keyboard where you don't want automatic simple multiselection applied.
Fixes #11601, slightly modified cherry-pick of #11641
Tatu Lund [Thu, 14 May 2020 12:02:58 +0000 (15:02 +0300)]
Catch exception that is thrown when Grid is scrolled during operation (#12002)
IllegalStateException may occur if user has scrolled Grid (compatibility library version) so that Escalator has updated, and row under Editor is no longer there
Chrerry pick from https://github.com/vaadin/framework/pull/11467
Tarek Oraby [Fri, 8 May 2020 12:46:59 +0000 (15:46 +0300)]
Fix RTA's CreateLink in Firefox & IE11 (#11979)
In Firefox and IE11, the 'Create Link' button of the RichTextArea (RTA) only works by turning some highlighted text into a link (by adding the inserted URI as the href property of the text). In that, the RTA in these two browsers behave similarly to the way it does in Chrome and Edge. However, in Firefox and IE11, clicking the 'Create Link' button has no effect if no text is pre-selected by the user. This is different from the button's behavior in Chrome and Edge where the user's provided URI is inserted, both, as the displayed text and its href property if no text is highlighted.
This fix enables the RTA's 'Create Link' button to work consistently across the supported browsers. Specifically, (and in addition to enabling adding the href property of a highlighted text), this fix enables Firefox and IE11 to also insert a new Uri as a text and its href property if no text is already highlighted.
Tatu Lund [Tue, 28 Apr 2020 10:12:08 +0000 (13:12 +0300)]
Fix hiding / un-hiding with frozen columns in multiselect mode (#11972)
The previous patch https://github.com/vaadin/framework/pull/11951 did fix the problem (frozen column indicator wrongly positioned) it was meant to, but caused a regression in hiding / un-hiding.
This new fix addresses both problems, i.e. it applies multiselect column compensation in other way, without causing problem in hiding / un-hiding logic
Tree class doesn't currently provide an obvious way that would enable a Tree object to be treated as a multi select. This commit extends the Tree API, enabling it to be used as a multi select, which would importantly facilitate the selection/deselection of multiple items in trees whose SelectionMode is MULTI.
Allow AbstractDateField to provide DST zone names over custom ranges (#11927)
DateTimeField and DateField currently implement a hardcoded logic by which they adjust their time zone names to display daylight-saving time (DST) zone names. Specifically, this hardcoded logic only adjusts the displayed date to DST format if that date falls in one of the years between 1980 and the following 20 years in the future from the current date (that is, until 2040 at the time of this commit).
For some use cases, this is problematic because it is desirable to display proper DST-adjusted time zones beyond the 20 years limit (and possibly also before 1980).
Rather than choosing another arbitrary, hardcoded threshold, this commit extends the AbstractDateField API to allow the user to choose the range (start and end years) between which the DST transition dates are calculated (and hence displayed properly). If the user doesn't invoke this new API, DateTimeField and DateField will default to behave according the existing logic (i.e. display DST zone names between 1980 and 20 years into the future).