Class Tree

All Implemented Interfaces:
HasAllFocusHandlers, HasAllKeyHandlers, HasAllMouseHandlers, HasBlurHandlers, HasFocusHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasAttachHandlers, HasCloseHandlers<TreeItem>, HasOpenHandlers<TreeItem>, HasSelectionHandlers<TreeItem>, HasHandlers, EventListener, Focusable, HasAnimation, HasFocus, HasTreeItems, HasTreeItems.ForIsWidget, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IsWidget, SourcesFocusEvents, SourcesKeyboardEvents, SourcesMouseEvents, SourcesTreeEvents, Iterable<Widget>

A standard hierarchical tree widget. The tree contains a hierarchy of TreeItems that the user can open, close, and select.

CSS Style Rules

.gwt-Tree
the tree itself
.gwt-Tree .gwt-TreeItem
a tree item
.gwt-Tree .gwt-TreeItem-selected
a selected tree item

Example

public class TreeExample implements EntryPoint {

  @Override
  public void onModuleLoad() {
    // Create a tree with a few items in it.
    TreeItem root = new TreeItem();
    root.setText("root");
    root.addTextItem("item0");
    root.addTextItem("item1");
    root.addTextItem("item2");

    // Add a CheckBox to the tree
    TreeItem item = new TreeItem(new CheckBox("item3"));
    root.addItem(item);

    Tree t = new Tree();
    t.addItem(root);

    // Add it to the root panel.
    RootPanel.get().add(t);
  }
}