Gwt In Action
GWT in Action
EASY AJAX WITH THE GOOGLE WEB TOOLKIT
ROBERT HANSON ADAM TACY
MANNING
Greenwich (74° w. long.)
For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact: Special Sales Department Manning Publications Co.Sound View Court 3B fax: (609) 877-8256 Greenwich, CT 06830 email: orders@manning.com
©2007 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher.
Many of the designations used bymanufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, andwe exert our best efforts to that end.
Manning Publications Co. Sound View Court 3B Greenwich, CT 06830
Copyeditor: Tiffany Taylor Typesetters: Gordan Salinovic Cover designer: Leslie Haimes
ISBN 1-933988-23-1 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – MAL – 13 12 11 10 09 08 07
To my son, David Thank you for letting me shorten playtime so many times, so that Daddycould work on his book. —RH
To my parents Everything I have achieved is because of something you did for me. Thank you. —AT
brief contents
PART 1 GETTING STARTED .......................................................1
1 2 3
■ ■ ■
Introducing GWT
3 38 64
Creating the default application
Advancing to your own application
PART 2
BUILDING USER INTERFACES.....................................107
4 5 6 7 8 9
■ ■ ■ ■ ■ ■
Working with widgets Working with panels Handling events 192
109 157 246 277 317
Creating composite widgets Building JSNI components Modularizing an application
PART 3
ADVANCED TECHNIQUES ...........................................345
10 11 12
■ ■ ■
Communicating with GWT-RPC Classic Ajax and HTML forms
347 375 409Examining client-side RPC architecture
vii
viii
BRIEF CONTENTS
13 14 15
■ ■ ■
Achieving interoperability with JSON 442 Automatically generating new code 471 494 Changing applications based on GWT properties
PART 4
COMPLETING THE UNDERSTANDING ..........................525
16 17
■ ■
Testing and deploying GWT applications Peeking into how GWT works 555
527
contentspreface xix acknowledgments xxi about this book xxiii about the title xxx about the cover illustration xxxi
PART 1 GETTING STARTED ............................................1
1
Introducing GWT 3
1.1 A walk through GWT 5
Explaining GWT's Java-to-JavaScript compiler 6 ■ Using JSNI to execute JavaScript from Java 8 ■ Accessing the JRE emulation library 10 ■ Understanding GWT's widget andpanel library 12 ■ Examining GWT’s internationalization and configuration tools 14 ■ Calling remote procedures with GWT 16 ■ Investigating GWT’s XML parser 20 ■ Managing the browser history 21 ■ Introducing GWT’s JUnit integration 22
1.2
GWT vs. other solutions
23
GWT vs. Swing 25 ■ GWT vs. Echo2 26 ■ GWT vs. JavaServer Faces 27 ■ GWT vs. Ruby on Rails 29
ix
x
CONTENTS
1.3Building your first GWT application
30
30
Building and running an example application Building Tic-Tac-Toe with GWT 32
1.4
Summary
37
2
Creating the default application 38
2.1 2.2 The GWT application development lifecycle Stage 1: Creating a GWT application 44 39
Creating the project 47 ■ Creating an application 50 Setting up internationalization 54 ■ Implementing...
Regístrate para leer el documento completo.