javantura zagreb 2014 - vaadin - peter lehto

70
Introduction to Peter Lehto 7 Vaadin .1 Javantura 2014, Zagreb

Category:

Technology


1 download

DESCRIPTION

Konferencija Javantura Zagreb 2014 by HUJAK Vaadin - thinking of U and I - by Peter Lehto Vaadin (vaadin.com) je Java framework za rapidni razvoj visoko interaktivnih HTML5 web aplikacija na poslužitelju. On sakriva tehnologije prijenosa dokumenata i stanja (DOM, AJAX, JSON) i omogućuje da web aplikacije budu razvijene u Javi prema metafori desktop aplikacija. Vaadin iskorištava svu moć GWT-a, Java-to-JavaScript prevoditelja, pa je moguće razviti cijeli stog web aplikacija i nove komponente na strani klijenta bez napuštanja Java okruženja. Brzi razvoj olakšava veliki izbor komponenata i trenutni deployment na poslužitelj. Vaadin aplikacije koje se izvode na poslužitelju pružaju veliko povećanje sigurnosti, kao i povezivanje Vaadin sučelja na bilo koji postojeći backend sustav. U predavanju bit će prikazan pregled Vaadin 7.1 mogučnosti, pogled na Vaadin arhitekturu i što se zapravo događa iza kulisa frameworka, a bit će raspravljene i značajke koje donosi Vaadin 7.2.

TRANSCRIPT

Page 1: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Introduction to

Peter Lehto7Vaadin

.1Javantura 2014, Zagreb

Page 2: Javantura Zagreb 2014 - Vaadin - Peter Lehto

What?

Why?

Page 3: Javantura Zagreb 2014 - Vaadin - Peter Lehto

How do I

use it?

new Label(“Hello world”)

How does

it work?

Page 4: Javantura Zagreb 2014 - Vaadin - Peter Lehto

How do I get started?

QAWhat’s new in Vaadin 7.2

Page 5: Javantura Zagreb 2014 - Vaadin - Peter Lehto

?

Page 6: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 7: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 8: Javantura Zagreb 2014 - Vaadin - Peter Lehto

User interface framework for Rich Internet Applications

Page 9: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Why?

Page 10: Javantura Zagreb 2014 - Vaadin - Peter Lehto

To strive on developer

productivity

Page 11: Javantura Zagreb 2014 - Vaadin - Peter Lehto

JavaScriptDOMAJAXJSON…

htmljava

Page 12: Javantura Zagreb 2014 - Vaadin - Peter Lehto

1Server-side RIA

2Rich components

3Embracing Java

How?

Page 13: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Servlet backendGWT frontend

Page 14: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Server-side RIA

DOM

Client Server

ViewHTML Pageover HttpResponse

Controller

Model

Parameters overHttpRequest

DB4

5

6

2

Term

inalAdapter

Term

inalAdapter

Automated bythe RIA framework

3

7

1

9

8

Handled by the framework

Page 15: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Example

Page 16: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 17: Javantura Zagreb 2014 - Vaadin - Peter Lehto

• Initial HTML• CSS (theme)• Images• JavaScript

1.2M

307k

compress

135k

reducedwidgetset and theme

Page 18: Javantura Zagreb 2014 - Vaadin - Peter Lehto

• name=”Johannes”• button clicked

263 bytes

Page 19: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 20: Javantura Zagreb 2014 - Vaadin - Peter Lehto

• name=”Johannes”• button clicked

263 bytes

• Add notification

269 bytes

Page 21: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Demo

Page 22: Javantura Zagreb 2014 - Vaadin - Peter Lehto

The architecture of Vaadin

Page 23: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 24: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 25: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 26: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 27: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 28: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 29: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 30: Javantura Zagreb 2014 - Vaadin - Peter Lehto

server

client

Component

Widget

Connector

RPC

State

Page 31: Javantura Zagreb 2014 - Vaadin - Peter Lehto

1Server-side RIA

2Rich components

3Embracing Java

How?

Page 32: Javantura Zagreb 2014 - Vaadin - Peter Lehto

User InterfaceData Source

Theme

Page 34: Javantura Zagreb 2014 - Vaadin - Peter Lehto

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

iPhoneAndroidWP 8

1.6 Going mobileGWT 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

iPadAndroidWindows 8

Page 35: Javantura Zagreb 2014 - Vaadin - Peter Lehto

400+ add-oncomponents

Page 36: Javantura Zagreb 2014 - Vaadin - Peter Lehto

User InterfaceData Source

Theme

Page 37: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 38: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 39: Javantura Zagreb 2014 - Vaadin - Peter Lehto

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

Page 40: Javantura Zagreb 2014 - Vaadin - Peter Lehto

User InterfaceData Source

Theme

Page 43: Javantura Zagreb 2014 - Vaadin - Peter Lehto

sass(syntactically awesome stylesheets)

Page 44: Javantura Zagreb 2014 - Vaadin - Peter Lehto

$blue: #3bbfce;$margin: 16px;

.content-navigation { border-color: $blue; color: darken($blue, 9%);}

.border { padding: $margin / 2; margin: $margin / 2; border-color: $blue;}

.scss

constants and functions

.content-navigation { border-color: #3bbfce; color: #2b9eab;}

.border { padding: 8px; margin: 8px; border-color: #3bbfce;}

.css

Page 45: Javantura Zagreb 2014 - Vaadin - Peter Lehto

@mixin table-base { th { text-align: center; font-weight: bold; } td,th {padding: 2px}}

@mixin left($dist) { float: left; margin-left: $dist;}

#data { @include left(10px); @include table-base;}

#data { float: left; margin-left: 10px;}

#data th { text-align: center; font-weight: bold;}

#data td, #data #th { padding: 2px;}

.scss .cssmixins

Page 46: Javantura Zagreb 2014 - Vaadin - Peter Lehto

1Server-side RIA

2Rich components

3Embracing Java

How?

Page 47: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Any language on JVM

JavaScalaGroovyClojure

PythonRubyCeylon

Page 48: Javantura Zagreb 2014 - Vaadin - Peter Lehto

EclipseIntelliJ IDEA

NetbeansMaven

Ant∙ ∙ ∙

Multipledevelopment environments

Page 49: Javantura Zagreb 2014 - Vaadin - Peter Lehto

GWTCompatible

Page 50: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 51: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Vaadin+=

GWT

Page 52: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Server-

Client-si

deO

ptim

ized fo

r

Prod

uctivity

Optim

ized for

Con

trol

Page 53: Javantura Zagreb 2014 - Vaadin - Peter Lehto

What’s new in Vaadin 7.2

Beta release Roadmapped to Q1/2014

Page 54: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Grid component

Table and TreeTable component “replacement”

Usable also as pure client side widget

Client side data source API

Page 55: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Grid componentLow level Escalator widget for optimized rendering performance

Frozen columns

Variable row and column sizes

Page 56: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Grid component

Components in header and footer

Clean and Extensible implementation

Page 57: Javantura Zagreb 2014 - Vaadin - Peter Lehto

New Theme

Customizable theme based on SASS

Effortlessly change sizings, paddings, margins and color schemes.

Page 58: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Responsive layout support integrated

New Theme

“Breakpoints” allow changing layouts based on device resolution or browser window size

Page 59: Javantura Zagreb 2014 - Vaadin - Peter Lehto

“Unit tests” for UI with new VaadinDriver

Support for TestBench 4.0

Easier and cleaner way to select and interact with elements in DOM tree

Page 60: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Official support for Windows Phone

Support for TouchKit 4.0

New touckit theme in addition of current iOS theme

Page 61: Javantura Zagreb 2014 - Vaadin - Peter Lehto

How do I get

started?

Page 62: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Eclipse

Download plugin from Marketplace

Page 63: Javantura Zagreb 2014 - Vaadin - Peter Lehto

IntelliJ IDEA

Built-in support

Page 64: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Netbeans

Download plugin Netbeans Plugin Portal

Page 65: Javantura Zagreb 2014 - Vaadin - Peter Lehto

mvn archetype:generate

-DarchetypeGroupId=

com.vaadin

-DarchetypeArtifactId=

vaadin-archetype-application

-DarchetypeVersion=

7.1.11

Maven

Page 66: Javantura Zagreb 2014 - Vaadin - Peter Lehto
Page 67: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Download for Freevaadin.com/book

> 600 pages

9 789529 319701

ISBN 978-952-93-1970-1

PDF, ePub, HTML

Page 68: Javantura Zagreb 2014 - Vaadin - Peter Lehto

Ohloh#2 used

Java WebFramework

Community of 100.000+

Page 69: Javantura Zagreb 2014 - Vaadin - Peter Lehto

By Marko Grönroos

ABOUT VAADIN

ww

w.d

zone

.co

m

G

et M

ore

Ref

card

z! V

isit

ref

card

z.co

m

#85

Getting Started with VaadinCONTENTS INCLUDE:�� About Vaadin�� Creating An Application�� Components �� Layout Components�� Themes�� Data Binding and more...

Vaadin is a server-side Ajax web application development framework that allows you to build web applications just like with traditional desktop frameworks, such as AWT or Swing. An application is built from user interface components contained hierarchically in layout components.

In the server-driven model, the application code runs on a server, while the actual user interaction is handled by a client-side engine running in the browser. The client-server communications and any client-side technologies, such as HTML and JavaScript, are invisible to the developer. As the client-side engine runs as JavaScript in the browser, there is no need to install plug-ins. Vaadin is released under the Apache License 2.0.

Figure 1: Vaadin Client-Server Architecture

If the built-in selection of components is not enough, you can develop new components with the Google Web Toolkit (GWT)

Figure 2: Architecture for Vaadin Applications

Hot Tip

You can get a reference to the application object from any component attached to the application with ��$!!����$� ���

Event ListenersIn the event-driven model, user interaction with user interface components triggers server-side events, which you can handle

Web BrowserClient-Side Engine

JavaWeb Server

VaadinUIComponents

YourJavaApplication

WebService

EJB

DB

Servlet Container

UserApplication

EventListener

DataModel

ApplicationThemes

ApplicationResources

DefaultTheme

FileResources

ExternalResources

Database

DataBinding

Inherits Events Changes

AJAX Requests

Inherits

UIComponent

JavaServlet

ApplicationClass

Web BrowserClient-Side Engine

brought to you by...

Page 70: Javantura Zagreb 2014 - Vaadin - Peter Lehto

3

Vaadin: A Familiar Way to Build Web Apps with Java

DZone, Inc. | www.dzone.comFigure 4: The Class Diagram presents all user interface component classes and the most important interfaces, relationships, and methods.

Questions?Comments?

[email protected]