com.google.gwt.user.client.ui
Class TreeItem

java.lang.Object
  extended bycom.google.gwt.user.client.ui.UIObject
      extended bycom.google.gwt.user.client.ui.TreeItem
All Implemented Interfaces:
HasHTML, HasText

public class TreeItem
extends UIObject
implements HasHTML

An item that can be contained within a Tree.


Field Summary
 
Fields inherited from class java.lang.Object
typeId, typeName
 
Constructor Summary
TreeItem()
          Creates an empty tree item.
TreeItem(String html)
          Constructs a tree item with the given HTML.
 
Method Summary
 TreeItem addItem(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 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.
 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.
 String getText()
          Gets this object's text.
 Tree getTree()
          Gets the tree that contains this item.
 Object getUserObject()
          Gets the user-defined object associated with this 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(String html)
          Sets this object's contents via HTML.
 void setSelected(boolean selected)
          Selects or unselects 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(String text)
          Sets this object's text.
 void setUserObject(Object userObj)
          Sets the user-defined object associated with this item.
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, finalize, hashCode
 

Constructor Detail

TreeItem

public TreeItem()
Creates an empty tree item.


TreeItem

public TreeItem(String html)
Constructs a tree item with the given HTML.

Parameters:
html - the item's HTML
Method Detail

addItem

public TreeItem addItem(String itemText)
Adds a child tree item containing the specified text.

Parameters:
itemText - the text to be added
Returns:
the item that was added

addItem

public void addItem(TreeItem item)
Adds another item as a child to this one.

Parameters:
item - the item to be added

getChild

public TreeItem getChild(int index)
Gets the child at the specified index.

Parameters:
index - the index to be retrieved
Returns:
the item at that index

getChildCount

public int getChildCount()
Gets the number of children contained in this item.

Returns:
this item's child count.

getChildIndex

public int getChildIndex(TreeItem child)
Gets the index of the specified child item.

Parameters:
child - the child item to be found
Returns:
the child's index, or -1 if none is found

getHTML

public String getHTML()
Description copied from interface: HasHTML
Gets this object's contents as HTML.

Specified by:
getHTML in interface HasHTML
Returns:
the object's HTML

getText

public String getText()
Description copied from interface: HasText
Gets this object's text.

Specified by:
getText in interface HasText
Returns:
the object's text

getParentItem

public TreeItem getParentItem()
Gets this item's parent.

Returns:
the parent item

getState

public boolean getState()
Gets whether this item's children are displayed.

Returns:
true if the item is open

getTree

public Tree getTree()
Gets the tree that contains this item.

Returns:
the containing tree

getUserObject

public Object getUserObject()
Gets the user-defined object associated with this item.

Returns:
the item's user-defined object

isSelected

public boolean isSelected()
Determines whether this item is currently selected.

Returns:
true if it is selected

remove

public void remove()
Removes this item from its tree.


removeItem

public void removeItem(TreeItem item)
Removes one of this item's children.

Parameters:
item - the item to be removed

removeItems

public void removeItems()
Removes all of this item's children.


setHTML

public void setHTML(String html)
Description copied from interface: HasHTML
Sets this object's contents via HTML. Use care when setting an object's HTML; it is an easy way to expose script-based security problems. Consider using HasText.setText(java.lang.String) whenever possible.

Specified by:
setHTML in interface HasHTML
Parameters:
html - the object's new HTML

setText

public void setText(String text)
Description copied from interface: HasText
Sets this object's text.

Specified by:
setText in interface HasText

setSelected

public void setSelected(boolean selected)
Selects or unselects this item.

Parameters:
selected - true to select the item, false to unselect it

setState

public void setState(boolean open)
Sets whether this item's children are displayed.

Parameters:
open - whether the item is open

setState

public void setState(boolean open,
                     boolean fireEvents)
Sets whether this item's children are displayed.

Parameters:
open - whether the item is open
fireEvents - true to allow open/close events to be fired

setUserObject

public void setUserObject(Object userObj)
Sets the user-defined object associated with this item.

Parameters:
userObj - the item's user-defined object


This javadoc distribution was not produced by Google. The official documentation is here.