Java Reference
In-Depth Information
without compiling it into JavaScript. The JVM is merely executing your application
code as compiled bytecode and piping the results into the hosted mode browser.
One of the nice features of hosted mode is that you don't have to restart the
hosted mode browser each time you make modifications to your source code. You
can simply click the Refresh button on the hosted-mode browser, and your code is
recompiled and loaded into that browser. However, if you make configuration or
server-side code changes, you will need to click the Restart Server button to cycle
Jetty and reload your application.
Hosted mode is the “magic” that makes GWT unique. By running your code as Java
bytecode instead of JavaScript, you can take advantage of Eclipse's debugging
capabilities to debug your server-side Java code and your client-side GWT (JavaScript)
code. With GWT, gone are the days of writing debug comments to the browser window,
displaying pop-ups for breakpoint messages, and, for that matter, using Firebug. With
GWT and Eclipse, you can do the code-test-debug steps in one integrated
environment, which dramatically increases productivity and reduces the number of
runtime, client-side errors. In hosted mode you can use the Eclipse debugger to catch
exceptions that normally occur in the browser, presenting users with ugly errors.
Web Mode
At some point in your development cycle you will want to start testing your
application with your target browsers to check the performance and see how your
application looks, feels, and operates on different browsers. Click the
Compile/Browse button on the hosted mode browser toolbar and GWT will compile
your source code into optimized JavaScript. You can then test your application, as it
will be deployed on any browser you'd like by using the same URL as in hosted mode.
Developing Your Application
Now you'll start designing your application's UI. If you have experience developing
Java applications using Swing, GWT will be an easy transition for you. Even if you've
never touched Swing, you should be able to jump in and start laying out applications
with a minimal learning curve.
GWT was designed for the front end and provides a rich set of UI components for
implementing your design specifications. A well-defined look and feel is very important
as you begin this stage. It really helps if you have a clearly defined UI, as retooling visual
components down the road can become quite tedious. As you can see in Figure 5-4,
you will be incorporating a variety of widgets in your application, but almost everything
is built upon panels. GWT provides a wide range of panels (see Table 5-2) that can be
nested in the same way that you might nest HTML tables or div elements on web pages.
Search WWH ::

Custom Search