|
|||||||||
| 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.TreeItem
public class TreeItem
An item that can be contained within a
Tree.
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 | |
|---|---|
TreeItem()
Creates an empty tree item. |
|
TreeItem(java.lang.String html)
Constructs a tree item with the given HTML. |
|
TreeItem(Widget widget)
Constructs a tree item with the given Widget. |
|
| Method Summary | |
|---|---|
TreeItem |
addItem(java.lang.String itemText)
Adds a child tree item containing the specified text. |
void |
addItem(TreeItem item)
Adds another item as a child to this one. |
TreeItem |
addItem(Widget widget)
Adds a child tree item containing the specified widget. |
TreeItem |
getChild(int index)
Gets the child at the specified index. |
int |
getChildCount()
Gets the number of children contained in this item. |
int |
getChildIndex(TreeItem child)
Gets the index of the specified child item. |
protected HasFocus |
getFocusableWidget()
Returns the widget, if any, that should be focused on if this TreeItem is selected. |
java.lang.String |
getHTML()
Gets this object's contents as HTML. |
TreeItem |
getParentItem()
Gets this item's parent. |
boolean |
getState()
Gets whether this item's children are displayed. |
java.lang.String |
getText()
Gets this object's text. |
Tree |
getTree()
Gets the tree that contains this item. |
java.lang.Object |
getUserObject()
Gets the user-defined object associated with this item. |
Widget |
getWidget()
Gets the Widget associated with this tree item. |
boolean |
isSelected()
Determines whether this item is currently selected. |
void |
remove()
Removes this item from its tree. |
void |
removeItem(TreeItem item)
Removes one of this item's children. |
void |
removeItems()
Removes all of this item's children. |
void |
setHTML(java.lang.String html)
Sets this object's contents via HTML. |
void |
setSelected(boolean selected)
Selects or deselects this item. |
void |
setState(boolean open)
Sets whether this item's children are displayed. |
void |
setState(boolean open,
boolean fireEvents)
Sets whether this item's children are displayed. |
void |
setText(java.lang.String text)
Sets this object's text. |
void |
setUserObject(java.lang.Object userObj)
Sets the user-defined object associated with this item. |
void |
setWidget(Widget newWidget)
Sets the current widget. |
| 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, setElement, 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 TreeItem()
public TreeItem(java.lang.String html)
html - the item's HTMLpublic TreeItem(Widget widget)
Widget.
widget - the item's widget| Method Detail |
|---|
public TreeItem addItem(java.lang.String itemText)
itemText - the text to be added
public void addItem(TreeItem item)
item - the item to be addedpublic TreeItem addItem(Widget widget)
widget - the widget to be added
public TreeItem getChild(int index)
index - the index to be retrieved
public int getChildCount()
public int getChildIndex(TreeItem child)
child - the child item to be found
-1 if none is foundpublic java.lang.String getHTML()
HasHTML
getHTML in interface HasHTMLpublic TreeItem getParentItem()
public boolean getState()
true if the item is openpublic java.lang.String getText()
HasText
getText in interface HasTextpublic final Tree getTree()
public java.lang.Object getUserObject()
public Widget getWidget()
Widget associated with this tree item.
public boolean isSelected()
true if it is selectedpublic void remove()
public void removeItem(TreeItem item)
item - the item to be removedpublic void removeItems()
public void setHTML(java.lang.String html)
HasHTMLHasText.setText(String) whenever possible.
setHTML in interface HasHTMLhtml - the object's new HTMLpublic void setSelected(boolean selected)
selected - true to select the item, false
to deselect itpublic void setState(boolean open)
open - whether the item is open
public void setState(boolean open,
boolean fireEvents)
open - whether the item is openfireEvents - true to allow open/close events to be
firedpublic void setText(java.lang.String text)
HasText
setText in interface HasTexttext - the object's new textpublic void setUserObject(java.lang.Object userObj)
userObj - the item's user-defined objectpublic void setWidget(Widget newWidget)
newWidget - Widget to setprotected HasFocus getFocusableWidget()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||