IgorShare Thoughts and Ideas

Consulting and Training

Tree event handler in GWT 1.6

Posted by Igor Moochnick 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());
    }
});
Advertisements

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: