Beginning Google Web Toolkit

Bram Smeets, Uri Boness, Roald Bankras

Mentioned 2

The open source, lightweight Google Web Toolkit (GWT) is a framework that allows Java developers to build rich Internet applications (RIAs), more recently called Ajax applications, in Java. Typically, writing these applications requires a lot of JavaScript development. However, Java and JavaScript are very distinctively different languages (although the name suggests otherwise), therefore requiring a different development process. In Beginning Google Web Toolkit: From Novice to Professional, you'll learn to build rich, user–friendly web applications using a popular Java–based Ajax web framework, the Google Web Toolkit. The authors will guide you through the complete development of a GWT front-end application with a no–nonsense, down–to–earth approach. You'll start with the first steps of working with GWT and learn to understand the concepts and consequences of building this kind of application. During the course of the book, all the key aspects of GWT are tackled pragmatically, as you're using them to build a real–world sample application. Unlike many other books, the inner workings of GWT and other unnecessary details are shelved, so you can focus on the stuff that really matters when developing GWT applications.

More on

Mentioned in questions and answers.

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()

Realated tags