SlideShare a Scribd company logo
ROCK GWT UI'S WITH
POLYMER ELEMENTS
1. Motivations
2. What are web components
3. What’s polymer
4. JsInterop
5. GWT consuming web components
6. introducing gwt-polymer-elements
7. Demo: full-stack gwt app using polymer and rest
services.
Agenda
Motivations
public void onScrollMove(ScrollMoveEvent event) {
int y = scrollPanel.getY();
if (header != null) {
if (y > header.getStateSwitchPosition() && headerState != PullState.PULLED) {
headerState = PullState.PULLED;
scrollPanel.setMinScrollY(0);
if (headerPullhandler != null)
headerPullhandler.onPullStateChanged(header, headerState);
} else {
if (y <= header.getStateSwitchPosition() && headerState != PullState.NORMAL) {
headerState = PullState.NORMAL;
scrollPanel.setMinScrollY(-header.getHeight());
if (headerPullhandler != null) headerPullhandler.onPullStateChanged(header, headerState);
}
}
header.onScroll(y);
}
int y_off = y;
if (footer != null && y < -footer.getHeight()) {
if (footerState == PullState.PULLED) {
y_off = y_off - footer.getHeight();
}
if (footerState == PullState.NORMAL) {
y_off = y_off + footer.getHeight();
}
if (y_off < (scrollPanel.getMaxScrollY() - footer.getStateSwitchPosition())
&& footerState != PullState.PULLED) {
footerState = PullState.PULLED;
scrollPanel.setMaxScrollY(scrollPanel.getMaxScrollY() - footer.getHeight());
if (footerPullhandler != null) {
footerPullhandler.onPullStateChanged(footer, footerState);
}
} else {
if (y_off > (scrollPanel.getMaxScrollY() - footer.getStateSwitchPosition()) && footerState != PullState.NORMAL) {
footerState = PullState.NORMAL;
scrollPanel.setMaxScrollY(scrollPanel.getMaxScrollY() + footer.getHeight());
if (footerPullhandler != null) {
footerPullhandler.onPullStateChanged(footer, footerState);
}
}
}
footer.onScroll(y_off - scrollPanel.getMaxScrollY());
}
}
Former Gwt Ui Development
- Verbose code
- Slow Debug & Test
- Difficult to share
- Ugly widgetset & no
mobile
Gwt + Web Components
- Standard specs.
- Ready to use elements
- Designers friendly
- Active Development
- Google
- Vaadin
gwt-classic vs gwt-polymer
6.500 LOC
http://gwt-mobilewebapp.appspot.com/
750 LOC
http://manolo.github.io/gwt-polymer-chat-app/demo/
Vaadin vision of Web Components
What are Web Components?
Problem: DOM unique tree
body { background-color: white; }
Solution: Shadow DOM
body { background-color: white; }
Encapsulation
Composition
Community
Web Components
State of the art
Browser support
Polyfill
Activity
What’s Polymer
Polymer
- Polymer makes it easier and faster to create anything
from a button to a complete application across
desktop, mobile, and beyond.
- Polymer ecosystem enables sharing UI components
between developers.
- JS estable API & polyfills
- Production ready reusable components
- Documentation system
- Let's GWT take advantage of the JS ecosystem to
create amazing UIs.
Catalog
- Iron Elements
- Paper Elements -> Material Design
- Neon Elements
- Platinum Elements
- Google Elements
- Vaadin Elements
JsInterop
1. Why JsInterop
a. Nowadays most GWT big projects interact with JS libs.
b. JSNI is a bad option for complex scenarios
2. JsInterop magic allows interact natively with Js. No JSNI anymore!
a. @JsType
b. @JsProperty @JsConstructor @JsMethod @JsFunction
c. Issues ? : experimental, does not extend JSO
3. Elemental-2.0 Interfaces for all HTML
a. Window, Document, Element, Style, Events, …
b. Issue: not available yet 2.8.x ?
4. Code generation
a. Let’s explore ways to create java boilerplate code
GWT JsInterop
GWT:
Consuming Web Components
1. Code Interfaces for Native Objects (Elemental-2)
2. Code methods for interacting with Web
Components Spec (create, import ...).
3. Define an annotated Java Interface per component,
event or behavior.
- Extends HTMLElement or Event
4. Optionally Wrap each Interface in a Widget class for
classic GWT apps.
Steps to consume WC in Java
Interfaces for native JS objects
@JsType
public interface HTMLElement extends Element {
}
@JsType
public interface Element extends Node {
@JsProperty String getInnerHTML();
@JsProperty DOMTokenList getClassList();
void setAttribute(String name, String value);
String getAttribute(String name);
void removeAttribute(String name);
}
@JsType
public interface Node extends EventTarget {
}
@JsType
public interface EventTarget {
void addEventListener(String type, EventListener listener);
}
Elemental-2 (gwt-2.8.1)
Utility methods
public class Polymer {
...
// Ensures that the tagName has been registered, otherwise injects
// the appropriate <import> tag in the document header
public static void ensureHTMLImport(String tagName) {
if ( !registered(tagName)) {
String href =
GWT.getModuleBaseForStaticFiles() + "bower_components/" + tagName + "/" + tagName + ".html";
Polymer.Base.importHref(href);
}
}
// Returns a new instance of the Element. It loads the webcomponent
// if not loaded yet.
public static <T> T createElement(String tagName) {
ensureHTMLImport(tagName);
return (T)Document.get().createElement(tagName);
}
...
}
The WebComponentElement.java
@JsType
public interface PaperButton extends HTMLElement {
@JsProperty PaperButton setLabel(String val);
@JsProperty String getLabel();
@JsProperty PaperButton setRaisedButton(boolean val);
@JsProperty boolean getRaisedButton();
@JsProperty PaperButton setIcon(String val);
@JsProperty String getIcon();
}
Consuming WC in Java (Element API)
// Create a new instance of PaperButton
PaperButtonElement button = Polymer.create(PaperButtonElement.TAG);
// Set some properties
button.icon("polymer");
button.label("Polymer");
button.raisedButton(false);
// Add event listeners
button.addEventListener("click", e -> {
});
// Append to the document
document.get().ppendChild(button);
The WebComponentWidget.java
public class PaperButton extends PolymerWidget {
//Default Constructor.
public PaperButton() {
this("");
}
//Constructor used by UIBinder
public PaperButton(String html) {
this(PaperButtonElement.TAG, html);
}
// Used when this element is extended by another.
protected PaperButton(String tag, String html) {
super(tag, html);
}
// Gets a handle to the Polymer object's underlying DOM element.
public PaperButtonElement getPolymerElement() {
return (PaperButtonElement) getElement();
}
public boolean isRaised() {
return getPolymerElement().isRaised();
}
}
public class PolymerWidget extends HTMLPanel {
public PolymerWidget(String tag, String src, String html) {
super(tag, html);
Polymer.ensureCustomElement(getElement(), src);
}
...
}
Consuming WC in Java (Widget API)
// Widgets allow consume WC using the GWT classic way.
PaperButton button = new PaperButton();
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
// ...
}
});
RootPanel.get().add(button);
Consuming WC in UIBinder
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:p='urn:import:com.vaadin.components.gwt.polymer.client.widget'>
<ui:style>
.container paper-button.colored {
background: #4285f4;
color: #fff;
}
</ui:style>
<g:HTMLPanel>
<!-- to use widgets we don’t need to import webcomponents by hand -->
<p:PaperButton toggle="" raised="" active="" addStyleNames="{style.colored}">active</p:PaperButton>
<!-- to use elements it’s mandatory to import webcomponents previously -->
<paper-button raised="" noink="">Click me</paper-button>
</g:HTMLPanel>
Introducing
Vaadin gwt-polymer
Two Projects
1. gwt-api-generator: It’s a code generator to produce
GWT wrappers for JS components
a. Scrapes source documentation
b. Right now polymer, but considering other sources.
c. Uses standard JS libraries to parse components.
- node.js, npm, bower, gulp
- hydrolysis parser + lodash.template
2. gwt-polymer-elements: a ready-to-use library for
using polymer elements in gwt (iron, paper, neon, vaadin)
a. Version 1.2.1.0.alpha1 (polymer 1.2.1)
b. Still under definition, expect package name changes, etc
gwt-polymer-elements
GWT
PaperButtonWidget
PolymerWidget
HTMLElement
PaperButtonElement
Polymer
paper-button.html
polimer.js
JsInterop
Vaadin
gwt-api-generator
1. Add java dependency to your project.
- vaadin-gwt-polymer-elements-1.2.1.0-alpha1.jar
2. Inherit it in your GWT module
- <inherits name="com.vaadin.polymer.Elements"/>
3. Use new Widgets or Elements as usual
- Document.get().createElement("PaperSliderElement")
4. Run mvn clean install to produce your package .jar
5. Everything is contained in the artefact
- polyfill, components, java code.
gwt-polymer-elements (bundle)
1. Install the generator
- sudo npm install gwt-api-generator -g
2. Install all the components you need for your project.
- bower install my-github-account/my-custom-polymer-element
3. Run the script to generate .java classes
- gwt-api-generator [--pom --groupId=xx --artifactId=xx]
4. Run mvn clean install to produce your gwt-package .jar
gwt-api-generator (custom elements)
gwt-api-generator goals
1. Very little code to maintain.
a. 1500 LOC / 100 KB
2. But it produces a lot of java code
a. 50000 LOC (paper & core elements)
3. It uses native JS parsers for JS code.
a. The same tools that polymer developers use
b. No GWT generators nor APT processors.
4. Standard tools for web developers.
a. They can deliver gwt libraries without knowing any java
Demo:
Building a full stack app
Demo Application
GWT
Polymer
PouchDB CouchDB
- Responsive
- Material Design
- Online/Offline
- Real Time
Demo Components
- GWT + Polymer
- CouchDB is a database that completely embraces
the web.
- Store your data with JSON documents
- Access your data via HTTP
- Serve pages directly
- PouchDB is database inspired by Apache CouchDB
that is designed to run well within the browser.
Demo
http://manolo.github.io/gwt-polymer-chat-app/demo/
https://github.com/manolo/gwt-polymer-chat-app
Thanks
+ManuelCarrascoMonino
manolo@vaadin.com
@dodotis

More Related Content

What's hot

Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
chris be
 
うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-
kyon mm
 
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
Fred Sauer
 
Building Rich Internet Applications Using Google Web Toolkit
Building Rich Internet Applications Using  Google Web ToolkitBuilding Rich Internet Applications Using  Google Web Toolkit
Building Rich Internet Applications Using Google Web Toolkitrajivmordani
 
Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02
rhemsolutions
 
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
Robert Keane
 
Wicket Next (1.4/1.5)
Wicket Next (1.4/1.5)Wicket Next (1.4/1.5)
Wicket Next (1.4/1.5)
jcompagner
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
Izzet Mustafaiev
 
Android presentation - Gradle ++
Android presentation - Gradle ++Android presentation - Gradle ++
Android presentation - Gradle ++
Javier de Pedro López
 
Gradle presentation
Gradle presentationGradle presentation
Gradle presentation
Oriol Jiménez
 
WPE WebKit for Android
WPE WebKit for AndroidWPE WebKit for Android
WPE WebKit for Android
Igalia
 
Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!
Stacy Devino
 
Dgeni documentation generator
Dgeni   documentation generatorDgeni   documentation generator
Dgeni documentation generator
Peter Darwin
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptHow to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScript
Katy Slemon
 
Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolved
Bhagwat Kumar
 
Dsc Charusat Learning React Part 1
Dsc Charusat Learning React Part 1 Dsc Charusat Learning React Part 1
Dsc Charusat Learning React Part 1
JainamMehta19
 
A friend in need - A JS indeed
A friend in need - A JS indeedA friend in need - A JS indeed
A friend in need - A JS indeed
Yonatan Levin
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android InfrastructureAlexey Buzdin
 
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
Katy Slemon
 
Angular 2 어디까지 왔을까
Angular 2 어디까지 왔을까Angular 2 어디까지 왔을까
Angular 2 어디까지 왔을까
장현 한
 

What's hot (20)

Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-
 
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
 
Building Rich Internet Applications Using Google Web Toolkit
Building Rich Internet Applications Using  Google Web ToolkitBuilding Rich Internet Applications Using  Google Web Toolkit
Building Rich Internet Applications Using Google Web Toolkit
 
Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02
 
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
 
Wicket Next (1.4/1.5)
Wicket Next (1.4/1.5)Wicket Next (1.4/1.5)
Wicket Next (1.4/1.5)
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Android presentation - Gradle ++
Android presentation - Gradle ++Android presentation - Gradle ++
Android presentation - Gradle ++
 
Gradle presentation
Gradle presentationGradle presentation
Gradle presentation
 
WPE WebKit for Android
WPE WebKit for AndroidWPE WebKit for Android
WPE WebKit for Android
 
Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!
 
Dgeni documentation generator
Dgeni   documentation generatorDgeni   documentation generator
Dgeni documentation generator
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptHow to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScript
 
Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolved
 
Dsc Charusat Learning React Part 1
Dsc Charusat Learning React Part 1 Dsc Charusat Learning React Part 1
Dsc Charusat Learning React Part 1
 
A friend in need - A JS indeed
A friend in need - A JS indeedA friend in need - A JS indeed
A friend in need - A JS indeed
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
 
Angular 2 어디까지 왔을까
Angular 2 어디까지 왔을까Angular 2 어디까지 왔을까
Angular 2 어디까지 왔을까
 

Similar to Rock GWT UI's with Polymer Elements

Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
Jeff Durta
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
IMC Institute
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
Software Park Thailand
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
Jeff Durta
 
GWT 2 Is Smarter Than You
GWT 2 Is Smarter Than YouGWT 2 Is Smarter Than You
GWT 2 Is Smarter Than You
Robert Cooper
 
Enterprise Guice 20090217 Bejug
Enterprise Guice 20090217 BejugEnterprise Guice 20090217 Bejug
Enterprise Guice 20090217 Bejugrobbiev
 
Modern frontend development with VueJs
Modern frontend development with VueJsModern frontend development with VueJs
Modern frontend development with VueJs
Tudor Barbu
 
Integrate Solr with real-time stream processing applications
Integrate Solr with real-time stream processing applicationsIntegrate Solr with real-time stream processing applications
Integrate Solr with real-time stream processing applications
lucenerevolution
 
Getting Started with React v16
Getting Started with React v16Getting Started with React v16
Getting Started with React v16
Benny Neugebauer
 
Developer Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for BeginnersDeveloper Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for Beginners
Jiaxuan Lin
 
react-slides.pptx
react-slides.pptxreact-slides.pptx
react-slides.pptx
DayNightGaMiNg
 
Fundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdfFundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdf
StephieJohn
 
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applications
Matteo Manchi
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e bigAndy Peterson
 
jRecruiter - The AJUG Job Posting Service
jRecruiter - The AJUG Job Posting ServicejRecruiter - The AJUG Job Posting Service
jRecruiter - The AJUG Job Posting Service
Gunnar Hillert
 
react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
DayNightGaMiNg
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
janet736113
 

Similar to Rock GWT UI's with Polymer Elements (20)

Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
GWT 2 Is Smarter Than You
GWT 2 Is Smarter Than YouGWT 2 Is Smarter Than You
GWT 2 Is Smarter Than You
 
Enterprise Guice 20090217 Bejug
Enterprise Guice 20090217 BejugEnterprise Guice 20090217 Bejug
Enterprise Guice 20090217 Bejug
 
Modern frontend development with VueJs
Modern frontend development with VueJsModern frontend development with VueJs
Modern frontend development with VueJs
 
Integrate Solr with real-time stream processing applications
Integrate Solr with real-time stream processing applicationsIntegrate Solr with real-time stream processing applications
Integrate Solr with real-time stream processing applications
 
Gwt
GwtGwt
Gwt
 
Getting Started with React v16
Getting Started with React v16Getting Started with React v16
Getting Started with React v16
 
Developer Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for BeginnersDeveloper Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for Beginners
 
react-slides.pptx
react-slides.pptxreact-slides.pptx
react-slides.pptx
 
Fundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdfFundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdf
 
Os Johnson
Os JohnsonOs Johnson
Os Johnson
 
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applications
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
jRecruiter - The AJUG Job Posting Service
jRecruiter - The AJUG Job Posting ServicejRecruiter - The AJUG Job Posting Service
jRecruiter - The AJUG Job Posting Service
 
react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
 
ReactJS (1)
ReactJS (1)ReactJS (1)
ReactJS (1)
 

More from Manuel Carrasco Moñino

The Java alternative to Javascript
The Java alternative to JavascriptThe Java alternative to Javascript
The Java alternative to Javascript
Manuel Carrasco Moñino
 
GWT and PWA
GWT and PWAGWT and PWA
Present and Future of GWT from a developer perspective
Present and Future of GWT from a developer perspectivePresent and Future of GWT from a developer perspective
Present and Future of GWT from a developer perspective
Manuel Carrasco Moñino
 
GWT Contributor Workshop
GWT Contributor WorkshopGWT Contributor Workshop
GWT Contributor Workshop
Manuel Carrasco Moñino
 
CRUD with Polymer 2.0
CRUD with Polymer 2.0CRUD with Polymer 2.0
CRUD with Polymer 2.0
Manuel Carrasco Moñino
 
Web Components and PWA
Web Components and PWAWeb Components and PWA
Web Components and PWA
Manuel Carrasco Moñino
 
Building Components for Business Apps
Building Components for Business AppsBuilding Components for Business Apps
Building Components for Business Apps
Manuel Carrasco Moñino
 
Web Components the best marriage for a PWA
Web Components the best marriage for a PWAWeb Components the best marriage for a PWA
Web Components the best marriage for a PWA
Manuel Carrasco Moñino
 
Vaadin codemotion 2014
Vaadin codemotion 2014Vaadin codemotion 2014
Vaadin codemotion 2014
Manuel Carrasco Moñino
 
GwtQuery the perfect companion for GWT, GWT.create 2013
GwtQuery the perfect companion for GWT,  GWT.create 2013GwtQuery the perfect companion for GWT,  GWT.create 2013
GwtQuery the perfect companion for GWT, GWT.create 2013
Manuel Carrasco Moñino
 
Rapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWTRapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWT
Manuel Carrasco Moñino
 
Aprendiendo GWT
Aprendiendo GWTAprendiendo GWT
Aprendiendo GWT
Manuel Carrasco Moñino
 
Apache James/Hupa & GWT
Apache James/Hupa & GWTApache James/Hupa & GWT
Apache James/Hupa & GWT
Manuel Carrasco Moñino
 
GWT: Why GWT, GQuery, and RequestFactory
GWT: Why GWT, GQuery, and RequestFactoryGWT: Why GWT, GQuery, and RequestFactory
GWT: Why GWT, GQuery, and RequestFactory
Manuel Carrasco Moñino
 
Gwt IV -mvp
Gwt IV -mvpGwt IV -mvp
Gwt III - Avanzado
Gwt III - AvanzadoGwt III - Avanzado
Gwt III - Avanzado
Manuel Carrasco Moñino
 
Gwt II - trabajando con gwt
Gwt II - trabajando con gwtGwt II - trabajando con gwt
Gwt II - trabajando con gwt
Manuel Carrasco Moñino
 
Gwt I - entendiendo gwt
Gwt I - entendiendo gwtGwt I - entendiendo gwt
Gwt I - entendiendo gwt
Manuel Carrasco Moñino
 

More from Manuel Carrasco Moñino (20)

The Java alternative to Javascript
The Java alternative to JavascriptThe Java alternative to Javascript
The Java alternative to Javascript
 
GWT and PWA
GWT and PWAGWT and PWA
GWT and PWA
 
Present and Future of GWT from a developer perspective
Present and Future of GWT from a developer perspectivePresent and Future of GWT from a developer perspective
Present and Future of GWT from a developer perspective
 
GWT Contributor Workshop
GWT Contributor WorkshopGWT Contributor Workshop
GWT Contributor Workshop
 
CRUD with Polymer 2.0
CRUD with Polymer 2.0CRUD with Polymer 2.0
CRUD with Polymer 2.0
 
Web Components and PWA
Web Components and PWAWeb Components and PWA
Web Components and PWA
 
Building Components for Business Apps
Building Components for Business AppsBuilding Components for Business Apps
Building Components for Business Apps
 
Web Components the best marriage for a PWA
Web Components the best marriage for a PWAWeb Components the best marriage for a PWA
Web Components the best marriage for a PWA
 
Vaadin codemotion 2014
Vaadin codemotion 2014Vaadin codemotion 2014
Vaadin codemotion 2014
 
GwtQuery the perfect companion for GWT, GWT.create 2013
GwtQuery the perfect companion for GWT,  GWT.create 2013GwtQuery the perfect companion for GWT,  GWT.create 2013
GwtQuery the perfect companion for GWT, GWT.create 2013
 
Rapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWTRapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWT
 
Aprendiendo GWT
Aprendiendo GWTAprendiendo GWT
Aprendiendo GWT
 
Apache James/Hupa & GWT
Apache James/Hupa & GWTApache James/Hupa & GWT
Apache James/Hupa & GWT
 
GWT: Why GWT, GQuery, and RequestFactory
GWT: Why GWT, GQuery, and RequestFactoryGWT: Why GWT, GQuery, and RequestFactory
GWT: Why GWT, GQuery, and RequestFactory
 
Mod security
Mod securityMod security
Mod security
 
Gwt IV -mvp
Gwt IV -mvpGwt IV -mvp
Gwt IV -mvp
 
Gwt III - Avanzado
Gwt III - AvanzadoGwt III - Avanzado
Gwt III - Avanzado
 
Gwt II - trabajando con gwt
Gwt II - trabajando con gwtGwt II - trabajando con gwt
Gwt II - trabajando con gwt
 
Gwt I - entendiendo gwt
Gwt I - entendiendo gwtGwt I - entendiendo gwt
Gwt I - entendiendo gwt
 
Seguridad en redes de computadores
Seguridad en redes de computadoresSeguridad en redes de computadores
Seguridad en redes de computadores
 

Recently uploaded

Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 

Recently uploaded (20)

Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 

Rock GWT UI's with Polymer Elements

  • 1. ROCK GWT UI'S WITH POLYMER ELEMENTS
  • 2. 1. Motivations 2. What are web components 3. What’s polymer 4. JsInterop 5. GWT consuming web components 6. introducing gwt-polymer-elements 7. Demo: full-stack gwt app using polymer and rest services. Agenda
  • 3. Motivations public void onScrollMove(ScrollMoveEvent event) { int y = scrollPanel.getY(); if (header != null) { if (y > header.getStateSwitchPosition() && headerState != PullState.PULLED) { headerState = PullState.PULLED; scrollPanel.setMinScrollY(0); if (headerPullhandler != null) headerPullhandler.onPullStateChanged(header, headerState); } else { if (y <= header.getStateSwitchPosition() && headerState != PullState.NORMAL) { headerState = PullState.NORMAL; scrollPanel.setMinScrollY(-header.getHeight()); if (headerPullhandler != null) headerPullhandler.onPullStateChanged(header, headerState); } } header.onScroll(y); } int y_off = y; if (footer != null && y < -footer.getHeight()) { if (footerState == PullState.PULLED) { y_off = y_off - footer.getHeight(); } if (footerState == PullState.NORMAL) { y_off = y_off + footer.getHeight(); } if (y_off < (scrollPanel.getMaxScrollY() - footer.getStateSwitchPosition()) && footerState != PullState.PULLED) { footerState = PullState.PULLED; scrollPanel.setMaxScrollY(scrollPanel.getMaxScrollY() - footer.getHeight()); if (footerPullhandler != null) { footerPullhandler.onPullStateChanged(footer, footerState); } } else { if (y_off > (scrollPanel.getMaxScrollY() - footer.getStateSwitchPosition()) && footerState != PullState.NORMAL) { footerState = PullState.NORMAL; scrollPanel.setMaxScrollY(scrollPanel.getMaxScrollY() + footer.getHeight()); if (footerPullhandler != null) { footerPullhandler.onPullStateChanged(footer, footerState); } } } footer.onScroll(y_off - scrollPanel.getMaxScrollY()); } } Former Gwt Ui Development - Verbose code - Slow Debug & Test - Difficult to share - Ugly widgetset & no mobile Gwt + Web Components - Standard specs. - Ready to use elements - Designers friendly - Active Development - Google - Vaadin
  • 4. gwt-classic vs gwt-polymer 6.500 LOC http://gwt-mobilewebapp.appspot.com/ 750 LOC http://manolo.github.io/gwt-polymer-chat-app/demo/
  • 5. Vaadin vision of Web Components
  • 6. What are Web Components?
  • 7. Problem: DOM unique tree body { background-color: white; }
  • 8. Solution: Shadow DOM body { background-color: white; }
  • 17. Polymer - Polymer makes it easier and faster to create anything from a button to a complete application across desktop, mobile, and beyond. - Polymer ecosystem enables sharing UI components between developers. - JS estable API & polyfills - Production ready reusable components - Documentation system - Let's GWT take advantage of the JS ecosystem to create amazing UIs.
  • 18. Catalog - Iron Elements - Paper Elements -> Material Design - Neon Elements - Platinum Elements - Google Elements - Vaadin Elements
  • 20. 1. Why JsInterop a. Nowadays most GWT big projects interact with JS libs. b. JSNI is a bad option for complex scenarios 2. JsInterop magic allows interact natively with Js. No JSNI anymore! a. @JsType b. @JsProperty @JsConstructor @JsMethod @JsFunction c. Issues ? : experimental, does not extend JSO 3. Elemental-2.0 Interfaces for all HTML a. Window, Document, Element, Style, Events, … b. Issue: not available yet 2.8.x ? 4. Code generation a. Let’s explore ways to create java boilerplate code GWT JsInterop
  • 22. 1. Code Interfaces for Native Objects (Elemental-2) 2. Code methods for interacting with Web Components Spec (create, import ...). 3. Define an annotated Java Interface per component, event or behavior. - Extends HTMLElement or Event 4. Optionally Wrap each Interface in a Widget class for classic GWT apps. Steps to consume WC in Java
  • 23. Interfaces for native JS objects @JsType public interface HTMLElement extends Element { } @JsType public interface Element extends Node { @JsProperty String getInnerHTML(); @JsProperty DOMTokenList getClassList(); void setAttribute(String name, String value); String getAttribute(String name); void removeAttribute(String name); } @JsType public interface Node extends EventTarget { } @JsType public interface EventTarget { void addEventListener(String type, EventListener listener); } Elemental-2 (gwt-2.8.1)
  • 24. Utility methods public class Polymer { ... // Ensures that the tagName has been registered, otherwise injects // the appropriate <import> tag in the document header public static void ensureHTMLImport(String tagName) { if ( !registered(tagName)) { String href = GWT.getModuleBaseForStaticFiles() + "bower_components/" + tagName + "/" + tagName + ".html"; Polymer.Base.importHref(href); } } // Returns a new instance of the Element. It loads the webcomponent // if not loaded yet. public static <T> T createElement(String tagName) { ensureHTMLImport(tagName); return (T)Document.get().createElement(tagName); } ... }
  • 25. The WebComponentElement.java @JsType public interface PaperButton extends HTMLElement { @JsProperty PaperButton setLabel(String val); @JsProperty String getLabel(); @JsProperty PaperButton setRaisedButton(boolean val); @JsProperty boolean getRaisedButton(); @JsProperty PaperButton setIcon(String val); @JsProperty String getIcon(); }
  • 26. Consuming WC in Java (Element API) // Create a new instance of PaperButton PaperButtonElement button = Polymer.create(PaperButtonElement.TAG); // Set some properties button.icon("polymer"); button.label("Polymer"); button.raisedButton(false); // Add event listeners button.addEventListener("click", e -> { }); // Append to the document document.get().ppendChild(button);
  • 27. The WebComponentWidget.java public class PaperButton extends PolymerWidget { //Default Constructor. public PaperButton() { this(""); } //Constructor used by UIBinder public PaperButton(String html) { this(PaperButtonElement.TAG, html); } // Used when this element is extended by another. protected PaperButton(String tag, String html) { super(tag, html); } // Gets a handle to the Polymer object's underlying DOM element. public PaperButtonElement getPolymerElement() { return (PaperButtonElement) getElement(); } public boolean isRaised() { return getPolymerElement().isRaised(); } } public class PolymerWidget extends HTMLPanel { public PolymerWidget(String tag, String src, String html) { super(tag, html); Polymer.ensureCustomElement(getElement(), src); } ... }
  • 28. Consuming WC in Java (Widget API) // Widgets allow consume WC using the GWT classic way. PaperButton button = new PaperButton(); button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { // ... } }); RootPanel.get().add(button);
  • 29. Consuming WC in UIBinder <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:p='urn:import:com.vaadin.components.gwt.polymer.client.widget'> <ui:style> .container paper-button.colored { background: #4285f4; color: #fff; } </ui:style> <g:HTMLPanel> <!-- to use widgets we don’t need to import webcomponents by hand --> <p:PaperButton toggle="" raised="" active="" addStyleNames="{style.colored}">active</p:PaperButton> <!-- to use elements it’s mandatory to import webcomponents previously --> <paper-button raised="" noink="">Click me</paper-button> </g:HTMLPanel>
  • 31. Two Projects 1. gwt-api-generator: It’s a code generator to produce GWT wrappers for JS components a. Scrapes source documentation b. Right now polymer, but considering other sources. c. Uses standard JS libraries to parse components. - node.js, npm, bower, gulp - hydrolysis parser + lodash.template 2. gwt-polymer-elements: a ready-to-use library for using polymer elements in gwt (iron, paper, neon, vaadin) a. Version 1.2.1.0.alpha1 (polymer 1.2.1) b. Still under definition, expect package name changes, etc
  • 33. 1. Add java dependency to your project. - vaadin-gwt-polymer-elements-1.2.1.0-alpha1.jar 2. Inherit it in your GWT module - <inherits name="com.vaadin.polymer.Elements"/> 3. Use new Widgets or Elements as usual - Document.get().createElement("PaperSliderElement") 4. Run mvn clean install to produce your package .jar 5. Everything is contained in the artefact - polyfill, components, java code. gwt-polymer-elements (bundle)
  • 34. 1. Install the generator - sudo npm install gwt-api-generator -g 2. Install all the components you need for your project. - bower install my-github-account/my-custom-polymer-element 3. Run the script to generate .java classes - gwt-api-generator [--pom --groupId=xx --artifactId=xx] 4. Run mvn clean install to produce your gwt-package .jar gwt-api-generator (custom elements)
  • 35. gwt-api-generator goals 1. Very little code to maintain. a. 1500 LOC / 100 KB 2. But it produces a lot of java code a. 50000 LOC (paper & core elements) 3. It uses native JS parsers for JS code. a. The same tools that polymer developers use b. No GWT generators nor APT processors. 4. Standard tools for web developers. a. They can deliver gwt libraries without knowing any java
  • 37. Demo Application GWT Polymer PouchDB CouchDB - Responsive - Material Design - Online/Offline - Real Time
  • 38. Demo Components - GWT + Polymer - CouchDB is a database that completely embraces the web. - Store your data with JSON documents - Access your data via HTTP - Serve pages directly - PouchDB is database inspired by Apache CouchDB that is designed to run well within the browser.