IgorShare Weblog

Practical Engineering

Tree event handler in GWT 1.6

Posted by igormoochnick on 04/28/2009

The documentation was a little sparse so, if you’d like to subscribe to the click events on the tree nodes you need to add a selection handler.

This is how you add a selection handler to the whole tree:

Tree optionsTree = new Tree();
optionsTree.addSelectionHandler(new SelectionHandler()
{
    @Override
    public void onSelection(SelectionEvent event)
    {
        Window.alert(event.getSelectedItem().getText());
    }
});

4 Responses to “Tree event handler in GWT 1.6”

  1. PVLebret said

    This is better :


    arbre.addSelectionHandler(new SelectionHandler()
    {
    public void onSelection(SelectionEvent event)
    {
    Window.alert(event.getSelectedItem().getText());
    }
    });

  2. Leon said

    very helpful, thank you!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>