Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Vaadin 7 alpha 1 - Renewal of application initialization and browser window

Artur Signell
1 decade ago Dec 23, 2011 9:03am

Vaadin 7 alpha1 contains significant changes in how an application is initialized and the API related to initialization

Improved API for sub windows

The Vaadin 6 Window is problematic because it represents both the entire Vaadin application as displayed in the browser as well as dialog windows opened inside the Vaadin application. Vaadin 7 alpha1 brings a new class named Root that in most aspects works in the same way as a browser level Window in Vaadin 6. Meanwhile, the Window class in Vaadin 7 has been simplified to only contain methods that are relevant for dialog windows opened inside a Vaadin application.

Multi tab out of the box

In Vaadin 7, you don’t typically implement any subclass of Application. You instead create your own subclass of Root and use a “root” servlet parameter in web.xml to tell the framework that you want to use that Root class as the root of your UI. Vaadin 7 comes with a default Application that automatically creates Roots when needed. Thanks to this, all Vaadin 7 applications support multiple tabs out-of-the-box.

Better support for initializing the application based on URI, URI fragment, parameters, screen size, etc.

The init method in Root gets a WrappedRequest as a parameter. WrappedRequest is an abstraction of the HttpServletRequest or PortletRequest originating from the user’s browser. Your can use the WrappedRequest to e.g. check request parameters or the URI fragment to construct your UI dynamically. Thanks to the new bootstrap sequence of the application, the URI fragment is always accessible when Root.init is called.

Better support for generating dynamic resources based on URI, Parameters and other request details

WrappedRequest also has a counterpart named WrappedResponse. The WrappedResponse is used by the new RequestHandlers. By adding a RequestHandler to the Application, you can intercept most requests from the browser and generate your own response to them by writing to the OutputStream or Writer of the WrappedResponse. This enables you to more easily generate dynamic resources and more.

Acquire a reference to the active Root and Application at any time

Vaadin 7 introduces Root.getCurrentRoot and Application.getCurrentApplication that enables you to get a reference to the current Root or Application anywhere in your code. The methods are static and thus usable also from constructors, init methods etc.

For short examples on how to use the new features, check out the Vaadin 7 minitutorials: https://vaadin.com/wiki/-/wiki/Main/Vaadin+7
For information on how to migrate from Vaadin 6 to Vaadin 7, see http://dev.vaadin.com/wiki/Vaadin7/MigrationGuide

This is an alpha release so we expect there to be bugs and still expect changes will be made to the API and functionality before the final 7.0.0 release. All your comments on the new features are welcome. Please post all Vaadin 7 related comments in the Vaadin 7 category of the forum.

Last updated on Dec, 23rd 2011
André Schild
1 decade ago Dec 27, 2011 7:52am
Henri Sara
1 decade ago Dec 27, 2011 8:18am
André Schild
1 decade ago Dec 27, 2011 8:55am
Cristiano Gavião
1 decade ago Jan 13, 2012 1:14am

Artur Signell: Vaadin 7 alpha1 contains significant changes in how an application is initialized and the API related to initialization

Hi,

Version 7 will include any improvement to help the use of Vaadin in OSGi environments without have to use vaadin-osgi add-on ?

thanks

Last updated on Jan, 13th 2012