Reputation: 2491
I have a cell tree with a SingleSelectionModel. When I click on a node, it fires an certain action. My problem is that the action is fired only on the first click.
public class TreeModel implements TreeViewModel {
private SingleSelectionModel<Entity> selectionModel;
public TreeModel(){
initialize();
}
private void initialize(){
selectionModel = new SingleSelectionModel<Entity>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
public void onSelectionChange(SelectionChangeEvent event) {
//fire an action
}
});
}
public <T> NodeInfo<?> getNodeInfo(T value) {
...
}
The CellTree is called normaly
CellTree.Resources resource = GWT.create(TreeResources.class);
cellTree = new CellTree(new TreeModel(), null,resource);
panel.add(cellTree);
Any clue why it does that ? Thanks
Upvotes: 0
Views: 506
Reputation: 64561
You mean clicking on the already-selected node? Well, in this case, you're not changing the selection, so there's no SelectionChangeEvent
.
Maybe you're looking for the NoSelectionModel
, or for something else than a SelectionModel
(e.g. a Cell
that responds to click events, or a CellPreviewHandler
)
Upvotes: 1