|
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.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); } }
Nested Class Summary | |
---|---|
static interface |
Tree.Resources
A ClientBundle that provides images for this widget. |
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 | |
---|---|
Tree()
Constructs an empty tree. |
|
Tree(Tree.Resources resources)
Constructs a tree that uses the specified ClientBundle for images. |
|
Tree(Tree.Resources resources,
boolean useLeafImages)
Constructs a tree that uses the specified ClientBundle for images. |
|
Tree(TreeImages images)
Deprecated. replaced by Tree(Resources) |
|
Tree(TreeImages images,
boolean useLeafImages)
Deprecated. replaced by Tree(Resources, boolean) |
Method Summary | |
---|---|
void |
add(Widget widget)
Adds the widget as a root tree item. |
HandlerRegistration |
addBlurHandler(BlurHandler handler)
Adds a BlurEvent handler. |
HandlerRegistration |
addCloseHandler(CloseHandler<TreeItem> handler)
Adds a CloseEvent handler. |
HandlerRegistration |
addFocusHandler(FocusHandler handler)
Adds a FocusEvent handler. |
void |
addFocusListener(FocusListener listener)
Deprecated. Use addFocusHandler(com.google.gwt.event.dom.client.FocusHandler) instead |
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)
Deprecated. Use addKeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) , addKeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler) and
addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler) instead |
HandlerRegistration |
addKeyDownHandler(KeyDownHandler handler)
Adds a KeyDownEvent handler. |
HandlerRegistration |
addKeyPressHandler(KeyPressHandler handler)
Adds a KeyPressEvent handler. |
HandlerRegistration |
addKeyUpHandler(KeyUpHandler handler)
Adds a KeyUpEvent handler. |
HandlerRegistration |
addMouseDownHandler(MouseDownHandler handler)
Adds a MouseDownEvent handler. |
void |
addMouseListener(MouseListener listener)
Deprecated. Use addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler) addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler) ,
addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler) , addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler) and
addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler) instead |
HandlerRegistration |
addMouseMoveHandler(MouseMoveHandler handler)
Adds a MouseMoveEvent handler. |
HandlerRegistration |
addMouseOutHandler(MouseOutHandler handler)
Adds a MouseOutEvent handler. |
HandlerRegistration |
addMouseOverHandler(MouseOverHandler handler)
Adds a MouseOverEvent handler. |
HandlerRegistration |
addMouseUpHandler(MouseUpHandler handler)
Adds a MouseUpEvent handler. |
HandlerRegistration |
addMouseWheelHandler(MouseWheelHandler handler)
Adds a MouseWheelEvent handler. |
HandlerRegistration |
addOpenHandler(OpenHandler<TreeItem> handler)
Adds a OpenEvent handler. |
HandlerRegistration |
addSelectionHandler(SelectionHandler<TreeItem> handler)
Adds a SelectionEvent handler. |
void |
addTreeListener(TreeListener listener)
Deprecated. Use addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler , addOpenHandler(com.google.gwt.event.logical.shared.OpenHandler , and
addCloseHandler(com.google.gwt.event.logical.shared.CloseHandler instead |
void |
clear()
Clears all tree items from the current tree. |
protected void |
doAttachChildren()
If a widget contains one or more child widgets that are not in the logical widget hierarchy (the child is physically connected only on the DOM level), it must override this method and call Widget.onAttach() for each of its
child widgets. |
protected void |
doDetachChildren()
If a widget contains one or more child widgets that are not in the logical widget hierarchy (the child is physically connected only on the DOM level), it must override this method and call Widget.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. |
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. |
boolean |
isAnimationEnabled()
|
protected boolean |
isKeyboardNavigationEnabled(TreeItem currentItem)
Indicates if keyboard navigation is enabled for the Tree and for a given TreeItem. |
java.util.Iterator<Widget> |
iterator()
Gets an iterator for the contained widgets. |
void |
onBrowserEvent(Event event)
Fired whenever a browser event is received. |
protected void |
onEnsureDebugId(java.lang.String baseID)
Affected Elements: -root = The root TreeItem .
|
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)
Deprecated. Use the HandlerRegistration.removeHandler() method on the
object returned by addFocusHandler(com.google.gwt.event.dom.client.FocusHandler) instead |
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)
Deprecated. Use the HandlerRegistration.removeHandler() method on the
object returned by an add*Handler method instead |
void |
removeMouseListener(MouseListener listener)
Deprecated. Use the HandlerRegistration.removeHandler() method on the
object returned by an add*Handler method instead |
void |
removeTreeListener(TreeListener listener)
Deprecated. Use the HandlerRegistration.removeHandler() method on the
object returned by an add*Handler method instead |
void |
setAccessKey(char key)
Sets the widget's 'access key'. |
void |
setAnimationEnabled(boolean enable)
Enable or disable animations. |
void |
setFocus(boolean focus)
Explicitly focus/unfocus this widget. |
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<TreeItem> |
treeItemIterator()
Iterator of tree items. |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
addDomHandler, addHandler, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onDetach, onUnload, removeFromParent, setLayoutData, sinkEvents |
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, toString, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Constructor Detail |
---|
public Tree()
public Tree(Tree.Resources resources)
resources
- a bundle that provides tree specific imagespublic Tree(Tree.Resources resources, boolean useLeafImages)
resources
- a bundle that provides tree specific imagesuseLeafImages
- use leaf images from bundle@Deprecated public Tree(TreeImages images)
Tree(Resources)
images
- a bundle that provides tree specific images@Deprecated public Tree(TreeImages images, boolean useLeafImages)
Tree(Resources, boolean)
images
- a bundle that provides tree specific imagesuseLeafImages
- use leaf images from bundleMethod Detail |
---|
public void add(Widget widget)
add
in interface HasWidgets
widget
- widget to add.HasWidgets.add(com.google.gwt.user.client.ui.Widget)
public HandlerRegistration addBlurHandler(BlurHandler handler)
HasBlurHandlers
BlurEvent
handler.
addBlurHandler
in interface HasBlurHandlers
handler
- the blur handler
HandlerRegistration
used to remove this handlerpublic HandlerRegistration addCloseHandler(CloseHandler<TreeItem> handler)
HasCloseHandlers
CloseEvent
handler.
addCloseHandler
in interface HasCloseHandlers<TreeItem>
handler
- the handler
public HandlerRegistration addFocusHandler(FocusHandler handler)
HasFocusHandlers
FocusEvent
handler.
addFocusHandler
in interface HasFocusHandlers
handler
- the focus handler
HandlerRegistration
used to remove this handler@Deprecated public void addFocusListener(FocusListener listener)
addFocusHandler(com.google.gwt.event.dom.client.FocusHandler)
instead
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 TreeItem addItem(Widget widget)
widget
- the widget to be added
@Deprecated public void addKeyboardListener(KeyboardListener listener)
addKeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler)
, addKeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler)
and
addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler)
instead
SourcesKeyboardEvents
addKeyboardListener
in interface SourcesKeyboardEvents
listener
- the listener interface to addpublic HandlerRegistration addKeyDownHandler(KeyDownHandler handler)
HasKeyDownHandlers
KeyDownEvent
handler.
addKeyDownHandler
in interface HasKeyDownHandlers
handler
- the key down handler
HandlerRegistration
used to remove this handlerpublic HandlerRegistration addKeyPressHandler(KeyPressHandler handler)
HasKeyPressHandlers
KeyPressEvent
handler.
addKeyPressHandler
in interface HasKeyPressHandlers
handler
- the key press handler
HandlerRegistration
used to remove this handlerpublic HandlerRegistration addKeyUpHandler(KeyUpHandler handler)
HasKeyUpHandlers
KeyUpEvent
handler.
addKeyUpHandler
in interface HasKeyUpHandlers
handler
- the key up handler
HandlerRegistration
used to remove this handlerpublic HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
HasMouseDownHandlers
MouseDownEvent
handler.
addMouseDownHandler
in interface HasMouseDownHandlers
handler
- the mouse down handler
HandlerRegistration
used to remove this handler@Deprecated public void addMouseListener(MouseListener listener)
addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler)
addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler)
,
addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler)
, addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler)
and
addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler)
instead
SourcesMouseEvents
addMouseListener
in interface SourcesMouseEvents
listener
- the listener interface to addpublic HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)
HasMouseMoveHandlers
MouseMoveEvent
handler.
addMouseMoveHandler
in interface HasMouseMoveHandlers
handler
- the mouse move handler
HandlerRegistration
used to remove this handlerpublic HandlerRegistration addMouseOutHandler(MouseOutHandler handler)
HasMouseOutHandlers
MouseOutEvent
handler.
addMouseOutHandler
in interface HasMouseOutHandlers
handler
- the mouse out handler
HandlerRegistration
used to remove this handlerpublic HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
HasMouseOverHandlers
MouseOverEvent
handler.
addMouseOverHandler
in interface HasMouseOverHandlers
handler
- the mouse over handler
HandlerRegistration
used to remove this handlerpublic HandlerRegistration addMouseUpHandler(MouseUpHandler handler)
HasMouseUpHandlers
MouseUpEvent
handler.
addMouseUpHandler
in interface HasMouseUpHandlers
handler
- the mouse up handler
HandlerRegistration
used to remove this handlerpublic HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler)
HasMouseWheelHandlers
MouseWheelEvent
handler.
addMouseWheelHandler
in interface HasMouseWheelHandlers
handler
- the mouse wheel handler
HandlerRegistration
used to remove this handlerpublic final HandlerRegistration addOpenHandler(OpenHandler<TreeItem> handler)
HasOpenHandlers
OpenEvent
handler.
addOpenHandler
in interface HasOpenHandlers<TreeItem>
handler
- the handler
public HandlerRegistration addSelectionHandler(SelectionHandler<TreeItem> handler)
HasSelectionHandlers
SelectionEvent
handler.
addSelectionHandler
in interface HasSelectionHandlers<TreeItem>
handler
- the handler
@Deprecated public void addTreeListener(TreeListener listener)
addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler)
, addOpenHandler(com.google.gwt.event.logical.shared.OpenHandler)
, and
addCloseHandler(com.google.gwt.event.logical.shared.CloseHandler)
instead
SourcesTreeEvents
addTreeListener
in interface SourcesTreeEvents
listener
- the listener interface to addpublic void clear()
clear
in interface HasWidgets
public void ensureSelectedItemVisible()
public TreeItem getItem(int index)
index
- the index to be retrieved
public int getItemCount()
public TreeItem getSelectedItem()
public int getTabIndex()
Focusable
getTabIndex
in interface Focusable
public boolean isAnimationEnabled()
isAnimationEnabled
in interface HasAnimation
public java.util.Iterator<Widget> iterator()
HasWidgets
Iterator.remove()
.
iterator
in interface HasWidgets
iterator
in interface java.lang.Iterable<Widget>
public void onBrowserEvent(Event event)
EventListener
onBrowserEvent
in interface EventListener
onBrowserEvent
in class Widget
event
- the event receivedpublic boolean remove(Widget w)
HasWidgets
remove
in interface HasWidgets
w
- the widget to be removed
true
if the widget was present@Deprecated public void removeFocusListener(FocusListener listener)
HandlerRegistration.removeHandler()
method on the
object returned by addFocusHandler(com.google.gwt.event.dom.client.FocusHandler)
instead
SourcesFocusEvents
removeFocusListener
in interface SourcesFocusEvents
listener
- the listener interface to removepublic void removeItem(TreeItem item)
item
- the item to be removedpublic void removeItems()
@Deprecated public void removeKeyboardListener(KeyboardListener listener)
HandlerRegistration.removeHandler()
method on the
object returned by an add*Handler method instead
SourcesKeyboardEvents
removeKeyboardListener
in interface SourcesKeyboardEvents
listener
- the listener interface to remove@Deprecated public void removeMouseListener(MouseListener listener)
HandlerRegistration.removeHandler()
method on the
object returned by an add*Handler method instead
SourcesMouseEvents
removeMouseListener
in interface SourcesMouseEvents
listener
- the listener interface to remove@Deprecated public void removeTreeListener(TreeListener listener)
HandlerRegistration.removeHandler()
method on the
object returned by an add*Handler method instead
SourcesTreeEvents
removeTreeListener
in interface SourcesTreeEvents
listener
- the listener interface to removepublic void setAccessKey(char key)
Focusable
setAccessKey
in interface Focusable
key
- the widget's access keypublic void setAnimationEnabled(boolean enable)
HasAnimation
setAnimationEnabled
in interface HasAnimation
enable
- true to enable, false to disablepublic void setFocus(boolean focus)
Focusable
setFocus
in interface Focusable
focus
- whether this widget should take focus or release itpublic 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)
Focusable
-1
will cause this widget to
be removed from the tab order.
setTabIndex
in interface Focusable
index
- the widget's tab indexpublic java.util.Iterator<TreeItem> treeItemIterator()
protected void doAttachChildren()
Widget
Widget.onAttach()
for each of its
child widgets.
doAttachChildren
in class Widget
Widget.onAttach()
protected void doDetachChildren()
Widget
Widget.onDetach()
for each of its
child widgets.
doDetachChildren
in class Widget
Widget.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 onEnsureDebugId(java.lang.String baseID)
TreeItem
.
onEnsureDebugId
in class UIObject
baseID
- the base ID used by the main elementUIObject.onEnsureDebugId(String)
protected void onLoad()
Widget
onLoad
in class Widget
|
GWT 2.0.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |