Google Web Toolkit Applications

Ryan Dewsbury

Mentioned 3

A thorough handbook on how to build applications with the Google Web Toolkit (GWT) furnishes coverage of the updated features, tools, and techniques of the latest version of GWT and includes a detailed study of five applications built with GWT to reveal development patterns, techniques, and subtleties used throughout the design and development process. Original. (Intermediate)

More on

Mentioned in questions and answers.

All HTTP responses require the client to initiate them, even those made using AJAX. But GMail's chat feature is able to receive messages from other users, even when I'm just sitting in my comfy computer chair watching but not interacting with the browser. How did they do it?

Yep Comets is correct. Google Web Toolkit Applications by Ryan Dewsbury explains how to create a Comets based Instant Messenger application in chapter 9.

I am trying to learn GWT, but have no clue about the same.

I have a java background and have all through my years of experience worked on Struts, Spring, Grails and such MVC Frameworks.

I am to learn GWT for a project and am looking for help as to how I can go about it.

Could someone give me an idea of the learning curve when it comes to a technology like this.

Thanks in advance!

The GWT documentation is a good starting point and watch the Google I/O presentations on GWT, start with the most recent it covers the newer features.

But if you (also) want to read a book make sure it's a recent version. GWT changes fast, and therefor most books are rather outdated. Actually some of the newer GWT features are not or very briefly covered in currently available books.

Here are 3 books which are more recent:

GWT in Action, Second Edition

Essential GWT: Building for the Web with Google Web Toolkit 2

Google App Engine Java and GWT Application Development (While this book covers also Google App Engine, it contains a lot of usefull examples)

I would avoid starting with Ext GWT, as it's a framework build upon GWT. Just learn the GWT basics and then decide if you want to use and additional framework.

I am having a difficult time understanding the Pyjamas/GWT event handling system. I am currently using the latest 0.8 Pyjamas in order to test. I am not sure of what the best event handling structure would be as I have never done GUI programming.

I haven't had much luck with the documentation I've found thus far. Does anyone know of a good reference for Pyjamas or GWT?

My main difficulty comes from understanding where listeners such as onClick, onMouseleave, etc are coming from? How are they triggered? Where are they defined? Do I define them?

What is the layered structure for the event handling system?

I know these are very general questions but I'm really just looking for a point in the right direction.

Thank you and I appreciate any help given.

I would suggest you study source in examples folder. Start with this

There are some links which has been helpful for me:

Also in examples folder there is a great example called showcase which gives you all API and some helpful code samples /localhost/somedir/showcase/output/Showcase.html

since API is similar you can always check them books (especially helpful for understanding callback etc..) :

for Django and Pyjamas

However i agree there is a great need for better introduction tutorials beyond the hello world example. I'm struggling with it myself. Good luck

ps. I've created small callback example that seems to work. I would be greatfull if people correct me here and edit this example to be of more use for people. All im trying to do here is to have navigation with 2 pages (represented by 2 classes: Intro and Outro )

    import pyjd
    from pyjamas.ui.VerticalPanel import VerticalPanel  
    from pyjamas.ui.RootPanel import RootPanel
    from pyjamas.ui.SimplePanel import SimplePanel
    from pyjamas.ui.DockPanel import DockPanel
    from pyjamas.ui.Hyperlink import Hyperlink
    from pyjamas.ui.Button import Button
    from pyjamas.ui.HTML import HTML
    from pyjamas import Window

    class Site(SimplePanel):
        def onModuleLoad(self):

            self.panel = DockPanel()
            self.intro = Intro()
            self.outro = Outro()
            self.index = HTML('index')
            self.curPage = self.index


            self.link1 = Hyperlink('menu item 1')
            self.link2 = Hyperlink('menu item 2')
            self.link1.addClickListener(getattr(self, 'onLINK1'))
            self.link2.addClickListener(getattr(self, 'onLINK2'))

            self.panel.add(self.link1, DockPanel.WEST)
            self.panel.add(self.link2, DockPanel.WEST)

            self.panel.add(self.index, DockPanel.CENTER)

        def onLINK1(self):
            self.panel.remove(self.curPage, DockPanel.CENTER)
            self.panel.add(self.intro, DockPanel.CENTER)
            self.curPage = self.intro

        def onLINK2(self):
            self.panel.remove(self.curPage, DockPanel.CENTER)
            self.panel.add(self.outro, DockPanel.CENTER)
            self.curPage = self.outro

    class Intro(SimplePanel):
        def __init__(self):
            self.vp = VerticalPanel()
            self.html = HTML('This is intro')
            self.button = Button('click me', self)

        def onClick(self):
            Window.alert('onClick Intro')

    class Outro(SimplePanel):
        def __init__(self):
            self.vp = VerticalPanel()
            self.html = HTML('This is outro')
            #we can do it this way
            self.button1 = Button('click me1', getattr(self, 'onBUTTON1'))
            self.button2 = Button('click me2')
            #or set up listener

        def onBUTTON1(self):
            Window.alert('hello from button1')
        def onBUTTON2(self):
            Window.alert('hello from button2')

    if __name__ == '__main__':
        app = Site()