Vaadin intro at GWT.create conference

85
Vaadin 7 introduction to @joonaslehtinen Founder & CEO

description

Introduction to Vaadin given at GWT.create conference

Transcript of Vaadin intro at GWT.create conference

Page 1: Vaadin intro at GWT.create conference

Vaadin7introduction to

@joonaslehtinen Founder & CEO

Page 2: Vaadin intro at GWT.create conference

Intro to Vaadin

new Label(“Hello world”)

Page 3: Vaadin intro at GWT.create conference

New in

7

Page 4: Vaadin intro at GWT.create conference

Getting started

QA

Page 5: Vaadin intro at GWT.create conference
Page 6: Vaadin intro at GWT.create conference

User interface framework for rich

web applications

Page 7: Vaadin intro at GWT.create conference

Sounds like GWT? Kinda…

Page 8: Vaadin intro at GWT.create conference

Building blocks

Page 9: Vaadin intro at GWT.create conference

Developer

Productivity

Rich

UX

Page 10: Vaadin intro at GWT.create conference
Page 11: Vaadin intro at GWT.create conference

htmljava

Page 12: Vaadin intro at GWT.create conference

123Key Ideas

Page 13: Vaadin intro at GWT.create conference

1Rich Components

Page 14: Vaadin intro at GWT.create conference

User Interface Data Source

Theme

Page 17: Vaadin intro at GWT.create conference
Page 18: Vaadin intro at GWT.create conference
Page 19: Vaadin intro at GWT.create conference
Page 20: Vaadin intro at GWT.create conference

1.6 Going mobile

GWT is a versatile technology that allows developers to create application UI for desktop, tablet, and mobile consumption. As can be expected, over 98% of apps support desktop browsers, but we found it interesting that tablets had overtaken phones (at least when it came to support from GWT-based apps). In US, the number of apps supporting tablets was as high as 46%, while it was just 34% in Europe.

What kind of devices does your app support?

98.1%25.7%

Phones

36.1%

Tablets

Desktop browsers

Others

2.1%

“Since gwt is used extensively in the enterprise, this may explain why tablets are more popular than support for phones”

Daniel

Browsers developers expect to support in 2013

3.5 Browsers to support in 2012

IE 6/7 Safari Opera IE 8

6/7 8

14% 18% 36% 54%

Chrome

9 10IE 9 IE 10 Firefox

79% 80% 94% 94%Browsers developers expect to support in 2013

3.5 Browsers to support in 2012

IE 6/7 Safari Opera IE 8

6/7 8

14% 18% 36% 54%

Chrome

9 10IE 9 IE 10 Firefox

79% 80% 94% 94%

1.6 Going mobile

GWT is a versatile technology that allows developers to create application UI for

desktop, tablet, and mobile consumption. As can be expected, over 98% of apps

support desktop browsers, but we found it interesting that tablets had overtaken

phones (at least when it came to support from GWT-based apps). In US, the number

of apps supporting tablets was as high as 46%, while it was just 34% in Europe.

What kind of devices does your app support?

98.1%

25.7%

Phones

36.1%

Tablets

Desktop

browsers

Others2.1%

“Since gwt is used extensively

in the enterprise, this may

explain why tablets are more

popular than support for

phones”

Daniel

iPhone Android

WP 8

1.6 Going mobile

GWT is a versatile technology that allows developers to create application UI for

desktop, tablet, and mobile consumption. As can be expected, over 98% of apps

support desktop browsers, but we found it interesting that tablets had overtaken

phones (at least when it came to support from GWT-based apps). In US, the number

of apps supporting tablets was as high as 46%, while it was just 34% in Europe.

What kind of devices does your app support?

98.1%

25.7%

Phones

36.1%

Tablets

Desktop

browsers

Others2.1%

“Since gwt is used extensively

in the enterprise, this may

explain why tablets are more

popular than support for

phones”

Daniel

iPad Android Windows 8

Page 21: Vaadin intro at GWT.create conference

350+ add-on components

Page 22: Vaadin intro at GWT.create conference
Page 23: Vaadin intro at GWT.create conference
Page 24: Vaadin intro at GWT.create conference
Page 25: Vaadin intro at GWT.create conference
Page 26: Vaadin intro at GWT.create conference

User Interface Data Source

Theme

Page 31: Vaadin intro at GWT.create conference

User Interface Data Source

Theme

Page 32: Vaadin intro at GWT.create conference
Page 33: Vaadin intro at GWT.create conference

InMemory, Bean, Method, Collection, JDBC, JPA, Hibernate, TextFile, FileSystem, Properties, EclipseLink, Lucene, Mockups, GAE, ...

Page 34: Vaadin intro at GWT.create conference

2Server + Client

Page 35: Vaadin intro at GWT.create conference

Web application layers

Backend server

Web server

Commu- nication JavaScript

Page 36: Vaadin intro at GWT.create conference

Web application layers

JavaScriptJava to JavaScript

Web server

Backend server

required optional optionalrequired

Commu- nication

optional

Vaad

in

required optionalrequired

GW

T

requiredrequiredJS

requiredrequired

required required

Page 37: Vaadin intro at GWT.create conference

Web application layers

JavaScriptJava to JavaScript

Web server

Backend server

required optional optionalrequired

Commu- nication

optional

Vaad

in

required optionalrequired

GW

T

requiredrequiredJS

requiredrequired

required required

1 layer vs

3 layers

-50% codelines -50% development -50% maintenance easier to learn

Page 38: Vaadin intro at GWT.create conference

Googlehttp://domain.com

Web Page Title

First name

Table cell

Table cell

Phone number

Table cell

Table cell

Table cellTable cell

Table cell

Table cell

Table cell

Table cell Table cell

Table cell

Table cell

Table cell Table cell

Table cell

Last name

Table cell

Table cell

Email address

Table cellTable cell

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.

A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth.

Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas.

Server-side

OfflineClient-side Vaadin-RPCClient-side GWT-RPCServer-side

Edit Delete New

Save Cancel

First name Last name

Phone number Email address

Page 39: Vaadin intro at GWT.create conference

AddressbookBackendAddress ImplBackendFrontend

Server-side!(with Vaadin)

Client-side!(with GWT-RPC)

AddressbookEditor

AddressbookEditor

RPCServlet Service

ServiceAsyncClient

Server

Proxy(generated)

implements

implements

equal~150loc

68loc

~270loc

0loc

17loc 19loc

Page 40: Vaadin intro at GWT.create conference

How does it work, really?

Page 41: Vaadin intro at GWT.create conference
Page 42: Vaadin intro at GWT.create conference

• Initial HTML • CSS (theme) • Images • JavaScript !1.2M total

307k

compress

135k

reduced widgetset

Page 43: Vaadin intro at GWT.create conference

• name=”Joonas” • button clicked !261 bytes

Page 44: Vaadin intro at GWT.create conference
Page 45: Vaadin intro at GWT.create conference

• name=”Joonas” • button clicked !261 bytes

• Add notification !267 bytes

Page 46: Vaadin intro at GWT.create conference

Development cycle

Page 47: Vaadin intro at GWT.create conference
Page 48: Vaadin intro at GWT.create conference

https://github.com/vaadin/documentmanager

https://vaadin.com/learn

Source

HOWTO Screencast

Page 49: Vaadin intro at GWT.create conference

3Embracing Java

Page 50: Vaadin intro at GWT.create conference

Any language on JVM

Page 51: Vaadin intro at GWT.create conference

Internet Explorer Chrome Firefox Safari Opera

iOS Android

Page 52: Vaadin intro at GWT.create conference

No browser plugins

!

Nothing to install

Page 53: Vaadin intro at GWT.create conference

Servlet Portlet

(most) clouds

Page 54: Vaadin intro at GWT.create conference

Eclipse IntelliJ IDEA

Netbeans Maven

Ant Ł Ł Ł

Page 55: Vaadin intro at GWT.create conference

Vaadin += GWT

1/7

Page 56: Vaadin intro at GWT.create conference
Page 57: Vaadin intro at GWT.create conference
Page 58: Vaadin intro at GWT.create conference
Page 59: Vaadin intro at GWT.create conference

GWT Compatible

Page 60: Vaadin intro at GWT.create conference

Server-

Client-

side

Optim

ized for

Productivity

Opt

imiz

ed fo

r

Cont

rol

Page 61: Vaadin intro at GWT.create conference

Architecture

Page 62: Vaadin intro at GWT.create conference
Page 63: Vaadin intro at GWT.create conference

BleedingedgE

Page 64: Vaadin intro at GWT.create conference

Complete stack

Renewed from Inside

Sass

JS

HTML5+= GWT

RPC State

UI

Field

Push

Page 65: Vaadin intro at GWT.create conference

vaadin.com/7

Page 66: Vaadin intro at GWT.create conference

SassSyntactically Awesome Stylesheets

Demo

Page 67: Vaadin intro at GWT.create conference

JavaScript Add-ons

Page 68: Vaadin intro at GWT.create conference

getPage().getJavaScript().addFunction("myCallback", new JavaScriptCallback() { public void call(JSONArray arguments) throws JSONException { // Do something with the arguments } });

Publish API from Java

window.myCallback('foo', 100);

Use from JavaScript

Page 69: Vaadin intro at GWT.create conference

!public class MyWidget extends AbstractJavaScriptComponent { public MyWidget() { addFunction("plotClick", new JavaScriptFunction() { public void call(JSONArray arguments) throws JSONException { // Do something with the event } }); }! public static class MyWidgetState extends JavaScriptComponentState { public List<List<List<Double>>> plotSeriesData = new ArrayList<List<List<Double>>>(); } public MyWidgetState getState() { return (MyWidgetState) super.getState(); }

!!}

Server-side Java API for Widget

Page 70: Vaadin intro at GWT.create conference

window.com_example_MyWidget = function() { var element = $(this.getWidgetElement());

// Draw a plot for any server-side (plot data) state change this.onStateChange = function() { $.plot(element, this.getState().series, {grid: {clickable: true}}); }!

// Communicate local events back to server-side component element.bind('plotclick', function(event, point, item) { if (item) {

var onPlotClick = this.getCallback("plotClick"); onPlotClick(item.seriesIndex, item.dataIndex); } });}

Widget implementation in JavaScript

Page 71: Vaadin intro at GWT.create conference

Server Push

Page 72: Vaadin intro at GWT.create conference

@Push MyUI !

!

<async-supported/> !

!

vaadin-push dependency

Page 73: Vaadin intro at GWT.create conference

RPC State

Page 74: Vaadin intro at GWT.create conference

server

client

Component

Widget

Connector

RPC

7State

Demo

Page 75: Vaadin intro at GWT.create conference

getting started

Page 76: Vaadin intro at GWT.create conference
Page 77: Vaadin intro at GWT.create conference

Eclipse

Download plugin from Martketplace

Page 78: Vaadin intro at GWT.create conference

IntelliJ IDEA

Built-in support

Page 79: Vaadin intro at GWT.create conference

Netbeans

Download plugin Netbeans Plugin Portal

Page 80: Vaadin intro at GWT.create conference

mvn archetype:generate -DarchetypeGroupId= com.vaadin -DarchetypeArtifactId= vaadin-archetype-application -DarchetypeVersion= 7.1.9

Maven

Page 81: Vaadin intro at GWT.create conference

Download for Freevaadin.com/book

728 pages

9 789529 319701

ISBN 978-952-93-1970-1

PDF, ePub, HTML

Page 82: Vaadin intro at GWT.create conference

Apache License

Page 83: Vaadin intro at GWT.create conference

community of

~100.000 developers

Ohloh #2 used

Java Web Framework

Page 84: Vaadin intro at GWT.create conference

Hybrid Applications !

Theming Workshop !

Vaadin Intro Workshop

1:30pm

Page 85: Vaadin intro at GWT.create conference

? [email protected] vaadin.com/joonas

@joonaslehtinen

slideshare.com/ joonaslehtinen