
public class TreeExample implements EntryPoint {
public void onModuleLoad() {
// Create a tree with a few items in it.
TreeItem root = new TreeItem("root");
root.addItem("item0");
root.addItem("item1");
root.addItem("item2");
Tree t = new Tree();
t.addItem(root);
// Add it to the root panel.
RootPanel.get().add(t);
}
}
| Tree() | Constructs an empty tree. |
| addFocusListener(FocusListener) | Adds a listener interface to receive mouse events. |
| addItem(String) | Adds a simple tree item containing the specified text. |
| addItem(TreeItem) | Adds an item to the root level of this tree. |
| addKeyboardListener(KeyboardListener) | Adds a listener interface to receive keyboard events. |
| addMouseListener(MouseListener) | |
| addTreeListener(TreeListener) | Adds a listener interface to receive tree events. |
| ensureSelectedItemVisible() | Ensures that the currently-selected item is visible, opening its parents and scrolling the tree as necessary. |
| getImageBase() | Gets this tree's default image package. |
| getItem(int) | Gets the top-level tree item at the specified index. |
| getItemCount() | Gets the number of items contained at the root of this tree. |
| getSelectedItem() | Gets the currently selected item. |
| getTabIndex() | Gets the widget's position in the tab index. |
| onBrowserEvent(Event) | |
| onLoad() | This method is called when the widget becomes attached to the browser's document. |
| removeFocusListener(FocusListener) | Removes a previously added listener interface. |
| removeItem(TreeItem) | Removes an item from the root level of this tree. |
| removeItems() | Removes all items from the root level of this tree. |
| removeKeyboardListener(KeyboardListener) | Removes a previously added listener interface. |
| removeTreeListener(TreeListener) | Removes a previously added listener interface. |
| setAccessKey(char) | Sets the widget's 'access key'. |
| setFocus(boolean) | Explicitly focus/unfocus this widget. |
| setImageBase(String) | Sets the base URL under which this tree will find its default images. |
| setSelectedItem(TreeItem) | Selects a specified item. |
| setSelectedItem(TreeItem, boolean) | Selects a specified item. |
| setTabIndex(int) | Sets the widget's position in the tab index. |
null to deselect all
itemsnull to deselect all
itemstrue to allow selection events to be fired-1 will cause this
widget to be removed from the tab order.