Open Source Tools Web Developers Front-End Java Ant
Open Source Tools Web Developers Front-End Java Ant
Google Web Toolkit (GWT) is an open source set of tools that allows web developers to create and maintain complex JavaScript front-end applications in Java. Other than a few native libraries, everything is Java source that can be built on any supported platform with the included GWT Ant build files. It is licensed under the Apache License version 2.0. GWT emphasizes reusable, efficient solutions to recurring Ajax challenges, namely asynchronous remote procedure calls, history management, bookmarking, internationalization and crossbrowser portability.It does not revolve only around user interface programming; it is a general set of tools for building any sort of high-performance client-side JavaScript functionality. In live presentations, the developers of GWT emphasize that "GWT is not its libraries" and that it only includes a library but is not fundamentally yet another AJAX library. This open-ended philosophy sometimes surprises developers new to GWT who expect it to provide an end-to-end "on rails" application framework.The GWT mission statement
Page 1
clarifies the philosophical breakdown of GWT's role versus the developer's role.
History
GWT version 1.0 RC 1 (build 1.0.20) was released on May 16, 2006. Google announced GWT at the JavaOne conference, 2006. Release history:
GWT GWT GWT GWT GWT GWT GWT GWT GWT GWT GWT GWT GWT GWT GWT
1.0 May 17, 2006 1.1 August 11, 2006 1.2 November 16, 2006 1.3 February 5, 2007 1.4 August 28, 2007 1.5 August 27, 2008 1.6 April 07, 2009 1.7 July 13, 2009 2.0 December 08, 2009 2.0.1 February 02, 2010 2.0.2 February 12, 2010 2.0.3 February 19, 2010 2.0.4 July 02, 2010 2.1.0 October 19, 2010 2.1.1 December 16, 2010
Page 2
GWT 2.2.0 February 11, 2011 GWT 2.3.0 May 3, 2011 (Latest)
GWT's role versus the developer's role. History is an example of such: although GWT manages history tokens as users click Back or Forward in the browser, it does not prescribe how to map history tokens to an application state.
Modes of GWT
Development mode (formerly Hosted mode): The application is run as Java bytecode within the Java Virtual Machine (JVM). This mode is typically used for development, supporting hot swapping of code and debugging. Web mode: The application is run as pure JavaScript and HTML, compiled from the Java source. This mode is typically used for deployment.Google provides a plugin for Eclipse which handles most GWT related tasks in the IDE, including creating projects, invoking the GWT compiler, creating GWT launch configurations, validations, syntax highlighting, etc.
Several open-source plugins are available for making GWT development easier with other IDEs.
Page 4
E.g., GWT4NB for NetBeans, Cypal Studio for GWT, Eclipse and JDeveloper etc. The Google Plugin for Eclipse handles most GWT relate tasks in the IDE, including creating projects, invoking the GWT compiler, creating GWT launch configurations, validations, syntax highlighting, etc.
Components
The major GWT components include: GWT Java-to-JavaScript Compiler Translates the Java programming language to the JavaScript programming language. GWT Development Mode Allows the developers to run and execute GWT applications in development mode (the app runs as Java in the JVM without compiling to JavaScript). Prior to 2.0, GWT hosted mode provided a special-purpose "hosted browser" to debug your GWT code. In 2.0, the web page being debugged is viewed within a regular browser. Development mode is supported
Page 5
through the use of a native-code plugin called the Google Web Toolkit Developer Plugin for many popular browsers.
JRE emulation library JavaScript implementations of the commonly used classes in the Java standard class library (such as most of the java.lang package classes and a subset of the java.util package classes). GWT Web UI class library A set of custom interfaces and classes for creating widgets.
Features
Dynamic and reusable UI components: programmers can use pre-designed classes to implement otherwise time-consuming dynamic behaviors, such as drag-and-drop or sophisticated visual tree structures. Simple RPC mechanism Browser history management Support for full-featured Java debugging
Page 6
GWT handles some cross-browser issues for the developer. JUnit integration Easy internationalization The developers can mix handwritten JavaScript in the Java source code using the JavaScript Native Interface (JSNI). Support for using Google APIs in GWT applications (initially, support for Google Gears) Open-source The developers can design and develop their application in a pure object-oriented fashion, since they're using Java (instead of JavaScript).C ommon JavaScript errors, such as typos and type mismatches, are caught at compile time. The JavaScript that the GWT compiler generates can be tailored to be either unobfuscated and easy to understand or obfuscated and smaller to download. A number of libraries are available for GWT, by Google and third parties. These extend GWT's features.
Page 7
Developing GWT
WRITE: The GWT SDK provides a set of core Java APIs and Widgets. These allow you to write AJAX applications in Java and then compile the source to highly optimized JavaScript that runs across all browsers, including mobile browsers for Android and the iPhone. Constructing AJAX applications in this manner is more productive thanks to a higher level of abstraction on top of common concepts like DOM manipulation and XHR communication. You aren't limited to precanned widgets either. Anything you can do with the browser's DOM and JavaScript can be done in GWT, including interacting with handwritten JavaScript. DEBUG: You can debug AJAX applications in your favorite IDE just like you would a desktop application, and in your favorite browser just like you would if you were coding JavaScript. The GWT developer plugin spans the gap between Java bytecode in the debugger and the browser's JavaScript.Thanks to the GWT developer plugin, there's no compiling of code to JavaScript to view it in the browser. You can
Page 8
use the same edit-refresh-view cycle you're used to with JavaScript, while at the same time inspect variables, set breakpoints, and utilize all the other debugger tools available to you with Java. And because GWT's development mode is now in the browser itself, you can use tools like Firebug and Inspector as you code in Java. OPTIMIZE: Google Web Toolkit contains two powerful tools for creating optimized web applications. The GWT compiler performs comprehensive optimizations across your codebase in-lining methods, removing dead code, optimizing strings, and more. By setting split-points in the code, it can also segment your download into multiple JavaScript fragments, splitting up large applications for faster startup time.Performance bottlenecks aren't limited to JavaScript. Browser layout and CSS often behave in strange ways that are hard to diagnose. Speed Tracer is a new Chrome Extension in Google Web Toolkit that enables you to diagnose performance problems in the browser. RUN:When you're ready to deploy, GWT
Page 9
compiles your Java source code into optimized, stand-alone JavaScript files that automatically run on all major browsers, as well as mobile browsers for Android and the iPhone.
Available Widgets
As of version 2.0.3 (February 2010), GWT offers several widgets: Button PushButton RadioButton CheckBox DatePicker ToggleButton TextBox PasswordTextBox TextArea Hyperlink ListBox MenuBar Tree SuggestBox (auto-complete)
Page 10
Available Panels
PopupPanel StackPanel StackLayoutPanel HorizontalPanel VerticalPanel FlowPanel VerticalSplitPanel HorizontalSplitPanel SplitLayoutPanel DockLayoutPanel TabPanel TabLayoutPanel DisclosurePanel
The Google Web Toolkit Incubator has additional widgets undergoing development (and likely to be released in future versions of GWT).
Page 11
Many common widgets not found in the GWT have been implemented in third-party libraries, such as Ext GWT, GWT Component Library, GWT-Ext, GWT Widget Library, GWTiger, Rocket GWT, Dojo, SmartGWT etc.
GWT 2.0
On Dec 08, 2009 Google launched Google Web Toolkit 2.0 with Speed Tracer. Version 2.0 of GWT offers a number of new features, including:
In-Browser Development Mode (formerly known as Out Of Process Hosted Mode, OOPHM): prior to version 2.0, hosted mode used to embed a modified browser to allow running the bytecode version of the application during development. With version 2.0, hosted mode, renamed "development mode", allows using any (supported) browser to view the page being debugged, through the use of a browser plugin. The plugin communicates with the development mode shell using TCP/IP, which allows cross platform debugging (for
Page 12
example, debugging in Internet Explorer on Windows from a development mode shell running on a Linux machine). Code splitting: with the developer providing "split points" in the source code, the GWT compiler will be able to split the JavaScript code into several small chunks instead of one big download. This will lead to reduced application startup time as the size of the initial download is decreased. Declarative User Interface: using an XML format, the new feature known as UiBinder allows the creation of user interfaces through declaration rather than code. This allows clean separation of UI construction and behavior implementation. Resource bundling: the ClientBundle interface will allow resources of any nature (images, CSS, text, binary) to be bundled together and transferred in one download, resulting in fewer round-trips to the server and hence lower application latency.
Since the new development mode removed most platform-specific code, the new version will be distributed as a unique archive, instead of one per
Page 13
Other Frameworks
Ext GWT, Rich Internet Application framework for Google Web Toolkit SmartGWT, a GWT framework with a comprehensive widget library Vaadin, a similar framework, which is based on GWT GWTEventService, a high-level GWT comet/server push framework Pyjamas (software) Pyjamas, a port of GWT to Python RubyJS, a port of GWT to Ruby Microsoft Live Labs Volta, a similar approach from Microsoft Wt - Web toolkit, a C++ Web tool kit Morfik, a development tool that compiles C#, Pascal and Basic code to Javascript. Script#, a development tool that compiles C# code to Javascript. SharpKit, a development tool that compiles C# code to Javascript.
Page 14
Php Rpc, Package to automatic rpc callback to php with code generator. Really simple to use, inspired by GWTcallback and extends by gwtphprpc.Use custom object, throws, primitive type, arrays created in Java inside php.
Conclusion
Google Web Toolkit (GWT) is a development toolkit for building and optimizing complex browser-based applications. GWT is used by many products at Google, including Google AdWords and Orkut. It's open source, completely free, and used by thousands of developers around the world. Using GWT, developers can rapidly develop and debug AJAX applications in the Java language using the Java development tools of their choice. When the application is deployed, the GWT crosscompiler translates the Java application to standalone JavaScript files that are optionally obfuscated and deeply optimized. GWT does not revolve only around user interface programming; it is a general set of tools for
Page 15
building any sort of high-performance client-side JavaScript functionality. In live presentations, the developers of GWT emphasize that "GWT is not its libraries" and that it only includes a library but is not fundamentally yet another AJAX library. This open-ended philosophy sometimes surprises developers new to GWT who expect it to provide an end-to-end "on rails" application framework. Indeed, many key architectural decisions are left completely to the developer. The GWT mission statement clarifies the philosophical breakdown of GWT's role versus the developer's role.
Chaganti, Prabhakar. Google Web Toolkit: GWT Java Ajax Programming Geary, David. Google Web Toolkit Solutions: More Cool & Useful Stuff. Prentice Hall Hanson, Robert; Adam Tacy. GWT in Action: Easy Ajax with the Google Web Toolkit. Manning
Page 17