|
GWT 2.7.0 | |||||||
| 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 {
@Override
public void onModuleLoad() {
// Create a tree with a few items in it.
TreeItem root = new TreeItem();
root.setText("root");
root.addTextItem("item0");
root.addTextItem("item1");
root.addTextItem("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 | |
|---|---|
(package private) static class |
Tree.ImageAdapter
There are several ways of configuring images for the Tree widget due to deprecated APIs. |
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 |
| Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasTreeItems |
|---|
HasTreeItems.ForIsWidget |
| Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets |
|---|
HasWidgets.ForIsWidget |
| Field Summary |
|---|
| Fields inherited from class com.google.gwt.user.client.ui.Widget |
|---|
eventsToSink |
| Fields inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR |
| 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(IsWidget w)
Overloaded version for IsWidget. |
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 |
void |
addItem(IsTreeItem isItem)
Adds an item to the root level of this tree. |
TreeItem |
addItem(IsWidget w)
Overloaded version for IsWidget. |
TreeItem |
addItem(SafeHtml itemHtml)
Adds a simple tree item containing the specified html. |
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 an OpenEvent handler. |
HandlerRegistration |
addSelectionHandler(SelectionHandler<TreeItem> handler)
Adds a SelectionEvent handler. |
TreeItem |
addTextItem(java.lang.String itemText)
Adds a simple tree item containing the specified text. |
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 |
(package private) void |
adopt(Widget widget,
TreeItem treeItem)
|
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. |
(package private) void |
fireStateChanged(TreeItem item,
boolean open)
|
(package private) java.util.Map<Widget,TreeItem> |
getChildWidgets()
|
(package private) Tree.ImageAdapter |
getImages()
|
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. |
TreeItem |
insertItem(int beforeIndex,
SafeHtml itemHtml)
Inserts a child tree item at the specified index containing the specified html. |
void |
insertItem(int beforeIndex,
TreeItem item)
Inserts an item into the root level of this tree. |
TreeItem |
insertItem(int beforeIndex,
Widget widget)
Inserts a child tree item at the specified index containing the specified widget. |
TreeItem |
insertTextItem(int beforeIndex,
java.lang.String itemText)
Inserts a child tree item at the specified index containing the specified text. |
boolean |
isAnimationEnabled()
Returns true if animations are enabled, false if not. |
protected boolean |
isKeyboardNavigationEnabled(TreeItem currentItem)
Indicates if keyboard navigation is enabled for the Tree and for a given TreeItem. |
boolean |
isScrollOnSelectEnabled()
Determines whether selecting a tree item will scroll it into view. |
java.util.Iterator<Widget> |
iterator()
Gets an iterator for the contained widgets. |
(package private) void |
maybeUpdateSelection(TreeItem itemThatChangedState,
boolean isItemOpening)
|
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. |
(package private) void |
orphan(Widget widget)
|
boolean |
remove(IsWidget w)
Overloaded version for IsWidget. |
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(IsTreeItem isItem)
Removes an item from the root level of this tree. |
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 |
setScrollOnSelectEnabled(boolean enable)
Enable or disable scrolling a tree item into view when it is selected. |
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. |
(package private) static boolean |
shouldTreeDelegateFocusToElement(Element elem)
|
(package private) void |
showClosedImage(TreeItem treeItem)
Called only from TreeItem: Shows the closed image on that tree
item. |
(package private) void |
showLeafImage(TreeItem treeItem)
Called only from TreeItem: Shows the leaf image on a tree item. |
(package private) void |
showOpenImage(TreeItem treeItem)
Called only from TreeItem: Shows the open image on a tree item. |
java.util.Iterator<TreeItem> |
treeItemIterator()
Iterator of tree items. |
| Methods inherited from class com.google.gwt.user.client.ui.Widget |
|---|
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onDetach, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents |
| 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, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString |
| 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 images
public 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 bundle| Method Detail |
|---|
static boolean shouldTreeDelegateFocusToElement(Element elem)
public void add(Widget widget)
add in interface HasWidgetswidget - widget to add.HasWidgets.add(com.google.gwt.user.client.ui.Widget)public void add(IsWidget w)
add in interface HasWidgets.ForIsWidgetadd(Widget)public HandlerRegistration addBlurHandler(BlurHandler handler)
HasBlurHandlersBlurEvent handler.
addBlurHandler in interface HasBlurHandlershandler - the blur handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addCloseHandler(CloseHandler<TreeItem> handler)
HasCloseHandlersCloseEvent handler.
addCloseHandler in interface HasCloseHandlers<TreeItem>handler - the handler
public HandlerRegistration addFocusHandler(FocusHandler handler)
HasFocusHandlersFocusEvent handler.
addFocusHandler in interface HasFocusHandlershandler - 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 SourcesFocusEventslistener - the listener interface to addpublic TreeItem addItem(SafeHtml itemHtml)
addItem in interface HasTreeItemsitemHtml - the html of the item to be added
public void addItem(TreeItem item)
addItem in interface HasTreeItemsitem - the item to be addedpublic void addItem(IsTreeItem isItem)
addItem in interface HasTreeItemsisItem - the wrapper of item to be addedpublic TreeItem addItem(Widget widget)
addItem in interface HasTreeItemswidget - the widget to be added
public TreeItem addItem(IsWidget w)
addItem in interface HasTreeItems.ForIsWidgetaddItem(Widget)@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 SourcesKeyboardEventslistener - the listener interface to addpublic HandlerRegistration addKeyDownHandler(KeyDownHandler handler)
HasKeyDownHandlersKeyDownEvent handler.
addKeyDownHandler in interface HasKeyDownHandlershandler - the key down handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addKeyPressHandler(KeyPressHandler handler)
HasKeyPressHandlersKeyPressEvent handler.
addKeyPressHandler in interface HasKeyPressHandlershandler - the key press handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addKeyUpHandler(KeyUpHandler handler)
HasKeyUpHandlersKeyUpEvent handler.
addKeyUpHandler in interface HasKeyUpHandlershandler - the key up handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
HasMouseDownHandlersMouseDownEvent handler.
addMouseDownHandler in interface HasMouseDownHandlershandler - 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 SourcesMouseEventslistener - the listener interface to addpublic HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)
HasMouseMoveHandlersMouseMoveEvent handler.
addMouseMoveHandler in interface HasMouseMoveHandlershandler - the mouse move handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseOutHandler(MouseOutHandler handler)
HasMouseOutHandlersMouseOutEvent handler.
addMouseOutHandler in interface HasMouseOutHandlershandler - the mouse out handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
HasMouseOverHandlersMouseOverEvent handler.
addMouseOverHandler in interface HasMouseOverHandlershandler - the mouse over handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseUpHandler(MouseUpHandler handler)
HasMouseUpHandlersMouseUpEvent handler.
addMouseUpHandler in interface HasMouseUpHandlershandler - the mouse up handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler)
HasMouseWheelHandlersMouseWheelEvent handler.
addMouseWheelHandler in interface HasMouseWheelHandlershandler - the mouse wheel handler
HandlerRegistration used to remove this handlerpublic final HandlerRegistration addOpenHandler(OpenHandler<TreeItem> handler)
HasOpenHandlersOpenEvent handler.
addOpenHandler in interface HasOpenHandlers<TreeItem>handler - the handler
public HandlerRegistration addSelectionHandler(SelectionHandler<TreeItem> handler)
HasSelectionHandlersSelectionEvent handler.
addSelectionHandler in interface HasSelectionHandlers<TreeItem>handler - the handler
public TreeItem addTextItem(java.lang.String itemText)
addTextItem in interface HasTreeItemsitemText - the text of the item to be added
@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 SourcesTreeEventslistener - the listener interface to addpublic void clear()
clear in interface HasWidgetspublic 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 TreeItem insertItem(int beforeIndex,
SafeHtml itemHtml)
beforeIndex - the index where the item will be inserteditemHtml - the html of the item to be added
java.lang.IndexOutOfBoundsException - if the index is out of range
public void insertItem(int beforeIndex,
TreeItem item)
beforeIndex - the index where the item will be inserteditem - the item to be added
java.lang.IndexOutOfBoundsException - if the index is out of range
public TreeItem insertItem(int beforeIndex,
Widget widget)
beforeIndex - the index where the item will be insertedwidget - the widget to be added
java.lang.IndexOutOfBoundsException - if the index is out of range
public TreeItem insertTextItem(int beforeIndex,
java.lang.String itemText)
beforeIndex - the index where the item will be inserteditemText - the text of the item to be added
java.lang.IndexOutOfBoundsException - if the index is out of rangepublic boolean isAnimationEnabled()
HasAnimation
isAnimationEnabled in interface HasAnimationpublic boolean isScrollOnSelectEnabled()
public java.util.Iterator<Widget> iterator()
HasWidgetsIterator.remove().
iterator in interface HasWidgetsiterator in interface java.lang.Iterable<Widget>public void onBrowserEvent(Event event)
EventListener
onBrowserEvent in interface EventListeneronBrowserEvent in class Widgetevent - the event receivedpublic boolean remove(Widget w)
HasWidgets
remove in interface HasWidgetsw - the widget to be removed
true if the widget was presentpublic boolean remove(IsWidget w)
remove in interface HasWidgets.ForIsWidgetremove(Widget)@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 SourcesFocusEventslistener - the listener interface to removepublic void removeItem(TreeItem item)
removeItem in interface HasTreeItemsitem - the item to be removedpublic void removeItem(IsTreeItem isItem)
removeItem in interface HasTreeItemsisItem - the wrapper of item to be removedpublic void removeItems()
removeItems in interface HasTreeItems@Deprecated public void removeKeyboardListener(KeyboardListener listener)
HandlerRegistration.removeHandler() method on the
object returned by an add*Handler method instead
SourcesKeyboardEvents
removeKeyboardListener in interface SourcesKeyboardEventslistener - 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 SourcesMouseEventslistener - 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 SourcesTreeEventslistener - the listener interface to removepublic void setAccessKey(char key)
Focusable
setAccessKey in interface Focusablekey - the widget's access keypublic void setAnimationEnabled(boolean enable)
HasAnimation
setAnimationEnabled in interface HasAnimationenable - true to enable, false to disablepublic void setFocus(boolean focus)
Focusable
setFocus in interface Focusablefocus - whether this widget should take focus or release itpublic void setScrollOnSelectEnabled(boolean enable)
public void setSelectedItem(TreeItem item)
item - the item to be selected, or null to deselect all
items
public 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 Focusableindex - the widget's tab indexpublic java.util.Iterator<TreeItem> treeItemIterator()
protected void doAttachChildren()
WidgetWidget.onAttach() for each of its
child widgets.
doAttachChildren in class WidgetWidget.onAttach()protected void doDetachChildren()
WidgetWidget.onDetach() for each of its
child widgets.
doDetachChildren in class WidgetWidget.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 UIObjectbaseID - the base ID used by the main elementUIObject.onEnsureDebugId(String)protected void onLoad()
Widget
onLoad in class Widget
void adopt(Widget widget,
TreeItem treeItem)
void fireStateChanged(TreeItem item,
boolean open)
java.util.Map<Widget,TreeItem> getChildWidgets()
Tree.ImageAdapter getImages()
void maybeUpdateSelection(TreeItem itemThatChangedState,
boolean isItemOpening)
void orphan(Widget widget)
void showClosedImage(TreeItem treeItem)
TreeItem: Shows the closed image on that tree
item.
treeItem - the tree itemvoid showLeafImage(TreeItem treeItem)
TreeItem: Shows the leaf image on a tree item.
treeItem - the tree itemvoid showOpenImage(TreeItem treeItem)
TreeItem: Shows the open image on a tree item.
treeItem - the tree item
|
GWT 2.7.0 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||