index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/9780321501967/index/0321501969...code...

20
555 Index Symbols $wnd object, JSNI, 216 & (ampersand), in GET and POST parameters, 112–113 { } (curly braces), JSON, 123 ? (question mark), GET requests, 112 A Abstract Factory pattern, 258–259 Abstract methods, 332 Abstract Window Toolkit (AWT), Java, 31 AbstractImagePrototype object, 245 Abstraction, DAOs and, 486 AbstractMessengerService Comet, 474 Jetty Continuations, 477 action attribute, HTML form tag, 507 Action-based web applications overview of, 116 PHP scripts for building, 523 ActionObjectDAO class, 527–530 Actions, server integration with, 507–508 ActionScript, 6 ActiveX, 7 Add Import command creating classes in Eclipse, 152 writing Java code using Eclipse Java editor, 154–155 addContact method ContactList class, 428 ContactListView class, 441 addHistoryListener method, Hyperlink wid- get, 46 addItem method, MenuBar widget, 68–69 addLoadListener method, Image widget, 44 addMessage method, ChatWindowView class, 444–445 addSearchResult method JUnit test case, 175 SearchResultsView class, 329 addSearchView method, MultiSearchView class, 327 addStyleName method, connecting GWT widgets to CSS, 201 addToken method, handling back button, 199 addTreeListener method, Tree widget, 67 Adobe Flash and Flex, 6–7 Aggregator pattern defined, 34 Multi-Search application and, 319–321 sample application, 35 Aggregators, 320 Ajax (Asynchronous JavaScript and XML) alternatives to, 6–8 application development and, 14–16 building web applications and, 479 emergence of, 3–5 Google Gears for storage, 306–309 Same Origin policy and, 335 success and limitations of, 5–6 usefulness of GWT to developers, 13 word processor, 362 Ajax (Asynchronous JavaScript and XML), software engineering for, 139–190 adding projects to Eclipse, 145–149

Upload: nguyentram

Post on 23-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

555

Index

Symbols$wnd object, JSNI, 216& (ampersand), in GET and POST parameters,

112–113{ } (curly braces), JSON, 123? (question mark), GET requests, 112

AAbstract Factory pattern, 258–259Abstract methods, 332Abstract Window Toolkit (AWT), Java, 31AbstractImagePrototype object, 245Abstraction, DAOs and, 486AbstractMessengerService

Comet, 474Jetty Continuations, 477

action attribute, HTML form tag, 507Action-based web applications

overview of, 116PHP scripts for building, 523

ActionObjectDAO class, 527–530Actions, server integration with, 507–508ActionScript, 6ActiveX, 7Add Import command

creating classes in Eclipse, 152writing Java code using Eclipse Java editor,

154–155addContact method

ContactList class, 428ContactListView class, 441

addHistoryListener method, Hyperlink wid-get, 46

addItem method, MenuBar widget, 68–69addLoadListener method, Image widget, 44addMessage method, ChatWindowView class,

444–445addSearchResult method

JUnit test case, 175SearchResultsView class, 329

addSearchView method, MultiSearchView class, 327

addStyleName method, connecting GWT widgets to CSS, 201

addToken method, handling back button, 199addTreeListener method, Tree widget, 67Adobe Flash and Flex, 6–7Aggregator pattern

defined, 34Multi-Search application and, 319–321sample application, 35

Aggregators, 320Ajax (Asynchronous JavaScript and XML)

alternatives to, 6–8application development and, 14–16building web applications and, 479emergence of, 3–5Google Gears for storage, 306–309Same Origin policy and, 335success and limitations of, 5–6usefulness of GWT to developers, 13word processor, 362

Ajax (Asynchronous JavaScript and XML), software engineering for, 139–190

adding projects to Eclipse, 145–149

Dewsbury.book Page 555 Wednesday, October 31, 2007 11:03 AM

556 Index

Ajax (Asynchronous JavaScript and XML), continuedautomating deployment with Ant, 187–190building and sharing modules, 180–183debugging in Eclipse, 158–164deploying servlet to servlet container, 184–186deploying to web server, 184installing Eclipse, 144–145installing GWT, 140–144installing JDK, 140organizing application structure, 164–168overview of, 8–11testing applications. See Testing applicationsusing modules, 180–181writing Java code in Eclipse, 149–157

Amazon Search, 354–358Amazon Web Services (AWS), 354–356Anonymous classes, 194–195Ant script, 187–190Apache

caching on, 246–247compression on, 249

API key, widget based on Google Map, 224Application patterns, 34–35applicationCreator script

creating module with, 182installing GWT, 141–142organizing application structure, 164–168

Applications. See also Web applicationsdevelopment skills, 14–16internationalizing. See Internationalizing appli-

cationssharing compiled, 183

APR connector, 475AsyncCallback interface, 134–135, 454–456asyncGet method, HTTPRequest, 28Asynchronous HTTP requests

server integration techniques, 106–109using, 27–29

Asynchronous interface, GWT-RPC using, 454–456Asynchronous JavaScript and XML. See Ajax (Asyn-

chronous JavaScript and XML)Asynchronous programming, 191–196

blocking operations and, 192features in GWT, 193–196IncrementalCommand class, 193sequential vs., 191–192

Atomaggregators and, 320GData protocol based on, 344RSS feeds and, 402

AtomEnabled Alliance, 402Authentication, 222–226AuthSub interface, 404–410

AWS (Amazon Web Services), 354–356AWT (Abstract Window Toolkit), Java, 31

BBack button, handling in Ajax, 197–200BaseObject class, 484Benchmarking, for testing applications, 176–179Binding, browser interoperability and, 302–303Block elements

CSS properties, 207–209defined, 71

Blocking operations, in asynchronous program-ming, 192

Blog class, 365–367Blog Editor application, 361–422

Atom Publishing Protocol and GData and, 402BlogEditorView class, 370–372BlogEntryView class, 376–378BloggerService class, 402–403BlogView class, 372–376bypassing HTTP request limitations, 108controller for, 390–392creating new widgets, 213cross-domain RequestBuilder for proxy

servlet, 394–397delete requests for blog entries, 419–420designing, 365EditEntryView class, 378–381Google account sign-in, 403–410HTTP Proxy servlet, building, 392–394ImageBundle, internationalization, and

RichTextToolbar, 383–386integration with, 401integration with stateless servers, 130–131LoadingPanel widget, 386–388model for, 365–367multiple document view for, 367–369overview of, 361page relationships in, 368reading and writing XML, 120–121rich text editing added to, 381–382RichTextArea widget, 382–383summary, 421–422third-party server integration, 128TitleCommandBar widget, 388–390web services client, building, 363–365Workspace pattern, 361–363writing proxy servlet, 397–401XML for creating and saving blog entries, 416–419XML listing of blog entries, 413–415XML listing of blogs, 410–413

Dewsbury.book Page 556 Wednesday, October 31, 2007 11:03 AM

Index 557

BlogEditorView class, 370–372BlogEntry class, 365–367, 416–419BlogEntryView class, 376–378BloggerService class, 402–403Blogs

defined, 361improvements in usability, 4

BlogView class, 372–376BlogViewListener interface, 371Borders, CSS properties, 207–208Breakpoints, in Eclipse

adding exception, 161–163debugging Eclipse, 158–161

broadcastEvent method, instant messenger server, 468–469

Browsersback button and history and, 197–200CookieStorage class and, 300–302Google Gears for storage, 306–309GWT support across, 218–221handling differences between, 302–303importing structured data formats, 334Same Origin policy and, 334–336

Button states, Button widget, 50–52Button widget

button states, 50–52creating dynamic interface, 25overview of, 47–49

ButtonsButton widget, 47–49CheckBox widget, 53Gadget Desktop, 280–282PushButton widget, 49–52RadioButton widget, 54ToggleButton widget, 49–52

CCache-control header

caching on Apache, 247caching on servlet container, 247–248

Cachingon Apache, 246–247on servlet container, 247–248

CallbacksBlogger services, 414–415third-party server integration using JSONP, 127

Calling stack, debugging in Eclipse, 161Cascading Style Sheets. See CSS (Cascading Style

Sheets)Challenge, defined, 222ChangeTableDialog class, DialogBox widget, 93

Chat windowsbuilding Instant Messenger interface, 430–431MessengerView class handling, 432–436

ChatWindowView classbuilding Instant Messenger interface, 442–447ContactListView class, 441–442defined, 431MessengerView class, 435–436

CheckBox widgetoverview of, 53RadioButton widget vs., 54

class attribute, GWT-RPC, 133Classes

anonymous, 194–195Eclipse, 149–153Eclipse Java editor for writing Java code,

153–157implementing code generator, 239Instant Messenger applications, 426–428, 449local, 194RPC interfaces and, 451

ClassSourceFileComposwerFactory, 239cleanString method, instant messenger server,

468Click events, Image widgets, 43ClickListener

creating dynamic interface, 25EditEntryView class, 378–381Hyperlink widget, 441MultiSearchView class, 327

ClickListenerCollection, 98Clients

web services client, 363–365writing Action data access layer for, 526–530

closeChatWindow method, 435, 444Code generators, 235–242

automatic serialization to JSON, 521–522automatic serialization to XML, 521generate method, 239–242generic GWT code generator, 512–521scaffolding and, 530working with, 235–237writing, 237–239

Code management, in Ajax applications, 16Code syntax coloring, in Java, 153–154Collaborator pattern

applied to instant messaging, 423–426defined, 34

Colorcreating interfaces with CSS, 203–204hex values for standard, 203–204in Java code syntax, 153–154RGB notation, 292

Dewsbury.book Page 557 Wednesday, October 31, 2007 11:03 AM

558 Index

Column layout, Gadget Desktop, 271–273Columned container interface, Gadget Desktop,

264–266Comet, using on Tomcat, 472–475com.google.gwt.core.ext, 33, 237–239com.google.gwt.http.client, 32com.google.gwt.il8n.client, 33com.google.gwt.json.client, 33com.google.gwt.junit.client, 33com.google.gwt.user.client, 31com.google.gwt.user.client.ui, 31com.google.gwt.user.User module, 166com.google.gwt.xml.client, 32–33com.google.user.client.rpc, 32com.google.user.server.rpc, 32Command interface, MenuBar widget using, 68CommandBar widget, 495Compilation

Ajax application development, 11Ant for application deployment, 189–190deploying applications to web server with, 184generating code during setup. See Code

generatorsinstalling GWT, 142–144organizing application structure, 168sharing compiled applications, 183

Complex container panels. See Panels, complex container

Complex layout panels, 80–84Complex widgets

defined, 37MenuBar, 67–69Tree, 63–67

Composite widgetBlogEditorView class extending, 370BlogView class extending, 373DatabaseEditorView class extending, 489integrating in GWT application, 225–226MessengerView class extending, 432MultiSearchView class extending, 326overview of, 84–85SignInView class extending, 438SimplePanel widget vs., 85, 441TitleCommandBar widget extending, 389

Compressionon Apache, 249on servlet container, 249–250

Connections, HTTP request limitations, 108–109Constant interface

Dictionary class vs., 235internationalizing applications with, 227–228managing locales, 232–234

Contact class, Instant Messenger, 426–428

Contact List view, DeckPanel widget, 77ContactClickListener class, Hyperlink wid-

get, 441ContactList class

Instant Messenger, 427–428server connections, 457

ContactListView classchat windows, 436defined, 431Instant Messenger, 439–442MessengerView class displaying, 432, 433

Container panelscomplex. See Panels, complex containersimple, 84–86

Container patterndefined, 34Gadget Desktop application, 256–257sample application, 35

Containersbuilding columned container interface for

Gadget Desktop, 264–266CSS styles added to Gadget Desktop containers,

297–298dockable windows and, 283for gadgets, 276–279

Continuations, using on Jetty, 475–478Controller

Blog Editor application, 390–392Instant Messenger application, 447–450Multi-Search application, 331–333

Cookie class, 300CookieConstants class, 302–303Cookies

client-side storage with, 300–302loading and saving, 303–305

CookieStorage class, 177, 300–302create command

creating objects, 502–507Database Editor application, 495–497

create methodcreating Constants interface, 227creating ImageBundle, 236creating Messages interface, 230DisclosurePanel widget, 91

createCallbackFunction, JSNI, 217createMessages flag, localization, 230–231Creating, reading, updating, and deleting (CRUD)

application processes and, 480HTTP methods, 364

Cross-browser support, 218–221CRUD (creating, reading, updating, and deleting)

application processes and, 480HTTP methods, 364

Dewsbury.book Page 558 Wednesday, October 31, 2007 11:03 AM

Index 559

CSS (Cascading Style Sheets)ChatWindowView class, 447CheckBox widget, 53DialogBox widget, 95FlexTable and Grid widgets, 74–76GadgetContainerView styles, 297–298GWT and, 291–292menu styles, 296MenuBar widget, 68rounding corners of gadgets, 298–299StackPanel widget, 81StackPanel widget, 82–83as standard used for GWT, 14SuggestBox widget, 57tab styles, 293–295ToggleButton/PushButton widgets, 52Tree widget, 66user interfaces on Gadget Desktop, 290–291

CSS (Cascading Style Sheets), building elegant interfaces, 200–212

connecting GWT widgets to CSS, 200–203overview of, 200sample application, 208–210specifying colors, 203specifying units, 203–205style rules, 201–203using cursor property, 210–212using font properties, 205using margin, border and padding properties,

207–208using text properties, 205–206

Ctrl+Click feature, Eclipse Java editor, 155–156cursor property, CSS, 210–212CustomButton class, ToggleButton/PushBut-

ton widgets, 49–52

DDAOs (Data Access Objects)

Actions version for server interface, 523–530asynchronous, 485–488function of, 486mapping to PHP, 522–523overview of, 480REST version for server interface, 538–542

Data format libraries, 117–125reading and writing JSON, 122–125reading and writing XML, 117–122

Data formats category, GWT library, 32–33Data types, JSON, 123Database Editor application, 479–554

Action API built with PHP, 523Actions for server integration, 507–508

asynchronous data access objects, 485–488automatic serialization to JSON, 521–522automatic serialization to XML, 521bypassing HTTP request limitations, 108code generator for, 238code generator, writing, 512–521DAO layer, writing Action version, 523–530DAO layer, writing REST version, 538–542dialogs for editing and creating objects, 502–507editor interface, 488extending/loading tree items, 490–494handling back button, 198Hibernate tool for storing the model, 548–553integrating with action-based PHP scripts,

522–523integrating with RPC servlet, 542–543integrating with Ruby on Rails, 530–531Manager pattern, 480–482model for, 482–485overview of, 479–480REST methods for server integration, 508–509RPC for server integration, 509–510RPC service, writing, 543–548Ruby on Rails for building REST API, 531–538serialization of classes, 510–512server integration, 507summary, 554Tree widget and SplitPanel widgets, 489–490workspace views, 494–502

DatabaseEditorView class, 489–490, 494–502Debug command. See also Debug mode, Eclipse

launching application from Eclipse using, 148–149

running JUnit test case from Eclipse, 173Debug mode, Eclipse, 158–164

adding exception breakpoints, 161–163fixing code while debugging, 163–164setting breakpoints, 158–161testing applications. see Testing applications

DeckPanel widgetMessengerView class implementing, 432–433overview of, 77–78StackPanel widget using, 82

DeferredCommand, 243delayTestFinish method, JUnit test case,

175–176delete command, ObjectView class, 499, 501DELETE method

REST and, 419–420, 508Ruby on Rails and, 541–542

Deploying applications, 183–190automating with Ant, 187–190servlet to servlet container, 184–186to web server, 184

Dewsbury.book Page 559 Wednesday, October 31, 2007 11:03 AM

560 Index

Design patterns, 256. See also sindividual patternDesign Patterns: Elements of Reusable Object-

Oriented Software (Gamma, Helm, Johnson, Vlissides), 256

Desktop application developers, 13–14Desktop applications

Ajax applications vs., 5–6GWT widgets modeled after, 15

DesktopConstants dictionary, 235DesktopView class

defining view for Gadget Desktop, 266HorizontalPanel and FlowPanel used for

column layout, 271–273HorizontalPanel widget used for menus,

267–269insertGadget method, 278–279TabPanel widget used for page selection,

269–271VerticalPanel widget used for main layout,

267Development background, evaluating for GWT,

11–14Ajax developers and, 13desktop application developers and, 13–14web application developers and, 13web designers and, 12web site developers and, 12

DialogBox widget, 93–95Dialogs, for editing and creating objects, 502–507Dictionary class, 234–235Directory structure, HelloWorld application,

164–168DisclosurePanel widget, 89–91, 329div tag

creating dynamic interface, 23–24creating widget based on Google Maps, 225SimplePanel vs. Composite widget, 441

Dockable gadgets, 283–284Dockable windows, 283DockableWidget

DeferredCommand, 243docking widgets between panels, 284–285dragging widgets using mouse events, 285–288

DockPanel widget, 78–79Document class, 119–122DOM (document object model)

creating external link widget using, 47creating new widgets with, 213–214user interface package, 31XML implementation of, 521

doPost method, Jetty Continuations, 476doSearch method, Button widget, 48doSearchTest method, JUnit test case, 174–176

Drag-and-drop gadgets, 283–284Dragging widgets, 285–288Dropping widgets, 288–290Dugg, defined, 8

EEclipse

adding projects to, 145–149Ajax application development using, 11creating classes when writing Java code,

149–153Eclipse Java editor for writing Java code,

153–157installing, 144–145internationalizing applications using localiza-

tion, 230–232Eclipse, debugging in, 158–164

adding exception breakpoints, 161–163fixing code while debugging, 163–164setting breakpoints, 158–161

Eclipse Editor, 151–152Eclipse Java editor, 153–157edit command

editing objects, 502–507ObjectView class, 499, 501

EditEntryView class, 378–381Element class, 119–120E-mail, polling protocols, 458–460EmptyCallback class, 457–458Encoded parameter types, Java, 216encoding attribute, HTML form tag, 508EntryPoint interface, 22, 450entry-point tag, organizing application struc-

ture, 166Errors

creating classes in Eclipse, 151–153internationalizing applications with constants,

228writing Java code using Eclipse Java editor,

154–155escapeHTML method, HTML widget, 42eval function

reading and writing JSON, 122using JSNI to extend GWT, 217

Event-based protocols, RPC events, 460–462ExampleFields interface, 241–242ExampleGenerator, 241–242Exception breakpoints, adding, 161–163execute method

IncrementalCommand, 243MenuBar widget, 68

Dewsbury.book Page 560 Wednesday, October 31, 2007 11:03 AM

Index 561

Extensible Markup Language. See XML (eXtensible Markup Language)

Extensible Stylesheet Language Transformations (XSLT), 354–356

External resources, creating link to, 47

FFeed aggregators, 320. See also Aggregator patternFeeds, types of, 343FileUpload widget, 62Filter interface, 247–248findDropContainer method, 289Find/Replace command, in Eclipse Java Editor,

155–156finishTest method, JUnit test case, 175fireClick method, ClickListenerCollection,

98Flash, 6–7FlashPanel widget, cross-browser support,

219–221Flex, 6–7FlexTable widget, 73–76, 441Flickr, 348–353FlowPanel widget

column layout for Gadget Desktop application, 271–273

HorizontalPanel widget vs., 71overview of, 70–71

FocusPanel widget, 86Fonts, CSS properties, 205–206Form encoding, 113–114form tag, HTML, 87Form widgets, 47–62

Button, 47–49Checkbox, 53defined, 37FileUpload, 62Hidden, 62ListBox, 54–55overview of, 47PasswordTextBox, 59–60PushButton, 49–52RadioButton, 54RichTextArea, 61–62SuggestBox, 56–58TextArea, 60TextBox, 58–59ToggleButton, 49–52

Formatsasynchronous HTTP requests, 107FlexTable widget, 75

number and value, creating interfaces with CSS, 203–205

reading and writing JSON, 122–125reading and writing XML, 117–122RichTextArea widget, 62

FormPanel class, 62FormPanel widget

integrating with traditional server-side technol-ogies, 114–116

overview of, 87–89

GGadget class, 261–262Gadget Desktop application, 255–318

Abstract Factory pattern, 258–259adding gadgets to view, 274–275benchmarking cookie test, 177–179browser interoperability and, 302–303buttons, 280–282column layout, 271–273columned container interface for, 264–266Container Application pattern, 256–257container for gadgets, 276–279cookies, 303–305CookieStorage class, 300–302CSS for cleaning up user interfaces, 290–291CSS styles added to menu, 296, 297–298CSS styles added to tabs, 293–295CSS styles for rounding corners of gadgets,

298–299CSS with GWT, 291–292docking widgets between panels, 284–285drag-and-drop gadgets, 283–284dragging widgets using mouse events, 285–288dropping widgets, 288–290Gadget class, 261–262GadgetClass class, 259–260Google Ajax API integrated with, 311–313Google Gears for storage, 306–309Google Maps API integrated with, 309–311ImageBundle, 236, 245JavaScript API and, 126JavaScript libraries for adding functionality to,

309main layout, 267menu, 267–269model for, 257–258overview of, 255–256page selection, 269–271persistency, 300RSS news gadget, 316–317

Dewsbury.book Page 561 Wednesday, October 31, 2007 11:03 AM

562 Index

Gadget Desktop application, continuedStrategy design pattern in, 219summary, 318user preferences, 262–264view for, 266weather gadget, 313–316

GadgetClass class, 259–260GadgetContainer widget, 274–275GadgetContainerView class

buttons for Gadget Desktop application, 280–282creating gadget containers, 276–279CSS styles added to Gadget Desktop containers,

297–298dragging widgets using mouse events, 285–288

GDataAtom as basis of, 402Blogger API and, 401–402Google account sign-in and, 403Google Base service and, 344

GearsStorage class, 306generate method

implementing code generator, 237–239internationalizing applications using localiza-

tion, 230–232SerializationGenerator class, 515–517writing, 239–242

Generated codegenerate method and, 239–242using, 235–237writing, 237–239

GeneratorContext, 238GET method

FormPanel widget, 88HTTP request limitations, 108as REST method, 417server integration, 508server-side technologies and, 112–114in traditional web applications, 15

getBasicFormatter method, RichTextArea widget, 62

getCellFormatter method, FlexTable widget, 75

getChatWindowView method, 435–436getContact method, ContactList class, 428getContactCount method, ContactList class,

428getCurrentUser method, Instant Messenger,

465–466getElementDocument method, XML, 118getElementText method, XML, 118getEvents method, Hanging RPC call, 462getEvents method, Instant Messenger, 463–468getExtended Formatter method,

RichTextArea widget, 62

getFlexCellFormatter method, FlexTable widget, 75

getHTML methodHTML widget, 41RichTextArea widget, 61

getItemText method, ListBox widget, 55getModuleName method, JUnit, 172getSelectedIndex method, ListBox widget,

55getText method, RichTextArea widget, 61getValuesAsString method, 303getView method, JUnit test case, 174Google

account sign-in, 403–410downloading Google APIs, 305purchase of Pyra Labs, 401

Google Ajax API, 311–313Google Base, 344–348Google Data API. See GDataGoogle Gears, 306–309Google Maps API

with Gadget Desktop, 309–311using JavaScript APIs with, 126

Google Web Toolkit. See GWT (Google Web Toolkit)Google Web Toolkit SDK, 17GoogleBaseSearch class, 347–348GoogleFeedRequest class

RSS news gadget, 316–317weather gadget, 313–316

GoogleMapsGadget class, 311Grid widget, 73–76guess method, creating dynamic interface, 25GWT (Google Web Toolkit), first steps, 3–36

emergence of Ajax, 3–5evaluating your background, 11–14GWT applications, 34–36importance of application development skills,

14–16installation, 140–144Quick Tutorial. See Quick Tutorialrethinking web applications, 5–8software engineering for Ajax, 8–11toolkit packages, 30–34

GWT (Google Web Toolkit), using effectivelybuilding new widgets, 212–215creating elegant interfaces. See CSS (Cascading

Style Sheets), building elegant interfacesgenerating code, 235–242handling back button, 197–200improving performance, 242–250internationalizing applications. See Interna-

tionalizing applicationsproviding cross-browser support, 218–221using asynchronous programming, 191–196

Dewsbury.book Page 562 Wednesday, October 31, 2007 11:03 AM

Index 563

using JavaScript Native Interface, 215–218using other JavaScript libraries, 221–226

gwt-HTML, 41GWT.create, 136gwt-Label, 39GWT-RPC

deploying servlet to servlet container, 184–186problems using Continuations with GWT-RPC,

475working with, 131–137

GWT-RPC, Instant Messenger applicationoverview of, 450–452RemoteService interface, 452–453RemoteServiceServlet class, 453using asynchronous interface, 454–456

gwt-servlet.jar filedeploying servlet to servlet container, 186installing GWT, 141using GWT-RPC, 134

GWTTestCase class, running JUnit test case, 170gwt.typeArgs Javadoc annotation, 463gwt-user.jar file

installing GWT, 141overview of, 30–31using modules, 180

.gz extension, for compression on servlet con-tainer, 250

gzipcompressing JavaScript files, 249compression on servlet container, 249–250

HHand pointer cursor, CSS, 211–212handleEvent method, Instant Messenger applica-

tion, 464–465Hanging RPC call, 462–465Hangman application, Ajax. See Quick TutorialHasFocus interface, Button widget, 48Hash values, caching on Apache, 246–247HashMap, 371HasHorizontalAlignment interface, 40HasHTML interface, 41HasName interface, 87HasWordWrap interface, 40Hello World gadgets

adding to Gadget Desktop, 279creating, 274–275

HelloWorld applicationadding projects to Eclipse, 145–149creating while installing GWT, 142organizing structure of, 164–168

HelloWorld class, 274–275

HelloWorldView class, 153Hibernate tool, storing Database Editor model,

548–553Hidden widget, 62Hierarchical structure

of modules, 182using Tree widget to show, 63

History feature, browser back button and, 197–200HistoryListener interface

back button and, 199Hyperlink widget implementing, 46

HorizontalPanel widgetcolumn layout for Gadget Desktop, 271–273Eclipse Java editor used with, 154–155menu layout for Gadget Desktop, 267–269MultiSearchView, 324overview of, 71–72TitleCommandBar widget and, 390

HorizontalSplitPanel widgetDatabaseEditorView class, 489–490overview of, 72–73

Hosted mode, GWT, 19–20HTML (HyperText Markup Language)

action attribute for HTML forms, 507building interfaces. See CSS (Cascading Style

Sheets), building elegant interfacescreating dynamic interface, 22–27CSS styles and, 292custom button settings, 52customizing generated GWT application, 20–22forms. See Form widgetsRichTextArea widget and, 383server integration with plain text and, 109–111XML vs., 117

HTML anchor, 197–200HTML widget

Google Maps API extending, 310HTMLPanel widget vs., 79–80overview of, 41–42

HTMLPanel widget, 79–80HTMLTable superclass, 73–74HTTP (HyperText Transfer Protocol)

REST as extension of, 364RPC technologies used over, 509in traditional web applications, 15web browsers and, 334

HTTP asynchronous requestsbasic server integration with, 106–109Hangman tutorial example, 27–29RequestBuilder class, 393–394

HTTP proxycross-domain RequestBuilder for proxy

servlet, 394–397overview of, 392–394

Dewsbury.book Page 563 Wednesday, October 31, 2007 11:03 AM

564 Index

HTTP proxy, continuedthird-party server integration using, 128writing proxy servlet, 397–401

HTTPProxy class, 397–401HTTPProxyRequestBuilder class, 394–397HTTPRequest class, 28HttpServlet, 476HttpURLConnection class, 400Hyperlink widget

building, 329–330ContactListView class, 441handling back button, 198–199overview of, 44–47

HyperText Markup Language. See HTML (Hyper-Text Markup Language)

HyperText Transfer Protocol. See HTTP (HyperText Transfer Protocol)

IIDE (Integrated Development Environment), Flex

using, 6il8nCreator script

installing GWT, 141internationalizing applications using, 230–232

Image widgetcreating dynamic interface, 24–25overview of, 42–44using image bundles, 246

ImageBundledecreasing application load time with, 11generated code, 235–237images as toolbar buttons, 383–386improving performance using, 244–246including resources with reusable modules

using, 183supplying images to title bar of Gadget Desktop

application, 280–282Tree widget using, 65writing code generator and, 237–239

Imagesadding to PushButton widget, 236–237setting for custom buttons, 52for title bar of Gadget Desktop application,

280–282Tree widget using, 65–66using image bundles to improve performance,

244–246Importing

creating classes in Eclipse, 152GWT project into Eclipse, 146–147writing Java code using Eclipse Java editor,

154–155

IncrementalCommand class, 193IncrementalCommand interface, 243–244Inheritance, 182initMap method, Google Map, 225initWidget method, Composite widget, 85initWidget method, Composite widget, 225–226Inline elements, 71Inline tags, CSS, 207input tag, HTML

CheckBox widget wrapping, 53FileUpload widget encapsulating, 62TextBox widget wrapping, 58

InputListener class, ChatWindowView class, 444–445

InsertGadget method, DesktopView class, 278–279

Instant Messenger application, 423–478adding RPC events, 458–465ChatWindowView class, 442–447Collaborator Application pattern, 423–424connecting to server, 456–458ContactListView class, 439–442controller, 447–450deploying servlet to servlet container, 186design, 425–426GWT-RPC and, 132, 134–137, 450–456MessengerView class, 432–436model for, 426–429overview of, 429–431server for, 465–470SignInView class, 436–438structure of, 167

Instant Messenger application, advanced server IO, 470–478

Comet on Tomcat, 472–475Continuations on Jetty, 475–478overview of, 470–472

Integrated Development Environment (IDE), Flex using, 6

Interfaces. See also User interface librarybuilding columned container interface for Gad-

get Desktop, 264–266cleaning up, 290–291creating dynamic, 22–27listeners, 325relationships between RPC classes and, 451two-paned interface for Database Editor, 488

Interfaces, CSS for elegant, 200–212color specification, 203connecting GWT widgets to CSS, 200–203cursor property, 210–212font properties, 205margin, border and padding properties, 207–208overview of, 200

Dewsbury.book Page 564 Wednesday, October 31, 2007 11:03 AM

Index 565

sample application, 208–210text properties, 205–206unit specification, 203–205

Internationalizing applications, 226–235declaring constants, 227–228declaring messages, 229–230defined, 226dictionary for, 234–235extension package for, 33localization tools, 230–232managing locales, 232–234overview of, 226–227RichTextToolbar, 383–386utility class package for, 33

IntRange constructor, for benchmarking code, 178IsSerializable interface

GWT-RPC using, 135–136Instant Messenger application and, 427RemoteService interface, 452

JJ2EE (Java 2 Enterprise Edition), 7JAR files

GWT modules distributed as, 180–181overview of, 30–31

JavaAjax application development, 11creating classes when writing Java code,

149–153CSS detaching from Java code, 292Eclipse Java editor for writing Java code,

153–157Hibernate tool, 548signature encodings for types in, 216

Java 2 Enterprise Edition (J2EE), 7Java Development Kit (JDK)

as GWT requirement, 17, 139installing, 140

Java FX, 8Java Runtime Environment (JRE)

installing, 140removed from Internet Explorer, 7

javac-version, GWT projects, 17java.lang, 33JavaScript

code management problem in, 15–16emergence of Ajax, 4–5Same Origin policy and, 335third-party server integration using JavaScript

API, 126

JavaScript librariesadding functionality to Gadget Desktop, 309Google Ajax API, 311–313Google Maps API, 309–311integrating other libraries into existing code,

221–226RSS news gadget, 316–317weather gadget, 313–316

JavaScript Native Interface. See JSNI (JavaScript Native Interface)

JavaScript Object Notation. See JSON (JavaScript Object Notation)

java.util, 33JClassType instance, 239, 241JDK (Java Development Kit)

as GWT requirement, 17, 139installing, 140

Jetty, using Continuations on, 475–478Join tables, 485JRE (Java Runtime Environment)

installing, 140removed from Internet Explorer, 7

JRE emulation category, GWT library, 33JSNI (JavaScript Native Interface)

accessing JavaScript methods, 310defined, 10integrating other libraries with, 221–226working with, 215–218

JSON (JavaScript Object Notation)automatic serialization to, 521–522browser importing structured data formats,

334Google Ajax API for JSON feeds, 311JSONP for loading JSON feeds, 336–339,

354–358libraries, 10reading and writing, 122–125transforming XML to, 354–356

JSONP (JSON with Padding)loading JSON feeds, 336–339third-party server integration using, 127–128

JSONRequest class, 127JSONRequestHandler Java interface, 218JUnit

Ajax application development using, 11benchmarking code through, 176–179testing applications using, 170–176utility class package for, 33

junitCreator scriptbenchmarking code through JUnit, 176–179installing GWT, 141running JUnit test case, 170–173

Dewsbury.book Page 565 Wednesday, October 31, 2007 11:03 AM

566 Index

KKeyboardListener interface

ChatWindowView class, 444–445MultiSearchView class, 327SignInView class, 438

KeyboardListenerAdapterimplementing in GWT, 97InputListener extending, 445

LLabel widget

creating dynamic interface, 24creating titles, 388HTML widget extending, 41hyperlinks and, 330overview of, 38–41

Latency, e-mail, 459Layout, Gadget Desktop, 267Layout panels

complex, 80–84simple. See Panels, simple layout

Length units, CSS, 205Letters widget, 24Library, GWT, 30–31Link widget

BlogView class, 373building, 329–330

Linkshandling back button, 198using Hyperlink widget, 44–47

ListBox widget, 54–55Listeners, 325ListView class, 495–497Load events, Image widget, 43–44load method, cookies, 304–305LoadingPanel widget, Blog Editor application,

386–388LoadListener interface, Image widget, 44Local class, asynchronous programming and, 194Locales, managing, 232–234Localization tools, 230–232Logical bugs, in JavaScript, 170

MManager pattern

Database Editor application, 480–482defined, 35

sample application, 35two-paned interface for Database Editor, 488

Many-to-many relationships, 485Margins, CSS properties, 207–208Mashups, 183MD5 hash function, 222–226me attribute, ContactList class, 427MenuItem class, 67–68Menus

CSS styles added to, 296Gadget Desktop, 267–269

message attribute, 427Message class, Instant Messenger application,

426–427, 429Messages interface

Constants interface vs., 229–230internationalizing applications with, 229–230localization and, 230–231managing locales, 232–234

Messenger class, Instant Messenger application, 449–450

MessengerService interfaceasynchronous interface, 454–456Comet on Tomcat and, 474GWT-RPC and, 451implementing instant messenger server,

465–470implementing RPC events, 463–465RemoteService interface, 452–453RemoteServiceServlet class, 453

MessengerServiceAsync interfaceasynchronous interface, 454–456GWT-RPC and, 451–452implementing RPC events, 463–465

MessengerServiceClientImpl classGWT-RPC and, 451implementing RPC events, 463–465Instant Messenger application, 450overview of, 456

MessengerServiceImpl classGWT-RPC and, 452implementing instant messenger server,

465–470MessengerView class

building Instant Messenger interface, 432–436ChatWindowView class, 444–447defined, 431

MessengerViewListener interface, 433method attribute, HTML form tag, 508Microsoft Silverlight, 7Mock objects, JUnit test case, 175mod_header module, caching on Apache, 247

Dewsbury.book Page 566 Wednesday, October 31, 2007 11:03 AM

Index 567

Modeling. See MVC (model-view-controller) architecture

Model-view-controller architecture. See MVC (model-view-controller) architecture

Modules, GWTcreating reusable, 181–182managing locales, 234sharing compiled application (mashups), 183using, 180–181

Mouse eventsdragging widgets, 285–288dropping widgets, 288–290Image widget supporting, 43

Move cursor, CSS, 210–211movies.txt file, 28Multimedia eXtensible Markup Language (MXML), 6Multiple document view, Blog Editor application,

367–369Multi-Search application, 319–359

Aggregator pattern, 319–321Amazon Search integration with, 354–358controller for, 331–333designing multi-search capability, 321–322Eclipse running JUnit test case, 170–176Flickr integration with, 348–353Google integration with, 344–348handling back button, 198JSNI extending GWT, 217JSON and, 125JSONP for loading JSON feeds, 336–339JSONP for server integration, 127Link widget for, 329–330modeling, 167, 322–323MultiSearchView class, 325–328overview of, 319Same Origin policy and, 334–336SearchResultsView class, 328–329structured data formats and, 334summary, 358–359view for, 324Yahoo! Search integration with, 340–344

MultiSearchView class, 324–328MultiSearchViewListener, 325MultiWordSuggestOracle, SuggestBox wid-

get, 56–57MVC (model-view-controller) architecture

Blog Editor application, 365–367, 369Database Editor application, 482–485Gadget Desktop application, 257–258Instant Messenger application, 426–429Multi-Search application, 167, 322organizing application structure, 167

MXML (Multimedia eXtensible Markup Language), 6mysql_query method, SuggestBox widget, 58

Nname attribute, Contact class, 427Name-value pairs, constants for internationaliza-

tion, 227–228New Class icon, Eclipse, 149new entry command, 373New Java Class dialog, Eclipse, 149–152NIO connector, 475no-arg constructor, IsSerializable interface,

427notify method, observer pattern, 96notifyAll method, instant messenger server,

467–469Number formats, CSS, 203–205

OObjectDAO interface, 486, 538–539ObjectFactory, 487, 493Objects

BaseObject class, 484dialogs for editing and creating, 502–507

ObjectView class, 495, 499, 501Observer pattern

event-based protocols benefiting from, 460–462implementing user interface events with,

95–100making server calls using HTTP library, 107–108

onBrowseEvent method, creating new widgets, 215onClick method

CheckBox widget, 53ClickListenerCollection, 98creating dynamic interface, 25

onCompletion method, asynchronous HTTP and, 28

onError method, Image widget, 44onFailure method

asynchronous interface, 454, 456GWT-RPC, 135

onHistoryChanged methodhandling back button, 199Hyperlink widget, 46

onKeyPress method, ChatWindowView class, 445onLoad method, Image widget, 44onModuleLoad method

asynchronous HTTP and, 28

Dewsbury.book Page 567 Wednesday, October 31, 2007 11:03 AM

568 Index

onModuleLoad method, continuedcreating dynamic interface, 24customizing generated application, 22Instant Messenger application controller, 450

onMouseMove method, 243, 288–289onResponseReceived method, asynchronous

HTTP requests, 107–108onSendMessage method

connecting to server, 457MessengerView class, 433

onSignIn methodconnecting to server, 457MessengerView class, 433SignInView class, 438

onSignOut methodconnecting to server, 457MessengerView class, 433SignInView class, 434

onSuccess methodconnecting to server, 457GWT-RPC, 135GWT-RPC using asynchronous interface,

454–455onTreeItemSelected method, Tree widget, 67onTreeItemStateChanged method, Tree wid-

get, 67onWindowClosed method, MessengerView class,

434onWindowClosing method, MessengerView

class, 434

PPadding, CSS properties, 207–208Pages, tab-based selection of gadget pages, 269–271Panels

docking widgets between, 284–285functionality of, 37–38overview of, 9

Panels, complex container, 87–95DialogBox widget, 93–95DisclosurePanel widget, 89–91FormPanel widget, 87–89PopupPanel widget, 91–92

Panels, complex layout, 80–84Panels, simple container, 84–86Panels, simple layout, 70–80

DeckPanel widget, 77–78DockPanel widget, 78–79FlexTable widget, 73–76FlowPanel widget, 70–71Grid widget, 73–76

HorizontalPanel widget vs., 71–72HorizontalSplitPanel widget, 72–73HTMLPanel widget, 79–80VerticalPanel widget, 71–72VerticalSplitPanel widget, 72–73

Parsing dataJSON data, 123with XML library, 117–118

Passwords, for secure hash function, 222–226PasswordTextBox widget, 59–60path attribute, GWT-RPC, 133PATH variable

adding GWT installation path to, 17–18installing GWT on, 141

PendingRequest class, Comet on Tomcat, 473–474

Percent format, 203–205Performance improvement, 242–250

caching on Apache, 246–247caching on servlet container, 247–248compression on Apache, 249compression on servlet container, 249–250handling long processing, 242–244ImageBundle for, 244–246

Persistencybrowser interoperability and, 302–303cookies, loading and saving, 303–305CookieStorage class, 300–302Google Gears for storage, 306–309maintaining state, 300

PHP scripts, 522–523Action API built with, 523integrating with traditional server-side technol-

ogies, 112–116SuggestBox widget, 57–58

Pixel format, 203–205Plain text, server integration with HTML and,

109–111Polling protocols, RPC events, 458–460PopupPanel widget

DialogBox widget extending, 93–95overview of, 91–92

POST methodFormPanel widget, 88HTTP proxy and, 397HTTP request limitations, 108as REST method, 417server integration and, 508server-side technologies and, 112–115

prefetch method, Image widget, 44PrintWriter, 238Progress cursor, CSS, 211–212projectCreator script, 141, 145–149

Dewsbury.book Page 568 Wednesday, October 31, 2007 11:03 AM

Index 569

Proxy servletcross-domain RequestBuilder for, 394–397overview of, 392–394writing, 397–401

PushButton widgetadding image to, 236–237buttons for Gadget Desktop application,

280–282ImageBundle and, 246overview of, 49–52

PUT methodas REST method, 417Ruby on Rails and, 541–542server integration and, 508

Pyra Labs, 401

QQuick Tutorial, 16–28

creating dynamic interface, 22–27customizing generated application, 20–22starting GWT project, 17–20using asynchronous HTTP, 27–29

RRadioButton widget, 54READ events, Comet on Tomcat, 472Refactor menu, 156–157register.php script, 114–116Relational databases, mapping Java classes and

relationships to, 548Remote procedure calls. See RPC (remote proce-

dure calls)RemoteService interface, 452–453RemoteServiceServlet class

GWT-RPC, 133, 451overview of, 453

removeStyleName method, connecting GWT widgets to CSS, 201

replace-with element, cross-browser support, 218Representational state transfer. See REST (repre-

sentational state transfer)RequestBuilder class

HTTP, 393for proxy servlet, 394–397

RequestCallback interfaceasynchronous HTTP requests, 107–108Blogger services, 411–412, 414–415

requestSuggestions method, SuggestBox widget, 57–58

resetChatWindowPositions method, Messen-gerView class, 434–436

ResponseTextHandler interface, asynchronous HTTP, 28

REST (representational state transfer)Amazon Search and, 354–356Atom and, 402building REST API with Ruby on Rails, 531–538as extension to HTTP, 364Flickr searches and, 348Google Base service and, 344overview of, 130–131sample applications, 35–36server integration with, 508–509web services and, 419XML listing of account blogs, 410–413Yahoo! Search and, 340–341

RESTObjectFactory class, 540Resume button, debugging in Eclipse, 159–160RGB notation, CSS, 203, 292RIAs (Rich Internet Applications), 6Rich text editing, adding to Blog Editor application,

381–382RichTextArea widget

Blog Editor application, 382–383overview of, 61–62

RichTextToolbar, Blog Editor application, 383–386

RootPanel class, Database Editor application, 489RoundedPanel class, for rounding widget corners,

298–299RPC (remote procedure calls). See also GWT-RPC

adding events to Instant Messenger application, 458–465

based on stateful servers, 129blog services and, 402Database Editor application integration with,

542–543Instant Messenger application controller and,

449–450server calls library package, 32server integration with, 509–510web services and, 363writing RPC service for Database Editor,

543–548XML-RPC, 129–130

RSS feedsaggregators and, 320building RSS news gadget, 316–317user preferences, 262–264

Ruby on Railsbuilding REST API, 531–538integrating Database Editor with, 530–531

Dewsbury.book Page 569 Wednesday, October 31, 2007 11:03 AM

570 Index

Rules, CSS, 201–203Run command, launching applications from

Eclipse, 148, 173

SSafari Browser, 108Same Origin policy

bypassing, 334–336overview of, 108third-party server integration and, 125

save method, cookies, 304Scaffolding, Ruby on Rails providing, 530script tag, JavaScript

Google Ajax API and, 312including JavaScript in module, 182integrating other libraries into existing code, 222JavaScript APIs and, 126server integration using JSONP, 127sharing compiled applications, 183

ScrollPanel widgetChatWindowView class, 444–445overview of, 85–86

Search engines. See also Multi-Search applicationAmazon Search integration with Multi-Search,

354–358Flickr integration with Multi-Search, 348–353Google Base integration with Multi-Search,

344–348Yahoo! Search integration with Multi-Search,

340–344Searcher classes

GoogleBaseSearch class, 347–348YahooSearcher class, 342–343

Searches, in Eclipse Java Editor, 155–157SearchResultsView class, 328–329Security

FormPanel widget, 89preventing server calls to third-party servers, 108

selectTab method, StackPanel widget, 84sendMessage method

instant messenger server, 467–468RemoteService interface, 452

SendMessageEvent, Instant Messenger, 464–465, 468

sendRequest method, asynchronous HTTP requests, 107

sendResponse method, Comet on Tomcat, 473–474

Sequential programming, 191–192Serializable interface

BaseObject class, 484

extending, 517GWT-RPC using, 135–136, 452, 543–548Instant Messenger application model, 427

Serialization of classesautomatic serialization to JSON, 521–522automatic serialization to XML, 521overview of, 510–512writing generic GWT code generator, 512–521

SerializationGenerator class, 514Server calls category, GWT library, 32Server integration techniques, 128–137

Actions, 507–508, 526–530basic, 106–111data format libraries, 117–124GWT-RPC, 131–137overview of, 507PHP scripts, 112–116REST methods, 508–509, 538–542RPC, 509–510stateful servers and, 128–129stateless servers and, 130third-party, 125–128

Serversconnecting Instant Messenger to, 456–458deploying Ajax to Web server, 184instant messenger functionality in, 465–470stateful, 128–129stateless, 130writing Action data access layer for server inter-

face, 526–530writing REST data access layer for server inter-

face, 538–542Servers, advanced IO, 470–478

Comet on Tomcat, 472–475Continuations on Jetty, 475–478overview of, 470–472

Servers, third-partyrestrictions preventing server calls to, 108Same Origin policy and, 125–128using HTTP proxy, 128using JavaScript APIs, 126using JSONP, 127–128

Server-side script technologies, 111ServiceDefTarget interface, GWT-RPC, 136,

451–452, 455Servlet container

caching on, 247–248compression on, 249–250deploying servlet to, 184–186

Session tokens, AuthSub interface, 404–410Sessions

defined, 129overview of, 466

Dewsbury.book Page 570 Wednesday, October 31, 2007 11:03 AM

Index 571

setCenter function, JSNI, 225setCenterImpl method, JSNI, 225setCharacterWidth method, TextArea widget,

60setChecked method, CheckBox widget, 53setHorizontalAlignment method, Label wid-

get, 40setHTML method

FlexTable and Grid widgets, 74HTML widget, 41RichTextArea widget, 61

setLeftWidget method, SplitPanel widgets, 73setMethod, FormPanel widget, 88setPopupPosition method, PopupPanel wid-

get, 91setPosition method

ChatWindowView class, 446–447MessengerView class implementing, 435

setRightWidget method, SplitPanel widgets, 73setStyleName method, connecting GWT widgets

to CSS, 201setText method

FlexTable and Grid widgets, 74RichTextArea widget, 61

setValuesFromString method, 303setVisible method, chat window, 435setVisibleItemCount method, ListBox wid-

get, 55setVisibleLines method, TextArea widget, 60setWidget method

FlexTable and Grid widgets, 74SimplePanel widget, 85

setWidth method, widgets, 205setWordWrap method, Label widget, 40Sharing compiled applications, 183show method, PopupPanel widget, 91Sign In view, DeckPanel widget, 77Signature encodings, for Java types, 216signIn method

Comet on Tomcat, 475RemoteService interface, 452SignInView class, 438

SignInCallback class, Instant Messenger appli-cation, 457, 463–464

SignInEvent, instant messenger server, 469SignInView class

building Instant Messenger interface, 436–438defined, 431–432handling chat windows, 436implementing WindowCloseListener, 434

SignOffEventInstant Messenger application, 464–465instant messenger server, 468

SignOnEventInstant Messenger application, 464–465instant messenger server, 468–469

signOut method, RemoteService interface, 452SignOutEvent, instant messenger server, 469Simple container panels, 84–86Simple layout panels. See Panels, simple layoutSimplePanel widget

ContactListView class implementing, 441FocusPanel vs., 86LoadingPanel widget and, 388overview of, 85PopupPanel widget vs., 91ScrollPanel widget extending, 85–86

sinkEvents method, when creating new widgets, 213

Slashdotted, defined, 9SOAP

replacing XML-RPC, 130server integration and, 509web services and, 363–364

Sockets, event-based protocols and, 461Software engineering

for Ajax. See Ajax (Asynchronous JavaScript and XML), software engineering for

for desktop applications, 5SourceClickEvents interface, Button widget,

48SourcesChangeEvents, TextBox widget, 58SourcesClickEvents interface

Image widget, 43TextBox widget, 58

SourcesFocusEvents, Button widget, 48SourcesLoadEvents interface, Image widget, 43SourcesMouseEvents interface, Image widget,

43SourceWriter class

code generation, 516–520generate method, 239

Split panels, 72SplitPanel widgets, Database Editor application,

489–490src/com/gwt examples directory, 164StackPanel widget

overview of, 80–81VerticalPanel widget vs., 81–82

Standard Widget Toolkit (SWT), Java, 7Standards

benefits of, 364–365GWT extensively using CSS, 14GWT interoperation through, 10lack of ActiveX, 7lack of Flash, 7

Dewsbury.book Page 571 Wednesday, October 31, 2007 11:03 AM

572 Index

startGame methodasynchronous HTTP and, 29dynamic interface, 24–25

State, maintaining. See PersistencyStateful server applications, 128–129Stateless server applications, 130States, button

CheckBox widget, 53CustomButton widget, 50–52overview of, 49–50

Static widgets, 38–47defined, 37HTML, 41–42Hyperlink, 44–47Image, 42–44Label, 38–41

Step Into button, debugging in Eclipse, 160Step Over button, debugging in Eclipse, 160Step Return button, debugging in Eclipse, 160Storage class, Google Gears for storage, 306–309Strategy pattern, cross-browser support using,

218–219String.split()method, asynchronous HTTP, 29Structured data formats, Multi-Search application

and, 334SuggestBox widget, 56–58SuggestOracle class, 56–57SWF files, in Adobe Flash and Flex, 6SWT (Standard Widget Toolkit), Java, 7

TTab index, FocusPanel widget, 86TabBar widget, StackPanel widget, 82–83table, HTML tags, 73TableListener interface, Grid widget, 75–76TabPanel class, 77TabPanel widget

CSS styles added to Gadget Desktop tabs, 293–295

overview of, 81–84RoundedPanel class for rounding widget cor-

ners, 298–299StackPanel widget using, 83–84tab-based selection of gadget pages, 269–271

Tabs, CSS styles added to, 293–295tar command, extracting GWT download with, 140Targets, automating deployment with Ant, 188–189TCP/IP, event-based protocols with, 461Terminate button, debugging in Eclipse, 159–160TestCase class, running JUnit test case from

Eclipse, 170

Testing applications, 168–179benchmarking, 176–179overview of, 168–170using JUnit, 170–176

testSimpleString method, benchmarking and, 178

Textaligning in Label widget, 40CSS font properties, 205–206server integration with HTML and plain text,

109–111setting for custom buttons, 52

Text class, accessing XML data with, 119–120TextArea widget

Blog Editor application, 382overview of, 60

TextBox widgetChatWindowView class, 444overview of, 58–59PasswordTextBox widget vs., 58–59

Third-party serversrestrictions preventing server calls to, 108Same Origin policy and, 125–128using HTTP proxy, 128using JavaScript APIs, 126using JSONP, 127–128

TitleCommandBar class, 389TitleCommandBar widget

BlogView class, 373ChatWindowView class, 444DatabaseEditorView class, 495EditEntryView class, 380overview of, 388–390

ToggleButton widgetGadget Desktop application, 280–282overview of, 49–52

TomcatComet on, 472–475compression option, 249–250deploying servlet to servlet container, 185–186GWT-RPC with, 133–134proxy servlet running in, 400

Toolkit packages, 30–34Tooltips, displaying errors in Java, 152toString method

reading and writing JSON, 124searching in Eclipse, 156

Tree widgetDatabase Editor application, 489–490extending/loading tree items, 490–494MenuBar widget vs., 67

TreeItem class, 64–65, 490–494TreeListener interface, 66–67

Dewsbury.book Page 572 Wednesday, October 31, 2007 11:03 AM

Index 573

Tutorial, GWTcreating dynamic interface, 22–27customizing generated application, 20–22starting, 17–20using asynchronous HTTP, 27–29

Type_x_Y.properties, managing locales, 233TypeOracle, generate method and, 239, 241

UUML diagrams, 331. See also MVC (model-view-

controller) architectureURL.encode method, 113URL.encodeComponent method, 113URLs

handling back button, 198–199linking to, 330specifying locale using URL parameters, 234using Hyperlink widget, 44–47using Image widget, 42–43

User interface library, 37–103. See also Interfacescomplex widgets, 63–69defining, 31event interfaces, 95–100feature interfaces, 100–103form widgets. See Form widgetsoverview of, 37–38panels, complex container. See Panels, complex

containerpanels, complex layout, 80–84panels, simple container, 84–86panels, simple layout. See Panels, simple layoutstatic widgets. See Static widgets

User preferences, gadgets, 262–264UserInfo class, instant messenger server, 466UserInfo instance, instant messenger server,

468–469Utility classes category, GWT library, 33

VValue formats, CSS, 203–205VerticalPanel widget

BlogView class, 373ChatWindowView class, 444as child widget of ScrollPanel, 85–86for main layout of Gadget Desktop, 267overview of, 71–72SignInView class setting, 438StackPanel widget vs., 80–81

VerticalSplitPanel widget, 72–73Views

adding gadgets to view, 274–275Gadget Desktop application, 266Multi-Search application, 324

Wwait method, instant messenger server, 467Weather gadget, building, 313–316Web application developers, 13Web applications

adopting Ajax techniques to build, 5Database Editor. See Database Editor applicationrethinking, 5–8traditional vs. GWT, 15

Web browsers. See BrowsersWeb designers, 12Web servers, deploying applications to, 184Web services. See also Blog Editor application

GWT interoperation through, 10interacting with, 393

Web services client, Blog Editor application, 363–365

Web site developers, 12Web support

Adobe Flex, 7Ant download, 187Eclipse download, 144Google Web Toolkit SDK download, 17, 140hash functions, 222hex values for standard colors, 203–204Instant Messenger application, 423Java resources, 18–19JDK download, 17, 140Microsoft Silverlight, 7ScrollPanel widget methods, 86for this book, xxiXML data access, 119

Web technologies, GWT and, 14–15WEB-INF directory, 134, 186Widgets

connecting to CSS, 200–203creating dynamic interface using, 24–27creating new, 212–215docking between panels, 284–285dragging using mouse events, 285–288event interfaces, 95–100feature interfaces, 100–103Google Map, integrating in GWT application,

224–226

Dewsbury.book Page 573 Wednesday, October 31, 2007 11:03 AM

574 Index

Widgets, continuedmargin, border and padding properties, 207–209modeled after desktop applications, 15overview of, 9–10user interface package and, 31

Widgets, types ofcomplex, 63–69complex container panels. See Panels, complex

containercomplex layout panels, 80–84form. See Form widgetssimple container panels, 84–86simple layout panels. See Panels, simple layoutstatic. See Static widgets

WindowCloseListener interface, MessengerView class, 432, 434

Window.getClientHeight method, ChatWindowView class, 446

Window.getClientWidth method, ChatWindowView class, 446

WindowResizeListener interface, MessengerView class, 432, 434

Windows, dockable, 283Word processor, Ajax, 362Word wrap, Label widget, 40Workspace pattern

Blog Editor application based on, 361–363defined, 34sample application, 35

Workspacesloading in Eclipse, 145–147workspace views in Database Editor applica-

tion, 494–502Writely, 362

XXML (eXtensible Markup Language)

Ant accepting XML build files, 187Atom syndication format for, 402automatic serialization to XML, 521blog entry listing with, 413–415blog listing with, 410–413browsers importing structured data formats

and, 334creating and saving blog entries, 416–419Google Ajax API for XML feeds, 311GWT interoperation through XML libraries, 10JSON vs., 122–125reading and writing, 117–122server calls package, 32transforming XML to JSON, 354–356web services and, 363

XMLHttpRequest objectevent-based protocols and, 461–462server calls library package, 32toolkit packages using, 32

XML-RPCoverview of, 129server integration and, 509SOAP replacing, 130

XSLT (Extensible Stylesheet Language Transforma-tions), 354–356

YYahoo! Search, 340–344YahooSearcher class, 342–343

Dewsbury.book Page 574 Wednesday, October 31, 2007 11:03 AM