Book Image

Google Web Toolkit 2 Application Development Cookbook

By : Shamsuddin Ahammad
Book Image

Google Web Toolkit 2 Application Development Cookbook

By: Shamsuddin Ahammad

Overview of this book

GWT 2 radically improves web experience for users by using existing Java tools to build no-compromise AJAX for any modern browser. It provides a solid platform so that other great libraries can be built on top of GWT. Creating web applications efficiently and making them impressive, however, is not as easy as it sounds. Writing web applications for multiple browsers can be quite tasking. In addition, building, reusing, and maintaining large JavaScript code bases and AJAX components can be difficult. GWT 2 Application Development Cookbook eases these burdens by allowing developers to quickly build and maintain complex yet highly efficient JavaScript front-end applications in the Java programming language . It tells you how to make web experience all the more thrilling and hassle free, using various tools along with GWT SDK.This book starts with developing an application from scratch. Right from creating the layout of the home page to home page elements including left and right sidebars, to placing tree like navigational menu, menu bars, tool bars, banners, footers are discussed with examples. You will see how to create forms using the Ext GWT library widgets and handle different types of events. Then you will move on to see how to design a database for sales processing systems and learn to create the database in MySQL with the help of easy–to-follow recipes. One of the interesting topics of this book is using JPA in GWT. Using the JPA object in GWT is a challenge. To use them perfectly, a mechanism to convert the JPA object into plain object and vice versa is required. You will see recipes to use entity classes, entity managers, and controller classes in GWT application. You will efficiently create reports with parameters, variables and subreports, and get the report output in both HTML and PDF format using real-world recipes. You will then learn to configure the GlassFish server to deploy a GWT application with database. Finally, learn how to trace speed and improve perfomance in web applications using tracing techniques.
Table of Contents (16 chapters)
Google Web Toolkit 2 Application Development Cookbook
Credits
About the Author
About the Reviewers
Preface
Index

Preface

GWT 2 radically improves the web experience for users by using the existing Java tools to build a no-compromise AJAX for any modern browser. It provides a solid platform so that the other great libraries can be built on top of the GWT. Creating web applications efficiently and making them impressive, however, is not as easy as it sounds. Writing web applications for multiple browsers can be quite tasking. In addition, building, reusing, and maintaining large JavaScript code bases and AJAX components can be difficult.

GWT 2 Application Development Cookbook eases these burdens by allowing the developers to build and maintain complex, yet highly efficient JavaScript frontend applications in the Java programming language quickly. It tells you how to make the web experience all the more thrilling and hassle-free by using various tools along with the GWT SDK.

This book starts with developing an application from scratch. Right from creating the layout of the home page to home page elements including left and right sidebars, to placing a tree-like navigational menu, menu bars, tool bars, banners, and footers are discussed with examples.

You will see how to create forms using the Ext GWT library widgets and handle different types of events. Then, you will move on to see how to design a database for sales processing systems, and learn how to create the database in MySQL with the help of easy-to-follow recipes.

One of the interesting topics of this book is using the JPA in GWT. Using the JPA object in GWT is a challenge. To use it perfectly, a mechanism to convert the JPA object into a plain object and vice versa is required. You will see recipes to use entity classes, entity managers, and controller classes in the GWT application. You will efficiently create reports with parameters, variables, and subreports, and get the report output in both HTML and PDF formats using real-world recipes.

You will then learn how to configure the GlassFish server to deploy a GWT application with a database. Finally, you will learn how to trace speed and improve performance in web applications using tracing techniques.

Create impressive web applications with tool bars, menus, multiple windows, and more with this step-by-step guide.

What this book covers

Chapter 1, Setting up the GWT Environment in NetBeans shows which tools and technologies are required to build a web application using GWT, JPA, and iReport in NetBeans. The required installation and configuration of the tools are shown as easy-to-follow recipes.

Chapter 2, Creating Home Page with Panels and Menus creates the layout of the application. It shows how to divide the page into the banner, left and right sidebars, and the center and footer sections.

Chapter 3, Forms with Layout and Widgets includes recipes that show how to use widgets to create forms, sidebars for navigation, tab panel, and so on.

Chapter 4, Handling your First Events includes easy-to-follow recipes that show how to handle the typical GWT events such as button event, field event, menu event, focus event, change event, and so on.

Chapter 5, Creating Database for Sales Processing creates a sample database in MySQL for Sales Processing Systems. To create a database and its tables with the required constraints, easily the uses of MySQL GUI tools have been shown.

Chapter 6, Managing Entities using JPA deals with the Java Persistence API (JPA) framework. It is a framework that is used to manage relational data in Java EE and Java SE applications. JPA provides a Plain Old Java Object (POJO) persistence model for object relational mapping. This chapter shows how to create a database connection, persistence unit, entity classes, and controller classes for the database CRUD operations.

Chapter 7, Communicating with Server using GWT RPC deals with the communication between the client and the server. The recipes in this chapter describe how to use the JPA in the server side and Data Transfer Objects (DTO) in the client side. It discusses how the GWT RPC mechanism allows the server and the client to pass Java objects back and forth.

Chapter 8, Reporting with iReport shows how to use iReport for the reporting solutions in Java web applications. Parameterized reports, subreports, and reports with variables are shown in some recipes. Then, the chapter discusses and shows how to show the created reports as HTML or PDF in the GWT application.

Chapter 9, Deploying a GWT Application includes recipes that show how to build the GWT project for the deployment, and before the deployment, how to create JDBC connection pool and resources in the GlassFish server are given as recipes.

Chapter 10, Using Speed Tracer deals with the extension Speed Tracer. Speed Tracer is a Google Chrome browser extension which is used to identify and fix performance problems in web applications. Installation and use of Speed Tracer for the created GWT applications are shown in this chapter.

Who this book is for

If you want to build AJAX web applications with GWT, then this book is for you. Developers with prior programming experience of Java development and object-oriented programming will find this book very useful.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

menuBar.add(menuBarItemFile);
menuBar.add(menuBarItemReports);
menuBar.add(menuBarItemHelp);

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Right-click on the Servers option, and then click on Add Server."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book — what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Tip

Downloading the example code for this book

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books — maybe a mistake in the text or the code — we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.