Google has just released (as a beta, of course) a
pretty comprehensive development environment and toolkit
for creating JavaScript/DHTML (or as they like to call it
these days Ajax
applications). What sets it apart from
most of the other frameworks (and there are so many now) is
that while it ultimately creates JavaScript applications,
a compiler generates the JavaScript from Java source code
(Google are not the first to come up with this idea, though,
there are already a few other projects using the same approach).
The immediate benefit here is that Java development tools are
much more mature and powerful than those available for JavaScript.
Being able to use Eclipse's debugger on client-side code is definitely
a Very Good Thing (tm).
Some random thoughts:
- No Mac version of the development kit (yet?), but it can be deployed on Safari, of course (along with IE, Opera, and Mozilla).
- While the runtime libraries are available under a Apache-style open-source license, the development tools (including the compiler) are only distributed in binary form (but still free of charge).
- Includes JavaScript libraries that emulate most of
java.langandjava.util - Some integration with Eclipse, but can also be used without it.
- Interesting way to embed native (JavaScript) code into Java programs.
- Comprehensive widget library, but apparently no drag-and-drop.
- I wonder if any of Google's own applications are built with GWT.
Client-side
Java code looks like this:public class ButtonExample implements EntryPoint { public void onModuleLoad() { // Make a new button that does something when you click it. Button b = new Button("Jump!", new ClickListener() { public void onClick(Widget sender) { Window.alert("How high?"); } }); // Add it to the root panel. RootPanel.get().add(b); } }- The compiled JavaScript code is completely illegible.
- The finished module gets included into an HTML page like so
<head> <meta name='gwt:module' content='com.example.cal.Calendar'> </head> <body> <script language="javascript" src="gwt.js"></script>



