From Wikipedia, the free encyclopedia
Google Web Toolkit (GWT /ˈɡwɪt/)) 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.[1]
GWT emphasizes reusable, efficient solutions to recurring
Ajax
challenges, namely asynchronous remote procedure
calls, history management, bookmarking, Internationalization and cross-browser portability.
History
GWT version 1.0 RC 1 (build 1.0.20) was released on May 16,
2006[2]. Google
announced GWT at the JavaOne
conference, 2006.[3]
Release history:
- GWT 1.0 May 17, 2006
- GWT 1.1 August 11, 2006
- GWT 1.2 November 16, 2006
- GWT 1.3 February 5, 2007
- GWT 1.4 August 28, 2007
- GWT 1.5 August 27, 2008
- GWT 1.6 April 07, 2009
- GWT 1.7 July 13, 2009
- GWT 2.0 December 08, 2009
Development
with GWT
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
cross-compiler 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 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. 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.
GWT applications can be run in two modes:
- 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. E.g., GWT4NB for NetBeans, Cypal Studio for GWT, Eclipse
and JDeveloper
etc.
Components
The major GWT components include:
- GWT Java-to-JavaScript Compiler
- Translates the Java programming language to the JavaScript
programming language.
- GWT Hosted Web Browser
- Allows the developers to run and execute GWT applications in
hosted mode (the app runs as Java in the JVM without compiling to
JavaScript). It is commonly used for debugging.
- 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.[4]
- Simple RPC mechanism
- Browser history management
- Support for full-featured Java debugging[3]
- GWT handles all cross-browser issues for the developer.[3]
- 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).[4]
Common 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.[4]
- A number of libraries are available for GWT, by Google and
third parties. These extend GWT's features.[4]
Available
widgets
As of version 1.4 (August 2007), GWT offers several widgets:[5]
- HTML primitives (Button, Radio Button, Checkbox, TextBox,
PasswordTextBox, TextArea, Hyperlink, ListBox, Table etc.)
- PushButton, ToggleButton
- MenuBar
- Tree
- TabBar
- DialogBox
- Panels (PopupPanel, StackPanel, HorizontalPanel, VerticalPanel,
FlowPanel, VerticalSplitPanel, HorizontalSplitPanel, DockPanel,
TabPanel, DisclosurePanel)
- RichTextArea
- SuggestBox (auto-complete)
The Google Web Toolkit
Incubator has additional widgets undergoing development (and
likely to be released in future versions of GWT).
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.[6][7]
Version 2.0 of GWT will offer a number of new features[8],
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 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 supported platform as was the case with previous
versions.
See also
References
Bibliography
- Dewsbury, Ryan (December 15, 2007).
Google Web Toolkit
Applications. Prentice Hall. pp. 608. ISBN
978-0321501967. http://www.informit.com/store/product.aspx?isbn=0321501969.
- Chaganti, Prabhakar (February 15,
2007). Google Web Toolkit: GWT
Java Ajax Programming. Packt Publishing. pp. 248. ISBN
978-1847191007. http://www.packtpub.com/google-web-toolkit-GWT-Java-AJAX/book.
- Geary, David (November 17, 2007).
Google Web Toolkit
Solutions: More Cool & Useful Stuff. Prentice Hall.
pp. 408. ISBN
978-0132344814. http://www.informit.com/store/product.aspx?isbn=0132344815.
- Hanson, Robert; Adam Tacy (June 5,
2007). GWT in Action: Easy Ajax
with the Google Web Toolkit. Manning. pp. 632. ISBN
978-1933988238. http://www.manning.com/hanson/.
- Cooper, Robert; Charlie Collins
(May 12, 2008). GWT in Practice.
Manning. pp. 376. ISBN
978-1933988290. http://www.manning.com/cooper/.
External
links
| List of Widget
toolkits |
|
| Low-level |
|
|
| High-level |
|
|
|
|
|
|
|
|
|
On Microsoft
Windows
|
|
|
|
|
|
|
|
Cross-platform,
by language
|
|
Flash
|
|
|
|
XML, AJAX
or SVG
|
|
|
|
Java
|
|
|
|
C or C++
|
|
|
|
Pascal
|
|
|
|
Objective C
|
|
|
|
|