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"); // 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); } }
Tree() | Constructs an empty tree. |
Tree(TreeImages) | Constructs a tree that uses the specified image bundle for images. |
add(Widget) | Adds the widget as a root tree item. |
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. |
addItem(Widget) | Adds a new tree item containing the specified widget. |
addKeyboardListener(KeyboardListener) | Adds a listener interface to receive keyboard events. |
addMouseListener(MouseListener) | |
addTreeListener(TreeListener) | Adds a listener interface to receive tree events. |
clear() | Clears all tree items from the current tree. |
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. |
isKeyboardNavigationEnabled(TreeItem) | Indicates if keyboard navigation is enabled for the Tree and for a given TreeItem. |
iterator() | Returns all TreeItem.ContentPanel elements contained within
this tree. |
onAttach() | This method is called when a widget is attached to the browser's document. |
onBrowserEvent(Event) | |
onDetach() | This method is called when a widget is detached from the browser's document. |
onLoad() | This method is called immediately after a widget becomes attached to the browser's document. |
remove(Widget) | Removes a child widget. |
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. |
treeItemIterator() | Iterator of tree items. |
true
if the Tree will response to arrow keys by
changing the currently selected itemTreeItem.ContentPanel
elements contained within
this tree. The existence of the TreeItem.ContentPanel
class
is an implementation detail that may or may not be preserved in future
versions of Tree.
Subclasses that override this method must call
super.onAttach()
to ensure that the Widget has been
attached to the underlying Element.
Subclasses that override this method must call
super.onDetach()
to ensure that the Widget has been
detached from the underlying Element. Failure to do so will result
in application memeroy leaks due to circular references between DOM
Elements and JavaScript objects.
true
if the widget was presentnull
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.