SlideShare a Scribd company logo
1 of 49
Download to read offline
H A I J I A N W A N G
W E B C O M P O N E N T S
W I T H J A V A
@haijian_wang
Java
Web
E l e m e n t s
C o m m u n i c a t i o n
Vaadin Framework
.1 .2 3 4 5 6 7 8
2001
2002
2002
2007
2008
2009
2013
2017
Vaadin Framework
.1 .2 3 4 5 6 7 8
1
Vaadin Core Elements
Web Components
in Practice 1/2
A new TAG for your browser: ‘<my-ui-
component>’
Based on standard specifications
(no frameworks!)
Goodbye to browser plugins (WC + HTML5)
Isolated from other elements in DOM
Easy to share (npm, yarn)
Easy to integrate
Web Components
in Practice 2/2
<vaadin-date-picker>
</vaadin-date-picker>
Web Components technically
F O U R H T M L 5 S P E C I F I C AT I O N S
1. Custom Elements
2. Templates
3. HTML imports (es6 modules)
4. Shadow DOM
Custom Elements
<my-new-element></my-new-element>
Templates
<template id=“my-template"> 

<style> 

...

</style> 

<div> 

<h1>Web Components</h1> 

<img src="/img/logo.svg"> 

</div> 

</template>





HTML Imports
<link rel="import" href="my-el.html">

S H A D O W D O M
<video src=“video-src.mp4” controls></video>

<video src=“video-src.mp4” controls></video>

• Encapsulation
• Reusability
Benefits of using Web Components
Native browser support
G E T S TA R T E D W I T H W E B
C O M P O N E N T S
I ns ta ll a co m pon ent
Us e i n H TM L
W E B C O M P O N E N T S W I T H J A V A ( V A A D I N ) ?
Ser ver- s id e Java Comp one nt
@Tag("paper-slider")

public interface PaperSlider extends Element{

static PaperSlider create() {

return Elements.create(PaperSlider.class);

}



void setValue(double value);



@UpdatedBy(“value-change")

double getValue();



}
Clien t- s i de I mple me ntation
( i n t e n t i o n a l l y l e f t b l a n k )
Using a s er ver- s id e co mp one nt
PaperSlider paperSlider = PaperSlider.create();
paperSlider.setValue(50);
paperSlider.addEventListener("change", arguments->{
Notification.show(
"Value changed to"+paperSlider.getValue());
});
Demo
H O W T O C R E AT E YO U R
O W N W E B C O M P O N E N T ?
Polymer
J A V A S C R I P T L I B R A R Y F O R W E B C O M P O N E N T S
• Vaadin Core Elements are built with Polymer 2.0
• Mentally for Vaadin Developer Polymer is new GWT
• Developed by Google
• Helps building re-usable Web Components
• Utilises new emerging Web Component standards
• Polyfills missing features for browsers
Polyfills
M A K E S TA N D A R D S W O R K T O D A Y
• Implementations making older browsers support new standards
• Will eventually be out powered by Browser standards
ES6-Class definition
class Shape {
constructor (id, x, y) {
this.id = id
this.move(x, y)
}
move (x, y) {
this.x = x
this.y = y
}
}
ES6-Class Inheritance
class Rectangle extends Shape {
constructor (id, x, y, width, height) {
super(id, x, y)
this.width = width
this.height = height
}
}
class Circle extends Shape {
constructor (id, x, y, radius) {
super(id, x, y)
this.radius = radius
}
}
ES6-Static Members
class Rectangle extends Shape {
static defaultRectangle () {
return new Rectangle("default", 0, 0, 100, 100)
}
}
class Circle extends Shape {
static defaultCircle () {
return new Circle("default", 0, 0, 100)
}
}
var defRectangle = Rectangle.defaultRectangle();
var defCircle = Circle.defaultCircle();
ES6-Arrow Functions
odds = evens.map(v => v + 1)
pairs = evens.map(v => ({ even: v, odd: v + 1 }))
nums = evens.map((v, i) => v + i)
nums.forEach(v => {
if (v % 5 === 0)
fives.push(v)
})
ES6-Method Properties
obj = {
foo (a, b) {
…
},
bar (x, y) {
…
}
}
Demo: How to create a web
component with Polymer
and Integrate with Vaadin
Vaadin Framework
.1 .2 3 4 5 6 7 8
1
Vaadin Core Elements
Vaadin Framework
.1 .2 3 4 5 6 7 8
1
Vaadin Core Elements
2
x
Unified
platform
https://bakery-flow.demo.vaadin.com/
Summary
• My talk has nothing to do with GWT :(
• Web components is the future of web
• Catch the train before it’s too late
• Vaadin provides pure client side web components as
Vaadin Elements
• Vaadin provides Java integration with Web
components
T H A N K YO U !
@haijian_wang
https://vaadin.com/blog/-/blogs/framework-roadmap-connecting-the-dots
https://vaadin.com/directory#!addon/elements-add-on

More Related Content

What's hot

Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud
Shekhar Gulati
 

What's hot (20)

React Vs AnagularJS
React Vs AnagularJSReact Vs AnagularJS
React Vs AnagularJS
 
GWT Introduction and Overview - SV Code Camp 09
GWT Introduction and Overview - SV Code Camp 09GWT Introduction and Overview - SV Code Camp 09
GWT Introduction and Overview - SV Code Camp 09
 
Micronaut For Single Page Apps
Micronaut For Single Page AppsMicronaut For Single Page Apps
Micronaut For Single Page Apps
 
Room with a Vue - Introduction to Vue.js
Room with a Vue - Introduction to Vue.jsRoom with a Vue - Introduction to Vue.js
Room with a Vue - Introduction to Vue.js
 
Geotalk presentation
Geotalk presentationGeotalk presentation
Geotalk presentation
 
An Introduction To Testing In AngularJS Applications
An Introduction To Testing In AngularJS Applications An Introduction To Testing In AngularJS Applications
An Introduction To Testing In AngularJS Applications
 
Gwt.Create Keynote San Francisco
Gwt.Create Keynote San FranciscoGwt.Create Keynote San Francisco
Gwt.Create Keynote San Francisco
 
Using VueJS in front of Drupal 8
Using VueJS in front of Drupal 8Using VueJS in front of Drupal 8
Using VueJS in front of Drupal 8
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
 
Javascript Module Patterns
Javascript Module PatternsJavascript Module Patterns
Javascript Module Patterns
 
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
 
The Past Year in Spring for Apache Geode
The Past Year in Spring for Apache GeodeThe Past Year in Spring for Apache Geode
The Past Year in Spring for Apache Geode
 
React Native: JS MVC Meetup #15
React Native: JS MVC Meetup #15React Native: JS MVC Meetup #15
React Native: JS MVC Meetup #15
 
Building a Startup Stack with AngularJS
Building a Startup Stack with AngularJSBuilding a Startup Stack with AngularJS
Building a Startup Stack with AngularJS
 
Introduction to VueJS & Vuex
Introduction to VueJS & VuexIntroduction to VueJS & Vuex
Introduction to VueJS & Vuex
 
React Facebook JavaScript Library
React Facebook JavaScript LibraryReact Facebook JavaScript Library
React Facebook JavaScript Library
 
Turducken - Divide and Conquer large GWT apps with multiple teams
Turducken - Divide and Conquer large GWT apps with multiple teamsTurducken - Divide and Conquer large GWT apps with multiple teams
Turducken - Divide and Conquer large GWT apps with multiple teams
 
Gradle - time for another build
Gradle - time for another buildGradle - time for another build
Gradle - time for another build
 
Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud
 
GWT Reloaded
GWT ReloadedGWT Reloaded
GWT Reloaded
 

Similar to Web components with java by Haijian Wang

Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
OSCON Byrum
 
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter PilgrimJavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
JavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development ExperiencesJavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development Experiences
Peter Pilgrim
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Library
rsnarayanan
 

Similar to Web components with java by Haijian Wang (20)

Svcc 2013-d3
Svcc 2013-d3Svcc 2013-d3
Svcc 2013-d3
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
 
Backbone js
Backbone jsBackbone js
Backbone js
 
SVGD3Angular2React
SVGD3Angular2ReactSVGD3Angular2React
SVGD3Angular2React
 
React js
React jsReact js
React js
 
Vue js for beginner
Vue js for beginner Vue js for beginner
Vue js for beginner
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
 
Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!
 
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter PilgrimJavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
 
JavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development ExperiencesJavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development Experiences
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 
How to Mess Up Your Angular UI Components
How to Mess Up Your Angular UI ComponentsHow to Mess Up Your Angular UI Components
How to Mess Up Your Angular UI Components
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Library
 
Redux vs Alt
Redux vs AltRedux vs Alt
Redux vs Alt
 
Web Components Everywhere
Web Components EverywhereWeb Components Everywhere
Web Components Everywhere
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
Learn D3.js in 90 minutes
Learn D3.js in 90 minutesLearn D3.js in 90 minutes
Learn D3.js in 90 minutes
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup Edinburgh
 
Opencast Admin UI - Introduction to developing using AngularJS
Opencast Admin UI - Introduction to developing using AngularJSOpencast Admin UI - Introduction to developing using AngularJS
Opencast Admin UI - Introduction to developing using AngularJS
 

More from GWTcon

GWTcon 2014 - Apertura
GWTcon 2014 - AperturaGWTcon 2014 - Apertura
GWTcon 2014 - Apertura
GWTcon
 

More from GWTcon (13)

"Jclays, A global solution for application design and automatic GWT code gene...
"Jclays, A global solution for application design and automatic GWT code gene..."Jclays, A global solution for application design and automatic GWT code gene...
"Jclays, A global solution for application design and automatic GWT code gene...
 
In defense of GWT-RPC By Colin Alworth
In defense of GWT-RPC By Colin AlworthIn defense of GWT-RPC By Colin Alworth
In defense of GWT-RPC By Colin Alworth
 
DIY: Split GWT Applications using TURDUCKEN approach By Alberto Mancini
DIY: Split GWT Applications using TURDUCKEN approach By Alberto ManciniDIY: Split GWT Applications using TURDUCKEN approach By Alberto Mancini
DIY: Split GWT Applications using TURDUCKEN approach By Alberto Mancini
 
Unirex Lean tools By Dario Carotenuto
Unirex Lean tools By Dario CarotenutoUnirex Lean tools By Dario Carotenuto
Unirex Lean tools By Dario Carotenuto
 
The future of GWT 2.x - By Colin Alworth
The future of GWT 2.x - By Colin AlworthThe future of GWT 2.x - By Colin Alworth
The future of GWT 2.x - By Colin Alworth
 
UI Framework Development using GWT and HTML Canvas - By Iarosla Kobyliukh
UI Framework Development using GWT and HTML Canvas - By Iarosla KobyliukhUI Framework Development using GWT and HTML Canvas - By Iarosla Kobyliukh
UI Framework Development using GWT and HTML Canvas - By Iarosla Kobyliukh
 
Best Practices - By Lofi Dewanto
Best Practices - By Lofi DewantoBest Practices - By Lofi Dewanto
Best Practices - By Lofi Dewanto
 
GWT Development for Handheld Devices
GWT Development for Handheld DevicesGWT Development for Handheld Devices
GWT Development for Handheld Devices
 
GWT vs CSS3
GWT vs CSS3GWT vs CSS3
GWT vs CSS3
 
WebTram: una WebApp GWT per l'editing di dati cartografici e topologici di un...
WebTram: una WebApp GWT per l'editing di dati cartografici e topologici di un...WebTram: una WebApp GWT per l'editing di dati cartografici e topologici di un...
WebTram: una WebApp GWT per l'editing di dati cartografici e topologici di un...
 
GWT Web Socket and data serialization
GWT Web Socket and data serializationGWT Web Socket and data serialization
GWT Web Socket and data serialization
 
GWTcon 2014 - Apertura
GWTcon 2014 - AperturaGWTcon 2014 - Apertura
GWTcon 2014 - Apertura
 
GWT videocall: power-up your mobile & web app with WebRTC
GWT videocall:  power-up your mobile & web app with WebRTCGWT videocall:  power-up your mobile & web app with WebRTC
GWT videocall: power-up your mobile & web app with WebRTC
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

Web components with java by Haijian Wang