ebook img

Accelerated GWT: Building Enterprise Google Web Toolkit Applications PDF

313 Pages·2008·6.64 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Accelerated GWT: Building Enterprise Google Web Toolkit Applications

CYAN YELLOW MAGENTA bLACK PANTONE 123 C EMPOWERING PRODUCTIVITY FOR THE JAVA™ DEVLOPER THE EXPERT’s VOICE® IN WEb DEVELOPMENT Companion eBook Available Accelerated GWT: Building Enterprise Google Web Toolkit Applications A c Dear Reader, c Accelerated e Writing web applications in JavaScript and making them work in different l e browsers has long been an issue faced by developers. Not anymore! Discover r the GWT framework, which helps you write Ajax-based web applications in a Java and then converts them into JavaScript for all supported browsers. GW T t Accelerated GWT is my way of taking the pain out of learning GWT for you. e As a developer, I was immediately excited by the idea of not doing repetitive d coding and adding tweaks to make an application compatible with different browsers. Since then, I’ve come to understand and admire the clarity and ease G of developing web applications using GWT. I can honestly say that GWT greatly simplifies the creation of complex Ajax-based web applications and puts a lot W of fun back into developing. If you’re trying to decide whether GWT would be good for your project, you’ll find that this book covers what you need to know and what you can gain T by using it. After mastering the fundamentals of GWT, you’ll learn about the remote procedure calls and the asynchronous callback mechanism, how to write test cases and benchmark tests for your application, how to bundle images, how to write applications with internationalization in mind, and how to design reusable Building Enterprise Google modules. In addition, you’ll learn how to compile and convert your Java code into JavaScript and deploy your applications on a web server. Throughout the book, you’ll find a large number of examples to help you understand and use Web Toolkit Applications these features with ease. After reading this book, you will thoroughly understand the GWT framework and what it can do for your applications. Vipul Gupta Write high-performance Ajax applications using Companion eBook Google Web Toolkit (GWT) to generate optimized THE APRESS ROADMAP JavaScript and avoid the dreaded browser “quirks.” Accelerated GWT: Building Enterprise Google Web Toolkit Beginning Google Web Toolkit: See last page for details From Novice to Professional on $10 eBook version Pro Web 2.0 Application Development with GWT Vipul Gupta SOURCE CODE ONLINE ISBN-13: 978-1-59059-975-4 G www.apress.com ISBN-10: 1-59059-975-6 u 53699 p t a US $36.99 Shelve in Web Development User level: 9 781590 599754 Beginner–Intermediate this print for content only—size & color not accurate spine = 0.729" 312 page count 9756fm.qxd 4/25/08 12:00 PM Page i Accelerated GWT Building Enterprise Google Web Toolkit Applications Vipul Gupta 9756fm.qxd 4/25/08 12:00 PM Page ii Accelerated GWT: Building Enterprise Google Web Toolkit Applications Copyright © 2008 by Vipul Gupta All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-59059-975-4 ISBN-10 (pbk): 1-59059-975-6 ISBN-13 (electronic): 978-1-4302-0616-3 ISBN-10 (electronic): 1-4302-0616-0 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Clay Andres Technical Reviewer: Eric Briley Editorial Board: Clay Andres, Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, JonathanGennick, Matthew Moodie, Joseph Ottinger, Jeffrey Pepper, Frank Pohlmann, BenRenow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Senior Project Manager: Tracy Brown Collins Copy Editor: Kim Wimpsett Associate Production Director: Kari Brooks-Copony Production Editor: Ellie Fountain Compositor: Molly Sharp Proofreader:Liz Welch Indexer: Beth Palmer Artist: Kinetic Publishing Services, LLC Cover Designer: Kurt Krames Manufacturing Director:Tom Debolski Distributed to the book trade worldwide bySpringer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected],or visit http://www.springeronline.com. For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected],or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses arealso available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every pre- caution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com. 9756fm.qxd 4/25/08 12:00 PM Page iii To my parents,for always being supportive and loving 9756fm.qxd 4/25/08 12:00 PM Page iv 9756fm.qxd 4/25/08 12:00 PM Page v Contents at a Glance About the Author .................................................................xv Acknowledgments ...............................................................xvii Introduction .....................................................................xix PART 1 n n n Getting Started with GWT nCHAPTER 1 GWT Basics and a First Application .............................3 nCHAPTER 2 GWT Architectureand Internal Features........................27 PART 2 n n n UI Programming and Client-Server Communication nCHAPTER 3 UI Programming:Basic Widgets ...............................59 nCHAPTER 4 Communication:RPC ..........................................89 nCHAPTER 5 UI Programming:Handling Events and Using AdvancedWidgets...105 nCHAPTER 6 Communication:Advanced Techniques .......................135 PART 3 n n n Making Applications Ready for the Real World nCHAPTER 7 Testing GWT Applications ....................................171 nCHAPTER 8 Internationalizing Your Applications:A Modern-Day Reality ....201 nCHAPTER 9 Some Important,Not-to-Be-Missed Techniques ...............233 nCHAPTER 10 Peeking Into the Upcoming GWT 1.5 Release ..................265 nINDEX .......................................................................283 v 9756fm.qxd 4/25/08 12:00 PM Page vi 9756fm.qxd 4/25/08 12:00 PM Page vii Contents About the Author .................................................................xv Acknowledgments ...............................................................xvii Introduction .....................................................................xix PART 1 n n n Getting Started with GWT nCHAPTER 1 GWT Basics and a First Application ........................3 Setting Up Your GWT Environment .................................4 Hosted Mode vs.Web Mode .......................................4 Web Mode .................................................4 Hosted Mode ...............................................5 What Are All Those GWT Files For? .................................6 Creating Your First GWT Application ................................6 Tools for Creating a Project...................................6 Running the Application Using Generated Scripts................9 Working with Modules in GWT ....................................11 Structure of a Module File ...................................11 Creating the Host HTML File ......................................15 Steps to CreateaGWT Application ................................16 Creating Another Application Step-by-Step .........................17 Creating the Basic Project Structure ..........................17 Adding the Module File .....................................17 Creating the Entry-Point Class ...............................18 Creating the Host HTML File .................................21 Running the Application in Hosted Mode ......................22 Summary ......................................................25 nCHAPTER 2 GWT Architecture and Internal Features ..................27 Understanding the Components That Make Up the GWT Framework ...27 Development Tools Explained................................27 Class Libraries Explained....................................28 What Version of the Java Language Does the GWT Support? .........31 vii 9756fm.qxd 4/25/08 12:00 PM Page viii viii nCONTENTS The Same Origin Policy and Its Implications on GWT.................33 Same Origin Policy Explained ................................33 What Are the Implications of the Same Origin Policy on GWT? ...34 Deferred Binding................................................34 Understanding Generator,Related Classes,and Code Generation UsingGenerators .............................................36 Example of Using Generator to Autogenerate Code for Your Applications ............................................39 Building the Generator-Based Application .....................40 GWT:Startup/Bootstrap Process ..................................52 Summary ......................................................55 PART 2 n n n UI Programming and Client-Server Communication nCHAPTER 3 UI Programming: Basic Widgets ...........................59 GUI Building with Fundamental Widgets ...........................59 Hierarchy of Base Classes Explained .........................60 How Do You Use the Widgets Provided by GWT? ...............65 Understanding Layouts Using Panels ..............................70 Starting with a RootPanel ...................................72 Aligning Widgets Using a CellPanel ...........................72 What Is an HTMLTable Panel? ...............................76 WhatIs a FlowPanel? .......................................78 Creating Complex Widgets Using Composites.......................79 Developing a Sample Application Using Composites ............80 Summary ......................................................86 nCHAPTER 4 Communication: RPC .......................................89 Understanding RPC .............................................89 Howto Use RPC in GWT .........................................90 Creating Service Interface (Also Called the Synchronous Interface) ...90 Creating the Asynchronous Interface .........................91 Understanding the AsyncCallback Interface....................91 Making an Actual Remote Procedure Call .....................92 Your First Complete RPC Example .................................93 RPC in GWT:Behind the Scenes .................................100 Summary .....................................................103

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.