<<

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

Index

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

556 Index

Ajax (Asynchronous JavaScript and XML), continued AWS (Amazon Web Services), 354–356 automating deployment with Ant, 187–190 AWT (Abstract Window Toolkit), Java, 31 building and sharing modules, 180–183 debugging in Eclipse, 158–164 deploying servlet to servlet container, 184–186 B deploying to web server, 184 installing Eclipse, 144–145 Back button, handling in Ajax, 197–200 installing GWT, 140–144 BaseObject class, 484 installing JDK, 140 Benchmarking, for testing applications, 176–179 organizing application structure, 164–168 Binding, browser interoperability and, 302–303 overview of, 8–11 Block elements testing applications. See Testing applications CSS properties, 207–209 using modules, 180–181 defined, 71 writing Java code in Eclipse, 149–157 Blocking operations, in asynchronous program- Amazon Search, 354–358 ming, 192 Amazon Web Services (AWS), 354–356 Blog class, 365–367 Anonymous classes, 194–195 Blog Editor application, 361–422 Ant script, 187–190 Publishing Protocol and GData and, 402 Apache BlogEditorView class, 370–372 caching on, 246–247 BlogEntryView class, 376–378 compression on, 249 BloggerService class, 402–403 API key, widget based on Google Map, 224 BlogView class, 372–376 Application patterns, 34–35 bypassing HTTP request limitations, 108 applicationCreator script controller for, 390–392 creating module with, 182 creating new widgets, 213 installing GWT, 141–142 cross-domain RequestBuilder for proxy organizing application structure, 164–168 servlet, 394–397 Applications. See also Web applications delete requests for blog entries, 419–420 development skills, 14–16 designing, 365 internationalizing. See Internationalizing appli- EditEntryView class, 378–381 cations sign-in, 403–410 sharing compiled, 183 HTTP Proxy servlet, building, 392–394 APR connector, 475 ImageBundle, internationalization, and AsyncCallback interface, 134–135, 454–456 RichTextToolbar, 383–386 asyncGet method, HTTPRequest, 28 integration with, 401 Asynchronous HTTP requests integration with stateless servers, 130–131 server integration techniques, 106–109 LoadingPanel widget, 386–388 using, 27–29 model for, 365–367 Asynchronous interface, GWT-RPC using, 454–456 multiple document view for, 367–369 Asynchronous JavaScript and XML. See Ajax (Asyn- overview of, 361 chronous JavaScript and XML) page relationships in, 368 Asynchronous programming, 191–196 reading and writing XML, 120–121 blocking operations and, 192 rich text editing added to, 381–382 features in GWT, 193–196 RichTextArea widget, 382–383 IncrementalCommand class, 193 summary, 421–422 sequential vs., 191–192 third-party server integration, 128 Atom TitleCommandBar widget, 388–390 aggregators and, 320 web services , building, 363–365 GData protocol based on, 344 Workspace pattern, 361–363 RSS feeds and, 402 writing proxy servlet, 397–401 AtomEnabled Alliance, 402 XML for creating and saving blog entries, 416–419 Authentication, 222–226 XML listing of blog entries, 413–415 AuthSub interface, 404–410 XML listing of blogs, 410–413 Dewsbury.book Page 557 Wednesday, October 31, 2007 11:03 AM

Index 557

BlogEditorView class, 370–372 Chat windows BlogEntry class, 365–367, 416–419 building Instant Messenger interface, 430–431 BlogEntryView class, 376–378 MessengerView class handling, 432–436 BloggerService class, 402–403 ChatWindowView class Blogs building Instant Messenger interface, 442–447 defined, 361 ContactListView class, 441–442 improvements in usability, 4 defined, 431 BlogView class, 372–376 MessengerView class, 435–436 BlogViewListener interface, 371 CheckBox widget Borders, CSS properties, 207–208 overview of, 53 Breakpoints, in Eclipse RadioButton widget vs., 54 adding exception, 161–163 class attribute, GWT-RPC, 133 debugging Eclipse, 158–161 Classes broadcastEvent method, instant messenger anonymous, 194–195 server, 468–469 Eclipse, 149–153 Browsers Eclipse Java editor for writing Java code, back button and history and, 197–200 153–157 CookieStorage class and, 300–302 implementing code generator, 239 Google Gears for storage, 306–309 Instant Messenger applications, 426–428, 449 GWT support across, 218–221 local, 194 handling differences between, 302–303 RPC interfaces and, 451 importing structured data formats, 334 ClassSourceFileComposwerFactory, 239 Same Origin policy and, 334–336 cleanString method, instant messenger server, Button states, Button widget, 50–52 468 Button widget Click events, Image widgets, 43 button states, 50–52 ClickListener creating dynamic interface, 25 creating dynamic interface, 25 overview of, 47–49 EditEntryView class, 378–381 Buttons Hyperlink widget, 441 Button widget, 47–49 MultiSearchView class, 327 CheckBox widget, 53 ClickListenerCollection, 98 Gadget Desktop, 280–282 Clients PushButton widget, 49–52 web services client, 363–365 RadioButton widget, 54 writing Action data access layer for, 526–530 ToggleButton widget, 49–52 closeChatWindow method, 435, 444 Code generators, 235–242 automatic serialization to JSON, 521–522 automatic serialization to XML, 521 generate method, 239–242 Cache-control header generic GWT code generator, 512–521 caching on Apache, 247 scaffolding and, 530 caching on servlet container, 247–248 working with, 235–237 Caching writing, 237–239 on Apache, 246–247 Code management, in Ajax applications, 16 on servlet container, 247–248 Code syntax coloring, in Java, 153–154 Callbacks Collaborator pattern services, 414–415 applied to instant messaging, 423–426 third-party server integration using JSONP, 127 defined, 34 Calling stack, debugging in Eclipse, 161 Color Cascading Style Sheets. See CSS (Cascading Style creating interfaces with CSS, 203–204 Sheets) hex values for standard, 203–204 Challenge, defined, 222 in Java code syntax, 153–154 ChangeTableDialog class, DialogBox widget, 93 RGB notation, 292 Dewsbury.book Page 558 Wednesday, October 31, 2007 11:03 AM

558 Index

Column layout, Gadget Desktop, 271–273 Contact List view, DeckPanel widget, 77 Columned container interface, Gadget Desktop, ContactClickListener class, Hyperlink wid- 264–266 get, 441 Comet, using on Tomcat, 472–475 ContactList class com.google.gwt.core.ext, 33, 237–239 Instant Messenger, 427–428 com.google.gwt.http.client, 32 server connections, 457 com.google.gwt.il8n.client, 33 ContactListView class com.google.gwt..client, 33 chat windows, 436 com.google.gwt..client, 33 defined, 431 com.google.gwt.user.client, 31 Instant Messenger, 439–442 com.google.gwt.user.client.ui, 31 MessengerView class displaying, 432, 433 com.google.gwt.user.User module, 166 Container panels com.google.gwt..client, 32–33 complex. See Panels, complex container com.google.user.client.rpc, 32 simple, 84–86 com.google.user.server.rpc, 32 Container pattern Command interface, MenuBar widget using, 68 defined, 34 CommandBar widget, 495 Gadget Desktop application, 256–257 Compilation sample application, 35 Ajax application development, 11 Containers Ant for application deployment, 189–190 building columned container interface for deploying applications to web server with, 184 Gadget Desktop, 264–266 generating code during setup. See Code CSS styles added to Gadget Desktop containers, generators 297–298 installing GWT, 142–144 dockable windows and, 283 organizing application structure, 168 for gadgets, 276–279 sharing compiled applications, 183 Continuations, using on Jetty, 475–478 Complex container panels. See Panels, complex Controller container Blog Editor application, 390–392 Complex layout panels, 80–84 Instant Messenger application, 447–450 Complex widgets Multi-Search application, 331–333 defined, 37 Cookie class, 300 MenuBar, 67–69 CookieConstants class, 302–303 Tree, 63–67 Cookies Composite widget client-side storage with, 300–302 BlogEditorView class extending, 370 loading and saving, 303–305 BlogView class extending, 373 CookieStorage class, 177, 300–302 DatabaseEditorView class extending, 489 create command integrating in GWT application, 225–226 creating objects, 502–507 MessengerView class extending, 432 Database Editor application, 495–497 MultiSearchView class extending, 326 create method overview of, 84–85 creating Constants interface, 227 SignInView class extending, 438 creating ImageBundle, 236 SimplePanel widget vs., 85, 441 creating interface, 230 TitleCommandBar widget extending, 389 DisclosurePanel widget, 91 Compression createCallbackFunction, JSNI, 217 on Apache, 249 createMessages flag, localization, 230–231 on servlet container, 249–250 Creating, reading, updating, and deleting (CRUD) Connections, HTTP request limitations, 108–109 application processes and, 480 Constant interface HTTP methods, 364 Dictionary class vs., 235 Cross-browser support, 218–221 internationalizing applications with, 227–228 CRUD (creating, reading, updating, and deleting) managing locales, 232–234 application processes and, 480 Contact class, Instant Messenger, 426–428 HTTP methods, 364 Dewsbury.book Page 559 Wednesday, October 31, 2007 11:03 AM

Index 559

CSS (Cascading Style Sheets) asynchronous data access objects, 485–488 ChatWindowView class, 447 automatic serialization to JSON, 521–522 CheckBox widget, 53 automatic serialization to XML, 521 DialogBox widget, 95 bypassing HTTP request limitations, 108 FlexTable and Grid widgets, 74–76 code generator for, 238 GadgetContainerView styles, 297–298 code generator, writing, 512–521 GWT and, 291–292 DAO layer, writing Action version, 523–530 menu styles, 296 DAO layer, writing REST version, 538–542 MenuBar widget, 68 dialogs for editing and creating objects, 502–507 rounding corners of gadgets, 298–299 editor interface, 488 StackPanel widget, 81 extending/loading tree items, 490–494 StackPanel widget, 82–83 handling back button, 198 as standard used for GWT, 14 tool for storing the model, 548–553 SuggestBox widget, 57 integrating with action-based PHP scripts, tab styles, 293–295 522–523 ToggleButton/PushButton widgets, 52 integrating with RPC servlet, 542–543 Tree widget, 66 integrating with , 530–531 user interfaces on Gadget Desktop, 290–291 Manager pattern, 480–482 CSS (Cascading Style Sheets), building elegant model for, 482–485 interfaces, 200–212 overview of, 479–480 connecting GWT widgets to CSS, 200–203 REST methods for server integration, 508–509 overview of, 200 RPC for server integration, 509–510 sample application, 208–210 RPC service, writing, 543–548 specifying colors, 203 Ruby on Rails for building REST API, 531–538 specifying units, 203–205 serialization of classes, 510–512 style rules, 201–203 server integration, 507 using cursor property, 210–212 summary, 554 using font properties, 205 Tree widget and SplitPanel widgets, 489–490 using margin, border and padding properties, workspace views, 494–502 207–208 DatabaseEditorView class, 489–490, 494–502 using text properties, 205–206 Debug command. See also Debug mode, Eclipse Ctrl+Click feature, Eclipse Java editor, 155–156 launching application from Eclipse using, cursor property, CSS, 210–212 148–149 CustomButton class, ToggleButton/PushBut- running JUnit test case from Eclipse, 173 ton widgets, 49–52 Debug mode, Eclipse, 158–164 adding exception breakpoints, 161–163 fixing code while debugging, 163–164 setting breakpoints, 158–161 testing applications. see Testing applications DAOs (Data Access Objects) DeckPanel widget Actions version for server interface, 523–530 MessengerView class implementing, 432–433 asynchronous, 485–488 overview of, 77–78 function of, 486 StackPanel widget using, 82 mapping to PHP, 522–523 DeferredCommand, 243 overview of, 480 delayTestFinish method, JUnit test case, REST version for server interface, 538–542 175–176 Data format libraries, 117–125 delete command, ObjectView class, 499, 501 reading and writing JSON, 122–125 DELETE method reading and writing XML, 117–122 REST and, 419–420, 508 Data formats category, GWT library, 32–33 Ruby on Rails and, 541–542 Data types, JSON, 123 Deploying applications, 183–190 Database Editor application, 479–554 automating with Ant, 187–190 Action API built with PHP, 523 servlet to servlet container, 184–186 Actions for server integration, 507–508 to web server, 184 Dewsbury.book Page 560 Wednesday, October 31, 2007 11:03 AM

560 Index

Design patterns, 256. See also sindividual pattern Drag-and-drop gadgets, 283–284 Design Patterns: Elements of Reusable Object- Dragging widgets, 285–288 Oriented Software (Gamma, Helm, Johnson, Dropping widgets, 288–290 Vlissides), 256 Dugg, defined, 8 Desktop application developers, 13–14 Desktop applications Ajax applications vs., 5–6 E GWT widgets modeled after, 15 DesktopConstants dictionary, 235 Eclipse DesktopView class adding projects to, 145–149 defining view for Gadget Desktop, 266 Ajax application development using, 11 HorizontalPanel and FlowPanel used for creating classes when writing Java code, column layout, 271–273 149–153 HorizontalPanel widget used for menus, Eclipse Java editor for writing Java code, 267–269 153–157 insertGadget method, 278–279 installing, 144–145 TabPanel widget used for page selection, internationalizing applications using localiza- 269–271 tion, 230–232 VerticalPanel widget used for main layout, Eclipse, debugging in, 158–164 267 adding exception breakpoints, 161–163 Development background, evaluating for GWT, fixing code while debugging, 163–164 11–14 setting breakpoints, 158–161 Ajax developers and, 13 Eclipse Editor, 151–152 desktop application developers and, 13–14 Eclipse Java editor, 153–157 web application developers and, 13 edit command web designers and, 12 editing objects, 502–507 web site developers and, 12 ObjectView class, 499, 501 DialogBox widget, 93–95 EditEntryView class, 378–381 Dialogs, for editing and creating objects, 502–507 Element class, 119–120 Dictionary class, 234–235 E-mail, polling protocols, 458–460 Directory structure, HelloWorld application, EmptyCallback class, 457–458 164–168 Encoded parameter types, Java, 216 DisclosurePanel widget, 89–91, 329 encoding attribute, HTML form tag, 508 div tag EntryPoint interface, 22, 450 creating dynamic interface, 23–24 entry-point tag, organizing application struc- creating widget based on , 225 ture, 166 SimplePanel vs. Composite widget, 441 Errors Dockable gadgets, 283–284 creating classes in Eclipse, 151–153 Dockable windows, 283 internationalizing applications with constants, DockableWidget 228 DeferredCommand, 243 writing Java code using Eclipse Java editor, docking widgets between panels, 284–285 154–155 dragging widgets using mouse events, 285–288 escapeHTML method, HTML widget, 42 DockPanel widget, 78–79 eval function Document class, 119–122 reading and writing JSON, 122 DOM () using JSNI to extend GWT, 217 creating external link widget using, 47 Event-based protocols, RPC events, 460–462 creating new widgets with, 213–214 ExampleFields interface, 241–242 package, 31 ExampleGenerator, 241–242 XML implementation of, 521 Exception breakpoints, adding, 161–163 doPost method, Jetty Continuations, 476 execute method doSearch method, Button widget, 48 IncrementalCommand, 243 doSearchTest method, JUnit test case, 174–176 MenuBar widget, 68 Dewsbury.book Page 561 Wednesday, October 31, 2007 11:03 AM

Index 561

Extensible Markup Language. See XML (eXtensible number and value, creating interfaces with CSS, Markup Language) 203–205 Extensible Stylesheet Language Transformations reading and writing JSON, 122–125 (XSLT), 354–356 reading and writing XML, 117–122 External resources, creating link to, 47 RichTextArea widget, 62 FormPanel class, 62 FormPanel widget F integrating with traditional server-side technol- ogies, 114–116 Feed aggregators, 320. See also Aggregator pattern overview of, 87–89 Feeds, types of, 343 FileUpload widget, 62 Filter interface, 247–248 G findDropContainer method, 289 Find/Replace command, in Eclipse Java Editor, Gadget class, 261–262 155–156 Gadget Desktop application, 255–318 finishTest method, JUnit test case, 175 Abstract Factory pattern, 258–259 fireClick method, ClickListenerCollection, adding gadgets to view, 274–275 98 benchmarking cookie test, 177–179 Flash, 6–7 browser interoperability and, 302–303 FlashPanel widget, cross-browser support, buttons, 280–282 219–221 column layout, 271–273 Flex, 6–7 columned container interface for, 264–266 FlexTable widget, 73–76, 441 Container Application pattern, 256–257 Flickr, 348–353 container for gadgets, 276–279 FlowPanel widget cookies, 303–305 column layout for Gadget Desktop application, CookieStorage class, 300–302 271–273 CSS for cleaning up user interfaces, 290–291 HorizontalPanel widget vs., 71 CSS styles added to menu, 296, 297–298 overview of, 70–71 CSS styles added to tabs, 293–295 FocusPanel widget, 86 CSS styles for rounding corners of gadgets, Fonts, CSS properties, 205–206 298–299 Form encoding, 113–114 CSS with GWT, 291–292 form tag, HTML, 87 docking widgets between panels, 284–285 Form widgets, 47–62 drag-and-drop gadgets, 283–284 Button, 47–49 dragging widgets using mouse events, 285–288 Checkbox, 53 dropping widgets, 288–290 defined, 37 Gadget class, 261–262 FileUpload, 62 GadgetClass class, 259–260 Hidden, 62 Google Ajax API integrated with, 311–313 ListBox, 54–55 Google Gears for storage, 306–309 overview of, 47 Google Maps API integrated with, 309–311 PasswordTextBox, 59–60 ImageBundle, 236, 245 PushButton, 49–52 JavaScript API and, 126 RadioButton, 54 JavaScript libraries for adding functionality to, RichTextArea, 61–62 309 SuggestBox, 56–58 main layout, 267 TextArea, 60 menu, 267–269 TextBox, 58–59 model for, 257–258 ToggleButton, 49–52 overview of, 255–256 Formats page selection, 269–271 asynchronous HTTP requests, 107 persistency, 300 FlexTable widget, 75 RSS news gadget, 316–317 Dewsbury.book Page 562 Wednesday, October 31, 2007 11:03 AM

562 Index

Gadget Desktop application, continued getFlexCellFormatter method, FlexTable Strategy design pattern in, 219 widget, 75 summary, 318 getHTML method user preferences, 262–264 HTML widget, 41 view for, 266 RichTextArea widget, 61 weather gadget, 313–316 getItemText method, ListBox widget, 55 GadgetClass class, 259–260 getModuleName method, JUnit, 172 GadgetContainer widget, 274–275 getSelectedIndex method, ListBox widget, GadgetContainerView class 55 buttons for Gadget Desktop application, 280–282 getText method, RichTextArea widget, 61 creating gadget containers, 276–279 getValuesAsString method, 303 CSS styles added to Gadget Desktop containers, getView method, JUnit test case, 174 297–298 Google dragging widgets using mouse events, 285–288 account sign-in, 403–410 GData downloading Google , 305 Atom as basis of, 402 purchase of Pyra Labs, 401 Blogger API and, 401–402 Google Ajax API, 311–313 Google account sign-in and, 403 , 344–348 Google Base service and, 344 Google Data API. See GData GearsStorage class, 306 Google Gears, 306–309 generate method Google Maps API implementing code generator, 237–239 with Gadget Desktop, 309–311 internationalizing applications using localiza- using JavaScript APIs with, 126 tion, 230–232 . See GWT (Google Web Toolkit) SerializationGenerator class, 515–517 Google Web Toolkit SDK, 17 writing, 239–242 GoogleBaseSearch class, 347–348 Generated code GoogleFeedRequest class generate method and, 239–242 RSS news gadget, 316–317 using, 235–237 weather gadget, 313–316 writing, 237–239 GoogleMapsGadget class, 311 GeneratorContext, 238 Grid widget, 73–76 GET method guess method, creating dynamic interface, 25 FormPanel widget, 88 GWT (Google Web Toolkit), first steps, 3–36 HTTP request limitations, 108 emergence of Ajax, 3–5 as REST method, 417 evaluating your background, 11–14 server integration, 508 GWT applications, 34–36 server-side technologies and, 112–114 importance of application development skills, in traditional web applications, 15 14–16 getBasicFormatter method, RichTextArea installation, 140–144 widget, 62 Quick Tutorial. See Quick Tutorial getCellFormatter method, FlexTable widget, rethinking web applications, 5–8 75 software engineering for Ajax, 8–11 getChatWindowView method, 435–436 toolkit packages, 30–34 getContact method, ContactList class, 428 GWT (Google Web Toolkit), using effectively getContactCount method, ContactList class, building new widgets, 212–215 428 creating elegant interfaces. See CSS (Cascading getCurrentUser method, Instant Messenger, Style Sheets), building elegant interfaces 465–466 generating code, 235–242 getElementDocument method, XML, 118 handling back button, 197–200 getElementText method, XML, 118 improving performance, 242–250 getEvents method, Hanging RPC call, 462 internationalizing applications. See Interna- getEvents method, Instant Messenger, 463–468 tionalizing applications getExtended Formatter method, providing cross-browser support, 218–221 RichTextArea widget, 62 using asynchronous programming, 191–196 Dewsbury.book Page 563 Wednesday, October 31, 2007 11:03 AM

Index 563

using JavaScript Native Interface, 215–218 HelloWorldView class, 153 using other JavaScript libraries, 221–226 Hibernate tool, storing Database Editor model, gwt-HTML, 41 548–553 GWT.create, 136 Hidden widget, 62 gwt-Label, 39 Hierarchical structure GWT-RPC of modules, 182 deploying servlet to servlet container, 184–186 using Tree widget to show, 63 problems using Continuations with GWT-RPC, History feature, browser back button and, 197–200 475 HistoryListener interface working with, 131–137 back button and, 199 GWT-RPC, Instant Messenger application Hyperlink widget implementing, 46 overview of, 450–452 HorizontalPanel widget RemoteService interface, 452–453 column layout for Gadget Desktop, 271–273 RemoteServiceServlet class, 453 Eclipse Java editor used with, 154–155 using asynchronous interface, 454–456 menu layout for Gadget Desktop, 267–269 gwt-servlet.jar file MultiSearchView, 324 deploying servlet to servlet container, 186 overview of, 71–72 installing GWT, 141 TitleCommandBar widget and, 390 using GWT-RPC, 134 HorizontalSplitPanel widget GWTTestCase class, running JUnit test case, 170 DatabaseEditorView class, 489–490 gwt.typeArgs Javadoc annotation, 463 overview of, 72–73 gwt-user.jar file Hosted mode, GWT, 19–20 installing GWT, 141 HTML (HyperText Markup Language) overview of, 30–31 action attribute for HTML forms, 507 using modules, 180 building interfaces. See CSS (Cascading Style .gz extension, for compression on servlet con- Sheets), building elegant interfaces tainer, 250 creating dynamic interface, 22–27 gzip CSS styles and, 292 compressing JavaScript , 249 custom button settings, 52 compression on servlet container, 249–250 customizing generated GWT application, 20–22 forms. See Form widgets RichTextArea widget and, 383 H server integration with plain text and, 109–111 XML vs., 117 Hand pointer cursor, CSS, 211–212 HTML anchor, 197–200 handleEvent method, Instant Messenger applica- HTML widget tion, 464–465 Google Maps API extending, 310 Hanging RPC call, 462–465 HTMLPanel widget vs., 79–80 Hangman application, Ajax. See Quick Tutorial overview of, 41–42 HasFocus interface, Button widget, 48 HTMLPanel widget, 79–80 Hash values, caching on Apache, 246–247 HTMLTable superclass, 73–74 HashMap, 371 HTTP (HyperText Transfer Protocol) HasHorizontalAlignment interface, 40 REST as extension of, 364 HasHTML interface, 41 RPC technologies used over, 509 HasName interface, 87 in traditional web applications, 15 HasWordWrap interface, 40 web browsers and, 334 Hello World gadgets HTTP asynchronous requests adding to Gadget Desktop, 279 basic server integration with, 106–109 creating, 274–275 Hangman tutorial example, 27–29 HelloWorld application RequestBuilder class, 393–394 adding projects to Eclipse, 145–149 HTTP proxy creating while installing GWT, 142 cross-domain RequestBuilder for proxy organizing structure of, 164–168 servlet, 394–397 HelloWorld class, 274–275 overview of, 392–394 Dewsbury.book Page 564 Wednesday, October 31, 2007 11:03 AM

564 Index

HTTP proxy, continued IncrementalCommand class, 193 third-party server integration using, 128 IncrementalCommand interface, 243–244 writing proxy servlet, 397–401 Inheritance, 182 HTTPProxy class, 397–401 initMap method, Google Map, 225 HTTPProxyRequestBuilder class, 394–397 initWidget method, Composite widget, 85 HTTPRequest class, 28 initWidget method, Composite widget, 225–226 HttpServlet, 476 Inline elements, 71 HttpURLConnection class, 400 Inline tags, CSS, 207 Hyperlink widget input tag, HTML building, 329–330 CheckBox widget wrapping, 53 ContactListView class, 441 FileUpload widget encapsulating, 62 handling back button, 198–199 TextBox widget wrapping, 58 overview of, 44–47 InputListener class, ChatWindowView class, HyperText Markup Language. See HTML (Hyper- 444–445 Text Markup Language) InsertGadget method, DesktopView class, HyperText Transfer Protocol. See HTTP (HyperText 278–279 Transfer Protocol) Instant Messenger application, 423–478 adding RPC events, 458–465 ChatWindowView class, 442–447 I Collaborator Application pattern, 423–424 connecting to server, 456–458 IDE (Integrated Development Environment), Flex ContactListView class, 439–442 using, 6 controller, 447–450 il8nCreator script deploying servlet to servlet container, 186 installing GWT, 141 design, 425–426 internationalizing applications using, 230–232 GWT-RPC and, 132, 134–137, 450–456 Image widget MessengerView class, 432–436 creating dynamic interface, 24–25 model for, 426–429 overview of, 42–44 overview of, 429–431 using image bundles, 246 server for, 465–470 ImageBundle SignInView class, 436–438 decreasing application load time with, 11 structure of, 167 generated code, 235–237 Instant Messenger application, advanced server IO, images as toolbar buttons, 383–386 470–478 improving performance using, 244–246 Comet on Tomcat, 472–475 including resources with reusable modules Continuations on Jetty, 475–478 using, 183 overview of, 470–472 supplying images to title bar of Gadget Desktop Integrated Development Environment (IDE), Flex application, 280–282 using, 6 Tree widget using, 65 Interfaces. See also User interface library writing code generator and, 237–239 building columned container interface for Gad- Images get Desktop, 264–266 adding to PushButton widget, 236–237 cleaning up, 290–291 setting for custom buttons, 52 creating dynamic, 22–27 for title bar of Gadget Desktop application, listeners, 325 280–282 relationships between RPC classes and, 451 Tree widget using, 65–66 two-paned interface for Database Editor, 488 using image bundles to improve performance, Interfaces, CSS for elegant, 200–212 244–246 color specification, 203 Importing connecting GWT widgets to CSS, 200–203 creating classes in Eclipse, 152 cursor property, 210–212 GWT project into Eclipse, 146–147 font properties, 205 writing Java code using Eclipse Java editor, margin, border and padding properties, 207–208 154–155 overview of, 200 Dewsbury.book Page 565 Wednesday, October 31, 2007 11:03 AM

Index 565

sample application, 208–210 JavaScript libraries text properties, 205–206 adding functionality to Gadget Desktop, 309 unit specification, 203–205 Google Ajax API, 311–313 Internationalizing applications, 226–235 Google Maps API, 309–311 declaring constants, 227–228 integrating other libraries into existing code, declaring messages, 229–230 221–226 defined, 226 RSS news gadget, 316–317 dictionary for, 234–235 weather gadget, 313–316 extension package for, 33 JavaScript Native Interface. See JSNI (JavaScript localization tools, 230–232 Native Interface) managing locales, 232–234 JavaScript Object Notation. See JSON (JavaScript overview of, 226–227 Object Notation) RichTextToolbar, 383–386 java.util, 33 utility class package for, 33 JClassType instance, 239, 241 IntRange constructor, for benchmarking code, 178 JDK () IsSerializable interface as GWT requirement, 17, 139 GWT-RPC using, 135–136 installing, 140 Instant Messenger application and, 427 Jetty, using Continuations on, 475–478 RemoteService interface, 452 Join , 485 JRE (Java Runtime Environment) installing, 140 J removed from Explorer, 7 JRE emulation category, GWT library, 33 J2EE (Java 2 Enterprise Edition), 7 JSNI (JavaScript Native Interface) JAR files accessing JavaScript methods, 310 GWT modules distributed as, 180–181 defined, 10 overview of, 30–31 integrating other libraries with, 221–226 Java working with, 215–218 Ajax application development, 11 JSON (JavaScript Object Notation) creating classes when writing Java code, automatic serialization to, 521–522 149–153 browser importing structured data formats, CSS detaching from Java code, 292 334 Eclipse Java editor for writing Java code, Google Ajax API for JSON feeds, 311 153–157 JSONP for loading JSON feeds, 336–339, Hibernate tool, 548 354–358 signature encodings for types in, 216 libraries, 10 Java 2 Enterprise Edition (J2EE), 7 reading and writing, 122–125 Java Development Kit (JDK) transforming XML to, 354–356 as GWT requirement, 17, 139 JSONP (JSON with Padding) installing, 140 loading JSON feeds, 336–339 Java FX, 8 third-party server integration using, 127–128 Java Runtime Environment (JRE) JSONRequest class, 127 installing, 140 JSONRequestHandler Java interface, 218 removed from , 7 JUnit javac-version, GWT projects, 17 Ajax application development using, 11 java.lang, 33 benchmarking code through, 176–179 JavaScript testing applications using, 170–176 code management problem in, 15–16 utility class package for, 33 emergence of Ajax, 4–5 junitCreator script Same Origin policy and, 335 benchmarking code through JUnit, 176–179 third-party server integration using JavaScript installing GWT, 141 API, 126 running JUnit test case, 170–173 Dewsbury.book Page 566 Wednesday, October 31, 2007 11:03 AM

566 Index

K sample application, 35 two-paned interface for Database Editor, 488 KeyboardListener interface Many-to-many relationships, 485 ChatWindowView class, 444–445 Margins, CSS properties, 207–208 MultiSearchView class, 327 Mashups, 183 SignInView class, 438 MD5 hash function, 222–226 KeyboardListenerAdapter me attribute, ContactList class, 427 implementing in GWT, 97 MenuItem class, 67–68 InputListener extending, 445 Menus CSS styles added to, 296 Gadget Desktop, 267–269 L message attribute, 427 Message class, Instant Messenger application, Label widget 426–427, 429 creating dynamic interface, 24 Messages interface creating titles, 388 Constants interface vs., 229–230 HTML widget extending, 41 internationalizing applications with, 229–230 hyperlinks and, 330 localization and, 230–231 overview of, 38–41 managing locales, 232–234 Latency, e-mail, 459 Messenger class, Instant Messenger application, Layout, Gadget Desktop, 267 449–450 Layout panels MessengerService interface complex, 80–84 asynchronous interface, 454–456 simple. See Panels, simple layout Comet on Tomcat and, 474 Length units, CSS, 205 GWT-RPC and, 451 Letters widget, 24 implementing instant messenger server, Library, GWT, 30–31 465–470 Link widget implementing RPC events, 463–465 BlogView class, 373 RemoteService interface, 452–453 building, 329–330 RemoteServiceServlet class, 453 Links MessengerServiceAsync interface handling back button, 198 asynchronous interface, 454–456 using Hyperlink widget, 44–47 GWT-RPC and, 451–452 ListBox widget, 54–55 implementing RPC events, 463–465 Listeners, 325 MessengerServiceClientImpl class ListView class, 495–497 GWT-RPC and, 451 Load events, Image widget, 43–44 implementing RPC events, 463–465 load method, cookies, 304–305 Instant Messenger application, 450 LoadingPanel widget, Blog Editor application, overview of, 456 386–388 MessengerServiceImpl class LoadListener interface, Image widget, 44 GWT-RPC and, 452 Local class, asynchronous programming and, 194 implementing instant messenger server, Locales, managing, 232–234 465–470 Localization tools, 230–232 MessengerView class Logical bugs, in JavaScript, 170 building Instant Messenger interface, 432–436 ChatWindowView class, 444–447 defined, 431 M MessengerViewListener interface, 433 method attribute, HTML form tag, 508 Manager pattern , 7 Database Editor application, 480–482 Mock objects, JUnit test case, 175 defined, 35 mod_header module, caching on Apache, 247 Dewsbury.book Page 567 Wednesday, October 31, 2007 11:03 AM

Index 567

Modeling. See MVC (model-view-controller) MXML (Multimedia eXtensible Markup Language), 6 architecture mysql_query method, SuggestBox widget, 58 Model-view-controller architecture. See MVC (model-view-controller) architecture Modules, GWT N creating reusable, 181–182 managing locales, 234 name attribute, Contact class, 427 sharing compiled application (mashups), 183 Name-value pairs, constants for internationaliza- using, 180–181 tion, 227–228 Mouse events New Class icon, Eclipse, 149 dragging widgets, 285–288 new entry command, 373 dropping widgets, 288–290 New Java Class , Eclipse, 149–152 Image widget supporting, 43 NIO connector, 475 Move cursor, CSS, 210–211 no-arg constructor, IsSerializable interface, movies.txt file, 28 427 Multimedia eXtensible Markup Language (MXML), 6 notify method, observer pattern, 96 Multiple document view, Blog Editor application, notifyAll method, instant messenger server, 367–369 467–469 Multi-Search application, 319–359 Number formats, CSS, 203–205 Aggregator pattern, 319–321 Amazon Search integration with, 354–358 controller for, 331–333 O designing multi-search capability, 321–322 Eclipse running JUnit test case, 170–176 ObjectDAO interface, 486, 538–539 Flickr integration with, 348–353 ObjectFactory, 487, 493 Google integration with, 344–348 Objects handling back button, 198 BaseObject class, 484 JSNI extending GWT, 217 dialogs for editing and creating, 502–507 JSON and, 125 ObjectView class, 495, 499, 501 JSONP for loading JSON feeds, 336–339 Observer pattern JSONP for server integration, 127 event-based protocols benefiting from, 460–462 Link widget for, 329–330 implementing user interface events with, modeling, 167, 322–323 95–100 MultiSearchView class, 325–328 making server calls using HTTP library, 107–108 overview of, 319 onBrowseEvent method, creating new widgets, 215 Same Origin policy and, 334–336 onClick method SearchResultsView class, 328–329 CheckBox widget, 53 structured data formats and, 334 ClickListenerCollection, 98 summary, 358–359 creating dynamic interface, 25 view for, 324 onCompletion method, asynchronous HTTP and, Yahoo! Search integration with, 340–344 28 MultiSearchView class, 324–328 onError method, Image widget, 44 MultiSearchViewListener, 325 onFailure method MultiWordSuggestOracle, SuggestBox wid- asynchronous interface, 454, 456 get, 56–57 GWT-RPC, 135 MVC (model-view-controller) architecture onHistoryChanged method Blog Editor application, 365–367, 369 handling back button, 199 Database Editor application, 482–485 Hyperlink widget, 46 Gadget Desktop application, 257–258 onKeyPress method, ChatWindowView class, 445 Instant Messenger application, 426–429 onLoad method, Image widget, 44 Multi-Search application, 167, 322 onModuleLoad method organizing application structure, 167 asynchronous HTTP and, 28 Dewsbury.book Page 568 Wednesday, October 31, 2007 11:03 AM

568 Index

onModuleLoad method, continued HorizontalPanel widget vs., 71–72 creating dynamic interface, 24 HorizontalSplitPanel widget, 72–73 customizing generated application, 22 HTMLPanel widget, 79–80 Instant Messenger application controller, 450 VerticalPanel widget, 71–72 onMouseMove method, 243, 288–289 VerticalSplitPanel widget, 72–73 onResponseReceived method, asynchronous Parsing data HTTP requests, 107–108 JSON data, 123 onSendMessage method with XML library, 117–118 connecting to server, 457 Passwords, for secure hash function, 222–226 MessengerView class, 433 PasswordTextBox widget, 59–60 onSignIn method path attribute, GWT-RPC, 133 connecting to server, 457 PATH variable MessengerView class, 433 adding GWT installation path to, 17–18 SignInView class, 438 installing GWT on, 141 onSignOut method PendingRequest class, Comet on Tomcat, connecting to server, 457 473–474 MessengerView class, 433 Percent format, 203–205 SignInView class, 434 Performance improvement, 242–250 onSuccess method caching on Apache, 246–247 connecting to server, 457 caching on servlet container, 247–248 GWT-RPC, 135 compression on Apache, 249 GWT-RPC using asynchronous interface, compression on servlet container, 249–250 454–455 handling long processing, 242–244 onTreeItemSelected method, Tree widget, 67 ImageBundle for, 244–246 onTreeItemStateChanged method, Tree wid- Persistency get, 67 browser interoperability and, 302–303 onWindowClosed method, MessengerView class, cookies, loading and saving, 303–305 434 CookieStorage class, 300–302 onWindowClosing method, MessengerView Google Gears for storage, 306–309 class, 434 maintaining state, 300 PHP scripts, 522–523 Action API built with, 523 P integrating with traditional server-side technol- ogies, 112–116 Padding, CSS properties, 207–208 SuggestBox widget, 57–58 Pages, tab-based selection of gadget pages, 269–271 format, 203–205 Panels Plain text, server integration with HTML and, docking widgets between, 284–285 109–111 functionality of, 37–38 Polling protocols, RPC events, 458–460 overview of, 9 PopupPanel widget Panels, complex container, 87–95 DialogBox widget extending, 93–95 DialogBox widget, 93–95 overview of, 91–92 DisclosurePanel widget, 89–91 POST method FormPanel widget, 87–89 FormPanel widget, 88 PopupPanel widget, 91–92 HTTP proxy and, 397 Panels, complex layout, 80–84 HTTP request limitations, 108 Panels, simple container, 84–86 as REST method, 417 Panels, simple layout, 70–80 server integration and, 508 DeckPanel widget, 77–78 server-side technologies and, 112–115 DockPanel widget, 78–79 prefetch method, Image widget, 44 FlexTable widget, 73–76 PrintWriter, 238 FlowPanel widget, 70–71 Progress cursor, CSS, 211–212 Grid widget, 73–76 projectCreator script, 141, 145–149 Dewsbury.book Page 569 Wednesday, October 31, 2007 11:03 AM

Index 569

Proxy servlet resetChatWindowPositions method, Messen- cross-domain RequestBuilder for, 394–397 gerView class, 434–436 overview of, 392–394 ResponseTextHandler interface, asynchronous writing, 397–401 HTTP, 28 PushButton widget REST (representational state transfer) adding image to, 236–237 Amazon Search and, 354–356 buttons for Gadget Desktop application, Atom and, 402 280–282 building REST API with Ruby on Rails, 531–538 ImageBundle and, 246 as extension to HTTP, 364 overview of, 49–52 Flickr searches and, 348 PUT method Google Base service and, 344 as REST method, 417 overview of, 130–131 Ruby on Rails and, 541–542 sample applications, 35–36 server integration and, 508 server integration with, 508–509 Pyra Labs, 401 web services and, 419 XML listing of account blogs, 410–413 Yahoo! Search and, 340–341 Q RESTObjectFactory class, 540 Resume button, debugging in Eclipse, 159–160 Quick Tutorial, 16–28 RGB notation, CSS, 203, 292 creating dynamic interface, 22–27 RIAs (Rich Internet Applications), 6 customizing generated application, 20–22 Rich text editing, adding to Blog Editor application, starting GWT project, 17–20 381–382 using asynchronous HTTP, 27–29 RichTextArea widget Blog Editor application, 382–383 overview of, 61–62 R RichTextToolbar, Blog Editor application, 383–386 RadioButton widget, 54 RootPanel class, Database Editor application, 489 READ events, Comet on Tomcat, 472 RoundedPanel class, for rounding widget corners, Refactor menu, 156–157 298–299 register. script, 114–116 RPC (remote procedure calls). See also GWT-RPC Relational databases, mapping Java classes and adding events to Instant Messenger application, relationships to, 548 458–465 Remote procedure calls. See RPC (remote proce- based on stateful servers, 129 dure calls) blog services and, 402 RemoteService interface, 452–453 Database Editor application integration with, RemoteServiceServlet class 542–543 GWT-RPC, 133, 451 Instant Messenger application controller and, overview of, 453 449–450 removeStyleName method, connecting GWT server calls library package, 32 widgets to CSS, 201 server integration with, 509–510 replace-with element, cross-browser support, 218 web services and, 363 Representational state transfer. See REST (repre- writing RPC service for Database Editor, sentational state transfer) 543–548 RequestBuilder class XML-RPC, 129–130 HTTP, 393 RSS feeds for proxy servlet, 394–397 aggregators and, 320 RequestCallback interface building RSS news gadget, 316–317 asynchronous HTTP requests, 107–108 user preferences, 262–264 Blogger services, 411–412, 414–415 Ruby on Rails requestSuggestions method, SuggestBox building REST API, 531–538 widget, 57–58 integrating Database Editor with, 530–531 Dewsbury.book Page 570 Wednesday, October 31, 2007 11:03 AM

570 Index

Rules, CSS, 201–203 extending, 517 Run command, launching applications from GWT-RPC using, 135–136, 452, 543–548 Eclipse, 148, 173 Instant Messenger application model, 427 Serialization of classes automatic serialization to JSON, 521–522 S automatic serialization to XML, 521 overview of, 510–512 Browser, 108 writing generic GWT code generator, 512–521 Same Origin policy SerializationGenerator class, 514 bypassing, 334–336 Server calls category, GWT library, 32 overview of, 108 Server integration techniques, 128–137 third-party server integration and, 125 Actions, 507–508, 526–530 save method, cookies, 304 basic, 106–111 Scaffolding, Ruby on Rails providing, 530 data format libraries, 117–124 script tag, JavaScript GWT-RPC, 131–137 Google Ajax API and, 312 overview of, 507 including JavaScript in module, 182 PHP scripts, 112–116 integrating other libraries into existing code, 222 REST methods, 508–509, 538–542 JavaScript APIs and, 126 RPC, 509–510 server integration using JSONP, 127 stateful servers and, 128–129 sharing compiled applications, 183 stateless servers and, 130 ScrollPanel widget third-party, 125–128 ChatWindowView class, 444–445 Servers overview of, 85–86 connecting Instant Messenger to, 456–458 Search engines. See also Multi-Search application deploying Ajax to Web server, 184 Amazon Search integration with Multi-Search, instant messenger functionality in, 465–470 354–358 stateful, 128–129 Flickr integration with Multi-Search, 348–353 stateless, 130 Google Base integration with Multi-Search, writing Action data access layer for server inter- 344–348 face, 526–530 Yahoo! Search integration with Multi-Search, writing REST data access layer for server inter- 340–344 face, 538–542 Searcher classes Servers, advanced IO, 470–478 GoogleBaseSearch class, 347–348 Comet on Tomcat, 472–475 YahooSearcher class, 342–343 Continuations on Jetty, 475–478 Searches, in Eclipse Java Editor, 155–157 overview of, 470–472 SearchResultsView class, 328–329 Servers, third-party Security restrictions preventing server calls to, 108 FormPanel widget, 89 Same Origin policy and, 125–128 preventing server calls to third-party servers, 108 using HTTP proxy, 128 selectTab method, StackPanel widget, 84 using JavaScript APIs, 126 sendMessage method using JSONP, 127–128 instant messenger server, 467–468 Server-side script technologies, 111 RemoteService interface, 452 ServiceDefTarget interface, GWT-RPC, 136, SendMessageEvent, Instant Messenger, 464–465, 451–452, 455 468 Servlet container sendRequest method, asynchronous HTTP caching on, 247–248 requests, 107 compression on, 249–250 sendResponse method, Comet on Tomcat, deploying servlet to, 184–186 473–474 Session tokens, AuthSub interface, 404–410 Sequential programming, 191–192 Sessions Serializable interface defined, 129 BaseObject class, 484 overview of, 466 Dewsbury.book Page 571 Wednesday, October 31, 2007 11:03 AM

Index 571

setCenter function, JSNI, 225 SignOnEvent setCenterImpl method, JSNI, 225 Instant Messenger application, 464–465 setCharacterWidth method, TextArea widget, instant messenger server, 468–469 60 signOut method, RemoteService interface, 452 setChecked method, CheckBox widget, 53 SignOutEvent, instant messenger server, 469 setHorizontalAlignment method, Label wid- Simple container panels, 84–86 get, 40 Simple layout panels. See Panels, simple layout setHTML method SimplePanel widget FlexTable and Grid widgets, 74 ContactListView class implementing, 441 HTML widget, 41 FocusPanel vs., 86 RichTextArea widget, 61 LoadingPanel widget and, 388 setLeftWidget method, SplitPanel widgets, 73 overview of, 85 setMethod, FormPanel widget, 88 PopupPanel widget vs., 91 setPopupPosition method, PopupPanel wid- ScrollPanel widget extending, 85–86 get, 91 sinkEvents method, when creating new widgets, setPosition method 213 ChatWindowView class, 446–447 Slashdotted, defined, 9 MessengerView class implementing, 435 SOAP setRightWidget method, SplitPanel widgets, 73 replacing XML-RPC, 130 setStyleName method, connecting GWT widgets server integration and, 509 to CSS, 201 web services and, 363–364 setText method Sockets, event-based protocols and, 461 FlexTable and Grid widgets, 74 Software engineering RichTextArea widget, 61 for Ajax. See Ajax (Asynchronous JavaScript and setValuesFromString method, 303 XML), software engineering for setVisible method, chat window, 435 for desktop applications, 5 setVisibleItemCount method, ListBox wid- SourceClickEvents interface, Button widget, get, 55 48 setVisibleLines method, TextArea widget, 60 SourcesChangeEvents, TextBox widget, 58 setWidget method SourcesClickEvents interface FlexTable and Grid widgets, 74 Image widget, 43 SimplePanel widget, 85 TextBox widget, 58 setWidth method, widgets, 205 SourcesFocusEvents, Button widget, 48 setWordWrap method, Label widget, 40 SourcesLoadEvents interface, Image widget, 43 Sharing compiled applications, 183 SourcesMouseEvents interface, Image widget, show method, PopupPanel widget, 91 43 Sign In view, DeckPanel widget, 77 SourceWriter class Signature encodings, for Java types, 216 code generation, 516–520 signIn method generate method, 239 Comet on Tomcat, 475 Split panels, 72 RemoteService interface, 452 SplitPanel widgets, Database Editor application, SignInView class, 438 489–490 SignInCallback class, Instant Messenger appli- src/com/gwt examples directory, 164 cation, 457, 463–464 StackPanel widget SignInEvent, instant messenger server, 469 overview of, 80–81 SignInView class VerticalPanel widget vs., 81–82 building Instant Messenger interface, 436–438 Standard (SWT), Java, 7 defined, 431–432 Standards handling chat windows, 436 benefits of, 364–365 implementing WindowCloseListener, 434 GWT extensively using CSS, 14 SignOffEvent GWT interoperation through, 10 Instant Messenger application, 464–465 lack of ActiveX, 7 instant messenger server, 468 lack of Flash, 7 Dewsbury.book Page 572 Wednesday, October 31, 2007 11:03 AM

572 Index

startGame method Testing applications, 168–179 asynchronous HTTP and, 29 benchmarking, 176–179 dynamic interface, 24–25 overview of, 168–170 State, maintaining. See Persistency using JUnit, 170–176 Stateful server applications, 128–129 testSimpleString method, benchmarking and, Stateless server applications, 130 178 States, button Text CheckBox widget, 53 aligning in Label widget, 40 CustomButton widget, 50–52 CSS font properties, 205–206 overview of, 49–50 server integration with HTML and plain text, Static widgets, 38–47 109–111 defined, 37 setting for custom buttons, 52 HTML, 41–42 Text class, accessing XML data with, 119–120 Hyperlink, 44–47 TextArea widget Image, 42–44 Blog Editor application, 382 Label, 38–41 overview of, 60 Step Into button, debugging in Eclipse, 160 TextBox widget Step Over button, debugging in Eclipse, 160 ChatWindowView class, 444 Step Return button, debugging in Eclipse, 160 overview of, 58–59 Storage class, Google Gears for storage, 306–309 PasswordTextBox widget vs., 58–59 Strategy pattern, cross-browser support using, Third-party servers 218–219 restrictions preventing server calls to, 108 String.split()method, asynchronous HTTP, 29 Same Origin policy and, 125–128 Structured data formats, Multi-Search application using HTTP proxy, 128 and, 334 using JavaScript APIs, 126 SuggestBox widget, 56–58 using JSONP, 127–128 SuggestOracle class, 56–57 TitleCommandBar class, 389 SWF files, in Adobe Flash and Flex, 6 TitleCommandBar widget SWT (), Java, 7 BlogView class, 373 ChatWindowView class, 444 DatabaseEditorView class, 495 T EditEntryView class, 380 overview of, 388–390 Tab index, FocusPanel widget, 86 ToggleButton widget TabBar widget, StackPanel widget, 82–83 Gadget Desktop application, 280–282 table, HTML tags, 73 overview of, 49–52 TableListener interface, Grid widget, 75–76 Tomcat TabPanel class, 77 Comet on, 472–475 TabPanel widget compression option, 249–250 CSS styles added to Gadget Desktop tabs, deploying servlet to servlet container, 185–186 293–295 GWT-RPC with, 133–134 overview of, 81–84 proxy servlet running in, 400 RoundedPanel class for rounding widget cor- Toolkit packages, 30–34 ners, 298–299 Tooltips, displaying errors in Java, 152 StackPanel widget using, 83–84 toString method tab-based selection of gadget pages, 269–271 reading and writing JSON, 124 Tabs, CSS styles added to, 293–295 searching in Eclipse, 156 tar command, extracting GWT download with, 140 Tree widget Targets, automating deployment with Ant, 188–189 Database Editor application, 489–490 TCP/IP, event-based protocols with, 461 extending/loading tree items, 490–494 Terminate button, debugging in Eclipse, 159–160 MenuBar widget vs., 67 TestCase class, running JUnit test case from TreeItem class, 64–65, 490–494 Eclipse, 170 TreeListener interface, 66–67 Dewsbury.book Page 573 Wednesday, October 31, 2007 11:03 AM

Index 573

Tutorial, GWT VerticalSplitPanel widget, 72–73 creating dynamic interface, 22–27 Views customizing generated application, 20–22 adding gadgets to view, 274–275 starting, 17–20 Gadget Desktop application, 266 using asynchronous HTTP, 27–29 Multi-Search application, 324 Type_x_Y.properties, managing locales, 233 TypeOracle, generate method and, 239, 241 W U wait method, instant messenger server, 467 Weather gadget, building, 313–316 UML diagrams, 331. See also MVC (model-view- Web application developers, 13 controller) architecture Web applications URL.encode method, 113 adopting Ajax techniques to build, 5 URL.encodeComponent method, 113 Database Editor. See Database Editor application URLs rethinking, 5–8 handling back button, 198–199 traditional vs. GWT, 15 linking to, 330 Web browsers. See Browsers specifying locale using URL parameters, 234 Web designers, 12 using Hyperlink widget, 44–47 Web servers, deploying applications to, 184 using Image widget, 42–43 Web services. See also Blog Editor application User interface library, 37–103. See also Interfaces GWT interoperation through, 10 complex widgets, 63–69 interacting with, 393 defining, 31 Web services client, Blog Editor application, event interfaces, 95–100 363–365 feature interfaces, 100–103 Web site developers, 12 form widgets. See Form widgets Web support overview of, 37–38 Adobe Flex, 7 panels, complex container. See Panels, complex Ant download, 187 container Eclipse download, 144 panels, complex layout, 80–84 Google Web Toolkit SDK download, 17, 140 panels, simple container, 84–86 hash functions, 222 panels, simple layout. See Panels, simple layout hex values for standard colors, 203–204 static widgets. See Static widgets Instant Messenger application, 423 User preferences, gadgets, 262–264 Java resources, 18–19 UserInfo class, instant messenger server, 466 JDK download, 17, 140 UserInfo instance, instant messenger server, Microsoft Silverlight, 7 468–469 ScrollPanel widget methods, 86 Utility classes category, GWT library, 33 for this book, xxi XML data access, 119 Web technologies, GWT and, 14–15 V WEB-INF directory, 134, 186 Widgets Value formats, CSS, 203–205 connecting to CSS, 200–203 VerticalPanel widget creating dynamic interface using, 24–27 BlogView class, 373 creating new, 212–215 ChatWindowView class, 444 docking between panels, 284–285 as child widget of ScrollPanel, 85–86 dragging using mouse events, 285–288 for main layout of Gadget Desktop, 267 event interfaces, 95–100 overview of, 71–72 feature interfaces, 100–103 SignInView class setting, 438 Google Map, integrating in GWT application, StackPanel widget vs., 80–81 224–226 Dewsbury.book Page 574 Wednesday, October 31, 2007 11:03 AM

574 Index

Widgets, continued X margin, border and padding properties, 207–209 modeled after desktop applications, 15 XML (eXtensible Markup Language) overview of, 9–10 Ant accepting XML build files, 187 user interface package and, 31 Atom syndication format for, 402 Widgets, types of automatic serialization to XML, 521 complex, 63–69 blog entry listing with, 413–415 complex container panels. See Panels, complex blog listing with, 410–413 container browsers importing structured data formats complex layout panels, 80–84 and, 334 form. See Form widgets creating and saving blog entries, 416–419 simple container panels, 84–86 Google Ajax API for XML feeds, 311 simple layout panels. See Panels, simple layout GWT interoperation through XML libraries, 10 static. See Static widgets JSON vs., 122–125 WindowCloseListener interface, reading and writing, 117–122 MessengerView class, 432, 434 server calls package, 32 Window.getClientHeight method, transforming XML to JSON, 354–356 ChatWindowView class, 446 web services and, 363 Window.getClientWidth method, XMLHttpRequest object ChatWindowView class, 446 event-based protocols and, 461–462 WindowResizeListener interface, server calls library package, 32 MessengerView class, 432, 434 toolkit packages using, 32 Windows, dockable, 283 XML-RPC Word processor, Ajax, 362 overview of, 129 Word wrap, Label widget, 40 server integration and, 509 Workspace pattern SOAP replacing, 130 Blog Editor application based on, 361–363 XSLT (Extensible Stylesheet Language Transforma- defined, 34 tions), 354–356 sample application, 35 Workspaces loading in Eclipse, 145–147 Y workspace views in Database Editor applica- tion, 494–502 Yahoo! Search, 340–344 Writely, 362 YahooSearcher class, 342–343