1 / 20

Google Web Toolkit An Overview

Google Web Toolkit An Overview. By Shauvik Roy Choudhary. Agenda. GWT Basics User Interfaces Remote Procedure Calls (RPCs) JavaScript Native Interface (JSNI) The GWT Project. GWT Basics. What is GWT?. Java software development framework that makes writing AJAX applications easy

shona
Download Presentation

Google Web Toolkit An Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Google Web ToolkitAn Overview By Shauvik Roy Choudhary

  2. Agenda • GWT Basics • User Interfaces • Remote Procedure Calls (RPCs) • JavaScript Native Interface (JSNI) • The GWT Project

  3. GWT Basics

  4. What is GWT? • Java software development framework that makes writing AJAX applications easy • Develop and debug AJAX applications in the Java language • Java-to-JavaScript compiler and a special web browser • The compiler translates your Java application to browser-compliant JavaScript and HTML

  5. Two Modes of Running • Hosted mode • Application runs as Java bytecode within the Java Virtual Machine (JVM) • Used for Development because running in the JVM means you can take advantage of Java's debugging facilities • Web mode • Application runs as pure JavaScript and HTML, compiled with the Java-to-JavaScript compiler • End users will only see this mode

  6. Why use Java ? • Static type checking boosts productivity while reducing errors. • Common JavaScript errors (typos, type mismatches) are easily caught at compile time • Code prompting/completion • Automated Java refactoring • Java-based OO designs are easier to communicate and understand

  7. Why GWT ? • No need to • learn/use JavaScript language • learn/use DOM APIs • handle browser incompatibilities and quirks • handle forward/backward buttons • build commonly used Widgets • Leverage various tools of Java programming language for writing/debugging/testing • JUnit integration • Internationalization

  8. GWT Architecture

  9. Building User Interfaces

  10. Building User Interfaces • GWT User Interface Classes • Lots of GWT Widgets • Custom Composite Widgets • Event Handling • Listener interface model • Styling through CSS • Dynamically add/remove styles

  11. Remote Procedure Call (RPC)

  12. What is and Why GWT RPC? • Mechanism for interacting with the server by invoking a method • Makes it easy for the client and server to pass Java objects back and forth over HTTP • When used properly, RPCs give you the opportunity to move all of your UI logic to the client (leaving business logic on the server)

  13. RPC Plumbing Architecture

  14. Implementing a GWT RPC • Write two service interface's (client & server) • Synchronous interface • Asynchronous interface - has to pass async. callback object • Implement the service at the server side • Service class implements Service interface and extends RemoteServiceServlet class • Configure the service in the module configuration file • Needed for running the app in hosted mode • Make a call from the client

  15. JavaScript Native JavaScript Native Interface (JSNI)

  16. Why JSNI? • Sometimes it's very useful to mix handwritten JavaScript into your Java source code • Leverage various existing JavaScript toolkits • Dojo toolkits, Prototype, Rico, etc. • Should be used sparingly • JSNI code is less portable across browsers, more likely to leak memory, less amenable to Java tools, and hard for the compiler to optimize • Web equivalent of inline assembly code

  17. GWT Module Configuration

  18. Configuration Settings of a GWT Project (*.gwt.xml) • Inherited modules • An entry point class name • Source path entries • Public path entries • Deferred binding rules, including property providers and class generators

  19. Project Structure • Overlaid into Java Packages • Standard GWT Project layout • com/example/cal/ - The project root package contains module XML files • com/example/cal/client/ - Client-side source files and subpackages • com/example/cal/server/ - Server-side code and subpackages • com/example/cal/public/ - Static resources that can be served publicly

  20. References • Links • http://code.google.com/webtoolkit/ • http://www.onjava.com/pub/a/onjava/2006/05/31/working-with-google-web-toolkit.html • http://www.javapassion.com • Books • GWT Java Ajax Programming by Prabhakar Chaganti [Packt Publishing] • The Google Web Toolkit by Bruce Johnson and Joel Webber [Addison-Wesley]

More Related