Book Image

Google Web Toolkit GWT Java AJAX Programming

By : Prabhakar Chaganti
Book Image

Google Web Toolkit GWT Java AJAX Programming

By: Prabhakar Chaganti

Overview of this book

<p>GWT Ajax Programming shows you how to create reliable user interfaces that enhance the user experience.<br /><br />GWT is an open source Java software development framework that makes writing AJAX applications like Google Maps and Gmail easy for developers who don't speak browser quirks as a second language. Writing dynamic web applications today is a tedious and error-prone process; you spend 90% of your time working around subtle incompatibilities between web browsers and platforms, and JavaScript's lack of modularity makes sharing, testing, and reusing AJAX components difficult and fragile.<br /><br />GWT lets you avoid many of these headaches while offering your users the same dynamic, standards-compliant experience. You write your front end in the Java programming language, and the GWT compiler converts your Java classes to browser-compliant JavaScript and HTML.</p> <h3>Chapter-by-Chapter</h3> <p><span style="font-weight: bold;">Chapter 1</span> introduces GWT, the download and installation of GWT, and running its sample application.</p> <p><span style="font-weight: bold;">Chapter 2</span> deals with the creation of a new GWT application from scratch, and using the Eclipse IDE with GWT projects, creating a new AJAX Random Quotes application, and running this new application.</p> <p><span style="font-weight: bold;">Chapter 3</span> deals with an introduction to and overview of GWT asynchronous services, and creating a prime number service and geocoder service.</p> <p><span style="font-weight: bold;">Chapter 4</span> deals with using GWT to build simple interactive user interfaces. The samples included in this chapter are live search, auto fillable forms, sortable tables, dynamic lists, and a flickr-style editable lable.</p> <p><span style="font-weight: bold;">Chapter 5</span> introduces some of the more advanced features of GWT to build more complex user interfaces. The samples included in this chapter are pageable tables, editable tree nodes, a simple log spy, sticky notes, and a jigsaw puzzle.</p> <p><span style="font-weight: bold;">Chapter 6</span> includes an introduction to JavaScript Native Interface (JSNI) and using it to wrap third-party JavaScript libraries like Moo.fx and Rico. it also includes using the gwt-widgets project and its support for the Script.aculo.us effects.</p> <p><span style="font-weight: bold;">Chapter 7</span> deals with creating custom GWT widgets. The samples included in this chapter are a calendar widget and a weather widget.</p> <p><span style="font-weight: bold;">Chapter 8</span> concerns itself with creating and running unit tests for GWT services and applications.</p> <p><span style="font-weight: bold;">Chapter 9</span> sees us using Internationalization (I18N) and client-side XML support in GWT.</p> <p><span style="font-weight: bold;">Chapter 10</span> includes the deployment of GWT applications using both Ant and Eclipse.</p>
Table of Contents (16 chapters)
Google Web Toolkit
Credits
About the Author
About the Reviewers
Preface
Running the Samples

Calendar Widget


We will create a reusable calendar widget, which can be easily used in multiple GWT applications. This widget is based on Alexei Sokolov's simple calendar widget (http://gwt.components.googlepages.com/calendar). We will adapt it to suit our requirements. The calendar will display the current date along with a listing for the current month and will enable navigation either forward or backward through the calendar. We will also provide a way to get back to the current day, no matter where we have navigated in the calendar.

Time for Action—Creating a Calendar

We will now create a calendar widget. The steps are as follows:

  1. 1. Create a new widget project to contain the artifacts for our custom widgets. We will create our widget in this project and then use it inside an application in our original Samples project. When we create the new project, the Widgets.gwt.xml file will be automatically created for us, and by default it will contain the following entry for inheriting from the...