Example usage for com.google.gwt.gen2.complexpanel.client FastTree addBeforeSelectionHandler

List of usage examples for com.google.gwt.gen2.complexpanel.client FastTree addBeforeSelectionHandler

Introduction

In this page you can find the example usage for com.google.gwt.gen2.complexpanel.client FastTree addBeforeSelectionHandler.

Prototype

public HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<FastTreeItem> handler) 

Source Link

Usage

From source file:com.google.gwt.gen2.demo.fasttree.client.FastTreeDemo.java

License:Apache License

private Widget cancelEventTree() {
    final FastTree cancelEventTree = new FastTree();
    FastTreeItem firstBranch = cancelEventTree.addItem("Select Me!");
    firstBranch.addItem("No! Select Me!");
    firstBranch.addItem("No! Select Me!");
    firstBranch.addItem("No! Select Me!");
    FastTreeItem secondBranch = cancelEventTree.addItem("Don't Select me!");
    secondBranch.addItem("Not me!");
    secondBranch.addItem("Not me!");
    secondBranch.addItem("Not me!");

    cancelEventTree.addBeforeSelectionHandler(new BeforeSelectionHandler<FastTreeItem>() {
        public void onBeforeSelection(BeforeSelectionEvent<FastTreeItem> event) {
            if (!Window.confirm("Continue?")) {
                event.cancel();//  w  w  w  . j  a  v  a2s . c  o m
            }
        }
    });

    return cancelEventTree;
}