Vaadin 7.2

68
Vaadin 7 @joonaslehtinen Founder & CEO .2

description

Presentation at DevNexus today about future Vaadin topics, including the upcoming Vaadin 7.2

Transcript of Vaadin 7.2

Page 1: Vaadin 7.2

Vaadin7@joonaslehtinen Founder & CEO .2

Page 2: Vaadin 7.2

Disclaimer Vaadin 7.2 is nowhere near release even though I though it would have been released by DevNexus when submitting this presentation. I hope you would not take this a case example for missing the estimated release dates. Even though it is clearly the case….

!Sorry, it will be released soon [when it is ready]

Page 3: Vaadin 7.2

11 maintenance releases since 28.6.2013 - one every 3 weeks 37 authors, 345 change sets7.1

Page 4: Vaadin 7.2

Beautifying apps with new sassy theme

Power(ful) Grid

Hybrid apps & RPC

Vaadin 8 & GWT 3

Agenda: The future TB4 TK4

7.2

7.2

Page 5: Vaadin 7.2

Hybrid apps?

Page 6: Vaadin 7.2

0L/100km1€/100km

450km range!growing charge station network

2.5L/100km4€/100km

500km range!gas stationseverywhere

8.6L/100km13€/100km

550km range!gas stationseverywhere

Page 7: Vaadin 7.2

Web application layers

Backend server

Web server

Commu- nication JavaScript

Client-side UI

Page 8: Vaadin 7.2

Web application layers

Backend server

Web server

Commu- nication JavaScript

Server-side UI Automated

Page 9: Vaadin 7.2

Web application layers

JavaScriptJava to JavaScript

Web server

Backend server

Commu- nication

required optionalrequired

GW

T

requiredrequiredJS

requiredrequired

required required

Client-side UI

Page 10: Vaadin 7.2

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

Client-side UI

Page 11: Vaadin 7.2

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

Client-side UIServer-side UI &

Page 12: Vaadin 7.2

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 13: Vaadin 7.2

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% dev. time -50% maintenance vs full control over DOM and communications

Page 14: Vaadin 7.2

Server-

Client-

side

Optim

ized for

Productivity

Opt

imiz

ed fo

r

Cont

rol

Page 15: Vaadin 7.2

Server-Client-

sideO

ptim

ized

for

Prod

uctiv

ity

Optim

ized for

Control

Page 16: Vaadin 7.2

Server-sideClient-side

Use for

• Offline!• Low latency interaction!• Maximum scalability

Use for

• Most places ( - 50% cost )!• High security!• Utilizing full Java platform

Benefits of the both sides, but adds complexity

Hybrid

Page 17: Vaadin 7.2

Server-side1 layer UI

Automated!connection to

server required

Hybrid1-3 layer UI

You choose!offline for chosen

functionality

Client-side3 layer UI

Full control!offline readyarchitecture

Page 18: Vaadin 7.2
Page 19: Vaadin 7.2

http://demo.vaadin.com/parking/

Page 20: Vaadin 7.2

Examplehttps://github.com/jojule/hybrid

Page 21: Vaadin 7.2

Google

http://domain.com

Web Page Title

First nameTable cell

Table cell

Phone number

Table cell

Table cell

Table cellTable cellTable cell

Table cell

Table cellTable cell

Table cellTable cell

Table cell

Table cell Table cell

Table cell

Last name

Table cellTable 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-RPC

Client-side GWT-RPCServer-side

Edit Delete New

Save Cancel

First name Last name

Phone number Email address

Page 22: Vaadin 7.2

AddressbookBackendAddress ImplBackendFrontend

Server-side!(with Vaadin)

Client-side!(with GWT-RPC)

AddressbookEditor

AddressbookEditor

RPCServlet Service

ServiceAsync

View

Connector

Client

Server

Proxy(generated)

create

place

implements

implements

equal

Page 23: Vaadin 7.2

Estimating Complexity

Page 24: Vaadin 7.2

Server-sideClient-side

1 class !

190 LOC

4 classes 2 interfaces ~ 500 LOC 3X

Page 25: Vaadin 7.2

Vaadin RPC State

Page 26: Vaadin 7.2

server

client

Component

Widget

Connector

RPC

State

Demo

Page 27: Vaadin 7.2

public interface ButtonRpc extends ServerRpc { public void click(MouseEventDetails details); }

private ButtonRpc rpc = RpcProxy.create(ButtonRpc.class, this); !public void onClick(ClickEvent event) { rpc.click( new MouseEventDetails(event)); }

serverclient

private ButtonRpc rpc = new ButtonRpc() { public void click( MouseEventDetails details) { // do stuff } }; !public Button() { registerRpc(rpc); }

Demo

Page 28: Vaadin 7.2

AddressbookBackendAddress ImplBackendFrontend

Client-side!(with Conntector)

Client-side!(with GWT-RPC)

AddressbookEditor

RPCServlet Service

ServiceAsync

View

Client

Serverplace

implements

equal

View

place & !serve

AddressbookEditor

StateServer!RPC

Client!RPC

Connector Proxy(generated)

createimplementsConnector

create

Page 29: Vaadin 7.2

PUSHSince 7.1

Page 30: Vaadin 7.2

@Push MyUI !

!

<async-supported/> !

!

vaadin-push dependency

Page 31: Vaadin 7.2

JavaScript Add-ons

6/7

Page 32: Vaadin 7.2

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 33: Vaadin 7.2

!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 34: Vaadin 7.2

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 35: Vaadin 7.2

Grid

Page 36: Vaadin 7.2

• >10 years old architecture • Really hard to customize • Client-side API missing (and impossible) • Performance (heavy DOM tree) • Some key features missing (frozen

columns, ..)

Table: challenges

Page 37: Vaadin 7.2

• Super fast on all devices • Unlimited datasets ("zillion rows")

• Built for extensibility • Superset of features compared to Table • Client- and Server API

Grid: New generation table for the next 10 years?

Page 38: Vaadin 7.2

Editor rowWidgetWidgetWidget

Editor rowComponentComponentComponent

Widget

Renderer

Grid

Escalator

Connector (Hierarchical) DataSource

(Hierarchical) DataSource

Grid

Component Component

Widget

Renderer Per column

In headers and cells

In headers and cells

Page 39: Vaadin 7.2

Escalator

Page 40: Vaadin 7.2

• Renderers • Client-side API and data sources • Editor rows • "Billion pixel scrolling" • Hierarchical headers • Widgets in headers

Some of the key features in 7.2

Page 41: Vaadin 7.2

• Hierarchy • Variable row height • Embedding to super long pages (body

scrollbars) • Infinite scrolling • Components in cells • Details rows

Some of the key features in 7.x

Page 42: Vaadin 7.2

Valo Theme

Page 43: Vaadin 7.2

Seriously SASSy

Page 44: Vaadin 7.2

Variables & functions

Page 45: Vaadin 7.2

Mixins

Page 46: Vaadin 7.2

Nesting

Page 47: Vaadin 7.2

Selector Inheritance

Page 48: Vaadin 7.2

<Beat design example>

Page 49: Vaadin 7.2
Page 50: Vaadin 7.2
Page 51: Vaadin 7.2
Page 52: Vaadin 7.2

Responsive

Page 53: Vaadin 7.2

// Vaadin UI protected void init(VaadinRequest request) { new Responsive(this); } !!// CSS .v-ui[width-range~="0-800px"] { /* Styles that apply when the UI's width is between 0 and 800 pixels */ } .v-ui[width-range~="801px-"] { /* Styles that apply when the UI's width is over 800 pixels */ }

http://demo.vaadin.com/responsive/

Page 54: Vaadin 7.2

TouchKit 4

Page 55: Vaadin 7.2

New cross-platform theme http://demo.vaadin.com/parking/

Windows Phone 8 support

Vaadin TouchKit 4.0

Page 56: Vaadin 7.2

New cross-platform theme http://demo.vaadin.com/parking/

Windows Phone 8 support

Vaadin TouchKit 4.0

Page 57: Vaadin 7.2

TestBench 4

Page 58: Vaadin 7.2

ButtonElement okButton = $(ButtonElement.class).caption("OK").first(); okButton.focus(); okButton.click(); List<AbstractLayoutElement> list = $(AbstractLayoutElement.class).all();

ElementQuery API

Page 59: Vaadin 7.2

getting started

Page 60: Vaadin 7.2
Page 61: Vaadin 7.2

Eclipse

Download plugin from Martketplace

Page 62: Vaadin 7.2

IntelliJ IDEA

Built-in support

Page 63: Vaadin 7.2

Netbeans

Download plugin Netbeans Plugin Portal

Page 64: Vaadin 7.2

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

Maven

Page 65: Vaadin 7.2

Download for Freevaadin.com/book

728 pages

9 789529 319701

ISBN 978-952-93-1970-1

PDF, ePub, HTML

Page 66: Vaadin 7.2

ApacheLicense

Page 67: Vaadin 7.2

community of

100.000+ developers

Ohloh #2 used

Java Web Framework

Page 68: Vaadin 7.2

? [email protected] vaadin.com/joonas

@joonaslehtinen

slideshare.com/ joonaslehtinen