Example usage for com.google.gwt.widgetideas.client ListeningFastTreeItem ListeningFastTreeItem

List of usage examples for com.google.gwt.widgetideas.client ListeningFastTreeItem ListeningFastTreeItem

Introduction

In this page you can find the example usage for com.google.gwt.widgetideas.client ListeningFastTreeItem ListeningFastTreeItem.

Prototype

public ListeningFastTreeItem(Widget widget) 

Source Link

Document

Constructs a tree item with the given Widget.

Usage

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

License:Apache License

private void verboseTreeItem(HasFastTreeItems parent, int children) {
    for (int i = 0; i < children; i++) {
        final int index = i;

        FastTreeItem item = new ListeningFastTreeItem("child " + i) {

            public void beforeClose() {
                Window.alert("Close item" + index);
            }/*  w  w  w  .  jav  a 2  s  .co  m*/

            public void beforeOpen() {
                Window.alert("Open item " + index);
            }

            protected boolean beforeSelectionLost() {
                return DOMHelper.confirm("Are you sure you want to leave me?");
            }

            protected void ensureChildren() {
                Window.alert("You are about to open my children for the first time");
            }

            protected void onSelected() {
                Window.alert("You selected item " + index);
            }
        };
        parent.addItem(item);
        verboseTreeItem(item, children - (i + 1));
    }
}