SlideShare a Scribd company logo
Peter Lehto
@peter_lehto
GWT
integration
with
GWT
&
Vaadin
GWT
transport
mechanisms
Web
Components?
Vaadin
Connectors
Polymer
QA
GWT integration with Vaadin
> var foo = [0];
> foo == !foo;
> var foo = [0];
> foo == !foo;
> true
> [] + [];
> var foo = [0];
> foo == !foo;
> true
> [] + [];
>
> var foo = [0];
> foo == !foo;
> true
> [] + [];
>
> [] + {};
> var foo = [0];
> foo == !foo;
> true
> [] + [];
>
> [] + {};
> [object Object]
> var foo = [0];
> foo == !foo;
> true
> [] + [];
>
> [] + {};
> [object Object]
> {} + [];
> var foo = [0];
> foo == !foo;
> true
> [] + [];
>
> [] + {};
> [object Object]
> {} + [];
> 0
> var foo = [0];
> foo == !foo;
> true
> [] + [];
>
> [] + {};
> [object Object]
> {} + [];
> 0
> {} + {};> var foo = [0];
> foo == !foo;
> true
> [] + [];
>
> [] + {};
> [object Object]
> {} + [];
> 0
> {} + {};
> NaN
> var foo = [0];
> foo == !foo;
> true
> [] + [];
>
> [] + {};
> [object Object]
> {} + [];
> 0
> {} + {};
> NaN
> NaN == NaN;
> var foo = [0];
> foo == !foo;
> true
> [] + [];
>
> [] + {};
> [object Object]
> {} + [];
> 0
> {} + {};
> NaN
> NaN == NaN;
> false
> var foo = [0];
> foo == !foo;
> true
> [] + [];
>
> [] + {};
> [object Object]
> {} + [];
> 0
> {} + {};
> NaN
> NaN == NaN;
> false
> typeof NaN;
> var foo = [0];
> foo == !foo;
> true
> [] + [];
>
> [] + {};
> [object Object]
> {} + [];
> 0
> {} + {};
> NaN
> NaN == NaN;
> false
> typeof NaN;
> number
> var foo = [0];
> foo == !foo;
> true
> [] + [];
>
> [] + {};
> [object Object]
> {} + [];
> 0
> {} + {};
> NaN
> NaN == NaN;
> false
> typeof NaN;
> number
> var foo = [0];
> foo == !foo;
> true
GWT integration with Vaadin
UI
Browser
UI
Browser
Widgets
Theme
UI
Browser
Widgets
Theme
UI
Browser
Backend
Server
Widgets
Theme
UI
Browser
Backend
Server
Widgets
Service (GWT-RPC)
GWT
Java -> JavaScript
- Optimizing compiler
GWT
Browser specific
compilation
- No browser differences
GWT
Pure Java
- Web apps without JavaScript
GWT
JSInterop
- JavaScript integration
GWT
GWT integration with Vaadin
GWT integration with Vaadin
Server driven UI
framework with
GWT based thin
client
Why ?
High abstraction level
- Components & Events
Full stack Java
- UI runs in JVM
Rapid development
- No JavaScript compilation
Any JVM language
- Java 8, Scala, Lambdas…
Transparent
- Automated communication
Developer
Productivity
Rich
UX
User Interface
Components
User Interface
Components
How ?
Backend
Server
UI Backend
Server
Browser
UI Backend
Server
Widgets Components
Theme
Browser
UI Backend
Server
Widgets Components
Theme
Browser
UI Backend
Server
Widgets Components
Shared State

RPC
GWT integration with Vaadin
• Loader page
• CSS Theme
• Images
• JavaScript
• Loader page
• CSS Theme
• Images
• JavaScript
135k
Compressed &
reduced
thin client
GWT integration with Vaadin
GWT integration with Vaadin
• name=”Joonas”
• button clicked
261 bytes

GWT integration with Vaadin
• name=”Joonas”
• button clicked
261 bytes
• Add notification
267 bytes

GWT transport
mechanisms
RequestBuilder
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
try {
builder.sendRequest(requestDataString, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
int statusCode = response.getStatusCode();
String text = response.getText();
}
@Override
public void onError(Request request, Throwable exception) {
// TODO Handle asynchronous problems
} });
} catch (RequestException e) {
// TODO Handle synchronous problems
}
RequestBuilder
Good
• It just works
RequestBuilder
Good
• It just works
Bad
• Very low level
GWT Remote procedure calls
public interface ContactService extends RemoteService {
void saveContact(Contact contact);
List<Contact> getContacts();
}
public interface ContactServiceAsync {
void saveContact(Contact contact, AsyncCallback<Void> callback);
void getContacts(AsyncCallback<List<Contact>>
}
GWT-RPC
Good
• Simple but

powerful 

concept
• Default solution
• Optimized
GWT-RPC
Good
• Simple but

powerful 

concept
• Default solution
• Optimized
Bad
• Sending large

object graph
• Polymorphism

problems
Vaadin Connectors
GWT integration with Vaadin
State synchronization
public class ContactState extends SharedState {
public String name;
@DelegateToWidget
public int yearOfBirth;
}
State synchronization
public class ContactState extends SharedState {
public String name;
@DelegateToWidget
public int yearOfBirth;
}
@OnStateChange("name")
protected void updateName() {
doSomethingWithTheName(getState().name);
}
Vaadin RPC
public interface ContactRpc extends ServerRpc {
public void deleteContact(int id);
}
Vaadin RPC
public interface ContactRpc extends ServerRpc {
public void deleteContact(int id);
}
// Register RPC handler on the server
registerRpc(new ContactRpc() {
@Override
public void deleteContact(int id) {
ContactDAO.deleteById(id);
}
});
Vaadin RPC
public interface ContactRpc extends ServerRpc {
public void deleteContact(int id);
}
// Register RPC handler on the server
registerRpc(new ContactRpc() {
@Override
public void deleteContact(int id) {
ContactDAO.deleteById(id);
}
});
// Send RPC from the client
public void sendDelete(int contactId) {
getRpcProxy(ContactRpc.class).deleteContact(contactId);
}
Server
Button
Browser
Server
VButton
Button
Browser
Server
VButton
ButtonConnector
Button
Browser
Server
VButton
ButtonConnector
SharedState
Button
SharedState
Browser
Server
SharedState
SharedState
Button
VButton
ButtonConnector
Browser
Server
SharedState
SharedState
RPC
RPC
Button
VButton
ButtonConnector
Browser
Server
SharedState
SharedState
RPC
RPC
Button
VButton
ButtonConnector
Browser
Server
SharedState
SharedState
RPC
RPC
Button
VButton
ButtonConnector
Browser
Server
Button
VButton
ButtonConnector
SharedState
SharedState
RPC
RPC
@Connect(value = Button.class)
public class ButtonConnector extends AbstractComponentConnector
implements ClickHandler {
@Connect(value = Button.class)
public class ButtonConnector extends AbstractComponentConnector
implements ClickHandler {
@OnStateChange({ "caption", "captionAsHtml" })
void setCaption() {
getWidget().setCaptionText(getState().caption);
}
@Connect(value = Button.class)
public class ButtonConnector extends AbstractComponentConnector
implements ClickHandler {
@OnStateChange({ "caption", "captionAsHtml" })
void setCaption() {
getWidget().setCaptionText(getState().caption);
}
void onClick(ClickEvent event) {
getRpcProxy(ButtonServerRpc.class).click();
}
server
client
Component
Widget
Connector
RPC
State
Vaadin Connectors
Good
• Stateful server
• Websocket

support
• JSON
Vaadin Connectors
Good
• Stateful server
• Websocket

support
• JSON
Bad
• Stateful server
• Tied to

framework
Web Components
<x-gangnam-style>
</x-gangnam-style>
<x-gangnam-style>
</x-gangnam-style>
GWT integration with Vaadin
GWT integration with Vaadin
<x-component></x-component>
var proto = Object.create(HTMLElement.prototype);
proto.createdCallback = function() {
var div = document.createElement('div');
div.textContent = 'This is Custom Element';
this.appendChild(div);
};
var XComponent = document.registerElement('x-component', {
prototype: proto
});
var host = document.querySelector('#host');
var root = host.createShadowRoot(); // Create a Shadow Root
var div = document.createElement('div');
div.textContent = 'This is Shadow DOM';
root.appendChild(div); // Append elements to the Shadow Root
index.html
<link rel="import" href="component.html" >
component.html
<link rel="stylesheet" href="css/style.css">
<script src="js/script.js"></script>
<template id="template">
<style>
...
</style>
<div>
<h1>Web Components</h1>
<img src="http://webcomponents.org/img/logo.svg">
</div>
</template>
<script>
var template = document.querySelector('#template');
var clone = document.importNode(template.content, true);
var host = document.querySelector('#host');
host.appendChild(clone);
</script>
<div id="host"></div>
GWT integration with Vaadin
Components Components
Statically typed Java
Components
Statically typed Java
Components
Statically typed Java
Components
Automated Communication
Statically typed Java
Components
Statically typed Java
Automated Communication
Statically typed Java
Statically typed Java
Automated Communication
Statically typed Java
Problem ?
Problem ?
GWT integration with Vaadin
Do web components
actually work?
GWT integration with Vaadin
GWT integration with Vaadin
Custom Elements
Support by browser market share
Shadow DOM
Support by browser market share
HTML Import
Support by browser market share
HTML Template
Support by browser market share
Summary
Custom Element
HTML Template
Shadow DOM
HTML Import
CHROME OPERA FIREFOX SAFARI IE
Do web components
actually work?
No, but Yes :)
GWT integration with Vaadin
webcomponents.js
Polyfill
http://webcomponents.org/polyfills/
Web Components
Custom Elements
HTML Imports
Shadow DOM
DOM
WeakMap
Mutation Observers{
GWT integration with Vaadin
Vaadin Labs
Reusable HTML
components
Encapsulation
What shadow DOM looks like?
<v-grid>
GWT integration with Vaadin
Vaadin Grid Client Widget
Vaadin Grid Client Widget
Exposed JavaScript API via
JsInterop from GWT 2.7+
Vaadin Grid Client Widget
Exposed JavaScript API via
JsInterop from GWT 2.7+
Wrapped as Polymer

Element
@JsNamespace(JS.VAADIN_JS_NAMESPACE)
@JsExport
@JsType
public class GridComponent…
…
private final com.vaadin.client.widgets.Grid grid; // Grid widget
public JSColumn addColumn(JSColumn jsColumn, Object beforeColumnId) {
grid.addColumn
}
…
GridComponent
<link rel='import' href='../bower_components/polymer/polymer.html' />
<script type="text/javascript" language="javascript" src=“VaadinGridImport.nocache.js" />
<dom-module id="v-grid">
<template>
…
</template>
</dom-module>
<script>
VGrid = Polymer({
is: “v-grid",
properties: {
…
},
created: function() {
this._grid = new vaadin.GridComponent();
},
attached: function() {
this._grid.attached(this, Polymer.dom(this).querySelector(“table”),
Polymer.dom(this.root));
…
},
vaadin-grid.html
<script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<script src="../VaadinGrid/VaadinGrid.nocache.js"></script>
<body>
<v-grid rows=1>
…
index.html
Grid Widget
Grid Component
Grid Widget
@JSType
vaadin-grid.html
Grid Component
Grid Widget
@JSType
index.html
vaadin-grid.html
Grid Component
Grid Widget
@JSType
GWT integration with Vaadin
Automated Communication
Statically typed Java
Components
Automated Communication
Statically typed Java
Componentsweb
Automated Communication
Statically typed Java
Components
Framework
Components web
Lessons learned today
Lessons learned today
1. Vaadin is server driven high abstraction level UI framework
Lessons learned today
1. Vaadin is server driven high abstraction level UI framework
2. GWT is used for client side rendering
Lessons learned today
1. Vaadin is server driven high abstraction level UI framework
2. GWT is used for client side rendering
3. Vaadin connectors form a bridge between GWT and Vaadin
Lessons learned today
1. Vaadin is server driven high abstraction level UI framework
2. GWT is used for client side rendering
3. Vaadin connectors form a bridge between GWT and Vaadin
4. Web Components will be the next big thing in the web!
Lessons learned today
1. Vaadin is server driven high abstraction level UI framework
2. GWT is used for client side rendering
3. Vaadin connectors form a bridge between GWT and Vaadin
4. Web Components will be the next big thing in the web!
5. Polymer polyfills today’s browsers to support emerging
features
Lessons learned today
1. Vaadin is server driven high abstraction level UI framework
2. GWT is used for client side rendering
3. Vaadin connectors form a bridge between GWT and Vaadin
4. Web Components will be the next big thing in the web!
5. Polymer polyfills today’s browsers to support emerging
features
6. Vaadin Components will utilize Polymer providing framework

independent way of using the best component library available
GWT integration with Vaadin
@peter_lehto
expert & trainer
peter@vaadin.com
slides
slideshare.net/peterlehto

More Related Content

PDF
Vaadin DevDay 2017 - Data Binding in Vaadin 8
PDF
Vaadin 8 with Spring Framework
PDF
Vaadin Flow - JavaLand 2018
PDF
Remote controlling Parrot AR Drone with Spring Boot & Vaadin (JavaCro15)
KEY
Html5 For Jjugccc2009fall
PDF
Vaadin DevDay 2017 - Web Components
PDF
PDF
Vaadin 8 and 10
Vaadin DevDay 2017 - Data Binding in Vaadin 8
Vaadin 8 with Spring Framework
Vaadin Flow - JavaLand 2018
Remote controlling Parrot AR Drone with Spring Boot & Vaadin (JavaCro15)
Html5 For Jjugccc2009fall
Vaadin DevDay 2017 - Web Components
Vaadin 8 and 10

What's hot (20)

PDF
Creating GUI Component APIs in Angular and Web Components
PDF
Vaadin 8 - Data Binding with Binder
PPTX
Android data binding
PDF
Graphql, REST and Apollo
PDF
Creating GUI container components in Angular and Web Components
PPTX
IndexedDB and Push Notifications in Progressive Web Apps
PDF
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
PPTX
Python Code Camp for Professionals 3/4
PPTX
Python Code Camp for Professionals 4/4
PDF
Dojo1.0_Tutorials
PPTX
Test and profile your Windows Phone 8 App
PDF
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
PPTX
Getting the Most Out of jQuery Widgets
PPTX
Python Code Camp for Professionals 1/4
PPTX
jQuery PPT
PDF
Building web apps with Vaadin 8
KEY
前端概述
PDF
Better Selenium Tests with Geb - Selenium Conf 2014
PDF
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
PPTX
Bare-knuckle web development
Creating GUI Component APIs in Angular and Web Components
Vaadin 8 - Data Binding with Binder
Android data binding
Graphql, REST and Apollo
Creating GUI container components in Angular and Web Components
IndexedDB and Push Notifications in Progressive Web Apps
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 4/4
Dojo1.0_Tutorials
Test and profile your Windows Phone 8 App
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
Getting the Most Out of jQuery Widgets
Python Code Camp for Professionals 1/4
jQuery PPT
Building web apps with Vaadin 8
前端概述
Better Selenium Tests with Geb - Selenium Conf 2014
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Bare-knuckle web development
Ad

Viewers also liked (10)

PDF
Techlunch - Dependency Injection with Vaadin
PDF
Easy REST APIs with Jersey and RestyGWT
PDF
Building impressive layout systems with vaadin
PDF
Binding business data to vaadin components
PDF
Vaadin 8 with Spring Frameworks AutoConfiguration
PDF
JavaEE with Vaadin - Workshop
PDF
Remote controlling Parrot AR drone with Vaadin & Spring Boot @ GWT.create
PDF
Vaadin 7 - Java Enterprise Edition integration
PDF
Vaadin with Java EE 7
PDF
WebApp controlled Parrot AR Drone with Vaadin and Spring Boot
Techlunch - Dependency Injection with Vaadin
Easy REST APIs with Jersey and RestyGWT
Building impressive layout systems with vaadin
Binding business data to vaadin components
Vaadin 8 with Spring Frameworks AutoConfiguration
JavaEE with Vaadin - Workshop
Remote controlling Parrot AR drone with Vaadin & Spring Boot @ GWT.create
Vaadin 7 - Java Enterprise Edition integration
Vaadin with Java EE 7
WebApp controlled Parrot AR Drone with Vaadin and Spring Boot
Ad

Similar to GWT integration with Vaadin (20)

PDF
GQuery a jQuery clone for Gwt, RivieraDev 2011
PPTX
Google web toolkit web conference presenation
PDF
Javaland 2014 / GWT architectures and lessons learned
PPTX
SoftShake 2013 - Vaadin componentization
PDF
Google Web Toolkitのすすめ
PDF
Introducing GWT Polymer (vaadin)
PPT
GWT is Smarter Than You
PPT
Gwt and rpc use 2007 1
PDF
What's New in GWT 2.2
PPTX
YaJUG: What's new in GWT2
PDF
IoT with Vaadin Elements
PDF
JavaCro'15 - GWT integration with Vaadin - Peter Lehto
PPT
GWT Extreme!
PPT
Google Dev Day2007
PDF
The Java alternative to Javascript
PPT
Google Web Toolkits
PDF
Rock GWT UI's with Polymer Elements
PPT
Google Web Toolkit Introduction - eXo Platform SEA
KEY
Google io bootcamp_2010
KEY
Gwt and Xtend
GQuery a jQuery clone for Gwt, RivieraDev 2011
Google web toolkit web conference presenation
Javaland 2014 / GWT architectures and lessons learned
SoftShake 2013 - Vaadin componentization
Google Web Toolkitのすすめ
Introducing GWT Polymer (vaadin)
GWT is Smarter Than You
Gwt and rpc use 2007 1
What's New in GWT 2.2
YaJUG: What's new in GWT2
IoT with Vaadin Elements
JavaCro'15 - GWT integration with Vaadin - Peter Lehto
GWT Extreme!
Google Dev Day2007
The Java alternative to Javascript
Google Web Toolkits
Rock GWT UI's with Polymer Elements
Google Web Toolkit Introduction - eXo Platform SEA
Google io bootcamp_2010
Gwt and Xtend

Recently uploaded (20)

PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PPTX
Funds Management Learning Material for Beg
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
DOCX
Unit-3 cyber security network security of internet system
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PPTX
Digital Literacy And Online Safety on internet
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPT
tcp ip networks nd ip layering assotred slides
PDF
Introduction to the IoT system, how the IoT system works
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Power Point - Lesson 3_2.pptx grad school presentation
An introduction to the IFRS (ISSB) Stndards.pdf
Funds Management Learning Material for Beg
Slides PPTX World Game (s) Eco Economic Epochs.pptx
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
INTERNET------BASICS-------UPDATED PPT PRESENTATION
Unit-3 cyber security network security of internet system
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Digital Literacy And Online Safety on internet
The New Creative Director: How AI Tools for Social Media Content Creation Are...
522797556-Unit-2-Temperature-measurement-1-1.pptx
tcp ip networks nd ip layering assotred slides
Introduction to the IoT system, how the IoT system works
Introuction about ICD -10 and ICD-11 PPT.pptx
introduction about ICD -10 & ICD-11 ppt.pptx
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
WebRTC in SignalWire - troubleshooting media negotiation
Cloud-Scale Log Monitoring _ Datadog.pdf

GWT integration with Vaadin