You are previewing Google™ Web Toolkit Applications.
O'Reilly logo
Google™ Web Toolkit Applications

Book Description

“Ryan clearly understands the GWT value proposition and how GWT integrates into a diverse web technology stack–and not just in a theoretical way. With the popularity of and, Ryan can speak with the authority of concrete success.” –Bruce Johnson, creator of Google Web Toolkit
“This book distinguishes itself from other books on GWT in that it walks through the entire process of building several nontrivial GWT applications, not the toy applications that most books present.” –R. Mark Volkmann, Object Computing, Inc.
Google™ Web Toolkit Applications is an excellent resource for any GWT developer. Solutions to challenges commonly encountered in GWT are presented through the design and development of actual applications. The applications developed throughout the text demonstrate best practices from simple UI design all the way to custom code generation, and are presented with little pretext about the amount of Java knowledge a given developer may have. Advanced concepts are not withheld but are presented in a way that will be understood by both novice and seasoned developers alike. Good application development practices and proper Model View Controller design is reinforced throughout the book, nearly guaranteeing that the reader will come away a better programmer. “ –Jason Essington, Senior Web/Java Engineer, Green River Computing
“Dewsbury’s Google™ Web Toolkit Applications is a book for both experts and beginner programmers who want to discover this open source Java software development framework, as well as write Ajax applications. A very detailed book!” –Massimo Nardone, Advisory IT Security Architect

Accelerate and Simplify Ajax Development with Google Web Toolkit

Get the edge you need to deliver exceptional user experiences with Google™ Web Toolkit Applications, a guidebook that provides web developers with core information and instructions for creating rich web applications. Whether you’re a developer who needs to build a high-performance front end for Java, PHP, or Ruby applications, or to integrate with external web services, this resource from expert Google Web Toolkit (GWT) developer Ryan Dewsbury delivers the in-depth coverage you’ll need.

In this valuable book, insider Ryan Dewsbury provides instructions for using the robust tool set and gets you on your way to creating first-class web applications by providing a comprehensive overview of GWT technology. In addition, he shares his “in-the-trenches” insights on

  • Building elegant and responsive user interfaces with Cascading Style Sheets and GWT’s Widgets and Panels

  • Creating seamless user experiences through asynchronous communication with HTTP, REST, JSON/JSONP, and RPC Interoperating with web standards–such as XML, RSS, and Atom–and web services–such as Google Maps, Amazon Books, Yahoo! Search, Flickr, and Blogger

  • Overcoming browser security restrictions, such as HTTP’s two-connection limit and the Same-Origin policy

  • Accelerating development, using software engineering, code generation, internationalization, application patterns, and Java tools

  • Deploying for optimal performance with resource compression and caching

  • Building five non-trivial applications: a gadget application with a rich drag-and-drop interface, a multi-search application that makes requests to many search engines, a blog editor application for managing entries across multiple blogs, a web-based instant messenger, and a database manager for a traditional web page

  • This practical guide to GWT introduces you to the technology; provides techniques, tips, and examples; and puts you on the road to delivering top-notch user experiences for your web applications.

    Table of Contents

    1. Copyright
      1. Dedication
    2. Praise for Google™ Web Toolkit Applications
    3. Preface
      1. What Is This Book About?
      2. Who Should Read This Book?
      3. Organization of This Book
      4. Web Support
      5. Acknowledgments
    4. About the Author
    5. I. Understanding the Google Web Toolkit
      1. 1. First Steps with the Google Web Toolkit
        1. The Emergence of Ajax
        2. Rethinking Web Applications
          1. Adobe Flash and Flex
          2. Microsoft Silverlight
          3. Java FX
        3. Software Engineering for Ajax
          1. Building Rich Interfaces with Widgets and Panels
          2. Getting Better Performance with Asynchronous Communication
          3. Providing Interoperation Through Web Standards and Web Services
          4. Speeding Development Using Java Tools
        4. Evaluating Your Background
          1. Web Designers
          2. Web Site Developers
          3. Ajax Developers
          4. Web Application Developers
          5. Desktop Application Developers
        5. The Importance of Application Development Skills
        6. A Quick Tutorial
          1. Starting a GWT Project
          2. Customizing a Generated Application
          3. Creating a Dynamic Interface
          4. Using Asynchronous HTTP
        7. Overview of Toolkit Packages
        8. Overview of GWT Applications
          1. Common Application Patterns
          2. Sample Applications
        9. Summary
      2. 2. User Interface Library Overview
        1. Static Widgets
          1. Label
          2. HTML
          3. Image
          4. Hyperlink
        2. Form Widgets
          1. Button
          2. ToggleButton and PushButton
          3. Checkbox
          4. RadioButton
          5. ListBox
          6. SuggestBox
          7. TextBox
          8. PasswordTextBox
          9. TextArea
          10. RichTextArea
          11. FileUpload
          12. Hidden
        3. Complex Widgets
          1. Tree
          2. MenuBar
        4. Simple Layout Panels
          1. FlowPanel
          2. HorizontalPanel and VerticalPanel
          3. HorizontalSplitPanel and VerticalSplitPanel
          4. FlexTable and Grid
          5. DeckPanel
          6. DockPanel
          7. HTMLPanel
        5. Complex Layout Panels
          1. StackPanel
          2. TabPanel
        6. Simple Container Panels
          1. Composite
          2. SimplePanel
          3. ScrollPanel
          4. FocusPanel
        7. Complex Container Panels
          1. FormPanel
          2. DisclosurePanel
          3. PopupPanel
          4. DialogBox
        8. User Interface Framework Glue
          1. Event Interfaces
          2. Feature Interfaces
        9. Summary
      3. 3. Server Integration Techniques
        1. Basic Server Integration Techniques
          1. Asynchronous HTTP Requests
          2. Working with Plain Text and HTML
          3. Integrating with Traditional Server-Side Script Technologies
        2. Using Data Format Libraries
          1. Reading and Writing XML
          2. Reading and Writing JSON
        3. Third-Party Server Integration
          1. The Same Origin Policy
          2. Using JavaScript APIs
          3. Using JSONP
          4. Using an HTTP Proxy
        4. Advanced Server Integration Techniques
          1. Stateful Servers
          2. Integrating with Stateless Servers
          3. Using GWT-RPC
        5. Summary
      4. 4. Software Engineering for Ajax
        1. Setting Up the Development Environment
          1. Installing the Java Development Kit
          2. Installing the Google Web Toolkit
          3. Installing Eclipse
        2. Adding Projects to Eclipse
        3. Writing Java Code in Eclipse
          1. Creating Classes in Eclipse
          2. Using the Eclipse Java Editor
        4. Debugging in Eclipse
        5. Organizing Your Application Structure
        6. Testing Applications
          1. Using JUnit
          2. Benchmarking
        7. Building and Sharing Modules
          1. Using Modules
          2. Creating a Reusable Module
          3. Sharing a Compiled Application (Mashups)
        8. Deploying Applications
          1. Deploying to a Web Server
          2. Deploying a Servlet to a Servlet Container
          3. Automating Deployment with Ant
        9. Summary
      5. 5. Using the Toolkit Effectively
        1. Using Asynchronous Programming
        2. Handling the Back Button
        3. Creating Elegant Interfaces with CSS
          1. Connecting GWT Widgets to CSS
          2. Specifying Colors
          3. Specifying Units
          4. Using Font Properties
          5. Using Text Properties
          6. Using Margin, Border, and Padding Properties
          7. CSS Examples
          8. Using the Cursor Property
        4. Extending the Toolkit
          1. Building New Widgets
          2. Using the JavaScript Native Interface
          3. Providing Cross-Browser Support
          4. Using Other JavaScript Libraries
        5. Internationalizing Applications
          1. Declaring Constants
          2. Declaring Messages
          3. Localization Tools
          4. Managing Locales
          5. Using the Dictionary
        6. Generating Code
          1. Using Generated Code
          2. Writing a Code Generator
          3. Writing the generate Method
        7. Improving Performance
          1. Handling Long Processing
          2. Using ImageBundle
          3. Caching on Apache
          4. Caching on a Servlet Container
          5. Compression on Apache
          6. Compression on a Servlet Container
        8. Summary
    6. II. Rich Web Applications by Example
      1. 6. Gadget Desktop Application
        1. Using the Container Application Pattern
        2. Designing the Model
          1. Using the Abstract Factory Pattern
          2. Making the GadgetClass Class
          3. Making the Gadget Class
          4. Making Easy User Preferences
        3. Building a Columned Container Interface
          1. Defining the View
          2. Using a VerticalPanel for the Main Layout
          3. Using HorizontalPanel for the Menu
          4. Using TabPanel for Page Selection
          5. Using HorizontalPanel and FlowPanel for Columns
        4. Putting Gadgets in the View
          1. The Hello World Gadget
          2. Making a Gadget Container
          3. Using ImageBundle, ToggleButton, and PushButton
        5. Creating Drag-and-Drop Gadgets
          1. Docking Widgets Between Panels
          2. Dragging Widgets Using Mouse Events
          3. Dropping a Widget
        6. Cleaning Up User Interfaces with CSS
          1. Using CSS with GWT
          2. Adding Styles to the Tabs
          3. Adding Styles to the Menu
          4. Adding Styles to the GadgetContainerView
          5. Creating a RoundedPanel
        7. Adding Persistency
          1. Implementing the CookieStorage Class
          2. Handling Browser Differences
          3. Loading and Saving Cookies
          4. Using Google Gears for Storage
        8. Using Other JavaScript Libraries
          1. Using Google Maps API
          2. Using Google Ajax API for Feeds
          3. Building a Weather Gadget
          4. Building an RSS News Gadget
        9. Summary
      2. 7. Multi-Search Application
        1. Using the Aggregator Application Pattern
        2. Multi-Search Design
        3. The Model
        4. The View
          1. The MultiSearchView Class
          2. The SearchResultsView Class
          3. Building a Link Widget
        5. The Controller
        6. Importing Structured Data Formats
          1. Bypassing the Same Origin Policy
          2. Loading JSON Feeds with JSONP
        7. Integrating with Yahoo! Search
        8. Integrating with Google Base
        9. Integrating with Flickr Search
        10. Integrating with Amazon Search
        11. Summary
      3. 8. Blog Editor Application
        1. Using the Workspace Application Pattern
        2. Building a Web Service Client
        3. Blog Editor Design
        4. The Model
        5. Building a Multiple Document View
          1. The BlogEditorView Class
          2. The BlogView Class
          3. The BlogEntryView Class
          4. The EditEntryView Class
        6. Adding Rich Text Editing
          1. Using RichTextArea
          2. Using ImageBundle, Internationalization, and the RichTextToolbar
        7. The LoadingPanel Widget
        8. The TitleCommandBar Widget
        9. Designing the Application Controller
        10. Building an HTTP Proxy Servlet
          1. A New Cross-Domain RequestBuilder
          2. Writing a Proxy Servlet
        11. Integrating with the Blogger API
          1. Using Atom Publishing Protocol and GData
          2. Defining the BloggerService Class
          3. Signing In to a Google Account
          4. Getting the XML List of Blogs for the Account
          5. Getting the XML List of Entries for Each Blog
          6. Sending XML to Create and Save an Entry
          7. Sending a Delete Request for an Entry
        12. Summary
      4. 9. Instant Messenger Application
        1. Using the Collaborator Application Pattern
        2. Instant Messenger Design
        3. The Model
        4. Building a Complementary Interface
          1. The MessengerView Class
            1. Handling Window Close and Resize Events
            2. Handling Chat Windows
          2. The SignInView Class
          3. The ContactListView Class
          4. The ChatWindowView Class
        5. The Controller Overview
        6. Using GWT-RPC
          1. The RemoteService Interface
          2. The RemoteServiceServlet Class
          3. Using an Asynchronous Interface
        7. Connecting to the Server
        8. Adding RPC Events
          1. Polling Protocols
          2. Event-Based Protocols
          3. Implementing Events
        9. The Instant Messenger Server
        10. Using Server-Side Advanced IO
          1. Using Comet on Tomcat
          2. Using Continuations on Jetty
        11. Summary
      5. 10. Database Editor Application
        1. Using the Manager Application Pattern
        2. Designing the Model
        3. Using Asynchronous Data Access Objects
        4. Building a Two-Paned Editor Interface
          1. Using the Tree and SplitPanel Widgets
          2. Extending and Dynamically Loading Tree Items
          3. Creating Workspace Views
          4. Using Dialogs for Editing and Creating Objects
        5. Server Integration Overview
          1. Using Actions
          2. Using REST
          3. Using RPC
        6. Writing a Generic GWT Code Generator
          1. Writing the Code Generator
          2. Automatically Serializing to XML
          3. Automatically Serializing to JSON
        7. Integrating with Action-Based PHP Scripts
          1. Using PHP to Build the Action API
          2. Writing the Action Data Access Layer in the Client
        8. Integrating with a RESTful Ruby on Rails Application
          1. Using Ruby on Rails to Build a REST API
          2. Writing the REST Data Access Layer in the Client
        9. Integrating with a GWT-RPC Servlet
          1. Writing the RPC Service
          2. Using Hibernate to Store the Model
        10. Summary