+ All Categories
Home > Technology > Migration from vaadin 6 to vaadin 7 devoxx france 2013

Migration from vaadin 6 to vaadin 7 devoxx france 2013

Date post: 10-May-2015
Category:
Upload: joonas-lehtinen
View: 3,127 times
Download: 5 times
Share this document with a friend
Description:
Henri Sara's presentation on migration from Vaadin 6 to 7 at Vaadin & GWT meetup in Paris
Popular Tags:
21
Moving to Vaadin 7 Henri Sara Sr. Vaadin Expert
Transcript
Page 1: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Moving to Vaadin 7Henri Sara

Sr. Vaadin Expert

Page 2: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Migrating from Vaadin 6 toVaadin 7

Page 3: Migration from vaadin 6 to vaadin 7   devoxx france 2013

First new major version since 2009, 1.5 years in development

Most APIs backwards compatible - some since 2002

In addition to new features, reworking (and breaking) some old APIs

Vaadin 7 in brief for migration

Page 4: Migration from vaadin 6 to vaadin 7   devoxx france 2013

New windowing API

New packaging (including GWT)

New FieldGroups and Converters for easier and more flexible forms

Major features in Vaadin 7 for migration

Page 5: Migration from vaadin 6 to vaadin 7   devoxx france 2013

SASS based themes

Much, much more - seehttps://vaadin.com/vaadin7

Simplified extending and widget development

... and some more

Page 6: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Migration Guidehttps://vaadin.com/wiki/-

/wiki/Main/Migrating+from+Vaadin+6+to+Vaadin+

Page 7: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Packaging

Page 8: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Maven or Ivy to the rescue

Page 9: Migration from vaadin 6 to vaadin 7   devoxx france 2013

UI Instead of Application and Windowimport com.vaadin.Application;import com.vaadin.ui.*;

public class V6Application extends Application {

@Overridepublic void init() {

Window mainWindow = new Window("V6");Label label = new Label("Hello!");mainWindow.addComponent(label);setMainWindow(mainWindow);setTheme(“mytheme”);

}}

import com.vaadin.server.*;import com.vaadin.ui.*;

@Theme("mytheme")@PreserveOnRefreshpublic class V7UI extends UI {

@Override protected void init(VaadinRequest request) { VerticalLayout view = new VerticalLayout(); view.addComponent(new Label("Hello!")); setContent(view); }}

Page 10: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Update dependencies

Update theme

UI replacing Application and Window

First steps

styles.scss:import "../reindeer/legacy-styles.css"

@Theme("mytheme")

public class V6Application extends Applicationpublic class V7UI extends UI

Page 11: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Converting an Eclipse project

Page 12: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Converting a Maven project<dependencies>

<dependency><groupId>com.vaadin</groupId><artifactId>vaadin-server</artifactId><version>${vaadin.version}</version>

</dependency><dependency>

<groupId>com.vaadin</groupId><artifactId>vaadin-client-compiled</artifactId><version>${vaadin.version}</version>

</dependency><dependency>

<groupId>com.vaadin</groupId><artifactId>vaadin-client</artifactId><version>${vaadin.version}</version><scope>provided</scope>

</dependency><dependency>

<groupId>com.vaadin</groupId><artifactId>vaadin-themes</artifactId><version>${vaadin.version}</version>

</dependency></dependencies>

<build><plugins>

<plugin><groupId>com.vaadin</groupId><artifactId>vaadin-maven-plugin</artifactId><version>${vaadin.plugin.version}</version>

Dependencies

Plug-in

Page 13: Migration from vaadin 6 to vaadin 7   devoxx france 2013

FieldGroup and Converters - separate presentation

Page 14: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Navigation and built-in multi-tab support@PreserveOnRefreshpublic class NavigationtestUI extends UI {

@Override public void init(VaadinRequest request) {

// Create Navigator, use the UI content layout to display the views Navigator navigator = new Navigator(this, this);

// Add some Views // Could also use a ViewProvider navigator.addView(MainView.NAME, new MainView()); // no fragment

// #count will be a new instance each time we navigate to it, counts: navigator.addView(CountView.NAME, CountView. class);

// The Navigator attached to the UI will automatically navigate to the // initial fragment once the UI has been initialized. }

}

http://server/test#!count/params

Page 15: Migration from vaadin 6 to vaadin 7   devoxx france 2013

SCSS compiled to CSS

Composite themes, multiple themes on a page, theme by component etc.

Variables, nesting, mix-ins, ...

Theming with SASS

Page 16: Migration from vaadin 6 to vaadin 7   devoxx france 2013

SASS example@import "../reindeer/reindeer.scss";

// Variables$margin: 16px;

// Mixins@mixin mytheme { // Including a mixin @include reindeer;

// Nesting .a { .b { c: $margin; } }}

.mytheme { @include mytheme;}

// reindeer theme contents within// .mytheme selector.mytheme .reindeerrules { ... }

// Nesting.mytheme .a .b { c: 16px;}

SASSCompiler

Page 17: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Easier to develop

GWT included in Vaadin

Layouting and client-server communication rewritten - RPC, shared state, ...

Client side widgets

Page 18: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Inherit com.vaadin.DefaultWidgetSet

Currently 135 Vaadin 7 compatible add-ons: http://vaadin.com/directory#:vaadin=7

Most/all add-ons need to be updated for Vaadin 7

Add-ons and Widgetsets

Page 19: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Both applications and add-ons can customize start-up page without servlet subclass

UIProvider, VaadinServletSession, VaadinSession, VaadinService etc. reduce the need to subclass servlets

@JavaScript on components to inject JavaScript

Extending servlets

Page 20: Migration from vaadin 6 to vaadin 7   devoxx france 2013

What's newhttps://vaadin.com/vaadin7

Migration guidehttps://vaadin.com/wiki/-/wiki/Main/Migrating+from+Vaadin+6+to+Vaadin+7

Vaadin 7 tutorialshttps://vaadin.com/wiki/-/wiki/Main/Vaadin+7

For more information

Page 21: Migration from vaadin 6 to vaadin 7   devoxx france 2013

Questions?


Recommended