Skip to content

Flow 4.0 for Vaadin 17.0

Compare
Choose a tag to compare
@pleku pleku released this 26 Aug 13:31

Vaadin Flow 4.0.0 is a major release of the Java Framework for Vaadin 17. To try it out, use the latest Vaadin 17 release available from the Maven central or create a new project from start.vaadin.com.

New features in 4.0

TypeScript API for form binding and validation

The @vaadin/form package includes the Binder API to create forms in TypeScript with lit-html templates. It includes helpers to save and load data, bind data to the UI template, update the form state reactively, and run validation (based on Java Bean validation constraints).
Documentation

Live reload of browser during development

When using HotswapAgent, Spring Boot Devtools, or JRebel, the browser is now automatically refreshed as soon as the Java changes have been compiled. Similarly frontend changes (TS/JS/CSS) will trigger a new webpack build and refresh the browser automatically. Documentation

New data binding API for components

Component's are now have an API for getting and manipulating of the in-memory data, such as exporting data, traversing between items, add/remove operations, and more (#8074).
Lazy data loading components have now an ability to set only a data fetch callback with no knowledge of item count, as well as an API for lazy loading customization (#8052).
Documentation

Support for paged repositories (#8557).

Data fetching from paged repositories becomes easier with a page number and page size getters. This information can be obtained from a Query parameter within the fetch and count callbacks.
Documentation

Extended URL parameters support

Parameters in the middle of the URL (#2740) and multiple optional parameters (#4213) are now supported.
Documentation

Basic LitTemplate support based on LitElement for Java UIs (#8041)

Supports @id mapping in the same way as PolymerTemplate. Contrary to PolymerTemplate, contains no special support for template in template, @uses or a template model.
Documentation

Add support for Unit in similar fashion to Vaadin 8 (#8533)

When we have been doing migration assessments of various customer projects, we have learned that usage of methods like setWidth(float width, Unit unit) in Vaadin 8 are rather popular. In order to make migration of such applications easier and support legacy style of setting sizes of components it is useful to have this feature in Flow HasSize as well.

New mixin interface for components with label definition (#3241)

HasLabel mixin interface has been added to provide the Components with a setter and getter for a label definition.

Adding a way to mark the fields as required (#8551)

Made more clear for the developer how to mark a field as required when defining custom field validators in TypeScript Binder API.

Adding a feature to populate the component with any bean (#7307, #7308)

The methods for setting the whole bean, list or map have been added to Element API. This allows the developer to get rid of multiple setProperty calls for particular bean fields.

Vaadin Maven Plugin enhancements (#8603, #8603)

It is possible to customize the automatic node installation via vaadin-maven-plugin with the configuration node.version and node.download.

Binder's clear method enhancements (#8619)

Calling Binder::clear() now resets the default value to 'empty' and clears all validation errors.

@PastOrPresent and @FutureOrPresent validation (#8684)

Broken client-side validation for @PastOrPresent and @FutureOrPresent has been removed (in favor of server-side-only validation).

Default validation message in annotations is passed to client (#8385)

Default JSR-380 error messages are now used in client-side validators.

Component::addListener registrations have been made idempotent (#8506)

IllegalArgumentException is not thrown now when calling remove() method multiple times on a Registration returned from Component::addListener (or its derivates).

Binder's error messaging enhancements (#8631)

Server-side error message now is shown on bound form fields if Binder::submitTo fails.

Adding a method to retrieve the LocationChangeEvent from an AfterNavigationEvent (#8727)

The AfterNavigationEvent now has an access to the LocationChangeEvent so as to easily retrieve the UI instance.

Add LocalTime type support in Endpoints (#8737)

LocalTime is now a supported type in Endpoint, and <vaadin-time-picker> can be used in a TypeScript form.

Deprecations and Incompatible Changes since 3.1

A new API for Binding Items to Components:

  • HasDataProvider and HasItems are now replaced by new HasListDataView, HasLazyDataView and HasDataView interfaces in Grid, Select and CheckBoxGroup. It will be also gradually replaced in other components which have an items binding.
  • setDataProvider() is now deprecated and overloaded setItems methods are recommended to use.
  • setItems methods now have a return type instead of void.
  • HasItemsAndComponents interface has been replaced by HasItemComponents in order to support the Data View API in in-memory binding components.
  • HasHierarchicalDataProvider no longer has setItems overloads for Collection, Stream and Array.

URL parameters template feature:

  • BeforeEvent has a bunch of new methods for forwarding, rerouting and getting the parameters. Some methods are now deprecated or removed.
  • RouteRegistry, SessionRouteRegistry interfaces are now supplemented with new methods and deprecate getters for route layouts.
  • com.vaadin.flow.server.startup.RouteTarget has been completely removed. This class was internal and should not have been used by anyone. In case you have been using it, please create an issue describing what you needed it for.

PWA install popup feature removed:

The HTML API beforeinstallprompt that is a basis for this feature, has been removed from the spec w3c/manifest#835 as Safari and Mozilla will not implement it. This means that the only way to install the app will be via the UI provided by the browser, not the app/website. So as this feature would not be supported in all browsers, it has been removed from Vaadin. PWA::enableInstallPrompt, PwaConfiguration::isInstallPromptEnabled and PwaRegistry::getInstallPrompt have been removed accordingly. The users should install the app through the browsers menu instead.

Configuring the app with certain annotations is no supported elsewhere than in a class that implements AppShellConfigurator

This applies for v15+ bootstrap mode (the default), but not for v14 legacy bootstrapping. Instead of nondeterministic behavior and logging an error, the build will fail when any of the following annotations are discovered elsewhere than in an AppShellConfigurator class:

Meta.class, PWA.class, Inline.class, Viewport.class, BodySize.class, Push.class

Changes

All changes since 4.0.0.rc1
All changes since 3.1