PDA

View Full Version : Tree.addListener(OnDoubleClick)



mimikoko
31 Mar 2009, 7:48 AM
Hello to all,

I want include to my Tree a Listener of Events.OnDoubleClick.

GWT: 1.5.3
GXT: 1.2.3

my try:


private final Tree tree = new Tree();

@Override
protected void onRender(Element parent, int pos) {
super.onRender(parent, pos);

tree.setSelectionMode(SelectionMode.SINGLE);
this.buildTree(createTreeModel());

tree.sinkEvents(Events.OnDoubleClick);
tree.addListener(Events.OnDoubleClick, new Listener<TreeEvent>(){
public void handleEvent(TreeEvent be) {
if( be.item.getModel() instanceof XQDocument ){
// TODO
}
else if( be.item.getModel() instanceof XQPage ){
// TODO
}
else if( be.item.getModel() instanceof XQBlock ){
// TODO
}
else if( be.item.getModel() instanceof XQQuestion ){
// TODO
}
}
});

setLayout(new FlowLayout(8));
add(tree);
tree.expandAll();
}
How i can the Listner in the upper TreeItems (TreeItems the children have) to call?

Where is my mistake? How should I implement so that it works?


Thank you