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

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.

Do you think there is a chance of getting minimize/maximize icon in the window header for Vaadin 7 ?

There seems to be no RFE for this either, should I open one ?

André

Do you mean
#3400
for sub-windows?

It is not planned for the early alphas, at least. Doing this properly might require thinking a bit more about the management of sub-windows, their positions and states etc.

Note that if you really need these, the buttons can also be added to subwindows using some CSS trickery - I have seen some application where a (non-clipping) layout inside the subwindow positions buttons outside of itself, in the title bar of the subwindow.

Yes,

exactly this.
I think as a start when we would have default buttons/icons beside the close icon, we could handle the minimize/maximize stuff ourself.
I do also know the CSS work arround… :slight_smile:

André

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