Introduction
In this tutorial, you will write a simple Ajax application: stockwatcher (stock index Monitor ).
Try to use it, add some stock code, and understand how it works.
Http://code.google.com/intl/en/webtoolkit/doc/latest/tutorial/gettingstarted/StockWatcher.html
When building stockwatcher, you will learn how GWT is for you:
- Use Java to compile browser applications in your Java IDE.
- Debug Java in the host mode that simulates the browser experience.
- Cross-compile your Java code into highly optimized JavaScript code.
- Maintain a code base (Java) for multiple browsers (JavaScript ).
Steps for developing Ajax applications using GWT
The application in this example is divided into the following eight steps, each of which is based on the previous section. In this simple stockwatcher implementation, all functions are written on the client. Content About server and client/server interaction is included in other tutorials.
The task you want to complete |
What you will learn |
You will use the GWT tool and API |
1. Create a GWT Project |
Generate the files and directories required to start. |
- Google plugin for eclipse
- GWT command line tool webappcreator
- Development Mode
|
2. Design Applications |
Define Requirements, constraints, and implement policies. |
Language constraints |
3. build user interfaces |
Visualize the layout and add user interface components. |
GWT widgets, panel, and root panel |
4. manage client events |
Handles mouse and keyboard events. |
Clickhandler and keypresshandler Interfaces |
5. Write client functions |
Maintain a code base for multiple browsers. Use the features such as refactoring and code provided by your Java ide To complete functions. |
Various GWT Methods |
6. Tune the GWT Application |
Debug the Java code before it is compiled into JavaScript. Use the debugging tools provided by your Java ide to run applications in development mode. |
Development Mode |
7. Application Style |
Apply visual styles to applications. Define a visual style in CSS. Set class attributes on HTML elements. Dynamically change the style. Add static elements such as files. |
- GWT Module
- GWT topic
- Application style sheet
- GWT method: addstylename, addstyledependentname, and setstylename
- Automatic Resource inclusion
|
8. Compile the GWT Application |
Compile your client Java code as JavaScript. Test in product mode. Learn more about the benefits of delayed binding. |
GWT Compiler |
Next step
If you have not set up your development environment: Java ide such as Eclipse and Google Web Toolkit of the latest version, you need to make some preparations.
You have created a GWT project.
Step 1: Create a GWT Project
Reprinted please keep the author's name and original website (jiaowei.cnblogs.com ).