You can listen to all click (or doubleclick) events on the Tree or TreeGrid via addDomHandler. You'll then need to ask the tree/treegrid's view for details about which model was represented in that click (if any - they might click in empty space or a header).
In a TreeGrid you can listen for all row clicks and doubleclicks and all cell clicks and double clicks (addRow/CellClick/DoubleClickHandler methods). The event will offer additional details about what was clicked.
What have you tried?
In either you can provide a custom cell with a onBrowserEvent method to give you the model object and the entire cell that was clicked. Example with Tree (applies to any cell widget in GXT or GWT): http://www.sencha.com/examples/#Exam...cellactiontree
I tried exactly this and all I got is the value of the leaf.
Is there any way to access further information about the leaf the event has been fired on?
Can you be more specific? The 'value' is what the leaf represents, the 'element' is the actual dom node that is drawn on the screen. What more are you looking for?
To have a simple example: Imagine the tree is supposed to represent a file system and the leafs only show the current file name. How could I determine if the click was fired on a node (representing a directory) or on a leaf (representing a file)? How could I determine what node and what leaf has been clicked?
I took the file system example because it's understandable that there can be different files with the same name in different folders.
In that case, the model that was passed in, the object that the cell is rendering should have that meta data. If you choose deliberately to not have the Tree know about that model (i.e. a Tree<FileSystemObject, String>), then one of the other approaches might make more sense. That said, the only reason to deliberately make the tree cells not know about that model is to make it easier to render, but if you are making it now harder to listen to events, then it sounds like that isn't a good idea after all. Make it a Tree<FileSystemObject, FileSystemObject> so that the cell gets the FileSystemObject as a value - you'll need a custom render method to draw correctly, but now you'll have a easier time with the model.
- you can use the Element passed in with Tree.findNode to get a TreeNode and call getModel() on that.
- see the other choices above. Also, consider just configuring a selection model for click or double click, and listening to SelectionEvent<M> of your model.