|
GWT 2.0.3 | ||||||||
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
.
Each tree item is assigned a unique DOM id in order to support ARIA. See
Accessibility
for more information.
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); } }
Nested Class Summary | |
---|---|
static class |
TreeItem.TreeItemImpl
Implementation class for TreeItem . |
static class |
TreeItem.TreeItemImplIE6
IE specific implementation class for TreeItem . |
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
Field Summary |
---|
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
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 Focusable |
getFocusable()
Returns a suggested Focusable instance to use when this tree item
is selected. |
protected HasFocus |
getFocusableWidget()
Deprecated. use getFocusable() instead |
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. |
protected void |
onEnsureDebugId(java.lang.String baseID)
Affected Elements: -content = The text or Widget next to the image.
-child# = The child at the specified index.
|
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, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setElement, 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 widgetMethod 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 HasHTML
public TreeItem getParentItem()
public boolean getState()
true
if the item is openpublic java.lang.String getText()
HasText
getText
in interface HasText
public 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)
HasHTML
HasText.setText(String)
whenever possible.
setHTML
in interface HasHTML
html
- 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 openpublic void setState(boolean open, boolean fireEvents)
open
- whether the item is openfireEvents
- true
to allow open/close events to bepublic void setText(java.lang.String text)
HasText
setText
in interface HasText
text
- 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 Focusable getFocusable()
Focusable
instance to use when this tree item
is selected. The tree maintains focus if this method returns null. By
default, if the tree item contains a focusable widget, that widget is
returned.
Note, the Tree
will ignore this value if the user clicked on an
input element such as a button or text area when selecting this item.
@Deprecated protected HasFocus getFocusableWidget()
getFocusable()
instead
protected void onEnsureDebugId(java.lang.String baseID)
Widget
next to the image.
onEnsureDebugId
in class UIObject
baseID
- the base ID used by the main elementUIObject.onEnsureDebugId(String)
|
GWT 2.0.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |