net.mygwt.ui.client.widget .Component net.mygwt.ui.client.widget.tree .Tree All known Subclasses: net.mygwt.ui.client.widget.treetable .TreeTable ,Tree public class Tree extends Component (Code) A standard hierarchical tree widget. The tree contains a hierarchy of
TreeItems
that the user can open, close, and select.
Styles:
SINGLE, MULTI, CHECK
Events:
BeforeAdd : (widget, item, index)
Fires before a item is added or inserted. Listeners can set the
doit
field to false
to cancel the action.
widget : the parent item
item : the item being added
index : the index at which the item will be added
BeforeRemove : (widget, item)
Fires before a item is removed. Listeners can set the doit
field to false
to cancel the action.
widget : the parent item
item : the item being removed
BeforeExpand : (widget, item)
Fires before a item is expanded. Listeners can set the doit
field to false
to cancel the expand.
widget : the parent item
item : the item being expanded
BeforeCollapse : (widget, item)
Fires before a item is collapsed. Listeners can set the
doit
field to false
to cancel the collapse.
widget : the parent item
item : the item being expanded
Add : (widget, item, index)
Fires after a item has been added or inserted.
widget : the parent item
item : the item that was added
index : the index at which the item will be added
Remove : (widget, item)
Fires after a item has been removed.
widget : the parent item
item : the item being removed
Expand : (widget, item)
Fires after a item has been expanded.
widget : the parent item
item : the item being expanded
Collapse : (widget, item)
Fires ater a item is collapsed.
widget : the parent item
item : the item being collapsed
CheckChange : (widget)
Fires after a check state change.
ContextMenu : (widget)
Fires before the tree's context menu is shown.
CSS:
.my-tree (the tree itself)
.my-tree-item-text span (the tree item text)
Constructor Summary public Tree () Creates a new single select tree.public Tree (int style) Creates a new tree.
checkNodes int checkNodes (Code)
checkStyle int checkStyle (Code)
Tree public Tree()(Code) Creates a new single select tree.
Tree public Tree(int style)(Code) Creates a new tree.
Parameters: style - the tree style
collapseAll public void collapseAll()(Code) Collapses all item's.
createRootItem protected void createRootItem()(Code)
deselect public void deselect(TreeItem item)(Code) Deselects a item.
Parameters: item - the item to be deselected
deselectAll public void deselectAll()(Code) Deselects all selections.
expandAll public void expandAll()(Code) Expands all item's.
expandPath public boolean expandPath(String path)(Code) Expands a specified path. A path can be retrieved from a tree item with
TreeItem.getPath .
Parameters: path - the path to expand true
if all paths expanded
findItem public TreeItem findItem(Element element)(Code) Returns the tree whose element or child elements match the passed target.
Parameters: element - the target element the matching tree item or null
if no match
getAllItems public TreeItem [] getAllItems()(Code) Returns all tree item's contained by the tree.
all tree item's
getAnimate public boolean getAnimate()(Code) Returns true
if animation is enabled.
the animate state
getChecked public TreeItem [] getChecked()(Code) Returns a list of id's for all checked items.
the list of checked id's
getIndentWidth public int getIndentWidth()(Code) Returns the indent width.
the indent width
getItemById public TreeItem getItemById(String id)(Code) Returns the item by id.
Parameters: id - the id of the element to return the item
getItemImageStyle public String getItemImageStyle()(Code) Returns the item image style.
the item image style
getNodeImageStyle public String getNodeImageStyle()(Code) Returns the node image style.
the node image style
getOpenNodeImageStyle public String getOpenNodeImageStyle()(Code) Returns the open node image style.
the open node image style
getRootItem public TreeItem getRootItem()(Code) Returns the tree's root item.
the root item
getSelectedItem public TreeItem getSelectedItem()(Code) Returns the selected item.
the selected item or null
if no selection
getSelection public TreeItem [] getSelection()(Code) Returns an array of selected items.
the selected items
getSelectionMode public int getSelectionMode()(Code) Returns the selection mode.
the selection mode
getSelectionModel public TreeSelectionModel getSelectionModel()(Code) Returns the tree's selection model.
the selection model
onBrowserEvent public void onBrowserEvent(Event event)(Code)
onRender protected void onRender()(Code)
setAnimate public void setAnimate(boolean animate)(Code) Specifies if expand / collapse should be animated. Default value is
true
.
Parameters: animate - true
to enable animations
setCheckNodes public void setCheckNodes(int value)(Code) Sets what nodes should have a check box. Default value is DEFAULT.
See Also: Style.DEFAULT See Also: - both nodes and leafsSee Also: Style.PARENT See Also: - only nodes with childrenSee Also: Style.LEAF See Also: - only leafsParameters: value - the value
setCheckStyle public void setCheckStyle(int style)(Code) Sets the tree check style which determines how checking cascades. Default
value is CHILD.
Parameters: style - the check style SINGLE, PARENT, CHILDREN.
setContextMenu public void setContextMenu(Menu menu)(Code)
setIndentWidth public void setIndentWidth(int indentWidth)(Code) Sets the number of pixels child items are indented. Default value is 18.
Parameters: indentWidth - the indent width
setItemImageStyle public void setItemImageStyle(String itemImageStyle)(Code) Sets the item image style. If specified all items without a image style
will use this style. Default value is null
.
Parameters: itemImageStyle - the item image style
setNodeImageStyle public void setNodeImageStyle(String nodeImageStyle)(Code) Sets the global icon style for tree items with children. Default value is
'tree-folder'.
Parameters: nodeImageStyle - the node image style
setOpenNodeImageStyle public void setOpenNodeImageStyle(String openNodeImageStyle)(Code) Sets the global icon style for open tree items. Default value is
'tree-folder-open'.
Parameters: openNodeImageStyle - the open node image style
setSelection public void setSelection(List selected)(Code) Sets the selection to the tree items. The current selection is cleared
before the new items are selected. If the tree is single-select then all
items are ignored.
Parameters: selected - the items to select
setSelection public void setSelection(TreeItem item)(Code) Sets the selection to the item. The current selection is cleared before the
new items are selected.
Parameters: item - the item to select
setSelectionMode public void setSelectionMode(int selectionMode)(Code) Sets the selection mode for the list. Calling after the tree has been
rendered will have no effect.
Parameters: selectionMode - the selection mode
Methods inherited from net.mygwt.ui.client.widget.Component public void addListener(int eventType, Listener listener)(Code) (Java Doc) public void addStyleName(String style)(Code) (Java Doc) public void addWidgetListener(WidgetListener listener)(Code) (Java Doc) protected void afterRender()(Code) (Java Doc) protected Component blur()(Code) (Java Doc) public void disable()(Code) (Java Doc) protected void disableContextMenu(boolean disable)(Code) (Java Doc) public void disableTextSelection(boolean disable)(Code) (Java Doc) public void dispose()(Code) (Java Doc) public void enable()(Code) (Java Doc) public void enableEvents(boolean enable)(Code) (Java Doc) public boolean fireEvent(int type)(Code) (Java Doc) public boolean fireEvent(int type, BaseEvent be)(Code) (Java Doc) public boolean fireEvent(int eventType, Widget widget, Widget item)(Code) (Java Doc) public boolean fireEvent(int eventType, Widget widget, Widget item, int index)(Code) (Java Doc) public Component focus()(Code) (Java Doc) public Rectangle getBounds()(Code) (Java Doc) public Rectangle getBounds(boolean content)(Code) (Java Doc) protected Menu getContextMenu()(Code) (Java Doc) public Object getData()(Code) (Java Doc) public Object getData(String key)(Code) (Java Doc) public String getDisabledStyle()(Code) (Java Doc) public Element getElement()(Code) (Java Doc) protected Element getFocusElement()(Code) (Java Doc) public int getHeight()(Code) (Java Doc) public int getHeight(boolean content)(Code) (Java Doc) public String getId()(Code) (Java Doc) public int getStyle()(Code) (Java Doc) public ToolTip getToolTip()(Code) (Java Doc) public int getWidth()(Code) (Java Doc) public int getWidth(boolean content)(Code) (Java Doc) public void hide()(Code) (Java Doc) public boolean isDisposed()(Code) (Java Doc) public boolean isEnabled()(Code) (Java Doc) public boolean isRendered()(Code) (Java Doc) public boolean isVisible()(Code) (Java Doc) protected void onAttach()(Code) (Java Doc) public void onBaseEvent(BaseEvent be)(Code) (Java Doc) public void onBrowserEvent(Event event)(Code) (Java Doc) protected void onDestroy()(Code) (Java Doc) protected void onDetach()(Code) (Java Doc) protected void onDisable()(Code) (Java Doc) protected void onEnable()(Code) (Java Doc) protected void onHide()(Code) (Java Doc) protected void onHideContextMenu()(Code) (Java Doc) protected void onLoad()(Code) (Java Doc) protected void onRender()(Code) (Java Doc) protected void onResize(int width, int height)(Code) (Java Doc) protected void onRightClick(BaseEvent be)(Code) (Java Doc) protected void onShow()(Code) (Java Doc) protected void onShowContextMenu(int x, int y)(Code) (Java Doc) public void recalculate()(Code) (Java Doc) public void removeAllListeners()(Code) (Java Doc) public void removeFromParent()(Code) (Java Doc) public void removeListener(int eventType, Listener listener)(Code) (Java Doc) public void removeStyleName(String style)(Code) (Java Doc) public void removeWidgetListener(WidgetListener listener)(Code) (Java Doc) protected void render()(Code) (Java Doc) public void setBorders(boolean show)(Code) (Java Doc) public void setBounds(int x, int y, int width, int height)(Code) (Java Doc) public void setBounds(Rectangle rect)(Code) (Java Doc) protected void setContextMenu(Menu menu)(Code) (Java Doc) public void setData(Object data)(Code) (Java Doc) public void setData(String key, Object data)(Code) (Java Doc) public void setDisabledStyle(String style)(Code) (Java Doc) public void setElement(Element elem)(Code) (Java Doc) public void setEnabled(boolean enabled)(Code) (Java Doc) public void setHeight(int height)(Code) (Java Doc) public void setHeight(String height)(Code) (Java Doc) public void setId(String id)(Code) (Java Doc) public void setIntStyleAttribute(String attr, int value)(Code) (Java Doc) public void setPagePosition(int x, int y)(Code) (Java Doc) public void setPixelSize(int width, int height)(Code) (Java Doc) public void setSize(int width, int height)(Code) (Java Doc) public void setSize(String width, String height)(Code) (Java Doc) public void setStyleAttribute(String attr, String value)(Code) (Java Doc) public void setStyleName(String style)(Code) (Java Doc) public void setTitle(String title)(Code) (Java Doc) public void setToolTip(String text)(Code) (Java Doc) public void setToolTip(String title, String text)(Code) (Java Doc) public void setVisible(boolean visible)(Code) (Java Doc) public void setWidth(int width)(Code) (Java Doc) public void setWidth(String width)(Code) (Java Doc) public void show()(Code) (Java Doc) public void unhook(int type, EventListener listener)(Code) (Java Doc)