SlideShare a Scribd company logo
The google web toolkit Stefaan Ternier
Classic web application model (synchronous)
Ajax web application model (asynchronous)
Asynchronous JavaScript and XML (AJAX) Server - side Client – side Javascript -> Firefox/IE <html> [...] <script type=&quot;text/javascript&quot;> [...] xmlhttp.open(&quot;POST&quot;, url, true); xmlhttp.onreadystatechange = function(func) { if (xmlhttp.readyState == 4) { [...] } } xmlhttp.setRequestHeader('MessageType', 'CALL'); xmlhttp.setRequestHeader('Content-Type', 'text/xml'); </script> <body>[...]</body> </html> JAVA -> Tomcat package com.mycompany.server; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.mycompany.client.MyAddService; public class MyAddServiceImpl extends  RemoteServiceServlet implements MyAddService{ public int add(int a, int b) { return a + b; } }
Asynchronous JavaScript and XML (AJAX) Server - side Client – side Javascript JAVA + no page transition, no blocking No IDE Debugging is difficult weakly typed + eclipse: debugging, easy development good IDE’s Debugging is easy strongly typed
Google Web Toolkit (GWT) @ deployment time @ development time <html> [...] <script type=&quot;text/javascript&quot;> [...] xmlhttp.open(&quot;POST&quot;, url, true); xmlhttp.onreadystatechange = function(func) { if (xmlhttp.readyState == 4) { [...] } } xmlhttp.setRequestHeader('MessageType', 'CALL'); xmlhttp.setRequestHeader('Content-Type', 'text/xml'); </script> <body>[...]</body> </html> JAVA/eclipse javascript Hosted mode JVM IDE Compile to  JAVA bytecode Compile to Javascript
GWT: create project in eclipse projectCreator -eclipse MySumationProject  applicationCreator -eclipse MySumationProject com.mycompany.client.MySumApplication Import project into eclipse
GWT: Build your first app GWT JAVA Code HTML Host page
GWT: Build your first app final  Label resultaatLabel =  new  Label(); final  TextBox aBox=  new  TextBox(); final  TextBox bBox=  new  TextBox(); final  Button button =  new  Button(&quot;Click me&quot;); button.addClickListener( new  ClickListener() { public   void  onClick(Widget sender) { resultaatLabel.setText(&quot;hier komt het resultaat&quot;); } }); RootPanel. get (&quot;inputboxa&quot;).add(aBox); RootPanel. get (&quot;inputboxb&quot;).add(bBox); RootPanel. get (&quot;resultaat&quot;).add(resultaatLabel); RootPanel. get (&quot;bereken&quot;).add(button); GWT Widgets Bind to HTML page
GWT: project structure Client-side source files and subpackages com/mycompany/client/ The project root package contains module XML files  com/mycompany/ Server-side code and subpackages  com/mycompany/server/ Static resources that can be served publicly com/mycompany/public/  Purpose Package
GWT: module XML files Defines configuration of GWT modules Source entry point HTML page entry Extension: .gwt.xml Example: <module>   <!-- Inherit the core Web Toolkit stuff.  -->   <inherits name='com.google.gwt.user.User'/>   <!-- Specify the app entry point class.  -->   <entry-point class='com.mycompany.client.MyApplication'/> </module>
GWT: module example com/mycompany/public/MyApplication.html com/mycompany/MyApplication.gwt.xml com/mycompany/client/MyApplication.java
GWT Widgets SuggestBox TabBar Panel More…  http:// code.google.com / webtoolkit / documentation / com.google.gwt.doc.DeveloperGuide.UserInterface.html
 
Google Maps – import api
Google Maps public void onModuleLoad() { GMap2Widget mapWidget = new GMap2Widget(&quot;300&quot;, &quot;400&quot;); final GMap2 gmaps = mapWidget.getGmap();  RootPanel.get(&quot;slot1&quot;).add(mapWidget); } <module> <inherits name='com.google.gwt.user.User'/> <inherits name='com.mapitz.gwt.googleMaps.GoogleMaps' /> <entry-point class='com.mycompany.client.MyMapsApplication'/>  </module> Module XML JAVA code
Google Maps - Geocoder Convert addresses to latitude/longitude pairs
Google Maps - Geocoder Convert addresses to latitude/longitude pairs
RPC plumbing diagram
RPC plumbing diagram package com.mycompany.client; import com.google.gwt.user.client.rpc.RemoteService; public interface MyAddService extends RemoteService { public int add(int a, int b); }
RPC plumbing diagram package com.mycompany.server; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.mycompany.client.MyAddService; public class MyAddServiceImpl  extends RemoteServiceServlet implements MyAddService{ public int add(int a, int b) { int z = a + b; return z; } }
RPC plumbing diagram package com.mycompany.client; import com.google.gwt.user.client.rpc.AsyncCallback; public interface MyAddServiceAsync { public void add(int a, int b, AsyncCallback callback); }
Deploy service Tomcat -> add Servlet Hosted mode -> modify module XML <module> <inherits name='com.google.gwt.user.User'/> <entry-point class='com.mycompany.client.MyApplication'/> <servlet path=&quot;/addService&quot;    class=&quot;com.mycompany.server.MyAddServiceImpl“/> </module>
Actually making a call button.addClickListener( new ClickListener() { public void onClick(Widget sender) { MyAddServiceAsync addService = (MyAddServiceAsync) GWT.create(MyAddService.class);   ServiceDefTarget endpoint = (ServiceDefTarget) addService;   String moduleRelativeURL = GWT.getModuleBaseURL() + &quot;addService“;   endpoint.setServiceEntryPoint(moduleRelativeURL); AsyncCallback callback = new AsyncCallback(){ public void onSuccess(Object result){   resultaatLabel.setText(result.toString());   } public void onFailure(Throwable caught) {   resultaatLabel.setText(caught.getMessage());   } }; addService.add(Integer.parseInt(aBox.getText()),      Integer.parseInt(bBox.getText()),      callback); }  } );
References Google Web Toolkit, http://code.google.com/webtoolkit/ W3 Schools,  http://www.w3schools.com/ Apache axis,  http://ws.apache.org/axis/ GWT – Google Maps API http://sourceforge.net/projects/gwt/ http://www.adaptivepath.com/ideas/essays/archives/000385.php
Computerklas /localhost/packages/gwt/gwt-linux-1.4.60 projectCreator applicationCreator /localhost/packages/gwt/googlemaps Lib javadoc_2_2_1

More Related Content

PPT
Building real-time collaborative apps with Ajax.org Platform
TXT
Httpsitesgooglecomsitekaratasajtov
PDF
Angular 2 binding
PDF
Angular 2.0 - What to expect
PDF
Angular Pipes Workshop
DOCX
C# 6.0
PDF
Zeppelin Helium: Spell
PDF
Angular 2 introduction
Building real-time collaborative apps with Ajax.org Platform
Httpsitesgooglecomsitekaratasajtov
Angular 2 binding
Angular 2.0 - What to expect
Angular Pipes Workshop
C# 6.0
Zeppelin Helium: Spell
Angular 2 introduction

What's hot (18)

PPT
Spring AOP @ DevClub.eu
PPTX
Grails Plugin
PDF
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
PPT
Week32
 
ODP
Zarafa SummerCamp 2012 - Basic Introduction WebApp plugin development
PDF
Print function in PHP
PDF
GraphQL in Symfony
DOCX
Client server part 12
PDF
Ngrx meta reducers
PDF
Simple Markdown with Ecto and Protocols
PPTX
Net conf BG xamarin lecture
PDF
Introduction To Angular's reactive forms
PPTX
Angular2 + rxjs
PDF
Styling recipes for Angular components
PDF
Monoids, Store, and Dependency Injection - Abstractions for Spark Streaming Jobs
PDF
Webdesing lab part-b__java_script_
PDF
UI Framework Development using GWT and HTML Canvas - By Iarosla Kobyliukh
PPTX
Sharing Data Between Angular Components
Spring AOP @ DevClub.eu
Grails Plugin
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Week32
 
Zarafa SummerCamp 2012 - Basic Introduction WebApp plugin development
Print function in PHP
GraphQL in Symfony
Client server part 12
Ngrx meta reducers
Simple Markdown with Ecto and Protocols
Net conf BG xamarin lecture
Introduction To Angular's reactive forms
Angular2 + rxjs
Styling recipes for Angular components
Monoids, Store, and Dependency Injection - Abstractions for Spark Streaming Jobs
Webdesing lab part-b__java_script_
UI Framework Development using GWT and HTML Canvas - By Iarosla Kobyliukh
Sharing Data Between Angular Components
Ad

Similar to Gooogle Web Toolkit (20)

ODP
Interoperable Web Services with JAX-WS
ODP
ActiveWeb: Chicago Java User Group Presentation
PPT
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
PPT
Ajax ppt
PPT
Ajax Ppt
PPT
GWT Training - Session 3/3
PPTX
Yahoo Query Language: Select * from Internet
PPT
Gwt RPC
PPT
JavaScript
PPT
Google Web Toolkit
PPT
Google Web Toolkits
PPT
Aug Xml Net Forum Dynamics Integration
PPTX
Introduction to AJAX and DWR
PPTX
Client-side JavaScript Vulnerabilities
PPT
PPT
PPT
Google Web Toolkits
PPT
Javascript: Ajax & DOM Manipulation v1.2
ODP
Forms With Ajax And Advanced Plugins
PPT
AJAX Workshop Notes
Interoperable Web Services with JAX-WS
ActiveWeb: Chicago Java User Group Presentation
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Ajax ppt
Ajax Ppt
GWT Training - Session 3/3
Yahoo Query Language: Select * from Internet
Gwt RPC
JavaScript
Google Web Toolkit
Google Web Toolkits
Aug Xml Net Forum Dynamics Integration
Introduction to AJAX and DWR
Client-side JavaScript Vulnerabilities
Google Web Toolkits
Javascript: Ajax & DOM Manipulation v1.2
Forms With Ajax And Advanced Plugins
AJAX Workshop Notes
Ad

More from Sanjeev Kulkarni (7)

PDF
Orcale Presentation
PDF
Jfreereport and Charts an essential Report generation tool for Java Developers
PDF
H2 Database New generation embeded database
PPT
Only In India
PPS
The Woman
PPT
Sweet Girl...
PPT
What is meant by Love???
Orcale Presentation
Jfreereport and Charts an essential Report generation tool for Java Developers
H2 Database New generation embeded database
Only In India
The Woman
Sweet Girl...
What is meant by Love???

Recently uploaded (20)

PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Empathic Computing: Creating Shared Understanding
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Cloud computing and distributed systems.
PDF
Modernizing your data center with Dell and AMD
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Mobile App Security Testing_ A Comprehensive Guide.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Per capita expenditure prediction using model stacking based on satellite ima...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Monthly Chronicles - July 2025
20250228 LYD VKU AI Blended-Learning.pptx
MYSQL Presentation for SQL database connectivity
Network Security Unit 5.pdf for BCA BBA.
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Big Data Technologies - Introduction.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Dropbox Q2 2025 Financial Results & Investor Presentation
Empathic Computing: Creating Shared Understanding
“AI and Expert System Decision Support & Business Intelligence Systems”
Cloud computing and distributed systems.
Modernizing your data center with Dell and AMD
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Understanding_Digital_Forensics_Presentation.pptx

Gooogle Web Toolkit

  • 1. The google web toolkit Stefaan Ternier
  • 2. Classic web application model (synchronous)
  • 3. Ajax web application model (asynchronous)
  • 4. Asynchronous JavaScript and XML (AJAX) Server - side Client – side Javascript -> Firefox/IE <html> [...] <script type=&quot;text/javascript&quot;> [...] xmlhttp.open(&quot;POST&quot;, url, true); xmlhttp.onreadystatechange = function(func) { if (xmlhttp.readyState == 4) { [...] } } xmlhttp.setRequestHeader('MessageType', 'CALL'); xmlhttp.setRequestHeader('Content-Type', 'text/xml'); </script> <body>[...]</body> </html> JAVA -> Tomcat package com.mycompany.server; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.mycompany.client.MyAddService; public class MyAddServiceImpl extends RemoteServiceServlet implements MyAddService{ public int add(int a, int b) { return a + b; } }
  • 5. Asynchronous JavaScript and XML (AJAX) Server - side Client – side Javascript JAVA + no page transition, no blocking No IDE Debugging is difficult weakly typed + eclipse: debugging, easy development good IDE’s Debugging is easy strongly typed
  • 6. Google Web Toolkit (GWT) @ deployment time @ development time <html> [...] <script type=&quot;text/javascript&quot;> [...] xmlhttp.open(&quot;POST&quot;, url, true); xmlhttp.onreadystatechange = function(func) { if (xmlhttp.readyState == 4) { [...] } } xmlhttp.setRequestHeader('MessageType', 'CALL'); xmlhttp.setRequestHeader('Content-Type', 'text/xml'); </script> <body>[...]</body> </html> JAVA/eclipse javascript Hosted mode JVM IDE Compile to JAVA bytecode Compile to Javascript
  • 7. GWT: create project in eclipse projectCreator -eclipse MySumationProject applicationCreator -eclipse MySumationProject com.mycompany.client.MySumApplication Import project into eclipse
  • 8. GWT: Build your first app GWT JAVA Code HTML Host page
  • 9. GWT: Build your first app final Label resultaatLabel = new Label(); final TextBox aBox= new TextBox(); final TextBox bBox= new TextBox(); final Button button = new Button(&quot;Click me&quot;); button.addClickListener( new ClickListener() { public void onClick(Widget sender) { resultaatLabel.setText(&quot;hier komt het resultaat&quot;); } }); RootPanel. get (&quot;inputboxa&quot;).add(aBox); RootPanel. get (&quot;inputboxb&quot;).add(bBox); RootPanel. get (&quot;resultaat&quot;).add(resultaatLabel); RootPanel. get (&quot;bereken&quot;).add(button); GWT Widgets Bind to HTML page
  • 10. GWT: project structure Client-side source files and subpackages com/mycompany/client/ The project root package contains module XML files com/mycompany/ Server-side code and subpackages com/mycompany/server/ Static resources that can be served publicly com/mycompany/public/ Purpose Package
  • 11. GWT: module XML files Defines configuration of GWT modules Source entry point HTML page entry Extension: .gwt.xml Example: <module> <!-- Inherit the core Web Toolkit stuff. --> <inherits name='com.google.gwt.user.User'/> <!-- Specify the app entry point class. --> <entry-point class='com.mycompany.client.MyApplication'/> </module>
  • 12. GWT: module example com/mycompany/public/MyApplication.html com/mycompany/MyApplication.gwt.xml com/mycompany/client/MyApplication.java
  • 13. GWT Widgets SuggestBox TabBar Panel More… http:// code.google.com / webtoolkit / documentation / com.google.gwt.doc.DeveloperGuide.UserInterface.html
  • 14.  
  • 15. Google Maps – import api
  • 16. Google Maps public void onModuleLoad() { GMap2Widget mapWidget = new GMap2Widget(&quot;300&quot;, &quot;400&quot;); final GMap2 gmaps = mapWidget.getGmap(); RootPanel.get(&quot;slot1&quot;).add(mapWidget); } <module> <inherits name='com.google.gwt.user.User'/> <inherits name='com.mapitz.gwt.googleMaps.GoogleMaps' /> <entry-point class='com.mycompany.client.MyMapsApplication'/> </module> Module XML JAVA code
  • 17. Google Maps - Geocoder Convert addresses to latitude/longitude pairs
  • 18. Google Maps - Geocoder Convert addresses to latitude/longitude pairs
  • 20. RPC plumbing diagram package com.mycompany.client; import com.google.gwt.user.client.rpc.RemoteService; public interface MyAddService extends RemoteService { public int add(int a, int b); }
  • 21. RPC plumbing diagram package com.mycompany.server; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.mycompany.client.MyAddService; public class MyAddServiceImpl extends RemoteServiceServlet implements MyAddService{ public int add(int a, int b) { int z = a + b; return z; } }
  • 22. RPC plumbing diagram package com.mycompany.client; import com.google.gwt.user.client.rpc.AsyncCallback; public interface MyAddServiceAsync { public void add(int a, int b, AsyncCallback callback); }
  • 23. Deploy service Tomcat -> add Servlet Hosted mode -> modify module XML <module> <inherits name='com.google.gwt.user.User'/> <entry-point class='com.mycompany.client.MyApplication'/> <servlet path=&quot;/addService&quot; class=&quot;com.mycompany.server.MyAddServiceImpl“/> </module>
  • 24. Actually making a call button.addClickListener( new ClickListener() { public void onClick(Widget sender) { MyAddServiceAsync addService = (MyAddServiceAsync) GWT.create(MyAddService.class); ServiceDefTarget endpoint = (ServiceDefTarget) addService; String moduleRelativeURL = GWT.getModuleBaseURL() + &quot;addService“; endpoint.setServiceEntryPoint(moduleRelativeURL); AsyncCallback callback = new AsyncCallback(){ public void onSuccess(Object result){ resultaatLabel.setText(result.toString()); } public void onFailure(Throwable caught) { resultaatLabel.setText(caught.getMessage()); } }; addService.add(Integer.parseInt(aBox.getText()), Integer.parseInt(bBox.getText()), callback); } } );
  • 25. References Google Web Toolkit, http://code.google.com/webtoolkit/ W3 Schools, http://www.w3schools.com/ Apache axis, http://ws.apache.org/axis/ GWT – Google Maps API http://sourceforge.net/projects/gwt/ http://www.adaptivepath.com/ideas/essays/archives/000385.php
  • 26. Computerklas /localhost/packages/gwt/gwt-linux-1.4.60 projectCreator applicationCreator /localhost/packages/gwt/googlemaps Lib javadoc_2_2_1