|
||||||||||
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
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"); Tree t = new Tree(); t.addItem(root); // Add it to the root panel. RootPanel.get().add(t); } }
Constructor Summary | |
Tree()
Constructs an empty tree. |
Method Summary | |
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. |
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 |
ensureSelectedItemVisible()
Ensures that the currently-selected item is visible, opening its parents and scrolling the tree as necessary. |
java.lang.String |
getImageBase()
Gets this tree's default image package. |
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. |
void |
onBrowserEvent(Event event)
Fired whenever a browser event is received. |
protected void |
onLoad()
This method is called when the widget becomes attached to the browser's document. |
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)
Sets the base URL under which this tree will find its default images. |
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. |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
getParent, isAttached, onAttach, onDetach, removeFromParent |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getTitle, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, 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()
Method Detail |
public void addFocusListener(FocusListener listener)
SourcesFocusEvents
addFocusListener
in interface SourcesFocusEvents
listener
- 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 void addKeyboardListener(KeyboardListener listener)
SourcesKeyboardEvents
addKeyboardListener
in interface SourcesKeyboardEvents
listener
- the listener interface to addpublic void addTreeListener(TreeListener listener)
SourcesTreeEvents
addTreeListener
in interface SourcesTreeEvents
listener
- the listener interface to addpublic void ensureSelectedItemVisible()
public java.lang.String getImageBase()
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 HasFocus
public void onBrowserEvent(Event event)
EventListener
onBrowserEvent
in interface EventListener
onBrowserEvent
in class Widget
public void removeFocusListener(FocusListener listener)
SourcesFocusEvents
removeFocusListener
in interface SourcesFocusEvents
listener
- 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 SourcesKeyboardEvents
listener
- the listener interface to removepublic void removeTreeListener(TreeListener listener)
SourcesTreeEvents
removeTreeListener
in interface SourcesTreeEvents
listener
- the listener interface to removepublic void setAccessKey(char key)
HasFocus
setAccessKey
in interface HasFocus
key
- the widget's access keypublic void setFocus(boolean focus)
HasFocus
setFocus
in interface HasFocus
focus
- whether this widget should take focus or release itpublic void setImageBase(java.lang.String baseUrl)
public void setSelectedItem(TreeItem item)
item
- the item to be selected, or null
to deselect all
itemspublic 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 HasFocus
index
- the widget's tab indexprotected void onLoad()
Widget
onLoad
in class Widget
public void addMouseListener(MouseListener listener)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |