GWT: Difference between revisions

From Wiki RB4
Line 21: Line 21:
   war/
   war/
     [[GWT#Host_Page|<Project>.html]]
     [[GWT#Host_Page|<Project>.html]]
    [[GWT#Host_Page|<Project>.css]]


====Specific Configuration Files====
====Specific Configuration Files====

Revision as of 23:30, 17 January 2010

Overview

Google Web Toolkit (GWT) is a development toolkit for building and optimizing complex browser-based applications. Its goal is to enable productive development of high-performance web applications without the developer having to be an expert in browser quirks, XMLHttpRequest, and JavaScript. 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.

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 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.

Development

Development Environment

The same as Google Application Engine Environment.


Development Process

New Project

Directoy structure (Details see here):

<Project>/
  src/
    <Project>/
      <Project>.gwt.xml
  war/
    <Project>.html
    <Project>.css

Specific Configuration Files

The module XML file

It contains the definition of the GWT module, the collection of resources that comprise a GWT application or a shared package. In the module XML file, you specify your application's entry point class. In order to compile, a GWT module must specify an entry point. If a GWT module has no entry point, then it can only be inherited by other modules. It is possible to include other modules that have entry points specified in their module XML files. If so, then your module would have multiple entry points. Each entry point is executed in sequence.

Host Page

The code for a web application executes within an HTML document. In GWT, we call this the host page. The host page references the application style sheet and references the path of JavaScript source code (generated by GWT) responsible for the dynamic elements on the page. The contents of the entire body element can be generated dynamically.

Run/Debug Project

Run
  • Project Context Menu -> Run As -> Web Application or
  • Project Context Menu -> Run As -> Run Configuration -> Web Application -> <Projectname>
  • Copy URL from Development Console and paste in browser (first time on computer will ask to install Google Web Toolkit Developer Plugin)