|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Tree
public class Tree
A standard hierarchical tree widget. The tree contains a hierarchy of
TreeItems that the user can
open, close, and select.
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);
}
}
| Constructor Summary | |
|---|---|
Tree()
Constructs an empty tree. |
|
Tree(TreeImages images)
Constructs a tree that uses the specified image bundle for images. |
|
| Method Summary | |
|---|---|
void |
add(Widget widget)
Adds the widget as a root tree item. |
void |
addFocusListener(FocusListener listener)
Adds a listener interface to receive mouse events. |
TreeItem |
addItem(java.lang.String itemText)
Adds a simple tree item containing the specified text. |
void |
addItem(TreeItem item)
Adds an item to the root level of this tree. |
TreeItem |
addItem(Widget widget)
Adds a new tree item containing the specified widget. |
void |
addKeyboardListener(KeyboardListener listener)
Adds a listener interface to receive keyboard events. |
void |
addMouseListener(MouseListener listener)
|
void |
addTreeListener(TreeListener listener)
Adds a listener interface to receive tree events. |
void |
clear()
Clears all tree items from the current tree. |
protected void |
doAttachChildren()
If a widget implements HasWidgets, it must override this method and call onAttach() for each of its child widgets. |
protected void |
doDetachChildren()
If a widget implements HasWidgets, it must override this method and call onDetach() for each of its child widgets. |
void |
ensureSelectedItemVisible()
Ensures that the currently-selected item is visible, opening its parents and scrolling the tree as necessary. |
java.lang.String |
getImageBase()
Deprecated. Use Tree(TreeImages) as it provides a more efficent
and manageable way to supply a set of images to be used within
a tree. |
TreeItem |
getItem(int index)
Gets the top-level tree item at the specified index. |
int |
getItemCount()
Gets the number of items contained at the root of this tree. |
TreeItem |
getSelectedItem()
Gets the currently selected item. |
int |
getTabIndex()
Gets the widget's position in the tab index. |
protected boolean |
isKeyboardNavigationEnabled(TreeItem currentItem)
Indicates if keyboard navigation is enabled for the Tree and for a given TreeItem. |
java.util.Iterator |
iterator()
Gets an iterator for the contained widgets. |
void |
onBrowserEvent(Event event)
Fired whenever a browser event is received. |
protected void |
onLoad()
This method is called immediately after a widget becomes attached to the browser's document. |
boolean |
remove(Widget w)
Removes a child widget. |
void |
removeFocusListener(FocusListener listener)
Removes a previously added listener interface. |
void |
removeItem(TreeItem item)
Removes an item from the root level of this tree. |
void |
removeItems()
Removes all items from the root level of this tree. |
void |
removeKeyboardListener(KeyboardListener listener)
Removes a previously added listener interface. |
void |
removeTreeListener(TreeListener listener)
Removes a previously added listener interface. |
void |
setAccessKey(char key)
Sets the widget's 'access key'. |
void |
setFocus(boolean focus)
Explicitly focus/unfocus this widget. |
void |
setImageBase(java.lang.String baseUrl)
Deprecated. Use Tree(TreeImages) as it provides a more efficent
and manageable way to supply a set of images to be used within
a tree. |
void |
setSelectedItem(TreeItem item)
Selects a specified item. |
void |
setSelectedItem(TreeItem item,
boolean fireEvents)
Selects a specified item. |
void |
setTabIndex(int index)
Sets the widget's position in the tab index. |
java.util.Iterator |
treeItemIterator()
Iterator of tree items. |
| Methods inherited from class com.google.gwt.user.client.ui.Widget |
|---|
getParent, isAttached, onAttach, onDetach, onUnload, removeFromParent, setElement |
| Methods inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
addStyleDependentName, addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Tree()
public Tree(TreeImages images)
images - a bundle that provides tree specific images| Method Detail |
|---|
public void add(Widget widget)
add in interface HasWidgetswidget - widget to add.HasWidgets.add(com.google.gwt.user.client.ui.Widget)public void addFocusListener(FocusListener listener)
SourcesFocusEvents
addFocusListener in interface SourcesFocusEventslistener - the listener interface to addpublic TreeItem addItem(java.lang.String itemText)
itemText - the text of the item to be added
public void addItem(TreeItem item)
item - the item to be addedpublic TreeItem addItem(Widget widget)
widget - the widget to be addedpublic void addKeyboardListener(KeyboardListener listener)
SourcesKeyboardEvents
addKeyboardListener in interface SourcesKeyboardEventslistener - the listener interface to addpublic void addMouseListener(MouseListener listener)
public void addTreeListener(TreeListener listener)
SourcesTreeEvents
addTreeListener in interface SourcesTreeEventslistener - the listener interface to addpublic void clear()
clear in interface HasWidgetspublic void ensureSelectedItemVisible()
public java.lang.String getImageBase()
Tree(TreeImages) as it provides a more efficent
and manageable way to supply a set of images to be used within
a tree.
setImageBase(java.lang.String)public TreeItem getItem(int index)
index - the index to be retrieved
public int getItemCount()
public TreeItem getSelectedItem()
public int getTabIndex()
HasFocus
getTabIndex in interface HasFocuspublic java.util.Iterator iterator()
HasWidgetsIterator.remove().
iterator in interface HasWidgetspublic void onBrowserEvent(Event event)
EventListener
onBrowserEvent in interface EventListeneronBrowserEvent in class Widgetevent - the event receivedpublic boolean remove(Widget w)
HasWidgets
remove in interface HasWidgetsw - the widget to be removed
true if the widget was presentpublic void removeFocusListener(FocusListener listener)
SourcesFocusEvents
removeFocusListener in interface SourcesFocusEventslistener - the listener interface to removepublic void removeItem(TreeItem item)
item - the item to be removedpublic void removeItems()
public void removeKeyboardListener(KeyboardListener listener)
SourcesKeyboardEvents
removeKeyboardListener in interface SourcesKeyboardEventslistener - the listener interface to removepublic void removeTreeListener(TreeListener listener)
SourcesTreeEvents
removeTreeListener in interface SourcesTreeEventslistener - the listener interface to removepublic void setAccessKey(char key)
HasFocus
setAccessKey in interface HasFocuskey - the widget's access keypublic void setFocus(boolean focus)
HasFocus
setFocus in interface HasFocusfocus - whether this widget should take focus or release itpublic void setImageBase(java.lang.String baseUrl)
Tree(TreeImages) as it provides a more efficent
and manageable way to supply a set of images to be used within
a tree.
baseUrl - public void setSelectedItem(TreeItem item)
item - the item to be selected, or null to deselect all
items
public void setSelectedItem(TreeItem item,
boolean fireEvents)
item - the item to be selected, or null to deselect all
itemsfireEvents - true to allow selection events to be firedpublic void setTabIndex(int index)
HasFocus-1 will cause this widget to
be removed from the tab order.
setTabIndex in interface HasFocusindex - the widget's tab indexpublic java.util.Iterator treeItemIterator()
protected void doAttachChildren()
Widget
doAttachChildren in class WidgetWidget.onAttach()protected void doDetachChildren()
Widget
doDetachChildren in class WidgetWidget.onDetach()protected boolean isKeyboardNavigationEnabled(TreeItem currentItem)
currentItem - the currently selected TreeItem
true if the Tree will response to arrow keys by
changing the currently selected itemprotected void onLoad()
Widget
onLoad in class Widget
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||