I have a Tree object which contains a few objects of my own class (MenuItem) which has a few simple attributes (mostly Strings). When specific conditions are met, I would like to make some of the items in the Tree are unselectable, so that the user cannot select them in the tree.
Is there any way how to do that? Do I need to have a custom selection model for my Tree?
Here is how my tree is defined:
Code:
Tree<MenuItem, ?> menuTree = getView().getMenu();
TreeSelectionModel<MenuItem> selectionModel = menuTree.getSelectionModel();
selectionModel.addSelectionHandler(new SelectionHandler<MenuItem>() {
@Override
public void onSelection(SelectionEvent<MenuItem> event) {
MenuItem menu = event.getSelectedItem();
// some business logic code
}
});
Is there any way how to do that? Do I need to have a custom selection model for my Tree?
Aucun commentaire:
Enregistrer un commentaire